@farm.js/core 0.1.0-beta.6 → 0.1.0-beta.8
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/after.cjs +227 -0
- package/dist/after.cjs.map +1 -0
- package/dist/after.d.mts +25 -0
- package/dist/after.d.ts +25 -0
- package/dist/after.mjs +14 -0
- package/dist/after.mjs.map +1 -0
- package/dist/agent-runtime.cjs +2379 -0
- package/dist/agent-runtime.cjs.map +1 -0
- package/dist/agent-runtime.d.mts +94 -0
- package/dist/agent-runtime.d.ts +94 -0
- package/dist/agent-runtime.mjs +479 -0
- package/dist/agent-runtime.mjs.map +1 -0
- package/dist/api/route-manager.d.mts +66 -0
- package/dist/api/route-manager.d.ts +66 -0
- package/dist/api/runtime.d.mts +3 -0
- package/dist/api/runtime.d.ts +3 -0
- package/dist/api.cjs +4100 -0
- package/dist/api.cjs.map +1 -0
- package/dist/api.d.mts +48 -0
- package/dist/api.d.ts +48 -0
- package/dist/api.mjs +93 -0
- package/dist/api.mjs.map +1 -0
- package/dist/app-BWtqQu3R.d.mts +302 -0
- package/dist/app-markdown.cjs +244 -0
- package/dist/app-markdown.cjs.map +1 -0
- package/dist/app-markdown.d.mts +22 -0
- package/dist/app-markdown.d.ts +22 -0
- package/dist/app-markdown.mjs +27 -0
- package/dist/app-markdown.mjs.map +1 -0
- package/dist/app-xltejvLY.d.ts +302 -0
- package/dist/cache.cjs +945 -0
- package/dist/cache.cjs.map +1 -0
- package/dist/cache.d.mts +192 -0
- package/dist/cache.d.ts +192 -0
- package/dist/cache.mjs +46 -0
- package/dist/cache.mjs.map +1 -0
- package/dist/chunk-2ED5Q2GH.mjs +422 -0
- package/dist/chunk-2ED5Q2GH.mjs.map +1 -0
- package/dist/chunk-32W4QEJP.mjs +158 -0
- package/dist/chunk-32W4QEJP.mjs.map +1 -0
- package/dist/chunk-3XNTL3FQ.mjs +452 -0
- package/dist/chunk-3XNTL3FQ.mjs.map +1 -0
- package/dist/chunk-44ZCFSKE.mjs +84 -0
- package/dist/chunk-44ZCFSKE.mjs.map +1 -0
- package/dist/chunk-4MGVSBRP.mjs +7787 -0
- package/dist/chunk-4MGVSBRP.mjs.map +1 -0
- package/dist/chunk-4S3ORGFA.mjs +44 -0
- package/dist/chunk-4S3ORGFA.mjs.map +1 -0
- package/dist/chunk-5BY76U2M.mjs +1 -0
- package/dist/chunk-5BY76U2M.mjs.map +1 -0
- package/dist/chunk-5ZGPRGWV.mjs +136 -0
- package/dist/chunk-5ZGPRGWV.mjs.map +1 -0
- package/dist/chunk-65A7QIKI.mjs +142 -0
- package/dist/chunk-65A7QIKI.mjs.map +1 -0
- package/dist/chunk-74YTBPTY.mjs +450 -0
- package/dist/chunk-74YTBPTY.mjs.map +1 -0
- package/dist/chunk-7FBJLMQH.mjs +338 -0
- package/dist/chunk-7FBJLMQH.mjs.map +1 -0
- package/dist/chunk-7HO6AEOP.mjs +74 -0
- package/dist/chunk-7HO6AEOP.mjs.map +1 -0
- package/dist/chunk-7MABZJIM.mjs +29 -0
- package/dist/chunk-7MABZJIM.mjs.map +1 -0
- package/dist/chunk-7N62DNSO.mjs +41 -0
- package/dist/chunk-7N62DNSO.mjs.map +1 -0
- package/dist/chunk-7ZY5AIJO.mjs +161 -0
- package/dist/chunk-7ZY5AIJO.mjs.map +1 -0
- package/dist/chunk-ALCLXXTY.mjs +187 -0
- package/dist/chunk-ALCLXXTY.mjs.map +1 -0
- package/dist/chunk-AZ7YUVNR.mjs +65 -0
- package/dist/chunk-AZ7YUVNR.mjs.map +1 -0
- package/dist/chunk-B232I2GP.mjs +163 -0
- package/dist/chunk-B232I2GP.mjs.map +1 -0
- package/dist/chunk-B4W3BNTL.mjs +483 -0
- package/dist/chunk-B4W3BNTL.mjs.map +1 -0
- package/dist/chunk-C2ROET2V.mjs +718 -0
- package/dist/chunk-C2ROET2V.mjs.map +1 -0
- package/dist/chunk-CGILA3WO.mjs +14 -0
- package/dist/chunk-CGILA3WO.mjs.map +1 -0
- package/dist/chunk-CGIXMLSY.mjs +184 -0
- package/dist/chunk-CGIXMLSY.mjs.map +1 -0
- package/dist/chunk-DJSGLHCN.mjs +597 -0
- package/dist/chunk-DJSGLHCN.mjs.map +1 -0
- package/dist/chunk-E2MPIBRE.mjs +149 -0
- package/dist/chunk-E2MPIBRE.mjs.map +1 -0
- package/dist/chunk-E6EPN5BT.mjs +203 -0
- package/dist/chunk-E6EPN5BT.mjs.map +1 -0
- package/dist/chunk-EI43C4RA.mjs +6277 -0
- package/dist/chunk-EI43C4RA.mjs.map +1 -0
- package/dist/chunk-EJ7T4TPB.mjs +622 -0
- package/dist/chunk-EJ7T4TPB.mjs.map +1 -0
- package/dist/chunk-FQYDHKKU.mjs +128 -0
- package/dist/chunk-FQYDHKKU.mjs.map +1 -0
- package/dist/chunk-FRPWCMMG.mjs +299 -0
- package/dist/chunk-FRPWCMMG.mjs.map +1 -0
- package/dist/chunk-GN72QAIH.mjs +146 -0
- package/dist/chunk-GN72QAIH.mjs.map +1 -0
- package/dist/chunk-GQVGIUSN.mjs +149 -0
- package/dist/chunk-GQVGIUSN.mjs.map +1 -0
- package/dist/chunk-GS6K5OCM.mjs +407 -0
- package/dist/chunk-GS6K5OCM.mjs.map +1 -0
- package/dist/chunk-GXASWWJU.mjs +364 -0
- package/dist/chunk-GXASWWJU.mjs.map +1 -0
- package/dist/chunk-GY2STC2S.mjs +180 -0
- package/dist/chunk-GY2STC2S.mjs.map +1 -0
- package/dist/chunk-H2FA2SBS.mjs +51 -0
- package/dist/chunk-H2FA2SBS.mjs.map +1 -0
- package/dist/chunk-I4CUBGVF.mjs +93 -0
- package/dist/chunk-I4CUBGVF.mjs.map +1 -0
- package/dist/chunk-ITN462YM.mjs +98 -0
- package/dist/chunk-ITN462YM.mjs.map +1 -0
- package/dist/chunk-J23HNLFY.mjs +72 -0
- package/dist/chunk-J23HNLFY.mjs.map +1 -0
- package/dist/chunk-J4FNJ5IU.mjs +179 -0
- package/dist/chunk-J4FNJ5IU.mjs.map +1 -0
- package/dist/chunk-J5YWQVI5.mjs +211 -0
- package/dist/chunk-J5YWQVI5.mjs.map +1 -0
- package/dist/chunk-JDEOUK5V.mjs +427 -0
- package/dist/chunk-JDEOUK5V.mjs.map +1 -0
- package/dist/chunk-JK25YEN6.mjs +219 -0
- package/dist/chunk-JK25YEN6.mjs.map +1 -0
- package/dist/chunk-K4667E2Q.mjs +1916 -0
- package/dist/chunk-K4667E2Q.mjs.map +1 -0
- package/dist/chunk-LGHEOHBU.mjs +218 -0
- package/dist/chunk-LGHEOHBU.mjs.map +1 -0
- package/dist/chunk-LM2YNO4U.mjs +24 -0
- package/dist/chunk-LM2YNO4U.mjs.map +1 -0
- package/dist/chunk-ME4MO2RJ.mjs +3540 -0
- package/dist/chunk-ME4MO2RJ.mjs.map +1 -0
- package/dist/chunk-MIUW47JX.mjs +639 -0
- package/dist/chunk-MIUW47JX.mjs.map +1 -0
- package/dist/chunk-NNLCAVB6.mjs +391 -0
- package/dist/chunk-NNLCAVB6.mjs.map +1 -0
- package/dist/chunk-P7QDS5AT.mjs +191 -0
- package/dist/chunk-P7QDS5AT.mjs.map +1 -0
- package/dist/chunk-PFE6GMNE.mjs +603 -0
- package/dist/chunk-PFE6GMNE.mjs.map +1 -0
- package/dist/chunk-QGOHVJ6J.mjs +63 -0
- package/dist/chunk-QGOHVJ6J.mjs.map +1 -0
- package/dist/chunk-QKVUNGAH.mjs +39 -0
- package/dist/chunk-QKVUNGAH.mjs.map +1 -0
- package/dist/chunk-QM746KUO.mjs +56 -0
- package/dist/chunk-QM746KUO.mjs.map +1 -0
- package/dist/chunk-QTZZ2ISQ.mjs +753 -0
- package/dist/chunk-QTZZ2ISQ.mjs.map +1 -0
- package/dist/chunk-RBRLLZL5.mjs +81 -0
- package/dist/chunk-RBRLLZL5.mjs.map +1 -0
- package/dist/chunk-RHIFZZUI.mjs +69 -0
- package/dist/chunk-RHIFZZUI.mjs.map +1 -0
- package/dist/chunk-RQ633A5I.mjs +187 -0
- package/dist/chunk-RQ633A5I.mjs.map +1 -0
- package/dist/chunk-SCFX4UTD.mjs +28 -0
- package/dist/chunk-SCFX4UTD.mjs.map +1 -0
- package/dist/chunk-SL6HTIOK.mjs +66 -0
- package/dist/chunk-SL6HTIOK.mjs.map +1 -0
- package/dist/chunk-SPBBQLXI.mjs +207 -0
- package/dist/chunk-SPBBQLXI.mjs.map +1 -0
- package/dist/chunk-SSA7THPX.mjs +10 -0
- package/dist/chunk-SSA7THPX.mjs.map +1 -0
- package/dist/chunk-T4QJQK76.mjs +459 -0
- package/dist/chunk-T4QJQK76.mjs.map +1 -0
- package/dist/chunk-TQAEEJB4.mjs +157 -0
- package/dist/chunk-TQAEEJB4.mjs.map +1 -0
- package/dist/chunk-UB5UOSHB.mjs +458 -0
- package/dist/chunk-UB5UOSHB.mjs.map +1 -0
- package/dist/chunk-USWZZUEH.mjs +25 -0
- package/dist/chunk-USWZZUEH.mjs.map +1 -0
- package/dist/chunk-UVCIEUJC.mjs +16 -0
- package/dist/chunk-UVCIEUJC.mjs.map +1 -0
- package/dist/chunk-UXUAWNO5.mjs +396 -0
- package/dist/chunk-UXUAWNO5.mjs.map +1 -0
- package/dist/chunk-V3XURYJO.mjs +756 -0
- package/dist/chunk-V3XURYJO.mjs.map +1 -0
- package/dist/chunk-V6WE6JSZ.mjs +352 -0
- package/dist/chunk-V6WE6JSZ.mjs.map +1 -0
- package/dist/chunk-V7RBCSDJ.mjs +170 -0
- package/dist/chunk-V7RBCSDJ.mjs.map +1 -0
- package/dist/chunk-VCANOYFI.mjs +588 -0
- package/dist/chunk-VCANOYFI.mjs.map +1 -0
- package/dist/chunk-VY2UYN5R.mjs +224 -0
- package/dist/chunk-VY2UYN5R.mjs.map +1 -0
- package/dist/chunk-W2CRQFF6.mjs +1352 -0
- package/dist/chunk-W2CRQFF6.mjs.map +1 -0
- package/dist/chunk-WDU6QXNK.mjs +872 -0
- package/dist/chunk-WDU6QXNK.mjs.map +1 -0
- package/dist/chunk-WZ5QFROO.mjs +23 -0
- package/dist/chunk-WZ5QFROO.mjs.map +1 -0
- package/dist/chunk-XIVV5IWN.mjs +541 -0
- package/dist/chunk-XIVV5IWN.mjs.map +1 -0
- package/dist/chunk-YW7OBE6Q.mjs +119 -0
- package/dist/chunk-YW7OBE6Q.mjs.map +1 -0
- package/dist/chunk-Z5CQMP54.mjs +365 -0
- package/dist/chunk-Z5CQMP54.mjs.map +1 -0
- package/dist/chunk-ZBE6MLHL.mjs +230 -0
- package/dist/chunk-ZBE6MLHL.mjs.map +1 -0
- package/dist/chunk-ZVWA4ZQ3.mjs +189 -0
- package/dist/chunk-ZVWA4ZQ3.mjs.map +1 -0
- package/dist/chunk-ZZ57EH5Z.mjs +173 -0
- package/dist/chunk-ZZ57EH5Z.mjs.map +1 -0
- package/dist/client-BT1mFQas.d.mts +447 -0
- package/dist/client-Nn0q4eO4.d.ts +447 -0
- package/dist/client-cache-CIlyBlmx.d.ts +6 -0
- package/dist/client-cache-D-EZ7XVW.d.mts +6 -0
- package/dist/client-plugins-BI2R6Eae.d.mts +1926 -0
- package/dist/client-plugins-DU9oMspX.d.ts +1926 -0
- package/dist/client-plugins.cjs +415 -0
- package/dist/client-plugins.cjs.map +1 -0
- package/dist/client-plugins.d.mts +22 -0
- package/dist/client-plugins.d.ts +22 -0
- package/dist/client-plugins.mjs +10 -0
- package/dist/client-plugins.mjs.map +1 -0
- package/dist/client.cjs +5402 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.mts +447 -0
- package/dist/client.d.ts +447 -0
- package/dist/client.mjs +110 -0
- package/dist/client.mjs.map +1 -0
- package/dist/config.cjs +38 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.mts +29 -0
- package/dist/config.d.ts +29 -0
- package/dist/config.mjs +10 -0
- package/dist/config.mjs.map +1 -0
- package/dist/cron.cjs +406 -0
- package/dist/cron.cjs.map +1 -0
- package/dist/cron.d.mts +78 -0
- package/dist/cron.d.ts +78 -0
- package/dist/cron.mjs +30 -0
- package/dist/cron.mjs.map +1 -0
- package/dist/deferred.cjs +438 -0
- package/dist/deferred.cjs.map +1 -0
- package/dist/deferred.d.mts +42 -0
- package/dist/deferred.d.ts +42 -0
- package/dist/deferred.mjs +28 -0
- package/dist/deferred.mjs.map +1 -0
- package/dist/deployment.cjs +199 -0
- package/dist/deployment.cjs.map +1 -0
- package/dist/deployment.d.mts +34 -0
- package/dist/deployment.d.ts +34 -0
- package/dist/deployment.mjs +38 -0
- package/dist/deployment.mjs.map +1 -0
- package/dist/devtools-REQTS3I7.mjs +371 -0
- package/dist/devtools-REQTS3I7.mjs.map +1 -0
- package/dist/devtools-client-3XRTBND5.mjs +216 -0
- package/dist/devtools-client-3XRTBND5.mjs.map +1 -0
- package/dist/devtools-ui-NJKFORTG.mjs +1349 -0
- package/dist/devtools-ui-NJKFORTG.mjs.map +1 -0
- package/dist/docs.cjs +5548 -0
- package/dist/docs.cjs.map +1 -0
- package/dist/docs.d.mts +69 -0
- package/dist/docs.d.ts +69 -0
- package/dist/docs.mjs +47 -0
- package/dist/docs.mjs.map +1 -0
- package/dist/env-types.cjs +232 -0
- package/dist/env-types.cjs.map +1 -0
- package/dist/env-types.d.mts +12 -0
- package/dist/env-types.d.ts +12 -0
- package/dist/env-types.mjs +11 -0
- package/dist/env-types.mjs.map +1 -0
- package/dist/env.cjs +215 -0
- package/dist/env.cjs.map +1 -0
- package/dist/env.d.mts +45 -0
- package/dist/env.d.ts +45 -0
- package/dist/env.mjs +22 -0
- package/dist/env.mjs.map +1 -0
- package/dist/environment/vite.d.mts +22 -0
- package/dist/environment/vite.d.ts +22 -0
- package/dist/environment.cjs +96 -0
- package/dist/environment.cjs.map +1 -0
- package/dist/environment.d.mts +18 -0
- package/dist/environment.d.ts +18 -0
- package/dist/environment.mjs +14 -0
- package/dist/environment.mjs.map +1 -0
- package/dist/headers.cjs +126 -0
- package/dist/headers.cjs.map +1 -0
- package/dist/headers.d.mts +22 -0
- package/dist/headers.d.ts +22 -0
- package/dist/headers.mjs +12 -0
- package/dist/headers.mjs.map +1 -0
- package/dist/i18n/client.d.mts +32 -0
- package/dist/i18n/client.d.ts +32 -0
- package/dist/i18n/index.d.mts +20 -0
- package/dist/i18n/index.d.ts +20 -0
- package/dist/i18n/server.d.mts +30 -0
- package/dist/i18n/server.d.ts +30 -0
- package/dist/image/server.d.mts +37 -0
- package/dist/image/server.d.ts +37 -0
- package/dist/image/sharp.d.mts +7 -0
- package/dist/image/sharp.d.ts +7 -0
- package/dist/image-config-Duob7wER.d.mts +50 -0
- package/dist/image-config-Duob7wER.d.ts +50 -0
- package/dist/image.cjs +209 -0
- package/dist/image.cjs.map +1 -0
- package/dist/image.d.mts +39 -0
- package/dist/image.d.ts +39 -0
- package/dist/image.mjs +165 -0
- package/dist/image.mjs.map +1 -0
- package/dist/index.cjs +42186 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +454 -0
- package/dist/index.d.ts +454 -0
- package/dist/index.mjs +980 -0
- package/dist/index.mjs.map +1 -0
- package/dist/integration-api-CHT2OKAf.d.mts +93 -0
- package/dist/integration-api-CHT2OKAf.d.ts +93 -0
- package/dist/integration-orm-GQLGU66X.mjs +13 -0
- package/dist/integration-orm-GQLGU66X.mjs.map +1 -0
- package/dist/integrations.cjs +2820 -0
- package/dist/integrations.cjs.map +1 -0
- package/dist/integrations.d.mts +22 -0
- package/dist/integrations.d.ts +22 -0
- package/dist/integrations.mjs +51 -0
- package/dist/integrations.mjs.map +1 -0
- package/dist/internal/build-runtime.cjs +643 -322
- package/dist/internal/build-runtime.cjs.map +1 -1
- package/dist/internal/build-runtime.d.mts +39 -0
- package/dist/internal/build-runtime.d.ts +39 -0
- package/dist/internal/build-runtime.mjs +11 -10
- package/dist/internal/client-runtime.d.mts +2 -0
- package/dist/internal/client-runtime.d.ts +2 -0
- package/dist/internal/config-runtime.cjs +135 -39
- package/dist/internal/config-runtime.cjs.map +1 -1
- package/dist/internal/config-runtime.d.mts +39 -0
- package/dist/internal/config-runtime.d.ts +39 -0
- package/dist/internal/config-runtime.mjs +5 -4
- package/dist/internal/production-node-env.d.mts +12 -0
- package/dist/internal/production-node-env.d.ts +12 -0
- package/dist/internal/production-runtime.d.mts +39 -0
- package/dist/internal/production-runtime.d.ts +39 -0
- package/dist/layers-VWVDTPUZ.mjs +16 -0
- package/dist/layers-VWVDTPUZ.mjs.map +1 -0
- package/dist/manager-THKFTOFE.mjs +10 -0
- package/dist/manager-THKFTOFE.mjs.map +1 -0
- package/dist/markdown.cjs +364 -0
- package/dist/markdown.cjs.map +1 -0
- package/dist/markdown.d.mts +60 -0
- package/dist/markdown.d.ts +60 -0
- package/dist/markdown.mjs +18 -0
- package/dist/markdown.mjs.map +1 -0
- package/dist/metadata-Cm9ujH4I.d.ts +22 -0
- package/dist/metadata-DacXbnLA.d.mts +22 -0
- package/dist/middleware.cjs +2148 -0
- package/dist/middleware.cjs.map +1 -0
- package/dist/middleware.d.mts +164 -0
- package/dist/middleware.d.ts +164 -0
- package/dist/middleware.mjs +49 -0
- package/dist/middleware.mjs.map +1 -0
- package/dist/navigation-errors-Dvwpzaer.d.mts +13 -0
- package/dist/navigation-errors-Dvwpzaer.d.ts +13 -0
- package/dist/navigation.cjs +1329 -0
- package/dist/navigation.cjs.map +1 -0
- package/dist/navigation.d.mts +14 -0
- package/dist/navigation.d.ts +14 -0
- package/dist/navigation.mjs +33 -0
- package/dist/navigation.mjs.map +1 -0
- package/dist/nitro-QO5LV6QK.mjs +689 -0
- package/dist/nitro-QO5LV6QK.mjs.map +1 -0
- package/dist/observability.cjs +186 -0
- package/dist/observability.cjs.map +1 -0
- package/dist/observability.d.mts +335 -0
- package/dist/observability.d.ts +335 -0
- package/dist/observability.mjs +16 -0
- package/dist/observability.mjs.map +1 -0
- package/dist/params-BALtrRim.d.ts +15 -0
- package/dist/params-ry-lxqmy.d.mts +15 -0
- package/dist/plugin-BJDf43dc.d.mts +165 -0
- package/dist/plugin-BJDf43dc.d.ts +165 -0
- package/dist/plugin.cjs +23470 -0
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.mts +22 -0
- package/dist/plugin.d.ts +22 -0
- package/dist/plugin.mjs +8 -7
- package/dist/production-runtime-4KKq1AVC.d.mts +79 -0
- package/dist/production-runtime-C_B79w2P.d.mts +28 -0
- package/dist/production-runtime-DDEM1D2q.d.ts +28 -0
- package/dist/production-runtime-DRsWDN2x.d.ts +79 -0
- package/dist/query/client.d.mts +61 -0
- package/dist/query/client.d.ts +61 -0
- package/dist/query/index.d.mts +90 -0
- package/dist/query/index.d.ts +90 -0
- package/dist/query/parsers.d.mts +25 -0
- package/dist/query/parsers.d.ts +25 -0
- package/dist/query/server.d.mts +55 -0
- package/dist/query/server.d.ts +55 -0
- package/dist/request-Dsq4kGW0.d.mts +6 -0
- package/dist/request-udtobOLv.d.ts +6 -0
- package/dist/request.d.mts +2 -0
- package/dist/request.d.ts +2 -0
- package/dist/resolver-DJqjLMg_.d.mts +14 -0
- package/dist/resolver-IH4RmPEl.d.ts +14 -0
- package/dist/route-runtime-DoOHzCAD.d.mts +38 -0
- package/dist/route-runtime-DoOHzCAD.d.ts +38 -0
- package/dist/router.d.mts +36 -0
- package/dist/router.d.ts +36 -0
- package/dist/routes.d.mts +224 -0
- package/dist/routes.d.ts +224 -0
- package/dist/runtime-9nQjVM7X.d.mts +206 -0
- package/dist/runtime-Cxpq6xZN.d.mts +27 -0
- package/dist/runtime-DgeS2skB.d.ts +206 -0
- package/dist/runtime-bv63eUiO.d.ts +27 -0
- package/dist/server-action-security.d.mts +43 -0
- package/dist/server-action-security.d.ts +43 -0
- package/dist/server-fn-client.d.mts +32 -0
- package/dist/server-fn-client.d.ts +32 -0
- package/dist/server-fn.d.mts +93 -0
- package/dist/server-fn.d.ts +93 -0
- package/dist/server-plugins.d.mts +55 -0
- package/dist/server-plugins.d.ts +55 -0
- package/dist/server-query-client.d.mts +50 -0
- package/dist/server-query-client.d.ts +50 -0
- package/dist/server-query.d.mts +36 -0
- package/dist/server-query.d.ts +36 -0
- package/dist/server.cjs +731 -447
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.mts +48 -0
- package/dist/server.d.ts +48 -0
- package/dist/server.mjs +9 -8
- package/dist/server.mjs.map +1 -1
- package/dist/storage.d.mts +52 -0
- package/dist/storage.d.ts +52 -0
- package/dist/testing.d.mts +101 -0
- package/dist/testing.d.ts +101 -0
- package/dist/transport-BmbGTXA5.d.mts +49 -0
- package/dist/transport-BmbGTXA5.d.ts +49 -0
- package/dist/types-BMxWr97v.d.mts +81 -0
- package/dist/types-BMxWr97v.d.ts +81 -0
- package/dist/types-C9N-nk5R.d.mts +53 -0
- package/dist/types-C9N-nk5R.d.ts +53 -0
- package/dist/types-D1A6-XvH.d.mts +73 -0
- package/dist/types-D1A6-XvH.d.ts +73 -0
- package/dist/utils-B-cUHwoK.d.ts +23 -0
- package/dist/utils-Cm41AefV.d.mts +23 -0
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.mts +3 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +682 -437
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.mts +22 -0
- package/dist/vite.d.ts +22 -0
- package/dist/vite.mjs +6 -5
- package/dist/workflows.d.mts +110 -0
- package/dist/workflows.d.ts +110 -0
- package/package.json +3 -2
- package/types/client.d.ts +1 -1
- package/types/image.d.ts +4 -0
- package/types/images.d.ts +59 -0
package/dist/cache.cjs
ADDED
|
@@ -0,0 +1,945 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/cache.ts
|
|
22
|
+
var cache_exports = {};
|
|
23
|
+
__export(cache_exports, {
|
|
24
|
+
FarmDataCache: () => FarmDataCache,
|
|
25
|
+
applyFarmCacheInvalidationTargets: () => applyFarmCacheInvalidationTargets,
|
|
26
|
+
applyFarmCacheInvalidations: () => applyFarmCacheInvalidations,
|
|
27
|
+
configureFarmCache: () => configureFarmCache,
|
|
28
|
+
createFarmCacheKey: () => createFarmCacheKey,
|
|
29
|
+
createPathCacheTag: () => createPathCacheTag,
|
|
30
|
+
createRouteDataCacheKey: () => createRouteDataCacheKey,
|
|
31
|
+
createRouteDataCacheTag: () => createRouteDataCacheTag,
|
|
32
|
+
defineCacheKey: () => defineCacheKey,
|
|
33
|
+
getFarmDataCache: () => getFarmDataCache,
|
|
34
|
+
invalidate: () => invalidate,
|
|
35
|
+
invalidateRouteData: () => invalidateRouteData,
|
|
36
|
+
normalizeRevalidatePath: () => normalizeRevalidatePath,
|
|
37
|
+
revalidatePath: () => revalidatePath,
|
|
38
|
+
revalidateTag: () => revalidateTag,
|
|
39
|
+
storageCacheAdapter: () => storageCacheAdapter,
|
|
40
|
+
unstable_cache: () => unstable_cache,
|
|
41
|
+
updateTag: () => updateTag
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(cache_exports);
|
|
44
|
+
|
|
45
|
+
// src/observability.ts
|
|
46
|
+
var runtimeHandlers = /* @__PURE__ */ new Set();
|
|
47
|
+
var observabilityState = {
|
|
48
|
+
logs: false,
|
|
49
|
+
handlers: []
|
|
50
|
+
};
|
|
51
|
+
function emitFarmEvent(input) {
|
|
52
|
+
const event = {
|
|
53
|
+
timestamp: Date.now(),
|
|
54
|
+
level: inferFarmEventLevel(input.type),
|
|
55
|
+
...input
|
|
56
|
+
};
|
|
57
|
+
if (!shouldEmitFarmEvent(event)) {
|
|
58
|
+
return event;
|
|
59
|
+
}
|
|
60
|
+
if (observabilityState.logs) {
|
|
61
|
+
logFarmEvent(event);
|
|
62
|
+
}
|
|
63
|
+
for (const handler of [...observabilityState.handlers, ...runtimeHandlers]) {
|
|
64
|
+
try {
|
|
65
|
+
Promise.resolve(handler(event)).catch((error) => {
|
|
66
|
+
console.warn(`[farm:observability] event handler failed: ${formatError(error)}`);
|
|
67
|
+
});
|
|
68
|
+
} catch (error) {
|
|
69
|
+
console.warn(`[farm:observability] event handler failed: ${formatError(error)}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return event;
|
|
73
|
+
}
|
|
74
|
+
__name(emitFarmEvent, "emitFarmEvent");
|
|
75
|
+
function shouldEmitFarmEvent(event) {
|
|
76
|
+
if (!observabilityState.logs && observabilityState.handlers.length === 0 && runtimeHandlers.size === 0) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
if (observabilityState.events && !observabilityState.events.has(event.type)) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
__name(shouldEmitFarmEvent, "shouldEmitFarmEvent");
|
|
85
|
+
function inferFarmEventLevel(type) {
|
|
86
|
+
if (type === "error" || type.endsWith(".error") || type.endsWith(".failed")) {
|
|
87
|
+
return "error";
|
|
88
|
+
}
|
|
89
|
+
if (type.endsWith(".bypass") || type.endsWith(".invalidated") || type.endsWith(".stale") || type.endsWith(".notFound")) {
|
|
90
|
+
return "warn";
|
|
91
|
+
}
|
|
92
|
+
if (type.endsWith(".hit") || type.endsWith(".miss") || type.endsWith(".start") || type.endsWith(".shellReady")) {
|
|
93
|
+
return "debug";
|
|
94
|
+
}
|
|
95
|
+
return "info";
|
|
96
|
+
}
|
|
97
|
+
__name(inferFarmEventLevel, "inferFarmEventLevel");
|
|
98
|
+
function logFarmEvent(event) {
|
|
99
|
+
const message = `[farm:${event.level}] ${event.type}${formatFarmEventDetails(event)}`;
|
|
100
|
+
switch (event.level) {
|
|
101
|
+
case "error":
|
|
102
|
+
console.error(message);
|
|
103
|
+
break;
|
|
104
|
+
case "warn":
|
|
105
|
+
console.warn(message);
|
|
106
|
+
break;
|
|
107
|
+
default:
|
|
108
|
+
console.log(message);
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
__name(logFarmEvent, "logFarmEvent");
|
|
113
|
+
function formatFarmEventDetails(event) {
|
|
114
|
+
const details = [];
|
|
115
|
+
const record = event;
|
|
116
|
+
for (const key of [
|
|
117
|
+
"route",
|
|
118
|
+
"pathname",
|
|
119
|
+
"method",
|
|
120
|
+
"status",
|
|
121
|
+
"key",
|
|
122
|
+
"tag",
|
|
123
|
+
"path",
|
|
124
|
+
"reason",
|
|
125
|
+
"durationMs",
|
|
126
|
+
"integration",
|
|
127
|
+
"operation",
|
|
128
|
+
"plugin",
|
|
129
|
+
"hook",
|
|
130
|
+
"target",
|
|
131
|
+
"count"
|
|
132
|
+
]) {
|
|
133
|
+
const value = record[key];
|
|
134
|
+
if (value !== void 0) {
|
|
135
|
+
details.push(`${key}=${formatDetailValue(value)}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return details.length > 0 ? ` ${details.join(" ")}` : "";
|
|
139
|
+
}
|
|
140
|
+
__name(formatFarmEventDetails, "formatFarmEventDetails");
|
|
141
|
+
function formatDetailValue(value) {
|
|
142
|
+
if (typeof value === "string") {
|
|
143
|
+
return value;
|
|
144
|
+
}
|
|
145
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
146
|
+
return String(value);
|
|
147
|
+
}
|
|
148
|
+
try {
|
|
149
|
+
return JSON.stringify(value);
|
|
150
|
+
} catch {
|
|
151
|
+
return String(value);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
__name(formatDetailValue, "formatDetailValue");
|
|
155
|
+
function formatError(error) {
|
|
156
|
+
return error instanceof Error ? error.message : String(error);
|
|
157
|
+
}
|
|
158
|
+
__name(formatError, "formatError");
|
|
159
|
+
|
|
160
|
+
// src/cache-invalidation.ts
|
|
161
|
+
var FARM_CACHE_INVALIDATION_STATE = /* @__PURE__ */ Symbol.for("farm.cacheInvalidationState");
|
|
162
|
+
var globalState = globalThis;
|
|
163
|
+
function getFarmCacheInvalidationState() {
|
|
164
|
+
return globalState[FARM_CACHE_INVALIDATION_STATE] ?? (globalState[FARM_CACHE_INVALIDATION_STATE] = {
|
|
165
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
166
|
+
taskListeners: /* @__PURE__ */ new Set()
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
__name(getFarmCacheInvalidationState, "getFarmCacheInvalidationState");
|
|
170
|
+
function notifyFarmCacheInvalidation(key) {
|
|
171
|
+
if (typeof key !== "string" || key.length === 0) return;
|
|
172
|
+
for (const listener of getFarmCacheInvalidationState().listeners) {
|
|
173
|
+
listener(key);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
__name(notifyFarmCacheInvalidation, "notifyFarmCacheInvalidation");
|
|
177
|
+
function notifyFarmCacheTask(task) {
|
|
178
|
+
for (const listener of getFarmCacheInvalidationState().taskListeners) {
|
|
179
|
+
listener(task);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
__name(notifyFarmCacheTask, "notifyFarmCacheTask");
|
|
183
|
+
function applyFarmCacheInvalidations(keys) {
|
|
184
|
+
if (!Array.isArray(keys)) return;
|
|
185
|
+
for (const key of keys) {
|
|
186
|
+
if (typeof key === "string") {
|
|
187
|
+
notifyFarmCacheInvalidation(key);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
__name(applyFarmCacheInvalidations, "applyFarmCacheInvalidations");
|
|
192
|
+
|
|
193
|
+
// src/i18n/bridge.ts
|
|
194
|
+
var FARM_I18N_SNAPSHOT_RESOLVER = /* @__PURE__ */ Symbol.for("farm.i18n.snapshotResolver");
|
|
195
|
+
function getActiveFarmI18nSnapshot() {
|
|
196
|
+
if (typeof window !== "undefined" && window.__FARM_I18N__) {
|
|
197
|
+
return window.__FARM_I18N__;
|
|
198
|
+
}
|
|
199
|
+
return globalThis[FARM_I18N_SNAPSHOT_RESOLVER]?.();
|
|
200
|
+
}
|
|
201
|
+
__name(getActiveFarmI18nSnapshot, "getActiveFarmI18nSnapshot");
|
|
202
|
+
|
|
203
|
+
// src/cache.ts
|
|
204
|
+
function defineCacheKey() {
|
|
205
|
+
return (factory) => {
|
|
206
|
+
if (typeof factory !== "function") {
|
|
207
|
+
throw new TypeError("defineCacheKey expects a key factory function.");
|
|
208
|
+
}
|
|
209
|
+
return ((...args) => {
|
|
210
|
+
const key = factory(...args);
|
|
211
|
+
if (typeof key !== "string" && !Array.isArray(key)) {
|
|
212
|
+
throw new TypeError(
|
|
213
|
+
"A defined cache key factory must return a string or structured array."
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
return key;
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
__name(defineCacheKey, "defineCacheKey");
|
|
221
|
+
function storageCacheAdapter(storage, options = {}) {
|
|
222
|
+
if (!storage || typeof storage.getItem !== "function" || typeof storage.setItem !== "function") {
|
|
223
|
+
throw new TypeError("storageCacheAdapter expects a compatible storage client.");
|
|
224
|
+
}
|
|
225
|
+
const base = normalizeCacheNamespace(options.base || "farm-cache");
|
|
226
|
+
const entryKey = /* @__PURE__ */ __name((key) => `${base}:entry:${key}`, "entryKey");
|
|
227
|
+
const tagKey = /* @__PURE__ */ __name((tag) => `${base}:tag:${tag}`, "tagKey");
|
|
228
|
+
return {
|
|
229
|
+
name: "storage",
|
|
230
|
+
get: /* @__PURE__ */ __name((key) => storage.getItem(entryKey(key)), "get"),
|
|
231
|
+
set: /* @__PURE__ */ __name(async (key, entry) => {
|
|
232
|
+
await storage.setItem(entryKey(key), entry);
|
|
233
|
+
}, "set"),
|
|
234
|
+
delete: /* @__PURE__ */ __name(async (key) => {
|
|
235
|
+
await storage.removeItem(entryKey(key));
|
|
236
|
+
}, "delete"),
|
|
237
|
+
clear: storage.clear ? async () => {
|
|
238
|
+
await storage.clear(base);
|
|
239
|
+
} : void 0,
|
|
240
|
+
getTagVersions: /* @__PURE__ */ __name(async (tags) => {
|
|
241
|
+
const versions = await Promise.all(
|
|
242
|
+
tags.map(async (tag) => {
|
|
243
|
+
const value = await storage.getItem(tagKey(tag));
|
|
244
|
+
return [tag, normalizeAdapterVersion(value)];
|
|
245
|
+
})
|
|
246
|
+
);
|
|
247
|
+
return Object.fromEntries(versions);
|
|
248
|
+
}, "getTagVersions"),
|
|
249
|
+
invalidateTags: /* @__PURE__ */ __name(async (tags) => {
|
|
250
|
+
await Promise.all(
|
|
251
|
+
tags.map(async (tag) => {
|
|
252
|
+
const key = tagKey(tag);
|
|
253
|
+
const current = normalizeAdapterVersion(await storage.getItem(key));
|
|
254
|
+
await storage.setItem(key, Math.max(Date.now(), current + 1));
|
|
255
|
+
})
|
|
256
|
+
);
|
|
257
|
+
}, "invalidateTags")
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
__name(storageCacheAdapter, "storageCacheAdapter");
|
|
261
|
+
var _FarmDataCache = class _FarmDataCache {
|
|
262
|
+
constructor(config = {}) {
|
|
263
|
+
this.entries = /* @__PURE__ */ new Map();
|
|
264
|
+
this.inflight = /* @__PURE__ */ new Map();
|
|
265
|
+
this.invalidatedTagVersions = /* @__PURE__ */ new Map();
|
|
266
|
+
this.version = 0;
|
|
267
|
+
this.namespace = "farm";
|
|
268
|
+
this.local = true;
|
|
269
|
+
this.lease = {
|
|
270
|
+
enabled: true,
|
|
271
|
+
ttlMs: 1e4,
|
|
272
|
+
waitTimeoutMs: 1e4,
|
|
273
|
+
pollIntervalMs: 25
|
|
274
|
+
};
|
|
275
|
+
this.configure(config);
|
|
276
|
+
}
|
|
277
|
+
configure(config = {}) {
|
|
278
|
+
this.adapter = config.adapter;
|
|
279
|
+
this.namespace = normalizeCacheNamespace(config.namespace || "farm");
|
|
280
|
+
this.local = !config.adapter;
|
|
281
|
+
this.lease = config.lease === false ? { ...this.lease, enabled: false } : {
|
|
282
|
+
enabled: true,
|
|
283
|
+
ttlMs: normalizePositiveDuration(config.lease?.ttlMs, 1e4, "cache.lease.ttlMs"),
|
|
284
|
+
waitTimeoutMs: normalizePositiveDuration(
|
|
285
|
+
config.lease?.waitTimeoutMs,
|
|
286
|
+
1e4,
|
|
287
|
+
"cache.lease.waitTimeoutMs"
|
|
288
|
+
),
|
|
289
|
+
pollIntervalMs: normalizePositiveDuration(
|
|
290
|
+
config.lease?.pollIntervalMs,
|
|
291
|
+
25,
|
|
292
|
+
"cache.lease.pollIntervalMs"
|
|
293
|
+
)
|
|
294
|
+
};
|
|
295
|
+
if (!this.local) {
|
|
296
|
+
this.entries.clear();
|
|
297
|
+
this.inflight.clear();
|
|
298
|
+
this.invalidatedTagVersions.clear();
|
|
299
|
+
this.version = 0;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
get adapterName() {
|
|
303
|
+
return this.adapter?.name || (this.adapter ? "custom" : "memory");
|
|
304
|
+
}
|
|
305
|
+
get hasAdapter() {
|
|
306
|
+
return this.adapter !== void 0;
|
|
307
|
+
}
|
|
308
|
+
get size() {
|
|
309
|
+
return this.entries.size;
|
|
310
|
+
}
|
|
311
|
+
get(key, options = {}) {
|
|
312
|
+
return this.getEntry(key, options)?.value;
|
|
313
|
+
}
|
|
314
|
+
getEntry(key, options = {}) {
|
|
315
|
+
const entry = this.entries.get(key);
|
|
316
|
+
if (!entry) {
|
|
317
|
+
emitFarmEvent({ type: "cache.miss", key });
|
|
318
|
+
return void 0;
|
|
319
|
+
}
|
|
320
|
+
const stale = this.isStale(entry, options.now);
|
|
321
|
+
if (stale) {
|
|
322
|
+
emitFarmEvent({
|
|
323
|
+
type: "cache.stale",
|
|
324
|
+
key,
|
|
325
|
+
tags: Array.from(entry.tags),
|
|
326
|
+
revalidate: entry.revalidate
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
if (!options.allowStale && stale) {
|
|
330
|
+
emitFarmEvent({ type: "cache.miss", key, reason: "stale" });
|
|
331
|
+
return void 0;
|
|
332
|
+
}
|
|
333
|
+
emitFarmEvent({
|
|
334
|
+
type: "cache.hit",
|
|
335
|
+
key,
|
|
336
|
+
tags: Array.from(entry.tags),
|
|
337
|
+
revalidate: entry.revalidate,
|
|
338
|
+
stale
|
|
339
|
+
});
|
|
340
|
+
return this.toPublicEntry(entry);
|
|
341
|
+
}
|
|
342
|
+
async getEntryAsync(key, options = {}) {
|
|
343
|
+
if (this.local) {
|
|
344
|
+
const localEntry = this.getEntry(key, options);
|
|
345
|
+
if (localEntry) return localEntry;
|
|
346
|
+
}
|
|
347
|
+
if (!this.adapter) {
|
|
348
|
+
return this.local ? void 0 : this.getEntry(key, options);
|
|
349
|
+
}
|
|
350
|
+
const entry = await this.adapter.get(this.createAdapterKey(key));
|
|
351
|
+
if (!entry) {
|
|
352
|
+
emitFarmEvent({ type: "cache.miss", key });
|
|
353
|
+
return void 0;
|
|
354
|
+
}
|
|
355
|
+
assertFarmCacheEntry(entry, key);
|
|
356
|
+
const stale = await this.isAdapterEntryStale(entry, options.now);
|
|
357
|
+
if (stale) {
|
|
358
|
+
emitFarmEvent({
|
|
359
|
+
type: "cache.stale",
|
|
360
|
+
key,
|
|
361
|
+
tags: [...entry.tags],
|
|
362
|
+
revalidate: entry.revalidate
|
|
363
|
+
});
|
|
364
|
+
if (!options.allowStale) {
|
|
365
|
+
emitFarmEvent({ type: "cache.miss", key, reason: "stale" });
|
|
366
|
+
return void 0;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
emitFarmEvent({
|
|
370
|
+
type: "cache.hit",
|
|
371
|
+
key,
|
|
372
|
+
tags: [...entry.tags],
|
|
373
|
+
revalidate: entry.revalidate,
|
|
374
|
+
stale
|
|
375
|
+
});
|
|
376
|
+
if (this.local && !stale) {
|
|
377
|
+
this.hydrateLocalEntry(entry);
|
|
378
|
+
}
|
|
379
|
+
return { ...entry, key };
|
|
380
|
+
}
|
|
381
|
+
set(key, value, options = {}) {
|
|
382
|
+
const tags = /* @__PURE__ */ new Set();
|
|
383
|
+
for (const tag of options.tags ?? []) {
|
|
384
|
+
tags.add(normalizeCacheTag(tag));
|
|
385
|
+
}
|
|
386
|
+
for (const routePath of options.paths ?? []) {
|
|
387
|
+
tags.add(createPathCacheTag(routePath));
|
|
388
|
+
}
|
|
389
|
+
const entry = {
|
|
390
|
+
key,
|
|
391
|
+
value,
|
|
392
|
+
tags,
|
|
393
|
+
tagVersions: void 0,
|
|
394
|
+
createdAt: options.createdAt ?? Date.now(),
|
|
395
|
+
createdVersion: ++this.version,
|
|
396
|
+
revalidate: normalizeRevalidate(options.revalidate)
|
|
397
|
+
};
|
|
398
|
+
this.entries.set(key, entry);
|
|
399
|
+
emitFarmEvent({
|
|
400
|
+
type: "cache.set",
|
|
401
|
+
key,
|
|
402
|
+
tags: Array.from(tags),
|
|
403
|
+
revalidate: entry.revalidate
|
|
404
|
+
});
|
|
405
|
+
return this.toPublicEntry(entry);
|
|
406
|
+
}
|
|
407
|
+
async setAsync(key, value, options = {}, tagVersions) {
|
|
408
|
+
const tags = normalizeCacheOptionsTags(options);
|
|
409
|
+
const capturedVersions = tagVersions ?? await this.getAdapterTagVersions(Array.from(tags.values()));
|
|
410
|
+
const entry = {
|
|
411
|
+
key,
|
|
412
|
+
value,
|
|
413
|
+
tags: Array.from(tags),
|
|
414
|
+
tagVersions: capturedVersions,
|
|
415
|
+
createdAt: options.createdAt ?? Date.now(),
|
|
416
|
+
createdVersion: ++this.version,
|
|
417
|
+
revalidate: normalizeRevalidate(options.revalidate)
|
|
418
|
+
};
|
|
419
|
+
if (this.local) {
|
|
420
|
+
this.hydrateLocalEntry(entry);
|
|
421
|
+
}
|
|
422
|
+
if (this.adapter) {
|
|
423
|
+
await this.adapter.set(this.createAdapterKey(key), entry);
|
|
424
|
+
}
|
|
425
|
+
emitFarmEvent({
|
|
426
|
+
type: "cache.set",
|
|
427
|
+
key,
|
|
428
|
+
tags: [...entry.tags],
|
|
429
|
+
revalidate: entry.revalidate
|
|
430
|
+
});
|
|
431
|
+
return entry;
|
|
432
|
+
}
|
|
433
|
+
delete(key) {
|
|
434
|
+
const deleted = this.entries.delete(key);
|
|
435
|
+
emitFarmEvent({ type: "cache.delete", key, deleted });
|
|
436
|
+
return deleted;
|
|
437
|
+
}
|
|
438
|
+
async deleteAsync(key) {
|
|
439
|
+
const deleted = this.entries.delete(key);
|
|
440
|
+
if (this.adapter) {
|
|
441
|
+
await this.adapter.delete(this.createAdapterKey(key));
|
|
442
|
+
}
|
|
443
|
+
emitFarmEvent({ type: "cache.delete", key, deleted: this.adapter ? true : deleted });
|
|
444
|
+
return this.adapter ? true : deleted;
|
|
445
|
+
}
|
|
446
|
+
clear() {
|
|
447
|
+
const count = this.entries.size;
|
|
448
|
+
this.entries.clear();
|
|
449
|
+
this.inflight.clear();
|
|
450
|
+
this.invalidatedTagVersions.clear();
|
|
451
|
+
this.version = 0;
|
|
452
|
+
emitFarmEvent({ type: "cache.clear", count });
|
|
453
|
+
}
|
|
454
|
+
async clearAsync() {
|
|
455
|
+
this.clear();
|
|
456
|
+
await this.adapter?.clear?.();
|
|
457
|
+
}
|
|
458
|
+
isStale(entry, now = Date.now()) {
|
|
459
|
+
if (typeof entry.revalidate === "number" && entry.revalidate > 0 && now - entry.createdAt >= entry.revalidate * 1e3) {
|
|
460
|
+
return true;
|
|
461
|
+
}
|
|
462
|
+
for (const tag of entry.tags) {
|
|
463
|
+
const invalidatedVersion = this.invalidatedTagVersions.get(normalizeCacheTag(tag));
|
|
464
|
+
if (typeof invalidatedVersion === "number" && typeof entry.createdVersion === "number" && invalidatedVersion > entry.createdVersion) {
|
|
465
|
+
return true;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
return false;
|
|
469
|
+
}
|
|
470
|
+
async isStaleAsync(entry, now = Date.now()) {
|
|
471
|
+
if (this.adapter) {
|
|
472
|
+
return this.isAdapterEntryStale(entry, now);
|
|
473
|
+
}
|
|
474
|
+
return this.isStale(entry, now);
|
|
475
|
+
}
|
|
476
|
+
revalidateTag(tag, options = {}) {
|
|
477
|
+
const normalized = normalizeCacheTag(tag);
|
|
478
|
+
const count = this.invalidateTag(normalized);
|
|
479
|
+
emitFarmEvent(
|
|
480
|
+
options.source === "updateTag" ? { type: "cache.updateTag", tag: normalized, count } : { type: "cache.revalidateTag", tag: normalized, profile: options.profile, count }
|
|
481
|
+
);
|
|
482
|
+
return count;
|
|
483
|
+
}
|
|
484
|
+
async revalidateTagAsync(tag, options = {}) {
|
|
485
|
+
const normalized = normalizeCacheTag(tag);
|
|
486
|
+
const count = this.invalidateTag(normalized);
|
|
487
|
+
await this.adapter?.invalidateTags?.([this.createAdapterTag(normalized)]);
|
|
488
|
+
emitFarmEvent(
|
|
489
|
+
options.source === "updateTag" ? { type: "cache.updateTag", tag: normalized, count } : { type: "cache.revalidateTag", tag: normalized, profile: options.profile, count }
|
|
490
|
+
);
|
|
491
|
+
return count;
|
|
492
|
+
}
|
|
493
|
+
revalidatePath(routePath) {
|
|
494
|
+
const normalizedPath = normalizeRevalidatePath(routePath);
|
|
495
|
+
const pathTag = createPathCacheTag(normalizedPath);
|
|
496
|
+
const pprCount = this.countEntriesForTags([pathTag, "ppr"]);
|
|
497
|
+
const count = this.invalidateTag(pathTag);
|
|
498
|
+
emitFarmEvent({ type: "cache.revalidatePath", path: normalizedPath, count });
|
|
499
|
+
if (pprCount > 0) {
|
|
500
|
+
emitFarmEvent({
|
|
501
|
+
type: "ppr.shell.invalidated",
|
|
502
|
+
route: normalizedPath,
|
|
503
|
+
reason: "revalidatePath",
|
|
504
|
+
count: pprCount
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
return count;
|
|
508
|
+
}
|
|
509
|
+
async revalidatePathAsync(routePath) {
|
|
510
|
+
const normalizedPath = normalizeRevalidatePath(routePath);
|
|
511
|
+
const pathTag = createPathCacheTag(normalizedPath);
|
|
512
|
+
const pprCount = this.countEntriesForTags([pathTag, "ppr"]);
|
|
513
|
+
const count = this.invalidateTag(pathTag);
|
|
514
|
+
await this.adapter?.invalidateTags?.([this.createAdapterTag(pathTag)]);
|
|
515
|
+
emitFarmEvent({ type: "cache.revalidatePath", path: normalizedPath, count });
|
|
516
|
+
if (pprCount > 0) {
|
|
517
|
+
emitFarmEvent({
|
|
518
|
+
type: "ppr.shell.invalidated",
|
|
519
|
+
route: normalizedPath,
|
|
520
|
+
reason: "revalidatePath",
|
|
521
|
+
count: pprCount
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
return count;
|
|
525
|
+
}
|
|
526
|
+
async getOrSet(key, producer, options = {}) {
|
|
527
|
+
const cached = await this.getEntryAsync(key);
|
|
528
|
+
if (cached) {
|
|
529
|
+
return cached.value;
|
|
530
|
+
}
|
|
531
|
+
const inflight = this.inflight.get(key);
|
|
532
|
+
if (inflight) {
|
|
533
|
+
emitFarmEvent({ type: "cache.dedupe", key });
|
|
534
|
+
return inflight;
|
|
535
|
+
}
|
|
536
|
+
const tags = Array.from(normalizeCacheOptionsTags(options));
|
|
537
|
+
const promise = this.fillCacheEntry(key, producer, options, tags).catch((error) => {
|
|
538
|
+
emitFarmEvent({ type: "cache.error", key, operation: "set", error });
|
|
539
|
+
throw error;
|
|
540
|
+
}).finally(() => {
|
|
541
|
+
this.inflight.delete(key);
|
|
542
|
+
});
|
|
543
|
+
this.inflight.set(key, promise);
|
|
544
|
+
return promise;
|
|
545
|
+
}
|
|
546
|
+
async fillCacheEntry(key, producer, options, tags) {
|
|
547
|
+
const leaseKey = `${this.namespace}:lease:${key}`;
|
|
548
|
+
let leaseToken;
|
|
549
|
+
if (this.adapter?.acquireLease && this.adapter.releaseLease && this.lease.enabled) {
|
|
550
|
+
leaseToken = await this.adapter.acquireLease(leaseKey, this.lease.ttlMs);
|
|
551
|
+
if (!leaseToken) {
|
|
552
|
+
const shared = await this.waitForAdapterEntry(key);
|
|
553
|
+
if (shared) {
|
|
554
|
+
emitFarmEvent({ type: "cache.dedupe", key });
|
|
555
|
+
return shared.value;
|
|
556
|
+
}
|
|
557
|
+
leaseToken = await this.adapter.acquireLease(leaseKey, this.lease.ttlMs);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
try {
|
|
561
|
+
const initialTagVersions = await this.getAdapterTagVersions(tags);
|
|
562
|
+
const value = await producer();
|
|
563
|
+
await this.setAsync(key, value, options, initialTagVersions);
|
|
564
|
+
return value;
|
|
565
|
+
} finally {
|
|
566
|
+
if (leaseToken && this.adapter?.releaseLease) {
|
|
567
|
+
await this.adapter.releaseLease(leaseKey, leaseToken);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
async waitForAdapterEntry(key) {
|
|
572
|
+
const deadline = Date.now() + this.lease.waitTimeoutMs;
|
|
573
|
+
while (Date.now() < deadline) {
|
|
574
|
+
await delay(this.lease.pollIntervalMs);
|
|
575
|
+
const entry = await this.getEntryAsync(key);
|
|
576
|
+
if (entry) return entry;
|
|
577
|
+
}
|
|
578
|
+
return void 0;
|
|
579
|
+
}
|
|
580
|
+
countEntriesForTag(tag) {
|
|
581
|
+
let count = 0;
|
|
582
|
+
for (const entry of this.entries.values()) {
|
|
583
|
+
if (entry.tags.has(tag)) {
|
|
584
|
+
count++;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
return count;
|
|
588
|
+
}
|
|
589
|
+
countEntriesForTags(tags) {
|
|
590
|
+
let count = 0;
|
|
591
|
+
for (const entry of this.entries.values()) {
|
|
592
|
+
if (tags.every((tag) => entry.tags.has(tag))) {
|
|
593
|
+
count++;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
return count;
|
|
597
|
+
}
|
|
598
|
+
invalidateTag(normalizedTag) {
|
|
599
|
+
this.invalidatedTagVersions.set(normalizedTag, ++this.version);
|
|
600
|
+
return this.countEntriesForTag(normalizedTag);
|
|
601
|
+
}
|
|
602
|
+
toPublicEntry(entry) {
|
|
603
|
+
return {
|
|
604
|
+
key: entry.key,
|
|
605
|
+
value: entry.value,
|
|
606
|
+
tags: Array.from(entry.tags),
|
|
607
|
+
tagVersions: entry.tagVersions,
|
|
608
|
+
createdAt: entry.createdAt,
|
|
609
|
+
createdVersion: entry.createdVersion,
|
|
610
|
+
revalidate: entry.revalidate
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
hydrateLocalEntry(entry) {
|
|
614
|
+
this.entries.set(entry.key, {
|
|
615
|
+
key: entry.key,
|
|
616
|
+
value: entry.value,
|
|
617
|
+
tags: new Set(entry.tags.map(normalizeCacheTag)),
|
|
618
|
+
tagVersions: entry.tagVersions,
|
|
619
|
+
createdAt: entry.createdAt,
|
|
620
|
+
createdVersion: entry.createdVersion ?? ++this.version,
|
|
621
|
+
revalidate: normalizeRevalidate(entry.revalidate)
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
createAdapterKey(key) {
|
|
625
|
+
return `${this.namespace}:entry:${key}`;
|
|
626
|
+
}
|
|
627
|
+
createAdapterTag(tag) {
|
|
628
|
+
return `${this.namespace}:tag:${tag}`;
|
|
629
|
+
}
|
|
630
|
+
async getAdapterTagVersions(tags) {
|
|
631
|
+
if (!this.adapter?.getTagVersions || tags.length === 0) return {};
|
|
632
|
+
const normalized = tags.map(normalizeCacheTag);
|
|
633
|
+
const physicalTags = normalized.map((tag) => this.createAdapterTag(tag));
|
|
634
|
+
const versions = await this.adapter.getTagVersions(physicalTags);
|
|
635
|
+
return Object.fromEntries(
|
|
636
|
+
normalized.map((tag, index) => [
|
|
637
|
+
tag,
|
|
638
|
+
normalizeAdapterVersion(versions[physicalTags[index]])
|
|
639
|
+
])
|
|
640
|
+
);
|
|
641
|
+
}
|
|
642
|
+
async isAdapterEntryStale(entry, now = Date.now()) {
|
|
643
|
+
if (typeof entry.revalidate === "number" && entry.revalidate > 0 && now - entry.createdAt >= entry.revalidate * 1e3) {
|
|
644
|
+
return true;
|
|
645
|
+
}
|
|
646
|
+
const currentVersions = await this.getAdapterTagVersions(entry.tags);
|
|
647
|
+
for (const tag of entry.tags) {
|
|
648
|
+
if (normalizeAdapterVersion(currentVersions[tag]) > normalizeAdapterVersion(entry.tagVersions?.[tag])) {
|
|
649
|
+
return true;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
return false;
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
__name(_FarmDataCache, "FarmDataCache");
|
|
656
|
+
var FarmDataCache = _FarmDataCache;
|
|
657
|
+
var FARM_DATA_CACHE_SYMBOL = /* @__PURE__ */ Symbol.for("farm.dataCache");
|
|
658
|
+
var farmDataCacheGlobal = globalThis;
|
|
659
|
+
var sharedFarmDataCache = farmDataCacheGlobal[FARM_DATA_CACHE_SYMBOL] ?? (farmDataCacheGlobal[FARM_DATA_CACHE_SYMBOL] = new FarmDataCache());
|
|
660
|
+
var functionIds = /* @__PURE__ */ new WeakMap();
|
|
661
|
+
var nextFunctionId = 0;
|
|
662
|
+
function getFarmDataCache() {
|
|
663
|
+
return sharedFarmDataCache;
|
|
664
|
+
}
|
|
665
|
+
__name(getFarmDataCache, "getFarmDataCache");
|
|
666
|
+
function configureFarmCache(config) {
|
|
667
|
+
sharedFarmDataCache.configure(config);
|
|
668
|
+
}
|
|
669
|
+
__name(configureFarmCache, "configureFarmCache");
|
|
670
|
+
function unstable_cache(fn, keyParts = [], options = {}) {
|
|
671
|
+
return async (...args) => {
|
|
672
|
+
const locale = getActiveFarmI18nSnapshot()?.locale;
|
|
673
|
+
const key = createFarmCacheKey([
|
|
674
|
+
"unstable_cache",
|
|
675
|
+
getFunctionCacheIdentity(fn),
|
|
676
|
+
locale ? ["locale", locale] : null,
|
|
677
|
+
keyParts,
|
|
678
|
+
args
|
|
679
|
+
]);
|
|
680
|
+
return getFarmDataCache().getOrSet(key, () => fn(...args), options);
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
__name(unstable_cache, "unstable_cache");
|
|
684
|
+
function revalidateTag(_tag, _profile) {
|
|
685
|
+
const cache = getFarmDataCache();
|
|
686
|
+
if (cache.hasAdapter) {
|
|
687
|
+
const task = cache.revalidateTagAsync(_tag, {
|
|
688
|
+
source: "revalidateTag",
|
|
689
|
+
profile: _profile
|
|
690
|
+
}).then(() => void 0);
|
|
691
|
+
notifyFarmCacheTask(task);
|
|
692
|
+
return task;
|
|
693
|
+
}
|
|
694
|
+
cache.revalidateTag(_tag, {
|
|
695
|
+
source: "revalidateTag",
|
|
696
|
+
profile: _profile
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
__name(revalidateTag, "revalidateTag");
|
|
700
|
+
function updateTag(tag) {
|
|
701
|
+
const cache = getFarmDataCache();
|
|
702
|
+
if (cache.hasAdapter) {
|
|
703
|
+
const task = cache.revalidateTagAsync(tag, { source: "updateTag" }).then(() => void 0);
|
|
704
|
+
notifyFarmCacheTask(task);
|
|
705
|
+
return task;
|
|
706
|
+
}
|
|
707
|
+
cache.revalidateTag(tag, { source: "updateTag" });
|
|
708
|
+
}
|
|
709
|
+
__name(updateTag, "updateTag");
|
|
710
|
+
function revalidatePath(routePath) {
|
|
711
|
+
const cache = getFarmDataCache();
|
|
712
|
+
if (cache.hasAdapter) {
|
|
713
|
+
const task = cache.revalidatePathAsync(routePath).then(() => void 0);
|
|
714
|
+
notifyFarmCacheTask(task);
|
|
715
|
+
return task;
|
|
716
|
+
}
|
|
717
|
+
cache.revalidatePath(routePath);
|
|
718
|
+
}
|
|
719
|
+
__name(revalidatePath, "revalidatePath");
|
|
720
|
+
function invalidate(key) {
|
|
721
|
+
const clientKey = createRouteDataCacheKey(key);
|
|
722
|
+
const task = updateTag(createRouteDataCacheTag(key));
|
|
723
|
+
notifyFarmCacheInvalidation(clientKey);
|
|
724
|
+
return task;
|
|
725
|
+
}
|
|
726
|
+
__name(invalidate, "invalidate");
|
|
727
|
+
function invalidateRouteData(key) {
|
|
728
|
+
return invalidate(key);
|
|
729
|
+
}
|
|
730
|
+
__name(invalidateRouteData, "invalidateRouteData");
|
|
731
|
+
async function applyFarmCacheInvalidationTargets(targets) {
|
|
732
|
+
if (!Array.isArray(targets)) {
|
|
733
|
+
throw new TypeError("Cache invalidations must resolve to an array of targets.");
|
|
734
|
+
}
|
|
735
|
+
const clientKeys = [];
|
|
736
|
+
for (const target of targets) {
|
|
737
|
+
assertFarmCacheInvalidationTarget(target);
|
|
738
|
+
if ("key" in target) {
|
|
739
|
+
await invalidate(target.key);
|
|
740
|
+
clientKeys.push(createRouteDataCacheKey(target.key));
|
|
741
|
+
} else if ("path" in target) {
|
|
742
|
+
await revalidatePath(target.path);
|
|
743
|
+
} else {
|
|
744
|
+
await updateTag(target.tag);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
return Array.from(new Set(clientKeys));
|
|
748
|
+
}
|
|
749
|
+
__name(applyFarmCacheInvalidationTargets, "applyFarmCacheInvalidationTargets");
|
|
750
|
+
function createPathCacheTag(routePath) {
|
|
751
|
+
return `path:${normalizeRevalidatePath(routePath)}`;
|
|
752
|
+
}
|
|
753
|
+
__name(createPathCacheTag, "createPathCacheTag");
|
|
754
|
+
function createRouteDataCacheTag(key) {
|
|
755
|
+
return `route-data:${createRouteDataCacheKey(key)}`;
|
|
756
|
+
}
|
|
757
|
+
__name(createRouteDataCacheTag, "createRouteDataCacheTag");
|
|
758
|
+
function createRouteDataCacheKey(key) {
|
|
759
|
+
return createFarmCacheKey(Array.isArray(key) ? key : [key]);
|
|
760
|
+
}
|
|
761
|
+
__name(createRouteDataCacheKey, "createRouteDataCacheKey");
|
|
762
|
+
function normalizeRevalidatePath(routePath) {
|
|
763
|
+
if (typeof routePath !== "string") {
|
|
764
|
+
throw new TypeError("revalidatePath expects a path string.");
|
|
765
|
+
}
|
|
766
|
+
let normalized = routePath.trim();
|
|
767
|
+
if (!normalized) {
|
|
768
|
+
throw new Error("revalidatePath expects a non-empty path.");
|
|
769
|
+
}
|
|
770
|
+
try {
|
|
771
|
+
if (/^https?:\/\//.test(normalized)) {
|
|
772
|
+
normalized = new URL(normalized).pathname;
|
|
773
|
+
}
|
|
774
|
+
} catch {
|
|
775
|
+
}
|
|
776
|
+
normalized = normalized.split("?")[0] ?? normalized;
|
|
777
|
+
normalized = normalized.startsWith("/") ? normalized : `/${normalized}`;
|
|
778
|
+
normalized = normalized.replace(/\/{2,}/g, "/");
|
|
779
|
+
if (normalized.length > 1) {
|
|
780
|
+
normalized = normalized.replace(/\/+$/, "");
|
|
781
|
+
}
|
|
782
|
+
return normalized || "/";
|
|
783
|
+
}
|
|
784
|
+
__name(normalizeRevalidatePath, "normalizeRevalidatePath");
|
|
785
|
+
function createFarmCacheKey(parts) {
|
|
786
|
+
return stableSerialize(parts);
|
|
787
|
+
}
|
|
788
|
+
__name(createFarmCacheKey, "createFarmCacheKey");
|
|
789
|
+
function normalizeRevalidate(revalidate) {
|
|
790
|
+
if (revalidate === false || revalidate === void 0) {
|
|
791
|
+
return revalidate;
|
|
792
|
+
}
|
|
793
|
+
if (!Number.isFinite(revalidate) || revalidate <= 0) {
|
|
794
|
+
return void 0;
|
|
795
|
+
}
|
|
796
|
+
return revalidate;
|
|
797
|
+
}
|
|
798
|
+
__name(normalizeRevalidate, "normalizeRevalidate");
|
|
799
|
+
function normalizeCacheTag(tag) {
|
|
800
|
+
if (typeof tag !== "string") {
|
|
801
|
+
throw new TypeError("Cache tags must be strings.");
|
|
802
|
+
}
|
|
803
|
+
const normalized = tag.trim();
|
|
804
|
+
if (!normalized) {
|
|
805
|
+
throw new Error("Cache tags cannot be empty.");
|
|
806
|
+
}
|
|
807
|
+
return normalized;
|
|
808
|
+
}
|
|
809
|
+
__name(normalizeCacheTag, "normalizeCacheTag");
|
|
810
|
+
function normalizeCacheNamespace(namespace) {
|
|
811
|
+
if (typeof namespace !== "string") {
|
|
812
|
+
throw new TypeError("Cache namespace must be a string.");
|
|
813
|
+
}
|
|
814
|
+
const normalized = namespace.trim().replace(/:+$/g, "");
|
|
815
|
+
if (!normalized) {
|
|
816
|
+
throw new Error("Cache namespace cannot be empty.");
|
|
817
|
+
}
|
|
818
|
+
return normalized;
|
|
819
|
+
}
|
|
820
|
+
__name(normalizeCacheNamespace, "normalizeCacheNamespace");
|
|
821
|
+
function normalizeAdapterVersion(value) {
|
|
822
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 0;
|
|
823
|
+
}
|
|
824
|
+
__name(normalizeAdapterVersion, "normalizeAdapterVersion");
|
|
825
|
+
function normalizePositiveDuration(value, fallback, name) {
|
|
826
|
+
if (value === void 0) return fallback;
|
|
827
|
+
if (!Number.isFinite(value) || value <= 0) {
|
|
828
|
+
throw new TypeError(`${name} must be a positive number of milliseconds.`);
|
|
829
|
+
}
|
|
830
|
+
return Math.floor(value);
|
|
831
|
+
}
|
|
832
|
+
__name(normalizePositiveDuration, "normalizePositiveDuration");
|
|
833
|
+
function delay(ms) {
|
|
834
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
835
|
+
}
|
|
836
|
+
__name(delay, "delay");
|
|
837
|
+
function normalizeCacheOptionsTags(options) {
|
|
838
|
+
const tags = /* @__PURE__ */ new Set();
|
|
839
|
+
for (const tag of options.tags ?? []) {
|
|
840
|
+
tags.add(normalizeCacheTag(tag));
|
|
841
|
+
}
|
|
842
|
+
for (const routePath of options.paths ?? []) {
|
|
843
|
+
tags.add(createPathCacheTag(routePath));
|
|
844
|
+
}
|
|
845
|
+
return tags;
|
|
846
|
+
}
|
|
847
|
+
__name(normalizeCacheOptionsTags, "normalizeCacheOptionsTags");
|
|
848
|
+
function assertFarmCacheEntry(entry, expectedKey) {
|
|
849
|
+
if (!entry || typeof entry !== "object" || entry.key !== expectedKey || !Array.isArray(entry.tags) || typeof entry.createdAt !== "number") {
|
|
850
|
+
throw new TypeError(
|
|
851
|
+
`Cache adapter returned an invalid entry for ${JSON.stringify(expectedKey)}.`
|
|
852
|
+
);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
__name(assertFarmCacheEntry, "assertFarmCacheEntry");
|
|
856
|
+
function assertFarmCacheInvalidationTarget(target) {
|
|
857
|
+
if (!target || typeof target !== "object") {
|
|
858
|
+
throw new TypeError("Cache invalidation targets must be { key }, { path }, or { tag }.");
|
|
859
|
+
}
|
|
860
|
+
if ("key" in target) {
|
|
861
|
+
const key = target.key;
|
|
862
|
+
if (typeof key === "string" || Array.isArray(key)) return;
|
|
863
|
+
} else if ("path" in target && typeof target.path === "string") {
|
|
864
|
+
return;
|
|
865
|
+
} else if ("tag" in target && typeof target.tag === "string") {
|
|
866
|
+
return;
|
|
867
|
+
}
|
|
868
|
+
throw new TypeError("Cache invalidation targets must contain a string/array key, path, or tag.");
|
|
869
|
+
}
|
|
870
|
+
__name(assertFarmCacheInvalidationTarget, "assertFarmCacheInvalidationTarget");
|
|
871
|
+
function getFunctionCacheIdentity(fn) {
|
|
872
|
+
if (fn.name) {
|
|
873
|
+
return `name:${fn.name}`;
|
|
874
|
+
}
|
|
875
|
+
let id = functionIds.get(fn);
|
|
876
|
+
if (!id) {
|
|
877
|
+
id = ++nextFunctionId;
|
|
878
|
+
functionIds.set(fn, id);
|
|
879
|
+
}
|
|
880
|
+
return `anonymous:${id}`;
|
|
881
|
+
}
|
|
882
|
+
__name(getFunctionCacheIdentity, "getFunctionCacheIdentity");
|
|
883
|
+
function stableSerialize(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
884
|
+
if (value === null) return "null";
|
|
885
|
+
if (value === void 0) return "undefined";
|
|
886
|
+
const valueType = typeof value;
|
|
887
|
+
if (valueType === "string") return JSON.stringify(value);
|
|
888
|
+
if (valueType === "number" || valueType === "boolean" || valueType === "bigint") {
|
|
889
|
+
return `${valueType}:${String(value)}`;
|
|
890
|
+
}
|
|
891
|
+
if (valueType === "symbol") {
|
|
892
|
+
return `symbol:${String(value)}`;
|
|
893
|
+
}
|
|
894
|
+
if (valueType === "function") {
|
|
895
|
+
return `function:${getFunctionCacheIdentity(value)}`;
|
|
896
|
+
}
|
|
897
|
+
if (value instanceof Date) {
|
|
898
|
+
return `date:${value.toISOString()}`;
|
|
899
|
+
}
|
|
900
|
+
if (value instanceof URL) {
|
|
901
|
+
return `url:${value.toString()}`;
|
|
902
|
+
}
|
|
903
|
+
if (value instanceof RegExp) {
|
|
904
|
+
return `regexp:${value.toString()}`;
|
|
905
|
+
}
|
|
906
|
+
if (Array.isArray(value)) {
|
|
907
|
+
return `[${value.map((item) => stableSerialize(item, seen)).join(",")}]`;
|
|
908
|
+
}
|
|
909
|
+
if (value && typeof value === "object") {
|
|
910
|
+
if (seen.has(value)) {
|
|
911
|
+
return "[Circular]";
|
|
912
|
+
}
|
|
913
|
+
seen.add(value);
|
|
914
|
+
const entries = Object.entries(value).sort(
|
|
915
|
+
([a], [b]) => a.localeCompare(b)
|
|
916
|
+
);
|
|
917
|
+
const serialized = entries.map(([key, item]) => `${JSON.stringify(key)}:${stableSerialize(item, seen)}`).join(",");
|
|
918
|
+
seen.delete(value);
|
|
919
|
+
return `{${serialized}}`;
|
|
920
|
+
}
|
|
921
|
+
return String(value);
|
|
922
|
+
}
|
|
923
|
+
__name(stableSerialize, "stableSerialize");
|
|
924
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
925
|
+
0 && (module.exports = {
|
|
926
|
+
FarmDataCache,
|
|
927
|
+
applyFarmCacheInvalidationTargets,
|
|
928
|
+
applyFarmCacheInvalidations,
|
|
929
|
+
configureFarmCache,
|
|
930
|
+
createFarmCacheKey,
|
|
931
|
+
createPathCacheTag,
|
|
932
|
+
createRouteDataCacheKey,
|
|
933
|
+
createRouteDataCacheTag,
|
|
934
|
+
defineCacheKey,
|
|
935
|
+
getFarmDataCache,
|
|
936
|
+
invalidate,
|
|
937
|
+
invalidateRouteData,
|
|
938
|
+
normalizeRevalidatePath,
|
|
939
|
+
revalidatePath,
|
|
940
|
+
revalidateTag,
|
|
941
|
+
storageCacheAdapter,
|
|
942
|
+
unstable_cache,
|
|
943
|
+
updateTag
|
|
944
|
+
});
|
|
945
|
+
//# sourceMappingURL=cache.cjs.map
|