@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
|
@@ -0,0 +1,541 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name
|
|
3
|
+
} from "./chunk-CGILA3WO.mjs";
|
|
4
|
+
|
|
5
|
+
// src/workflows.ts
|
|
6
|
+
var DEFAULT_FARM_WORKFLOW_DIRS = ["src/jobs", "src/workflows", "src/cron"];
|
|
7
|
+
var DEFAULT_FARM_WORKFLOW_ROUTE = "/api/_farm/workflows";
|
|
8
|
+
var DEFAULT_FARM_WORKFLOW_SECRET_ENV = "CRON_SECRET";
|
|
9
|
+
function defineWorkflow(definition) {
|
|
10
|
+
return {
|
|
11
|
+
...definition,
|
|
12
|
+
kind: "farm-workflow"
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
__name(defineWorkflow, "defineWorkflow");
|
|
16
|
+
function defineTask(definition) {
|
|
17
|
+
return defineWorkflow(definition);
|
|
18
|
+
}
|
|
19
|
+
__name(defineTask, "defineTask");
|
|
20
|
+
function defineCron(definition) {
|
|
21
|
+
return {
|
|
22
|
+
...definition,
|
|
23
|
+
kind: "farm-workflow"
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
__name(defineCron, "defineCron");
|
|
27
|
+
function resolveWorkflowsConfig(workflows) {
|
|
28
|
+
if (workflows === false) {
|
|
29
|
+
return {
|
|
30
|
+
enabled: false,
|
|
31
|
+
dirs: [...DEFAULT_FARM_WORKFLOW_DIRS],
|
|
32
|
+
route: DEFAULT_FARM_WORKFLOW_ROUTE,
|
|
33
|
+
secretEnv: DEFAULT_FARM_WORKFLOW_SECRET_ENV
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const options = workflows && typeof workflows === "object" ? workflows : {};
|
|
37
|
+
const dirs = normalizeWorkflowDirs(options);
|
|
38
|
+
return {
|
|
39
|
+
enabled: options.enabled ?? true,
|
|
40
|
+
dirs,
|
|
41
|
+
route: normalizeWorkflowRoute(options.route || DEFAULT_FARM_WORKFLOW_ROUTE),
|
|
42
|
+
secretEnv: options.secretEnv || DEFAULT_FARM_WORKFLOW_SECRET_ENV,
|
|
43
|
+
secret: options.secret
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
__name(resolveWorkflowsConfig, "resolveWorkflowsConfig");
|
|
47
|
+
async function discoverFarmWorkflows(config, options = {}) {
|
|
48
|
+
const workflowConfig = isResolvedWorkflowConfig(config.workflows) ? config.workflows : resolveWorkflowsConfig(config.workflows);
|
|
49
|
+
if (!workflowConfig.enabled) return [];
|
|
50
|
+
const root = config.root || process.cwd();
|
|
51
|
+
const files = await findWorkflowFiles(root, workflowConfig.dirs);
|
|
52
|
+
const workflows = [];
|
|
53
|
+
const seenIds = /* @__PURE__ */ new Map();
|
|
54
|
+
for (const filePath of files) {
|
|
55
|
+
const module = options.loadModule ? await options.loadModule(filePath) : await loadWorkflowModule(filePath, root);
|
|
56
|
+
const definition = resolveWorkflowDefinition(module);
|
|
57
|
+
if (!definition) continue;
|
|
58
|
+
const id = normalizeWorkflowId(definition.id || workflowIdFromFile(root, filePath));
|
|
59
|
+
const previousPath = seenIds.get(id);
|
|
60
|
+
if (previousPath) {
|
|
61
|
+
throw new Error(
|
|
62
|
+
`Duplicate Farm workflow id "${id}" found in ${relativePath(root, previousPath)} and ${relativePath(root, filePath)}.`
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
seenIds.set(id, filePath);
|
|
66
|
+
workflows.push({
|
|
67
|
+
id,
|
|
68
|
+
filePath,
|
|
69
|
+
description: definition.description,
|
|
70
|
+
schedule: normalizeSchedule(definition.schedule),
|
|
71
|
+
timezone: definition.timezone,
|
|
72
|
+
routePath: joinRoute(workflowConfig.route, encodeURIComponent(id))
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return workflows;
|
|
76
|
+
}
|
|
77
|
+
__name(discoverFarmWorkflows, "discoverFarmWorkflows");
|
|
78
|
+
function createFarmWorkflowRequestHandler(options) {
|
|
79
|
+
const workflowsById = new Map(options.workflows.map((workflow) => [workflow.id, workflow]));
|
|
80
|
+
return /* @__PURE__ */ __name(async function handleFarmWorkflowRequest(request) {
|
|
81
|
+
const url = new URL(request.url);
|
|
82
|
+
const route = normalizeWorkflowRoute(options.config.route);
|
|
83
|
+
if (url.pathname !== route && !url.pathname.startsWith(`${route}/`)) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
if (url.pathname === route) {
|
|
87
|
+
const secretError2 = verifyWorkflowSecret(request, options.config);
|
|
88
|
+
if (secretError2) return secretError2;
|
|
89
|
+
return Response.json({
|
|
90
|
+
workflows: options.workflows.map(toWorkflowMetadata)
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
const id = decodeURIComponent(url.pathname.slice(route.length + 1));
|
|
94
|
+
const workflow = workflowsById.get(id);
|
|
95
|
+
if (!workflow) {
|
|
96
|
+
return Response.json({ error: `Workflow "${id}" was not found.` }, { status: 404 });
|
|
97
|
+
}
|
|
98
|
+
const secretError = verifyWorkflowSecret(request, options.config);
|
|
99
|
+
if (secretError) return secretError;
|
|
100
|
+
const payload = await readWorkflowPayload(request);
|
|
101
|
+
const module = await options.loadModule(workflow);
|
|
102
|
+
const result = await runFarmWorkflowModule(module, {
|
|
103
|
+
id: workflow.id,
|
|
104
|
+
name: workflow.id,
|
|
105
|
+
payload,
|
|
106
|
+
request,
|
|
107
|
+
scheduledTime: readScheduledTime(payload)
|
|
108
|
+
});
|
|
109
|
+
return Response.json({
|
|
110
|
+
id: workflow.id,
|
|
111
|
+
ok: true,
|
|
112
|
+
result: result ?? null
|
|
113
|
+
});
|
|
114
|
+
}, "handleFarmWorkflowRequest");
|
|
115
|
+
}
|
|
116
|
+
__name(createFarmWorkflowRequestHandler, "createFarmWorkflowRequestHandler");
|
|
117
|
+
async function runFarmWorkflowModule(module, context) {
|
|
118
|
+
const definition = resolveWorkflowDefinition(module);
|
|
119
|
+
if (!definition) {
|
|
120
|
+
throw new Error(`Farm workflow "${context.id}" does not export a workflow definition.`);
|
|
121
|
+
}
|
|
122
|
+
return await definition.run({
|
|
123
|
+
id: context.id,
|
|
124
|
+
name: context.name || context.id,
|
|
125
|
+
payload: context.payload,
|
|
126
|
+
scheduledTime: context.scheduledTime,
|
|
127
|
+
request: context.request,
|
|
128
|
+
event: context.event,
|
|
129
|
+
env: context.env || process.env,
|
|
130
|
+
data: /* @__PURE__ */ new Map(),
|
|
131
|
+
log: console
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
__name(runFarmWorkflowModule, "runFarmWorkflowModule");
|
|
135
|
+
async function prepareFarmWorkflowsForNitro(config) {
|
|
136
|
+
const workflowConfig = isResolvedWorkflowConfig(config.workflows) ? config.workflows : resolveWorkflowsConfig(config.workflows);
|
|
137
|
+
const workflows = await discoverFarmWorkflows({
|
|
138
|
+
root: config.root,
|
|
139
|
+
workflows: workflowConfig
|
|
140
|
+
});
|
|
141
|
+
if (workflows.length === 0) {
|
|
142
|
+
return {
|
|
143
|
+
workflows,
|
|
144
|
+
tasks: {},
|
|
145
|
+
scheduledTasks: {}
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
const root = config.root || process.cwd();
|
|
149
|
+
const distDir = config.distDir || ".farm";
|
|
150
|
+
const fs = await import("fs/promises");
|
|
151
|
+
const path = await import("path");
|
|
152
|
+
const generatedDir = path.join(root, distDir, ".nitro", "farm-workflows");
|
|
153
|
+
await fs.mkdir(generatedDir, { recursive: true });
|
|
154
|
+
const tasks = {};
|
|
155
|
+
const scheduledTasks = createScheduledTasks(workflows);
|
|
156
|
+
for (const workflow of workflows) {
|
|
157
|
+
const wrapperPath = path.join(generatedDir, `${safeFileName(workflow.id)}.mjs`);
|
|
158
|
+
await fs.writeFile(wrapperPath, createNitroTaskWrapper(workflow), "utf8");
|
|
159
|
+
tasks[workflow.id] = {
|
|
160
|
+
handler: wrapperPath,
|
|
161
|
+
description: workflow.description || `Farm workflow ${workflow.id}`
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
const handlerPath = path.join(generatedDir, "http-handler.mjs");
|
|
165
|
+
await fs.writeFile(
|
|
166
|
+
handlerPath,
|
|
167
|
+
createNitroWorkflowHTTPHandler(workflowConfig, workflows),
|
|
168
|
+
"utf8"
|
|
169
|
+
);
|
|
170
|
+
const manifestPath = path.join(generatedDir, "manifest.json");
|
|
171
|
+
await fs.writeFile(
|
|
172
|
+
manifestPath,
|
|
173
|
+
JSON.stringify(
|
|
174
|
+
{
|
|
175
|
+
route: workflowConfig.route,
|
|
176
|
+
secretEnv: workflowConfig.secretEnv,
|
|
177
|
+
trigger: {
|
|
178
|
+
method: "GET",
|
|
179
|
+
authorization: `Bearer $${workflowConfig.secretEnv}`
|
|
180
|
+
},
|
|
181
|
+
workflows: workflows.map(toWorkflowMetadata)
|
|
182
|
+
},
|
|
183
|
+
null,
|
|
184
|
+
2
|
|
185
|
+
),
|
|
186
|
+
"utf8"
|
|
187
|
+
);
|
|
188
|
+
return {
|
|
189
|
+
workflows,
|
|
190
|
+
tasks,
|
|
191
|
+
scheduledTasks,
|
|
192
|
+
handlerPath,
|
|
193
|
+
manifestPath
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
__name(prepareFarmWorkflowsForNitro, "prepareFarmWorkflowsForNitro");
|
|
197
|
+
function createFarmWorkflowVercelCrons(workflows) {
|
|
198
|
+
return workflows.flatMap(
|
|
199
|
+
(workflow) => workflow.schedule.map((schedule) => ({
|
|
200
|
+
path: workflow.routePath,
|
|
201
|
+
schedule
|
|
202
|
+
}))
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
__name(createFarmWorkflowVercelCrons, "createFarmWorkflowVercelCrons");
|
|
206
|
+
function applyFarmWorkflowVercelCrons(vercelConfig, workflows) {
|
|
207
|
+
const crons = createFarmWorkflowVercelCrons(workflows);
|
|
208
|
+
if (crons.length === 0) return vercelConfig;
|
|
209
|
+
const existingCrons = Array.isArray(vercelConfig.crons) ? vercelConfig.crons : [];
|
|
210
|
+
const seen = new Set(existingCrons.map((cron) => `${cron.path}:${cron.schedule}`));
|
|
211
|
+
const nextCrons = [...existingCrons];
|
|
212
|
+
for (const cron of crons) {
|
|
213
|
+
const key = `${cron.path}:${cron.schedule}`;
|
|
214
|
+
if (seen.has(key)) continue;
|
|
215
|
+
seen.add(key);
|
|
216
|
+
nextCrons.push(cron);
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
...vercelConfig,
|
|
220
|
+
crons: nextCrons
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
__name(applyFarmWorkflowVercelCrons, "applyFarmWorkflowVercelCrons");
|
|
224
|
+
function isResolvedWorkflowConfig(value) {
|
|
225
|
+
return !!value && typeof value === "object" && "dirs" in value && Array.isArray(value.dirs) && typeof value.route === "string";
|
|
226
|
+
}
|
|
227
|
+
__name(isResolvedWorkflowConfig, "isResolvedWorkflowConfig");
|
|
228
|
+
function normalizeWorkflowDirs(options) {
|
|
229
|
+
const rawDirs = options.dirs || (Array.isArray(options.dir) ? options.dir : options.dir ? [options.dir] : void 0);
|
|
230
|
+
const dirs = rawDirs && rawDirs.length > 0 ? rawDirs : DEFAULT_FARM_WORKFLOW_DIRS;
|
|
231
|
+
return [...new Set(dirs.map((dir) => trimSlashes(dir)).filter(Boolean))];
|
|
232
|
+
}
|
|
233
|
+
__name(normalizeWorkflowDirs, "normalizeWorkflowDirs");
|
|
234
|
+
function normalizeWorkflowRoute(route) {
|
|
235
|
+
const trimmed = route.trim();
|
|
236
|
+
if (!trimmed || trimmed === "/") return DEFAULT_FARM_WORKFLOW_ROUTE;
|
|
237
|
+
return `/${trimSlashes(trimmed)}`;
|
|
238
|
+
}
|
|
239
|
+
__name(normalizeWorkflowRoute, "normalizeWorkflowRoute");
|
|
240
|
+
function normalizeWorkflowId(id) {
|
|
241
|
+
const normalized = id.replace(/\\/g, "/").replace(/\.(tsx?|jsx?|mjs|cjs)$/, "").replace(/\/index$/, "").replace(/[^a-zA-Z0-9._/-]+/g, "-").replace(/^\/+|\/+$/g, "").replace(/\/+/g, "/");
|
|
242
|
+
return normalized || "workflow";
|
|
243
|
+
}
|
|
244
|
+
__name(normalizeWorkflowId, "normalizeWorkflowId");
|
|
245
|
+
function normalizeSchedule(schedule) {
|
|
246
|
+
if (!schedule) return [];
|
|
247
|
+
return (Array.isArray(schedule) ? schedule : [schedule]).map((value) => value.trim()).filter(Boolean);
|
|
248
|
+
}
|
|
249
|
+
__name(normalizeSchedule, "normalizeSchedule");
|
|
250
|
+
function resolveWorkflowDefinition(module) {
|
|
251
|
+
const candidates = [module.default, module.workflow, module.cron, module.task, module.job];
|
|
252
|
+
for (const candidate of candidates) {
|
|
253
|
+
if (candidate && typeof candidate === "object" && typeof candidate.run === "function") {
|
|
254
|
+
return candidate;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return null;
|
|
258
|
+
}
|
|
259
|
+
__name(resolveWorkflowDefinition, "resolveWorkflowDefinition");
|
|
260
|
+
async function findWorkflowFiles(root, dirs) {
|
|
261
|
+
const fs = await import("fs/promises");
|
|
262
|
+
const path = await import("path");
|
|
263
|
+
const files = [];
|
|
264
|
+
for (const dir of dirs) {
|
|
265
|
+
const absoluteDir = path.isAbsolute(dir) ? dir : path.join(root, dir);
|
|
266
|
+
if (!await pathExists(absoluteDir)) continue;
|
|
267
|
+
await walkWorkflowDir(absoluteDir, files);
|
|
268
|
+
}
|
|
269
|
+
return files.sort();
|
|
270
|
+
}
|
|
271
|
+
__name(findWorkflowFiles, "findWorkflowFiles");
|
|
272
|
+
async function walkWorkflowDir(dir, files) {
|
|
273
|
+
const fs = await import("fs/promises");
|
|
274
|
+
const path = await import("path");
|
|
275
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
276
|
+
for (const entry of entries) {
|
|
277
|
+
const filePath = path.join(dir, entry.name);
|
|
278
|
+
if (entry.isDirectory()) {
|
|
279
|
+
if (entry.name === "node_modules" || entry.name.startsWith(".")) continue;
|
|
280
|
+
await walkWorkflowDir(filePath, files);
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
if (isWorkflowFile(entry.name)) {
|
|
284
|
+
files.push(filePath);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
__name(walkWorkflowDir, "walkWorkflowDir");
|
|
289
|
+
async function pathExists(filePath) {
|
|
290
|
+
const fs = await import("fs/promises");
|
|
291
|
+
return fs.access(filePath).then(() => true).catch(() => false);
|
|
292
|
+
}
|
|
293
|
+
__name(pathExists, "pathExists");
|
|
294
|
+
function isWorkflowFile(fileName) {
|
|
295
|
+
return /\.(?:ts|tsx|js|jsx|mjs|cjs)$/.test(fileName) && !/\.d\.[cm]?ts$/.test(fileName);
|
|
296
|
+
}
|
|
297
|
+
__name(isWorkflowFile, "isWorkflowFile");
|
|
298
|
+
async function loadWorkflowModule(filePath, root) {
|
|
299
|
+
const fs = await import("fs/promises");
|
|
300
|
+
const path = await import("path");
|
|
301
|
+
const { pathToFileURL } = await import("url");
|
|
302
|
+
const { build } = await import("esbuild");
|
|
303
|
+
const outDir = path.join(root, ".farm", ".workflow-loader");
|
|
304
|
+
await fs.mkdir(outDir, { recursive: true });
|
|
305
|
+
const outfile = path.join(
|
|
306
|
+
outDir,
|
|
307
|
+
`workflow-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`
|
|
308
|
+
);
|
|
309
|
+
await build({
|
|
310
|
+
absWorkingDir: root,
|
|
311
|
+
entryPoints: [filePath],
|
|
312
|
+
outfile,
|
|
313
|
+
bundle: true,
|
|
314
|
+
format: "esm",
|
|
315
|
+
platform: "node",
|
|
316
|
+
target: `node${process.versions.node.split(".")[0]}`,
|
|
317
|
+
packages: "external",
|
|
318
|
+
external: ["@farm.js/core", "@farm.js/core/*", "nitro", "nitro/*"],
|
|
319
|
+
jsx: "automatic",
|
|
320
|
+
logLevel: "silent",
|
|
321
|
+
sourcemap: "inline"
|
|
322
|
+
});
|
|
323
|
+
try {
|
|
324
|
+
return await import(
|
|
325
|
+
/* @vite-ignore */
|
|
326
|
+
`${pathToFileURL(outfile).href}?t=${Date.now()}`
|
|
327
|
+
);
|
|
328
|
+
} finally {
|
|
329
|
+
await fs.unlink(outfile).catch(() => void 0);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
__name(loadWorkflowModule, "loadWorkflowModule");
|
|
333
|
+
function workflowIdFromFile(root, filePath) {
|
|
334
|
+
const normalizedRoot = root.replace(/\\/g, "/");
|
|
335
|
+
const normalizedFile = filePath.replace(/\\/g, "/");
|
|
336
|
+
const relative = normalizedFile.startsWith(`${normalizedRoot}/`) ? normalizedFile.slice(normalizedRoot.length + 1) : normalizedFile;
|
|
337
|
+
return normalizeWorkflowId(
|
|
338
|
+
relative.replace(/^src\/(?:jobs|workflows|cron)\//, "").replace(/\.(tsx?|jsx?|mjs|cjs)$/, "")
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
__name(workflowIdFromFile, "workflowIdFromFile");
|
|
342
|
+
function createScheduledTasks(workflows) {
|
|
343
|
+
const scheduleMap = /* @__PURE__ */ new Map();
|
|
344
|
+
for (const workflow of workflows) {
|
|
345
|
+
for (const schedule of workflow.schedule) {
|
|
346
|
+
const taskIds = scheduleMap.get(schedule) || [];
|
|
347
|
+
taskIds.push(workflow.id);
|
|
348
|
+
scheduleMap.set(schedule, taskIds);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
return Object.fromEntries(
|
|
352
|
+
[...scheduleMap.entries()].map(([schedule, taskIds]) => [
|
|
353
|
+
schedule,
|
|
354
|
+
taskIds.length === 1 ? taskIds[0] : taskIds
|
|
355
|
+
])
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
__name(createScheduledTasks, "createScheduledTasks");
|
|
359
|
+
function createNitroTaskWrapper(workflow) {
|
|
360
|
+
const normalizedPath = workflow.filePath.replace(/\\/g, "/");
|
|
361
|
+
return `
|
|
362
|
+
import { defineTask } from "nitro/runtime";
|
|
363
|
+
import { runFarmWorkflowModule } from "@farm.js/core/workflows";
|
|
364
|
+
import * as workflowModule from ${JSON.stringify(normalizedPath)};
|
|
365
|
+
|
|
366
|
+
export default defineTask({
|
|
367
|
+
meta: {
|
|
368
|
+
description: ${JSON.stringify(workflow.description || `Farm workflow ${workflow.id}`)}
|
|
369
|
+
},
|
|
370
|
+
async run(event) {
|
|
371
|
+
const payload = event?.payload || {};
|
|
372
|
+
const env = event?.context?.cloudflare?.env || event?.context?.env || process.env;
|
|
373
|
+
return await runFarmWorkflowModule(workflowModule, {
|
|
374
|
+
id: ${JSON.stringify(workflow.id)},
|
|
375
|
+
name: event?.name || ${JSON.stringify(workflow.id)},
|
|
376
|
+
payload,
|
|
377
|
+
scheduledTime: payload.scheduledTime,
|
|
378
|
+
request: event?.context?.request,
|
|
379
|
+
event,
|
|
380
|
+
env
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
`.trim();
|
|
385
|
+
}
|
|
386
|
+
__name(createNitroTaskWrapper, "createNitroTaskWrapper");
|
|
387
|
+
function createNitroWorkflowHTTPHandler(config, workflows) {
|
|
388
|
+
return `
|
|
389
|
+
import { H3 } from "h3";
|
|
390
|
+
import { runTask } from "nitro/runtime";
|
|
391
|
+
|
|
392
|
+
const route = ${JSON.stringify(config.route)};
|
|
393
|
+
const secretEnv = ${JSON.stringify(config.secretEnv)};
|
|
394
|
+
const inlineSecret = ${JSON.stringify(config.secret || "")};
|
|
395
|
+
const workflows = ${JSON.stringify(workflows.map(toWorkflowMetadata))};
|
|
396
|
+
const workflowIds = new Set(workflows.map((workflow) => workflow.id));
|
|
397
|
+
|
|
398
|
+
function json(value, status = 200) {
|
|
399
|
+
return new Response(JSON.stringify(value), {
|
|
400
|
+
status,
|
|
401
|
+
headers: { "content-type": "application/json" }
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function getHeader(event, name) {
|
|
406
|
+
return event.req.headers.get(name);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
function getSecret() {
|
|
410
|
+
return inlineSecret || process.env[secretEnv] || "";
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
function verifySecret(event) {
|
|
414
|
+
const secret = getSecret();
|
|
415
|
+
if (!secret) return null;
|
|
416
|
+
const authorization = getHeader(event, "authorization") || "";
|
|
417
|
+
const headerSecret = getHeader(event, "x-farm-workflow-secret") || "";
|
|
418
|
+
const querySecret = event.url.searchParams.get("secret") || "";
|
|
419
|
+
const bearer = authorization.startsWith("Bearer ") ? authorization.slice(7) : "";
|
|
420
|
+
if (headerSecret === secret || querySecret === secret || bearer === secret) return null;
|
|
421
|
+
return json({ error: "Unauthorized workflow request." }, 401);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
async function readPayload(event) {
|
|
425
|
+
if (event.req.method === "GET" || event.req.method === "HEAD") {
|
|
426
|
+
const payload = Object.fromEntries(event.url.searchParams.entries());
|
|
427
|
+
delete payload.secret;
|
|
428
|
+
return payload;
|
|
429
|
+
}
|
|
430
|
+
return await event.req.json().catch(() => ({}));
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
export default new H3()
|
|
434
|
+
.get(route, (event) => {
|
|
435
|
+
const unauthorized = verifySecret(event);
|
|
436
|
+
if (unauthorized) return unauthorized;
|
|
437
|
+
return { workflows };
|
|
438
|
+
})
|
|
439
|
+
.all(route + "/:id", async (event) => {
|
|
440
|
+
const id = decodeURIComponent(event.context.params?.id || "");
|
|
441
|
+
if (!workflowIds.has(id)) {
|
|
442
|
+
return json({ error: "Workflow " + id + " was not found." }, 404);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
const unauthorized = verifySecret(event);
|
|
446
|
+
if (unauthorized) return unauthorized;
|
|
447
|
+
|
|
448
|
+
const payload = await readPayload(event);
|
|
449
|
+
const result = await runTask(id, {
|
|
450
|
+
payload,
|
|
451
|
+
context: {
|
|
452
|
+
source: "http",
|
|
453
|
+
request: event.req,
|
|
454
|
+
route,
|
|
455
|
+
url: event.url.href,
|
|
456
|
+
method: event.req.method
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
return {
|
|
460
|
+
id,
|
|
461
|
+
ok: true,
|
|
462
|
+
result: result ?? null
|
|
463
|
+
};
|
|
464
|
+
});
|
|
465
|
+
`.trim();
|
|
466
|
+
}
|
|
467
|
+
__name(createNitroWorkflowHTTPHandler, "createNitroWorkflowHTTPHandler");
|
|
468
|
+
function toWorkflowMetadata(workflow) {
|
|
469
|
+
return {
|
|
470
|
+
id: workflow.id,
|
|
471
|
+
description: workflow.description || null,
|
|
472
|
+
schedule: workflow.schedule,
|
|
473
|
+
timezone: workflow.timezone || null,
|
|
474
|
+
path: workflow.routePath
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
__name(toWorkflowMetadata, "toWorkflowMetadata");
|
|
478
|
+
async function readWorkflowPayload(request) {
|
|
479
|
+
const url = new URL(request.url);
|
|
480
|
+
if (request.method === "GET" || request.method === "HEAD") {
|
|
481
|
+
const payload = Object.fromEntries(url.searchParams.entries());
|
|
482
|
+
delete payload.secret;
|
|
483
|
+
return payload;
|
|
484
|
+
}
|
|
485
|
+
const contentType = request.headers.get("content-type") || "";
|
|
486
|
+
if (contentType.includes("application/json")) {
|
|
487
|
+
return await request.json().catch(() => ({}));
|
|
488
|
+
}
|
|
489
|
+
const text = await request.text().catch(() => "");
|
|
490
|
+
return text ? { text } : {};
|
|
491
|
+
}
|
|
492
|
+
__name(readWorkflowPayload, "readWorkflowPayload");
|
|
493
|
+
function readScheduledTime(payload) {
|
|
494
|
+
return payload && typeof payload === "object" && "scheduledTime" in payload ? payload.scheduledTime : void 0;
|
|
495
|
+
}
|
|
496
|
+
__name(readScheduledTime, "readScheduledTime");
|
|
497
|
+
function verifyWorkflowSecret(request, config) {
|
|
498
|
+
const secret = config.secret || process.env[config.secretEnv] || "";
|
|
499
|
+
if (!secret) return null;
|
|
500
|
+
const url = new URL(request.url);
|
|
501
|
+
const authorization = request.headers.get("authorization") || "";
|
|
502
|
+
const bearer = authorization.startsWith("Bearer ") ? authorization.slice(7) : "";
|
|
503
|
+
const headerSecret = request.headers.get("x-farm-workflow-secret") || "";
|
|
504
|
+
const querySecret = url.searchParams.get("secret") || "";
|
|
505
|
+
if (bearer === secret || headerSecret === secret || querySecret === secret) return null;
|
|
506
|
+
return Response.json({ error: "Unauthorized workflow request." }, { status: 401 });
|
|
507
|
+
}
|
|
508
|
+
__name(verifyWorkflowSecret, "verifyWorkflowSecret");
|
|
509
|
+
function joinRoute(...parts) {
|
|
510
|
+
return `/${parts.map((part) => trimSlashes(part)).filter(Boolean).join("/")}`;
|
|
511
|
+
}
|
|
512
|
+
__name(joinRoute, "joinRoute");
|
|
513
|
+
function trimSlashes(value) {
|
|
514
|
+
return value.replace(/^\/+|\/+$/g, "");
|
|
515
|
+
}
|
|
516
|
+
__name(trimSlashes, "trimSlashes");
|
|
517
|
+
function safeFileName(value) {
|
|
518
|
+
return value.replace(/[^a-zA-Z0-9._-]+/g, "-") || "workflow";
|
|
519
|
+
}
|
|
520
|
+
__name(safeFileName, "safeFileName");
|
|
521
|
+
function relativePath(root, filePath) {
|
|
522
|
+
return filePath.replace(/\\/g, "/").replace(`${root.replace(/\\/g, "/")}/`, "");
|
|
523
|
+
}
|
|
524
|
+
__name(relativePath, "relativePath");
|
|
525
|
+
|
|
526
|
+
export {
|
|
527
|
+
DEFAULT_FARM_WORKFLOW_DIRS,
|
|
528
|
+
DEFAULT_FARM_WORKFLOW_ROUTE,
|
|
529
|
+
DEFAULT_FARM_WORKFLOW_SECRET_ENV,
|
|
530
|
+
defineWorkflow,
|
|
531
|
+
defineTask,
|
|
532
|
+
defineCron,
|
|
533
|
+
resolveWorkflowsConfig,
|
|
534
|
+
discoverFarmWorkflows,
|
|
535
|
+
createFarmWorkflowRequestHandler,
|
|
536
|
+
runFarmWorkflowModule,
|
|
537
|
+
prepareFarmWorkflowsForNitro,
|
|
538
|
+
createFarmWorkflowVercelCrons,
|
|
539
|
+
applyFarmWorkflowVercelCrons
|
|
540
|
+
};
|
|
541
|
+
//# sourceMappingURL=chunk-XIVV5IWN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/workflows.ts"],"sourcesContent":["export type FarmWorkflowSchedule = string | string[];\n\nexport interface FarmWorkflowsUserConfig {\n /** Enable or disable Farm workflow discovery. Enabled by default. */\n enabled?: boolean;\n /** Directory or directories to scan for workflow modules. */\n dir?: string | string[];\n /** Alias for dir. */\n dirs?: string[];\n /** HTTP route used for manual and URL-based cron invocation. */\n route?: string;\n /** Environment variable that stores the optional runner secret. */\n secretEnv?: string;\n /** Inline runner secret. Prefer secretEnv for deployed apps. */\n secret?: string;\n}\n\nexport interface FarmWorkflowsResolvedConfig {\n enabled: boolean;\n dirs: string[];\n route: string;\n secretEnv: string;\n secret?: string;\n}\n\nexport interface FarmWorkflowLogger {\n info: (...args: unknown[]) => void;\n warn: (...args: unknown[]) => void;\n error: (...args: unknown[]) => void;\n}\n\nexport interface FarmWorkflowRunContext<TPayload = unknown> {\n id: string;\n name: string;\n payload: TPayload;\n scheduledTime?: number | string;\n request?: Request;\n event?: unknown;\n env: Record<string, string | undefined>;\n data: Map<string, unknown>;\n log: FarmWorkflowLogger;\n}\n\nexport interface FarmWorkflowDefinition<TPayload = unknown, TResult = unknown> {\n kind?: \"farm-workflow\";\n id?: string;\n description?: string;\n schedule?: FarmWorkflowSchedule;\n timezone?: string;\n run: (ctx: FarmWorkflowRunContext<TPayload>) => TResult | Promise<TResult>;\n}\n\nexport interface FarmCronDefinition<\n TPayload = unknown,\n TResult = unknown,\n> extends FarmWorkflowDefinition<TPayload, TResult> {\n schedule: FarmWorkflowSchedule;\n}\n\nexport interface FarmDiscoveredWorkflow {\n id: string;\n filePath: string;\n description?: string;\n schedule: string[];\n timezone?: string;\n routePath: string;\n}\n\nexport interface PreparedFarmWorkflows {\n workflows: FarmDiscoveredWorkflow[];\n tasks: Record<string, { handler: string; description: string }>;\n scheduledTasks: Record<string, string | string[]>;\n handlerPath?: string;\n manifestPath?: string;\n}\n\nexport interface FarmWorkflowHTTPHandlerOptions {\n workflows: FarmDiscoveredWorkflow[];\n config: FarmWorkflowsResolvedConfig;\n loadModule: (workflow: FarmDiscoveredWorkflow) => Promise<Record<string, any>>;\n}\n\nexport const DEFAULT_FARM_WORKFLOW_DIRS = [\"src/jobs\", \"src/workflows\", \"src/cron\"];\nexport const DEFAULT_FARM_WORKFLOW_ROUTE = \"/api/_farm/workflows\";\nexport const DEFAULT_FARM_WORKFLOW_SECRET_ENV = \"CRON_SECRET\";\n\nexport function defineWorkflow<const TPayload = unknown, TResult = unknown>(\n definition: FarmWorkflowDefinition<TPayload, TResult>,\n): FarmWorkflowDefinition<TPayload, TResult> {\n return {\n ...definition,\n kind: \"farm-workflow\",\n };\n}\n\nexport function defineTask<const TPayload = unknown, TResult = unknown>(\n definition: FarmWorkflowDefinition<TPayload, TResult>,\n): FarmWorkflowDefinition<TPayload, TResult> {\n return defineWorkflow(definition);\n}\n\n/**\n * @deprecated Configure `cron` in `farm.config.ts` and point it at an API route.\n */\nexport function defineCron<const TPayload = unknown, TResult = unknown>(\n definition: FarmCronDefinition<TPayload, TResult>,\n): FarmCronDefinition<TPayload, TResult> {\n return {\n ...definition,\n kind: \"farm-workflow\",\n };\n}\n\nexport function resolveWorkflowsConfig(\n workflows: FarmWorkflowsUserConfig | boolean | undefined,\n): FarmWorkflowsResolvedConfig {\n if (workflows === false) {\n return {\n enabled: false,\n dirs: [...DEFAULT_FARM_WORKFLOW_DIRS],\n route: DEFAULT_FARM_WORKFLOW_ROUTE,\n secretEnv: DEFAULT_FARM_WORKFLOW_SECRET_ENV,\n };\n }\n\n const options = workflows && typeof workflows === \"object\" ? workflows : {};\n const dirs = normalizeWorkflowDirs(options);\n\n return {\n enabled: options.enabled ?? true,\n dirs,\n route: normalizeWorkflowRoute(options.route || DEFAULT_FARM_WORKFLOW_ROUTE),\n secretEnv: options.secretEnv || DEFAULT_FARM_WORKFLOW_SECRET_ENV,\n secret: options.secret,\n };\n}\n\nexport async function discoverFarmWorkflows(\n config: {\n root?: string;\n workflows?: FarmWorkflowsResolvedConfig | FarmWorkflowsUserConfig | boolean;\n },\n options: {\n loadModule?: (filePath: string) => Promise<Record<string, any>>;\n } = {},\n): Promise<FarmDiscoveredWorkflow[]> {\n const workflowConfig = isResolvedWorkflowConfig(config.workflows)\n ? config.workflows\n : resolveWorkflowsConfig(config.workflows);\n if (!workflowConfig.enabled) return [];\n\n const root = config.root || process.cwd();\n const files = await findWorkflowFiles(root, workflowConfig.dirs);\n const workflows: FarmDiscoveredWorkflow[] = [];\n const seenIds = new Map<string, string>();\n\n for (const filePath of files) {\n const module = options.loadModule\n ? await options.loadModule(filePath)\n : await loadWorkflowModule(filePath, root);\n const definition = resolveWorkflowDefinition(module);\n if (!definition) continue;\n\n const id = normalizeWorkflowId(definition.id || workflowIdFromFile(root, filePath));\n const previousPath = seenIds.get(id);\n if (previousPath) {\n throw new Error(\n `Duplicate Farm workflow id \"${id}\" found in ${relativePath(root, previousPath)} and ${relativePath(root, filePath)}.`,\n );\n }\n seenIds.set(id, filePath);\n\n workflows.push({\n id,\n filePath,\n description: definition.description,\n schedule: normalizeSchedule(definition.schedule),\n timezone: definition.timezone,\n routePath: joinRoute(workflowConfig.route, encodeURIComponent(id)),\n });\n }\n\n return workflows;\n}\n\nexport function createFarmWorkflowRequestHandler(options: FarmWorkflowHTTPHandlerOptions) {\n const workflowsById = new Map(options.workflows.map((workflow) => [workflow.id, workflow]));\n\n return async function handleFarmWorkflowRequest(request: Request): Promise<Response | null> {\n const url = new URL(request.url);\n const route = normalizeWorkflowRoute(options.config.route);\n if (url.pathname !== route && !url.pathname.startsWith(`${route}/`)) {\n return null;\n }\n\n if (url.pathname === route) {\n const secretError = verifyWorkflowSecret(request, options.config);\n if (secretError) return secretError;\n\n return Response.json({\n workflows: options.workflows.map(toWorkflowMetadata),\n });\n }\n\n const id = decodeURIComponent(url.pathname.slice(route.length + 1));\n const workflow = workflowsById.get(id);\n if (!workflow) {\n return Response.json({ error: `Workflow \"${id}\" was not found.` }, { status: 404 });\n }\n\n const secretError = verifyWorkflowSecret(request, options.config);\n if (secretError) return secretError;\n\n const payload = await readWorkflowPayload(request);\n const module = await options.loadModule(workflow);\n const result = await runFarmWorkflowModule(module, {\n id: workflow.id,\n name: workflow.id,\n payload,\n request,\n scheduledTime: readScheduledTime(payload),\n });\n\n return Response.json({\n id: workflow.id,\n ok: true,\n result: result ?? null,\n });\n };\n}\n\nexport async function runFarmWorkflowModule(\n module: Record<string, any>,\n context: {\n id: string;\n name?: string;\n payload?: unknown;\n scheduledTime?: number | string;\n request?: Request;\n event?: unknown;\n env?: Record<string, string | undefined>;\n },\n): Promise<unknown> {\n const definition = resolveWorkflowDefinition(module);\n if (!definition) {\n throw new Error(`Farm workflow \"${context.id}\" does not export a workflow definition.`);\n }\n\n return await definition.run({\n id: context.id,\n name: context.name || context.id,\n payload: context.payload,\n scheduledTime: context.scheduledTime,\n request: context.request,\n event: context.event,\n env: context.env || process.env,\n data: new Map<string, unknown>(),\n log: console,\n });\n}\n\nexport async function prepareFarmWorkflowsForNitro(config: {\n root?: string;\n distDir?: string;\n workflows?: FarmWorkflowsResolvedConfig | FarmWorkflowsUserConfig | boolean;\n}): Promise<PreparedFarmWorkflows> {\n const workflowConfig = isResolvedWorkflowConfig(config.workflows)\n ? config.workflows\n : resolveWorkflowsConfig(config.workflows);\n const workflows = await discoverFarmWorkflows({\n root: config.root,\n workflows: workflowConfig,\n });\n\n if (workflows.length === 0) {\n return {\n workflows,\n tasks: {},\n scheduledTasks: {},\n };\n }\n\n const root = config.root || process.cwd();\n const distDir = config.distDir || \".farm\";\n const fs = await import(\"fs/promises\");\n const path = await import(\"path\");\n const generatedDir = path.join(root, distDir, \".nitro\", \"farm-workflows\");\n await fs.mkdir(generatedDir, { recursive: true });\n\n const tasks: PreparedFarmWorkflows[\"tasks\"] = {};\n const scheduledTasks = createScheduledTasks(workflows);\n\n for (const workflow of workflows) {\n const wrapperPath = path.join(generatedDir, `${safeFileName(workflow.id)}.mjs`);\n await fs.writeFile(wrapperPath, createNitroTaskWrapper(workflow), \"utf8\");\n tasks[workflow.id] = {\n handler: wrapperPath,\n description: workflow.description || `Farm workflow ${workflow.id}`,\n };\n }\n\n const handlerPath = path.join(generatedDir, \"http-handler.mjs\");\n await fs.writeFile(\n handlerPath,\n createNitroWorkflowHTTPHandler(workflowConfig, workflows),\n \"utf8\",\n );\n\n const manifestPath = path.join(generatedDir, \"manifest.json\");\n await fs.writeFile(\n manifestPath,\n JSON.stringify(\n {\n route: workflowConfig.route,\n secretEnv: workflowConfig.secretEnv,\n trigger: {\n method: \"GET\",\n authorization: `Bearer $${workflowConfig.secretEnv}`,\n },\n workflows: workflows.map(toWorkflowMetadata),\n },\n null,\n 2,\n ),\n \"utf8\",\n );\n\n return {\n workflows,\n tasks,\n scheduledTasks,\n handlerPath,\n manifestPath,\n };\n}\n\nexport function createFarmWorkflowVercelCrons(\n workflows: FarmDiscoveredWorkflow[],\n): Array<{ path: string; schedule: string }> {\n return workflows.flatMap((workflow) =>\n workflow.schedule.map((schedule) => ({\n path: workflow.routePath,\n schedule,\n })),\n );\n}\n\nexport function applyFarmWorkflowVercelCrons(\n vercelConfig: Record<string, any>,\n workflows: FarmDiscoveredWorkflow[],\n): Record<string, any> {\n const crons = createFarmWorkflowVercelCrons(workflows);\n if (crons.length === 0) return vercelConfig;\n\n const existingCrons = Array.isArray(vercelConfig.crons) ? vercelConfig.crons : [];\n const seen = new Set(existingCrons.map((cron) => `${cron.path}:${cron.schedule}`));\n const nextCrons = [...existingCrons];\n for (const cron of crons) {\n const key = `${cron.path}:${cron.schedule}`;\n if (seen.has(key)) continue;\n seen.add(key);\n nextCrons.push(cron);\n }\n return {\n ...vercelConfig,\n crons: nextCrons,\n };\n}\n\nfunction isResolvedWorkflowConfig(value: unknown): value is FarmWorkflowsResolvedConfig {\n return (\n !!value &&\n typeof value === \"object\" &&\n \"dirs\" in value &&\n Array.isArray((value as FarmWorkflowsResolvedConfig).dirs) &&\n typeof (value as FarmWorkflowsResolvedConfig).route === \"string\"\n );\n}\n\nfunction normalizeWorkflowDirs(options: FarmWorkflowsUserConfig): string[] {\n const rawDirs =\n options.dirs ||\n (Array.isArray(options.dir) ? options.dir : options.dir ? [options.dir] : undefined);\n const dirs = rawDirs && rawDirs.length > 0 ? rawDirs : DEFAULT_FARM_WORKFLOW_DIRS;\n return [...new Set(dirs.map((dir) => trimSlashes(dir)).filter(Boolean))];\n}\n\nfunction normalizeWorkflowRoute(route: string): string {\n const trimmed = route.trim();\n if (!trimmed || trimmed === \"/\") return DEFAULT_FARM_WORKFLOW_ROUTE;\n return `/${trimSlashes(trimmed)}`;\n}\n\nfunction normalizeWorkflowId(id: string): string {\n const normalized = id\n .replace(/\\\\/g, \"/\")\n .replace(/\\.(tsx?|jsx?|mjs|cjs)$/, \"\")\n .replace(/\\/index$/, \"\")\n .replace(/[^a-zA-Z0-9._/-]+/g, \"-\")\n .replace(/^\\/+|\\/+$/g, \"\")\n .replace(/\\/+/g, \"/\");\n return normalized || \"workflow\";\n}\n\nfunction normalizeSchedule(schedule: FarmWorkflowSchedule | undefined): string[] {\n if (!schedule) return [];\n return (Array.isArray(schedule) ? schedule : [schedule])\n .map((value) => value.trim())\n .filter(Boolean);\n}\n\nfunction resolveWorkflowDefinition(\n module: Record<string, any>,\n): FarmWorkflowDefinition | FarmCronDefinition | null {\n const candidates = [module.default, module.workflow, module.cron, module.task, module.job];\n for (const candidate of candidates) {\n if (candidate && typeof candidate === \"object\" && typeof candidate.run === \"function\") {\n return candidate as FarmWorkflowDefinition;\n }\n }\n return null;\n}\n\nasync function findWorkflowFiles(root: string, dirs: string[]): Promise<string[]> {\n const fs = await import(\"fs/promises\");\n const path = await import(\"path\");\n const files: string[] = [];\n\n for (const dir of dirs) {\n const absoluteDir = path.isAbsolute(dir) ? dir : path.join(root, dir);\n if (!(await pathExists(absoluteDir))) continue;\n await walkWorkflowDir(absoluteDir, files);\n }\n\n return files.sort();\n}\n\nasync function walkWorkflowDir(dir: string, files: string[]): Promise<void> {\n const fs = await import(\"fs/promises\");\n const path = await import(\"path\");\n const entries = await fs.readdir(dir, { withFileTypes: true });\n for (const entry of entries) {\n const filePath = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n if (entry.name === \"node_modules\" || entry.name.startsWith(\".\")) continue;\n await walkWorkflowDir(filePath, files);\n continue;\n }\n if (isWorkflowFile(entry.name)) {\n files.push(filePath);\n }\n }\n}\n\nasync function pathExists(filePath: string): Promise<boolean> {\n const fs = await import(\"fs/promises\");\n return fs\n .access(filePath)\n .then(() => true)\n .catch(() => false);\n}\n\nfunction isWorkflowFile(fileName: string): boolean {\n return /\\.(?:ts|tsx|js|jsx|mjs|cjs)$/.test(fileName) && !/\\.d\\.[cm]?ts$/.test(fileName);\n}\n\nasync function loadWorkflowModule(filePath: string, root: string): Promise<Record<string, any>> {\n const fs = await import(\"fs/promises\");\n const path = await import(\"path\");\n const { pathToFileURL } = await import(\"url\");\n const { build } = await import(\"esbuild\");\n const outDir = path.join(root, \".farm\", \".workflow-loader\");\n await fs.mkdir(outDir, { recursive: true });\n const outfile = path.join(\n outDir,\n `workflow-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`,\n );\n\n await build({\n absWorkingDir: root,\n entryPoints: [filePath],\n outfile,\n bundle: true,\n format: \"esm\",\n platform: \"node\",\n target: `node${process.versions.node.split(\".\")[0]}`,\n packages: \"external\",\n external: [\"@farm.js/core\", \"@farm.js/core/*\", \"nitro\", \"nitro/*\"],\n jsx: \"automatic\",\n logLevel: \"silent\",\n sourcemap: \"inline\",\n });\n\n try {\n return await import(/* @vite-ignore */ `${pathToFileURL(outfile).href}?t=${Date.now()}`);\n } finally {\n await fs.unlink(outfile).catch(() => undefined);\n }\n}\n\nfunction workflowIdFromFile(root: string, filePath: string): string {\n const normalizedRoot = root.replace(/\\\\/g, \"/\");\n const normalizedFile = filePath.replace(/\\\\/g, \"/\");\n const relative = normalizedFile.startsWith(`${normalizedRoot}/`)\n ? normalizedFile.slice(normalizedRoot.length + 1)\n : normalizedFile;\n return normalizeWorkflowId(\n relative.replace(/^src\\/(?:jobs|workflows|cron)\\//, \"\").replace(/\\.(tsx?|jsx?|mjs|cjs)$/, \"\"),\n );\n}\n\nfunction createScheduledTasks(\n workflows: FarmDiscoveredWorkflow[],\n): Record<string, string | string[]> {\n const scheduleMap = new Map<string, string[]>();\n for (const workflow of workflows) {\n for (const schedule of workflow.schedule) {\n const taskIds = scheduleMap.get(schedule) || [];\n taskIds.push(workflow.id);\n scheduleMap.set(schedule, taskIds);\n }\n }\n\n return Object.fromEntries(\n [...scheduleMap.entries()].map(([schedule, taskIds]) => [\n schedule,\n taskIds.length === 1 ? taskIds[0] : taskIds,\n ]),\n );\n}\n\nfunction createNitroTaskWrapper(workflow: FarmDiscoveredWorkflow): string {\n const normalizedPath = workflow.filePath.replace(/\\\\/g, \"/\");\n return `\nimport { defineTask } from \"nitro/runtime\";\nimport { runFarmWorkflowModule } from \"@farm.js/core/workflows\";\nimport * as workflowModule from ${JSON.stringify(normalizedPath)};\n\nexport default defineTask({\n meta: {\n description: ${JSON.stringify(workflow.description || `Farm workflow ${workflow.id}`)}\n },\n async run(event) {\n const payload = event?.payload || {};\n const env = event?.context?.cloudflare?.env || event?.context?.env || process.env;\n return await runFarmWorkflowModule(workflowModule, {\n id: ${JSON.stringify(workflow.id)},\n name: event?.name || ${JSON.stringify(workflow.id)},\n payload,\n scheduledTime: payload.scheduledTime,\n request: event?.context?.request,\n event,\n env\n });\n }\n});\n`.trim();\n}\n\nfunction createNitroWorkflowHTTPHandler(\n config: FarmWorkflowsResolvedConfig,\n workflows: FarmDiscoveredWorkflow[],\n): string {\n return `\nimport { H3 } from \"h3\";\nimport { runTask } from \"nitro/runtime\";\n\nconst route = ${JSON.stringify(config.route)};\nconst secretEnv = ${JSON.stringify(config.secretEnv)};\nconst inlineSecret = ${JSON.stringify(config.secret || \"\")};\nconst workflows = ${JSON.stringify(workflows.map(toWorkflowMetadata))};\nconst workflowIds = new Set(workflows.map((workflow) => workflow.id));\n\nfunction json(value, status = 200) {\n return new Response(JSON.stringify(value), {\n status,\n headers: { \"content-type\": \"application/json\" }\n });\n}\n\nfunction getHeader(event, name) {\n return event.req.headers.get(name);\n}\n\nfunction getSecret() {\n return inlineSecret || process.env[secretEnv] || \"\";\n}\n\nfunction verifySecret(event) {\n const secret = getSecret();\n if (!secret) return null;\n const authorization = getHeader(event, \"authorization\") || \"\";\n const headerSecret = getHeader(event, \"x-farm-workflow-secret\") || \"\";\n const querySecret = event.url.searchParams.get(\"secret\") || \"\";\n const bearer = authorization.startsWith(\"Bearer \") ? authorization.slice(7) : \"\";\n if (headerSecret === secret || querySecret === secret || bearer === secret) return null;\n return json({ error: \"Unauthorized workflow request.\" }, 401);\n}\n\nasync function readPayload(event) {\n if (event.req.method === \"GET\" || event.req.method === \"HEAD\") {\n const payload = Object.fromEntries(event.url.searchParams.entries());\n delete payload.secret;\n return payload;\n }\n return await event.req.json().catch(() => ({}));\n}\n\nexport default new H3()\n .get(route, (event) => {\n const unauthorized = verifySecret(event);\n if (unauthorized) return unauthorized;\n return { workflows };\n })\n .all(route + \"/:id\", async (event) => {\n const id = decodeURIComponent(event.context.params?.id || \"\");\n if (!workflowIds.has(id)) {\n return json({ error: \"Workflow \" + id + \" was not found.\" }, 404);\n }\n\n const unauthorized = verifySecret(event);\n if (unauthorized) return unauthorized;\n\n const payload = await readPayload(event);\n const result = await runTask(id, {\n payload,\n context: {\n source: \"http\",\n request: event.req,\n route,\n url: event.url.href,\n method: event.req.method\n }\n });\n return {\n id,\n ok: true,\n result: result ?? null\n };\n });\n`.trim();\n}\n\nfunction toWorkflowMetadata(workflow: FarmDiscoveredWorkflow) {\n return {\n id: workflow.id,\n description: workflow.description || null,\n schedule: workflow.schedule,\n timezone: workflow.timezone || null,\n path: workflow.routePath,\n };\n}\n\nasync function readWorkflowPayload(request: Request): Promise<unknown> {\n const url = new URL(request.url);\n if (request.method === \"GET\" || request.method === \"HEAD\") {\n const payload = Object.fromEntries(url.searchParams.entries());\n delete payload.secret;\n return payload;\n }\n\n const contentType = request.headers.get(\"content-type\") || \"\";\n if (contentType.includes(\"application/json\")) {\n return await request.json().catch(() => ({}));\n }\n\n const text = await request.text().catch(() => \"\");\n return text ? { text } : {};\n}\n\nfunction readScheduledTime(payload: unknown): number | string | undefined {\n return payload && typeof payload === \"object\" && \"scheduledTime\" in payload\n ? (payload as { scheduledTime?: number | string }).scheduledTime\n : undefined;\n}\n\nfunction verifyWorkflowSecret(\n request: Request,\n config: FarmWorkflowsResolvedConfig,\n): Response | null {\n const secret = config.secret || process.env[config.secretEnv] || \"\";\n if (!secret) return null;\n\n const url = new URL(request.url);\n const authorization = request.headers.get(\"authorization\") || \"\";\n const bearer = authorization.startsWith(\"Bearer \") ? authorization.slice(7) : \"\";\n const headerSecret = request.headers.get(\"x-farm-workflow-secret\") || \"\";\n const querySecret = url.searchParams.get(\"secret\") || \"\";\n if (bearer === secret || headerSecret === secret || querySecret === secret) return null;\n\n return Response.json({ error: \"Unauthorized workflow request.\" }, { status: 401 });\n}\n\nfunction joinRoute(...parts: string[]): string {\n return `/${parts\n .map((part) => trimSlashes(part))\n .filter(Boolean)\n .join(\"/\")}`;\n}\n\nfunction trimSlashes(value: string): string {\n return value.replace(/^\\/+|\\/+$/g, \"\");\n}\n\nfunction safeFileName(value: string): string {\n return value.replace(/[^a-zA-Z0-9._-]+/g, \"-\") || \"workflow\";\n}\n\nfunction relativePath(root: string, filePath: string): string {\n return filePath.replace(/\\\\/g, \"/\").replace(`${root.replace(/\\\\/g, \"/\")}/`, \"\");\n}\n"],"mappings":";;;;;AAkFO,IAAM,6BAA6B,CAAC,YAAY,iBAAiB,UAAU;AAC3E,IAAM,8BAA8B;AACpC,IAAM,mCAAmC;AAEzC,SAAS,eACd,YAC2C;AAC3C,SAAO;AAAA,IACL,GAAG;AAAA,IACH,MAAM;AAAA,EACR;AACF;AAPgB;AAST,SAAS,WACd,YAC2C;AAC3C,SAAO,eAAe,UAAU;AAClC;AAJgB;AAST,SAAS,WACd,YACuC;AACvC,SAAO;AAAA,IACL,GAAG;AAAA,IACH,MAAM;AAAA,EACR;AACF;AAPgB;AAST,SAAS,uBACd,WAC6B;AAC7B,MAAI,cAAc,OAAO;AACvB,WAAO;AAAA,MACL,SAAS;AAAA,MACT,MAAM,CAAC,GAAG,0BAA0B;AAAA,MACpC,OAAO;AAAA,MACP,WAAW;AAAA,IACb;AAAA,EACF;AAEA,QAAM,UAAU,aA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