@farm.js/core 0.1.0-beta.96 → 0.1.0-beta.97
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 +1 -1
- package/dist/after.mjs +1 -1
- package/dist/agent-runtime.d.mts +3 -2
- package/dist/agent-runtime.d.ts +3 -2
- package/dist/api/route-manager.cjs +43 -4
- package/dist/api/route-manager.d.mts +4 -3
- package/dist/api/route-manager.d.ts +4 -3
- package/dist/api/route-manager.mjs +6 -6
- package/dist/api/runtime.cjs +43 -4
- package/dist/api/runtime.d.mts +1 -1
- package/dist/api/runtime.d.ts +1 -1
- package/dist/api/runtime.mjs +4 -4
- package/dist/api.cjs +239 -70
- package/dist/api.d.mts +7 -6
- package/dist/api.d.ts +7 -6
- package/dist/api.mjs +17 -11
- package/dist/{app-CIIEvA4r.d.ts → app-CIOx3LvY.d.ts} +4 -4
- package/dist/{app-O4AEC1OH.d.mts → app-DBd6437H.d.mts} +4 -4
- package/dist/app-markdown.d.mts +4 -3
- package/dist/app-markdown.d.ts +4 -3
- package/dist/cache.cjs +42 -4
- package/dist/cache.d.mts +68 -1
- package/dist/cache.d.ts +68 -1
- package/dist/cache.mjs +3 -3
- package/dist/{chunk-AXVJCMVF.mjs → chunk-2HDOV47R.mjs} +3 -3
- package/dist/chunk-2HDOV47R.mjs.map +1 -0
- package/dist/{chunk-RBRLLZL5.mjs → chunk-34IAPZBG.mjs} +16 -3
- package/dist/chunk-34IAPZBG.mjs.map +1 -0
- package/dist/{chunk-VV24CC42.mjs → chunk-35NPLKQJ.mjs} +2 -2
- package/dist/{chunk-MM46HTX6.mjs → chunk-3TWQERDE.mjs} +4 -3
- package/dist/chunk-3TWQERDE.mjs.map +1 -0
- package/dist/{chunk-RWYRFCLG.mjs → chunk-4X57GXQA.mjs} +2 -2
- package/dist/{chunk-3I55IGXU.mjs → chunk-52BR7LTX.mjs} +14 -15
- package/dist/chunk-52BR7LTX.mjs.map +1 -0
- package/dist/{chunk-RAGSHKDC.mjs → chunk-6EJHNHH4.mjs} +38 -3
- package/dist/chunk-6EJHNHH4.mjs.map +1 -0
- package/dist/{chunk-ZFNK77WN.mjs → chunk-6JNGOC37.mjs} +2 -2
- package/dist/{after.cjs.map → chunk-6JNGOC37.mjs.map} +1 -1
- package/dist/{chunk-MOW47IF5.mjs → chunk-6UYVU46O.mjs} +2 -2
- package/dist/{chunk-7MABZJIM.mjs → chunk-7PYVLJ4J.mjs} +1 -1
- package/dist/chunk-7PYVLJ4J.mjs.map +1 -0
- package/dist/{chunk-54XSGLKT.mjs → chunk-D7F7YZ7L.mjs} +93 -67
- package/dist/chunk-D7F7YZ7L.mjs.map +1 -0
- package/dist/{chunk-SCFX4UTD.mjs → chunk-EHTUKVSW.mjs} +1 -1
- package/dist/chunk-EHTUKVSW.mjs.map +1 -0
- package/dist/{chunk-LZTGDH3H.mjs → chunk-EPDIF432.mjs} +424 -10
- package/dist/chunk-EPDIF432.mjs.map +1 -0
- package/dist/{chunk-GZHKWHCH.mjs → chunk-FP5Q67FO.mjs} +167 -96
- package/dist/chunk-FP5Q67FO.mjs.map +1 -0
- package/dist/{chunk-HHZAOTQD.mjs → chunk-GJ7W6LNK.mjs} +7 -6
- package/dist/chunk-GJ7W6LNK.mjs.map +1 -0
- package/dist/{chunk-RLGUZ3HS.mjs → chunk-I3OOUWO5.mjs} +3 -3
- package/dist/{chunk-LKKMI7JG.mjs → chunk-IZBX2TEU.mjs} +153 -68
- package/dist/chunk-IZBX2TEU.mjs.map +1 -0
- package/dist/{chunk-74QPONAN.mjs → chunk-J3MPQ4MQ.mjs} +2 -2
- package/dist/{chunk-74QPONAN.mjs.map → chunk-J3MPQ4MQ.mjs.map} +1 -1
- package/dist/{chunk-ODJGAWDH.mjs → chunk-JV7JUD7Q.mjs} +4 -4
- package/dist/{chunk-Q3OX763A.mjs → chunk-LXDASSTE.mjs} +2 -2
- package/dist/{chunk-ZRBCBOEX.mjs → chunk-N2FY2QZ7.mjs} +28 -3
- package/dist/chunk-N2FY2QZ7.mjs.map +1 -0
- package/dist/{chunk-MRVJCLYQ.mjs → chunk-PSQ7N4XP.mjs} +4 -2
- package/dist/chunk-PSQ7N4XP.mjs.map +1 -0
- package/dist/{chunk-HVG3HLQZ.mjs → chunk-Q7WGOOAI.mjs} +3 -3
- package/dist/{chunk-WTYAPO5I.mjs → chunk-RCNWMEBT.mjs} +3 -2
- package/dist/{chunk-WTYAPO5I.mjs.map → chunk-RCNWMEBT.mjs.map} +1 -1
- package/dist/{chunk-3INDBMUU.mjs → chunk-TGDIACZT.mjs} +2 -2
- package/dist/{chunk-WB75GIX2.mjs → chunk-TQTB33JS.mjs} +14 -3
- package/dist/chunk-TQTB33JS.mjs.map +1 -0
- package/dist/{chunk-WMAYETRD.mjs → chunk-TT3E2JOF.mjs} +3 -3
- package/dist/{chunk-FVAM43KI.mjs → chunk-UMUWR5XA.mjs} +2 -2
- package/dist/{chunk-VOUJW4FL.mjs → chunk-WD2EBM3I.mjs} +70 -15
- package/dist/chunk-WD2EBM3I.mjs.map +1 -0
- package/dist/{chunk-ZPG6SNHH.mjs → chunk-WMJGA32P.mjs} +47 -5
- package/dist/chunk-WMJGA32P.mjs.map +1 -0
- package/dist/{chunk-TKQCJMY7.mjs → chunk-X4SFHKFH.mjs} +7 -4
- package/dist/{chunk-TKQCJMY7.mjs.map → chunk-X4SFHKFH.mjs.map} +1 -1
- package/dist/{chunk-Q7GPJZCO.mjs → chunk-YIBV77KZ.mjs} +26 -7
- package/dist/chunk-YIBV77KZ.mjs.map +1 -0
- package/dist/client/lifecycle.mjs +2 -2
- package/dist/{client-mcMC334J.d.mts → client-DWoLZ3QU.d.mts} +52 -5
- package/dist/{client-d5ONQ-Pd.d.ts → client-DuQuQC1h.d.ts} +52 -5
- package/dist/client-cache-BMxuFqwH.d.ts +18 -0
- package/dist/client-cache-CCK-fCe0.d.mts +18 -0
- package/dist/{client-plugins-BvClItiL.d.mts → client-plugins-B6-07YmP.d.mts} +52 -99
- package/dist/{client-plugins-B9Sq-iMg.d.ts → client-plugins-By6MVUX-.d.ts} +52 -99
- package/dist/client-plugins.cjs +1 -1
- package/dist/client-plugins.d.mts +3 -2
- package/dist/client-plugins.d.ts +3 -2
- package/dist/client-plugins.mjs +2 -2
- package/dist/client.cjs +757 -104
- package/dist/client.d.mts +124 -16
- package/dist/client.d.ts +124 -16
- package/dist/client.mjs +28 -14
- package/dist/config.d.mts +3 -2
- package/dist/config.d.ts +3 -2
- package/dist/{devtools-S52RRRMN.mjs → devtools-XWZX6CCL.mjs} +5 -5
- package/dist/{devtools-client-EOVDBPOI.mjs → devtools-client-Z7QQA3Q2.mjs} +2 -2
- package/dist/{devtools-ui-NJKFORTG.mjs → devtools-ui-2HG5M4EL.mjs} +3 -1
- package/dist/devtools-ui-2HG5M4EL.mjs.map +1 -0
- package/dist/docs.cjs +24 -5
- package/dist/docs.mjs +5 -5
- package/dist/i18n/server.cjs +13 -2
- package/dist/i18n/server.d.mts +2 -2
- package/dist/i18n/server.d.ts +2 -2
- package/dist/i18n/server.mjs +1 -1
- package/dist/index.cjs +1578 -772
- package/dist/index.d.mts +28 -20
- package/dist/index.d.ts +28 -20
- package/dist/index.mjs +53 -33
- package/dist/index.mjs.map +1 -1
- package/dist/integration-api-BT024nuJ.d.mts +97 -0
- package/dist/integration-api-BT024nuJ.d.ts +97 -0
- package/dist/integrations.d.mts +3 -2
- package/dist/integrations.d.ts +3 -2
- package/dist/internal/build-runtime.cjs +710 -532
- package/dist/internal/build-runtime.d.mts +5 -4
- package/dist/internal/build-runtime.d.ts +5 -4
- package/dist/internal/build-runtime.mjs +15 -15
- package/dist/internal/client-runtime.cjs +1 -1
- package/dist/internal/client-runtime.mjs +2 -2
- package/dist/internal/config-runtime.cjs +4 -1
- package/dist/internal/config-runtime.d.mts +4 -3
- package/dist/internal/config-runtime.d.ts +4 -3
- package/dist/internal/config-runtime.mjs +4 -4
- package/dist/internal/product-telemetry-runtime.cjs +1 -1
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +29 -3
- package/dist/internal/production-runtime.d.mts +8 -7
- package/dist/internal/production-runtime.d.ts +8 -7
- package/dist/internal/production-runtime.mjs +5 -5
- package/dist/{metadata-route-yV4U6X8h.d.ts → metadata-route-8_V3UonT.d.ts} +1 -1
- package/dist/{metadata-route-p4K1l92V.d.mts → metadata-route-CWP_HjGU.d.mts} +1 -1
- package/dist/middleware.cjs +28 -2
- package/dist/middleware.d.mts +5 -4
- package/dist/middleware.d.ts +5 -4
- package/dist/middleware.mjs +4 -4
- package/dist/navigation.cjs +3 -1
- package/dist/navigation.mjs +3 -3
- package/dist/observability.cjs +27 -2
- package/dist/observability.mjs +1 -1
- package/dist/plugin.cjs +474 -334
- package/dist/plugin.d.mts +3 -2
- package/dist/plugin.d.ts +3 -2
- package/dist/plugin.mjs +12 -12
- package/dist/{production-runtime-IkB0Qj4i.d.mts → production-runtime-BGRH1dKG.d.mts} +1 -1
- package/dist/{production-runtime-0JTch4_d.d.ts → production-runtime-CdmzsDax.d.ts} +1 -1
- package/dist/query/client.cjs +11 -3
- package/dist/query/client.mjs +12 -4
- package/dist/query/client.mjs.map +1 -1
- package/dist/{render-plan-Dc8CjNI7.d.ts → render-plan-0GeHiGVZ.d.ts} +1 -1
- package/dist/{render-plan-CU31j-Jk.d.mts → render-plan-DLxJYAA5.d.mts} +1 -1
- package/dist/renderer-client.cjs +140 -26
- package/dist/renderer-client.d.mts +7 -6
- package/dist/renderer-client.d.ts +7 -6
- package/dist/renderer-client.mjs +16 -19
- package/dist/renderer-client.mjs.map +1 -1
- package/dist/{request-BXa1KY8i.d.mts → request-BCNXSXLh.d.mts} +1 -1
- package/dist/{request-CUUBujZt.d.ts → request-BstWbZ6O.d.ts} +1 -1
- package/dist/request.d.mts +4 -3
- package/dist/request.d.ts +4 -3
- package/dist/{route-Y8lfz1wF.d.ts → route-4pd-EVtw.d.ts} +45 -50
- package/dist/{route-Cq3aObmj.d.mts → route-CvEr4Uc9.d.mts} +45 -50
- package/dist/routes.cjs +27 -2
- package/dist/routes.d.mts +3 -2
- package/dist/routes.d.ts +3 -2
- package/dist/routes.mjs +4 -4
- package/dist/{runtime-j1S3sDTh.d.ts → runtime-BgDQzBiu.d.ts} +1 -0
- package/dist/{runtime-DDwvDtS4.d.mts → runtime-CV2UCV-5.d.mts} +1 -0
- package/dist/server-action-security.mjs +2 -2
- package/dist/server-fn-client.cjs +34 -2
- package/dist/server-fn-client.d.mts +6 -0
- package/dist/server-fn-client.d.ts +6 -0
- package/dist/server-fn-client.mjs +1 -1
- package/dist/server-fn.cjs +42 -4
- package/dist/server-fn.mjs +5 -5
- package/dist/server-plugins.d.mts +4 -3
- package/dist/server-plugins.d.ts +4 -3
- package/dist/server-query-client.cjs +146 -27
- package/dist/server-query-client.d.mts +3 -3
- package/dist/server-query-client.d.ts +3 -3
- package/dist/server-query-client.mjs +7 -7
- package/dist/{server-query-runtime-3zAj77yv.d.ts → server-query-runtime-DXRNhX_3.d.ts} +2 -0
- package/dist/{server-query-runtime-B50KAcj5.d.mts → server-query-runtime-aP52iuL5.d.mts} +2 -0
- package/dist/server-query.cjs +44 -5
- package/dist/server-query.d.mts +4 -0
- package/dist/server-query.d.ts +4 -0
- package/dist/server-query.mjs +7 -7
- package/dist/server.cjs +499 -355
- package/dist/server.d.mts +11 -10
- package/dist/server.d.ts +11 -10
- package/dist/server.mjs +16 -16
- package/dist/{spa-router-CyLkwst6.d.mts → spa-router-BeyAVSc6.d.mts} +1 -1
- package/dist/{spa-router-BkqGXaV_.d.ts → spa-router-COgu4txb.d.ts} +1 -1
- package/dist/testing.cjs +27 -2
- package/dist/testing.d.mts +3 -2
- package/dist/testing.d.ts +3 -2
- package/dist/testing.mjs +8 -8
- package/dist/{utils-NKR6SoNv.d.mts → utils-DL2VwDQl.d.mts} +1 -1
- package/dist/{utils-B2OHrb9F.d.ts → utils-DkU2c_1B.d.ts} +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +482 -338
- package/dist/vite.d.mts +3 -2
- package/dist/vite.d.ts +3 -2
- package/dist/vite.mjs +16 -12
- package/package.json +17 -17
- package/types/client.d.ts +87 -1
- package/dist/agent-runtime.cjs.map +0 -1
- package/dist/api/route-manager.cjs.map +0 -1
- package/dist/api/runtime.cjs.map +0 -1
- package/dist/api.cjs.map +0 -1
- package/dist/app-markdown.cjs.map +0 -1
- package/dist/cache.cjs.map +0 -1
- package/dist/chunk-3I55IGXU.mjs.map +0 -1
- package/dist/chunk-54XSGLKT.mjs.map +0 -1
- package/dist/chunk-7MABZJIM.mjs.map +0 -1
- package/dist/chunk-AXVJCMVF.mjs.map +0 -1
- package/dist/chunk-GZHKWHCH.mjs.map +0 -1
- package/dist/chunk-HHZAOTQD.mjs.map +0 -1
- package/dist/chunk-LKKMI7JG.mjs.map +0 -1
- package/dist/chunk-LZTGDH3H.mjs.map +0 -1
- package/dist/chunk-MM46HTX6.mjs.map +0 -1
- package/dist/chunk-MRVJCLYQ.mjs.map +0 -1
- package/dist/chunk-Q7GPJZCO.mjs.map +0 -1
- package/dist/chunk-RAGSHKDC.mjs.map +0 -1
- package/dist/chunk-RBRLLZL5.mjs.map +0 -1
- package/dist/chunk-SCFX4UTD.mjs.map +0 -1
- package/dist/chunk-VOUJW4FL.mjs.map +0 -1
- package/dist/chunk-WB75GIX2.mjs.map +0 -1
- package/dist/chunk-ZFNK77WN.mjs.map +0 -1
- package/dist/chunk-ZPG6SNHH.mjs.map +0 -1
- package/dist/chunk-ZRBCBOEX.mjs.map +0 -1
- package/dist/client/lifecycle.cjs.map +0 -1
- package/dist/client-cache-CopR_MaI.d.mts +0 -6
- package/dist/client-cache-Djy_TlE8.d.ts +0 -6
- package/dist/client-plugins.cjs.map +0 -1
- package/dist/client.cjs.map +0 -1
- package/dist/config.cjs.map +0 -1
- package/dist/cron.cjs.map +0 -1
- package/dist/deferred.cjs.map +0 -1
- package/dist/deployment.cjs.map +0 -1
- package/dist/devtools-ui-NJKFORTG.mjs.map +0 -1
- package/dist/docs.cjs.map +0 -1
- package/dist/env-types.cjs.map +0 -1
- package/dist/env.cjs.map +0 -1
- package/dist/environment/vite.cjs.map +0 -1
- package/dist/environment.cjs.map +0 -1
- package/dist/font.cjs.map +0 -1
- package/dist/headers.cjs.map +0 -1
- package/dist/i18n/client.cjs.map +0 -1
- package/dist/i18n/index.cjs.map +0 -1
- package/dist/i18n/server.cjs.map +0 -1
- package/dist/image/server.cjs.map +0 -1
- package/dist/image/sharp.cjs.map +0 -1
- package/dist/image.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/instrumentation.cjs.map +0 -1
- package/dist/integrations.cjs.map +0 -1
- package/dist/internal/build-runtime.cjs.map +0 -1
- package/dist/internal/client-runtime.cjs.map +0 -1
- package/dist/internal/config-runtime.cjs.map +0 -1
- package/dist/internal/isolated-boundary.cjs.map +0 -1
- package/dist/internal/metadata-image-runtime.cjs.map +0 -1
- package/dist/internal/product-telemetry-runtime.cjs.map +0 -1
- package/dist/internal/production-node-env.cjs.map +0 -1
- package/dist/internal/production-runtime.cjs.map +0 -1
- package/dist/markdown.cjs.map +0 -1
- package/dist/middleware.cjs.map +0 -1
- package/dist/navigation.cjs.map +0 -1
- package/dist/observability.cjs.map +0 -1
- package/dist/plugin.cjs.map +0 -1
- package/dist/query/client.cjs.map +0 -1
- package/dist/query/index.cjs.map +0 -1
- package/dist/query/parsers.cjs.map +0 -1
- package/dist/query/server.cjs.map +0 -1
- package/dist/renderer/react/client.cjs.map +0 -1
- package/dist/renderer/react/server.cjs.map +0 -1
- package/dist/renderer/react/vite.cjs.map +0 -1
- package/dist/renderer-client.cjs.map +0 -1
- package/dist/renderer.cjs.map +0 -1
- package/dist/request.cjs.map +0 -1
- package/dist/router.cjs.map +0 -1
- package/dist/routes.cjs.map +0 -1
- package/dist/server-action-security.cjs.map +0 -1
- package/dist/server-fn-client.cjs.map +0 -1
- package/dist/server-fn.cjs.map +0 -1
- package/dist/server-plugins.cjs.map +0 -1
- package/dist/server-query-client.cjs.map +0 -1
- package/dist/server-query.cjs.map +0 -1
- package/dist/server.cjs.map +0 -1
- package/dist/storage.cjs.map +0 -1
- package/dist/testing.cjs.map +0 -1
- package/dist/theme/client.cjs.map +0 -1
- package/dist/theme/index.cjs.map +0 -1
- package/dist/theme/runtime.cjs.map +0 -1
- package/dist/theme/server.cjs.map +0 -1
- package/dist/version.cjs.map +0 -1
- package/dist/vite.cjs.map +0 -1
- package/dist/workflows.cjs.map +0 -1
- /package/dist/{chunk-VV24CC42.mjs.map → chunk-35NPLKQJ.mjs.map} +0 -0
- /package/dist/{chunk-RWYRFCLG.mjs.map → chunk-4X57GXQA.mjs.map} +0 -0
- /package/dist/{chunk-MOW47IF5.mjs.map → chunk-6UYVU46O.mjs.map} +0 -0
- /package/dist/{chunk-RLGUZ3HS.mjs.map → chunk-I3OOUWO5.mjs.map} +0 -0
- /package/dist/{chunk-ODJGAWDH.mjs.map → chunk-JV7JUD7Q.mjs.map} +0 -0
- /package/dist/{chunk-Q3OX763A.mjs.map → chunk-LXDASSTE.mjs.map} +0 -0
- /package/dist/{chunk-HVG3HLQZ.mjs.map → chunk-Q7WGOOAI.mjs.map} +0 -0
- /package/dist/{chunk-3INDBMUU.mjs.map → chunk-TGDIACZT.mjs.map} +0 -0
- /package/dist/{chunk-WMAYETRD.mjs.map → chunk-TT3E2JOF.mjs.map} +0 -0
- /package/dist/{chunk-FVAM43KI.mjs.map → chunk-UMUWR5XA.mjs.map} +0 -0
- /package/dist/{devtools-S52RRRMN.mjs.map → devtools-XWZX6CCL.mjs.map} +0 -0
- /package/dist/{devtools-client-EOVDBPOI.mjs.map → devtools-client-Z7QQA3Q2.mjs.map} +0 -0
|
@@ -48,27 +48,56 @@ declare function isJSONStreamResponse(response: {
|
|
|
48
48
|
declare function readJSONStream<TItem>(response: Response): FarmAPIStream<TItem>;
|
|
49
49
|
declare function isFarmAPIStream(value: unknown): value is FarmAPIStream<unknown>;
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
_input?:
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
/** Server-only schema contract shared by declarative routes and the API runtime. */
|
|
52
|
+
interface RouteSchema {
|
|
53
|
+
readonly _input?: unknown;
|
|
54
|
+
readonly _output?: unknown;
|
|
55
|
+
parse?: (value: unknown) => unknown;
|
|
56
|
+
parseAsync?: (value: unknown) => Promise<unknown>;
|
|
57
|
+
readonly "~standard"?: {
|
|
58
|
+
readonly types?: {
|
|
59
|
+
input: unknown;
|
|
60
|
+
output: unknown;
|
|
61
|
+
};
|
|
62
|
+
validate(value: unknown): unknown;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
type RouteSchemaInput<T> = T extends {
|
|
66
|
+
_input: infer I;
|
|
67
|
+
} ? I : T extends {
|
|
68
|
+
"~standard": {
|
|
69
|
+
types?: {
|
|
70
|
+
input: infer I;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
} ? I : unknown;
|
|
74
|
+
type RouteSchemaOutput<T> = T extends {
|
|
75
|
+
_output: infer O;
|
|
76
|
+
} ? O : T extends {
|
|
77
|
+
"~standard": {
|
|
78
|
+
types?: {
|
|
79
|
+
output: infer O;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
} ? O : T extends {
|
|
83
|
+
parse: (...args: any[]) => infer O;
|
|
84
|
+
} ? Awaited<O> : unknown;
|
|
85
|
+
|
|
86
|
+
type AnySchema = RouteSchema;
|
|
56
87
|
type MaybePromise<T> = T | Promise<T>;
|
|
57
88
|
type Simplify<T> = {
|
|
58
89
|
[TKey in keyof T]: T[TKey];
|
|
59
90
|
} & {};
|
|
60
91
|
type UnionToIntersection$1<T> = (T extends unknown ? (value: T) => void : never) extends (value: infer TIntersection) => void ? TIntersection : never;
|
|
61
|
-
type InferOutput<T> = T
|
|
62
|
-
_output: infer O;
|
|
63
|
-
} ? O : T extends {
|
|
64
|
-
parse: (data: unknown) => infer R;
|
|
65
|
-
} ? R : unknown;
|
|
92
|
+
type InferOutput<T> = RouteSchemaOutput<T>;
|
|
66
93
|
type InferInput<T> = T extends {
|
|
67
94
|
_input: infer I;
|
|
68
95
|
} ? I : T extends {
|
|
96
|
+
"~standard": unknown;
|
|
97
|
+
} ? RouteSchemaInput<T> : T extends {
|
|
69
98
|
parse: (data: infer I) => unknown;
|
|
70
99
|
} ? I : unknown;
|
|
71
|
-
type InferBodyInput<T> = T extends MultipartSchema<AnySchema> ? TypedFormData<
|
|
100
|
+
type InferBodyInput<T> = T extends MultipartSchema<AnySchema> ? TypedFormData<InferInput<T>> : InferInput<T>;
|
|
72
101
|
type InferHeadersOutput<T> = [T] extends [never] ? Record<string, string> : T extends AnySchema ? InferOutput<T> : Record<string, string>;
|
|
73
102
|
type EndpointErrorSchema = AnySchema & {
|
|
74
103
|
parse: (data: unknown) => unknown;
|
|
@@ -165,11 +194,12 @@ type EndpointHandler<TBody extends AnySchema = never, TQuery extends AnySchema =
|
|
|
165
194
|
/** @deprecated Use `error`. */
|
|
166
195
|
fail: EndpointFail<TErrors>;
|
|
167
196
|
}) => Promise<TResponse> | TResponse;
|
|
168
|
-
type TypedEndpoint<TBody = never, TQuery = never, TResponse = any, THeaders = Record<string, string>, TErrors = never, TBodyInput = TBody> = {
|
|
197
|
+
type TypedEndpoint<TBody = never, TQuery = never, TResponse = any, THeaders = Record<string, string>, TErrors = never, TBodyInput = TBody, TQueryInput = TQuery> = {
|
|
169
198
|
__types: {
|
|
170
199
|
body: TBody;
|
|
171
200
|
inputBody: TBodyInput;
|
|
172
201
|
query: TQuery;
|
|
202
|
+
inputQuery: TQueryInput;
|
|
173
203
|
headers: THeaders;
|
|
174
204
|
response: TResponse;
|
|
175
205
|
errors: TErrors;
|
|
@@ -177,10 +207,10 @@ type TypedEndpoint<TBody = never, TQuery = never, TResponse = any, THeaders = Re
|
|
|
177
207
|
__path?: string;
|
|
178
208
|
__method?: string;
|
|
179
209
|
} & ((options?: {
|
|
180
|
-
body?:
|
|
181
|
-
query?:
|
|
210
|
+
body?: TBodyInput;
|
|
211
|
+
query?: TQueryInput;
|
|
182
212
|
}) => Promise<TResponse>);
|
|
183
|
-
type CreatedEndpoint<TBody extends AnySchema, TQuery extends AnySchema, THeaders extends AnySchema, TResponse, TErrors extends EndpointErrorDefinitions = {}> = TypedEndpoint<InferOutput<TBody>, InferOutput<TQuery>, Awaited<TResponse>, InferHeadersOutput<THeaders>, EndpointErrorContracts<TErrors>, InferBodyInput<TBody>>;
|
|
213
|
+
type CreatedEndpoint<TBody extends AnySchema, TQuery extends AnySchema, THeaders extends AnySchema, TResponse, TErrors extends EndpointErrorDefinitions = {}> = TypedEndpoint<InferOutput<TBody>, InferOutput<TQuery>, Awaited<TResponse>, InferHeadersOutput<THeaders>, EndpointErrorContracts<TErrors>, InferBodyInput<TBody>, InferInput<TQuery>>;
|
|
184
214
|
type AnyEndpointOptions = EndpointOptions<AnySchema, AnySchema, AnySchema, readonly AnyEndpointMiddleware[], EndpointErrorDefinitions>;
|
|
185
215
|
type EndpointBodyFromOptions<TOptions> = TOptions extends {
|
|
186
216
|
body: infer TBody extends AnySchema;
|
|
@@ -265,41 +295,6 @@ declare function OPTIONS<T = any>(handler: EndpointHandler<never, never, never,
|
|
|
265
295
|
declare function OPTIONS<const TOptions extends MethodlessEndpointOptions, TResponse = any>(options: TOptions, handler: ValidatedEndpointHandlerFromOptions<TOptions, TResponse>): CreatedEndpointFromOptions<TOptions, TResponse>;
|
|
266
296
|
declare function OPTIONS<TBody extends AnySchema = never, TQuery extends AnySchema = never, THeaders extends AnySchema = never, TResponse = any>(options: Omit<EndpointOptions<TBody, TQuery, THeaders, readonly []>, "method">, handler: EndpointHandler<TBody, TQuery, THeaders, TResponse>): CreatedEndpoint<TBody, TQuery, THeaders, TResponse>;
|
|
267
297
|
|
|
268
|
-
/** Server-only schema contract shared by declarative routes and the API runtime. */
|
|
269
|
-
interface RouteSchema {
|
|
270
|
-
readonly _input?: unknown;
|
|
271
|
-
readonly _output?: unknown;
|
|
272
|
-
parse?: (value: unknown) => unknown;
|
|
273
|
-
parseAsync?: (value: unknown) => Promise<unknown>;
|
|
274
|
-
readonly "~standard"?: {
|
|
275
|
-
readonly types?: {
|
|
276
|
-
input: unknown;
|
|
277
|
-
output: unknown;
|
|
278
|
-
};
|
|
279
|
-
validate(value: unknown): unknown;
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
type RouteSchemaInput<T> = T extends {
|
|
283
|
-
_input: infer I;
|
|
284
|
-
} ? I : T extends {
|
|
285
|
-
"~standard": {
|
|
286
|
-
types?: {
|
|
287
|
-
input: infer I;
|
|
288
|
-
};
|
|
289
|
-
};
|
|
290
|
-
} ? I : unknown;
|
|
291
|
-
type RouteSchemaOutput<T> = T extends {
|
|
292
|
-
_output: infer O;
|
|
293
|
-
} ? O : T extends {
|
|
294
|
-
"~standard": {
|
|
295
|
-
types?: {
|
|
296
|
-
output: infer O;
|
|
297
|
-
};
|
|
298
|
-
};
|
|
299
|
-
} ? O : T extends {
|
|
300
|
-
parse: (...args: any[]) => infer O;
|
|
301
|
-
} ? Awaited<O> : unknown;
|
|
302
|
-
|
|
303
298
|
type RouteMethod = "GET" | "HEAD" | "QUERY" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS";
|
|
304
299
|
type RoutePathParams<Path extends string> = Path extends `${infer Head}/${infer Tail}` ? RoutePathParams<Head> & RoutePathParams<Tail> : Path extends `[[...${infer Name}]]` ? {
|
|
305
300
|
[K in Name]?: string[];
|
|
@@ -48,27 +48,56 @@ declare function isJSONStreamResponse(response: {
|
|
|
48
48
|
declare function readJSONStream<TItem>(response: Response): FarmAPIStream<TItem>;
|
|
49
49
|
declare function isFarmAPIStream(value: unknown): value is FarmAPIStream<unknown>;
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
_input?:
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
/** Server-only schema contract shared by declarative routes and the API runtime. */
|
|
52
|
+
interface RouteSchema {
|
|
53
|
+
readonly _input?: unknown;
|
|
54
|
+
readonly _output?: unknown;
|
|
55
|
+
parse?: (value: unknown) => unknown;
|
|
56
|
+
parseAsync?: (value: unknown) => Promise<unknown>;
|
|
57
|
+
readonly "~standard"?: {
|
|
58
|
+
readonly types?: {
|
|
59
|
+
input: unknown;
|
|
60
|
+
output: unknown;
|
|
61
|
+
};
|
|
62
|
+
validate(value: unknown): unknown;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
type RouteSchemaInput<T> = T extends {
|
|
66
|
+
_input: infer I;
|
|
67
|
+
} ? I : T extends {
|
|
68
|
+
"~standard": {
|
|
69
|
+
types?: {
|
|
70
|
+
input: infer I;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
} ? I : unknown;
|
|
74
|
+
type RouteSchemaOutput<T> = T extends {
|
|
75
|
+
_output: infer O;
|
|
76
|
+
} ? O : T extends {
|
|
77
|
+
"~standard": {
|
|
78
|
+
types?: {
|
|
79
|
+
output: infer O;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
} ? O : T extends {
|
|
83
|
+
parse: (...args: any[]) => infer O;
|
|
84
|
+
} ? Awaited<O> : unknown;
|
|
85
|
+
|
|
86
|
+
type AnySchema = RouteSchema;
|
|
56
87
|
type MaybePromise<T> = T | Promise<T>;
|
|
57
88
|
type Simplify<T> = {
|
|
58
89
|
[TKey in keyof T]: T[TKey];
|
|
59
90
|
} & {};
|
|
60
91
|
type UnionToIntersection$1<T> = (T extends unknown ? (value: T) => void : never) extends (value: infer TIntersection) => void ? TIntersection : never;
|
|
61
|
-
type InferOutput<T> = T
|
|
62
|
-
_output: infer O;
|
|
63
|
-
} ? O : T extends {
|
|
64
|
-
parse: (data: unknown) => infer R;
|
|
65
|
-
} ? R : unknown;
|
|
92
|
+
type InferOutput<T> = RouteSchemaOutput<T>;
|
|
66
93
|
type InferInput<T> = T extends {
|
|
67
94
|
_input: infer I;
|
|
68
95
|
} ? I : T extends {
|
|
96
|
+
"~standard": unknown;
|
|
97
|
+
} ? RouteSchemaInput<T> : T extends {
|
|
69
98
|
parse: (data: infer I) => unknown;
|
|
70
99
|
} ? I : unknown;
|
|
71
|
-
type InferBodyInput<T> = T extends MultipartSchema<AnySchema> ? TypedFormData<
|
|
100
|
+
type InferBodyInput<T> = T extends MultipartSchema<AnySchema> ? TypedFormData<InferInput<T>> : InferInput<T>;
|
|
72
101
|
type InferHeadersOutput<T> = [T] extends [never] ? Record<string, string> : T extends AnySchema ? InferOutput<T> : Record<string, string>;
|
|
73
102
|
type EndpointErrorSchema = AnySchema & {
|
|
74
103
|
parse: (data: unknown) => unknown;
|
|
@@ -165,11 +194,12 @@ type EndpointHandler<TBody extends AnySchema = never, TQuery extends AnySchema =
|
|
|
165
194
|
/** @deprecated Use `error`. */
|
|
166
195
|
fail: EndpointFail<TErrors>;
|
|
167
196
|
}) => Promise<TResponse> | TResponse;
|
|
168
|
-
type TypedEndpoint<TBody = never, TQuery = never, TResponse = any, THeaders = Record<string, string>, TErrors = never, TBodyInput = TBody> = {
|
|
197
|
+
type TypedEndpoint<TBody = never, TQuery = never, TResponse = any, THeaders = Record<string, string>, TErrors = never, TBodyInput = TBody, TQueryInput = TQuery> = {
|
|
169
198
|
__types: {
|
|
170
199
|
body: TBody;
|
|
171
200
|
inputBody: TBodyInput;
|
|
172
201
|
query: TQuery;
|
|
202
|
+
inputQuery: TQueryInput;
|
|
173
203
|
headers: THeaders;
|
|
174
204
|
response: TResponse;
|
|
175
205
|
errors: TErrors;
|
|
@@ -177,10 +207,10 @@ type TypedEndpoint<TBody = never, TQuery = never, TResponse = any, THeaders = Re
|
|
|
177
207
|
__path?: string;
|
|
178
208
|
__method?: string;
|
|
179
209
|
} & ((options?: {
|
|
180
|
-
body?:
|
|
181
|
-
query?:
|
|
210
|
+
body?: TBodyInput;
|
|
211
|
+
query?: TQueryInput;
|
|
182
212
|
}) => Promise<TResponse>);
|
|
183
|
-
type CreatedEndpoint<TBody extends AnySchema, TQuery extends AnySchema, THeaders extends AnySchema, TResponse, TErrors extends EndpointErrorDefinitions = {}> = TypedEndpoint<InferOutput<TBody>, InferOutput<TQuery>, Awaited<TResponse>, InferHeadersOutput<THeaders>, EndpointErrorContracts<TErrors>, InferBodyInput<TBody>>;
|
|
213
|
+
type CreatedEndpoint<TBody extends AnySchema, TQuery extends AnySchema, THeaders extends AnySchema, TResponse, TErrors extends EndpointErrorDefinitions = {}> = TypedEndpoint<InferOutput<TBody>, InferOutput<TQuery>, Awaited<TResponse>, InferHeadersOutput<THeaders>, EndpointErrorContracts<TErrors>, InferBodyInput<TBody>, InferInput<TQuery>>;
|
|
184
214
|
type AnyEndpointOptions = EndpointOptions<AnySchema, AnySchema, AnySchema, readonly AnyEndpointMiddleware[], EndpointErrorDefinitions>;
|
|
185
215
|
type EndpointBodyFromOptions<TOptions> = TOptions extends {
|
|
186
216
|
body: infer TBody extends AnySchema;
|
|
@@ -265,41 +295,6 @@ declare function OPTIONS<T = any>(handler: EndpointHandler<never, never, never,
|
|
|
265
295
|
declare function OPTIONS<const TOptions extends MethodlessEndpointOptions, TResponse = any>(options: TOptions, handler: ValidatedEndpointHandlerFromOptions<TOptions, TResponse>): CreatedEndpointFromOptions<TOptions, TResponse>;
|
|
266
296
|
declare function OPTIONS<TBody extends AnySchema = never, TQuery extends AnySchema = never, THeaders extends AnySchema = never, TResponse = any>(options: Omit<EndpointOptions<TBody, TQuery, THeaders, readonly []>, "method">, handler: EndpointHandler<TBody, TQuery, THeaders, TResponse>): CreatedEndpoint<TBody, TQuery, THeaders, TResponse>;
|
|
267
297
|
|
|
268
|
-
/** Server-only schema contract shared by declarative routes and the API runtime. */
|
|
269
|
-
interface RouteSchema {
|
|
270
|
-
readonly _input?: unknown;
|
|
271
|
-
readonly _output?: unknown;
|
|
272
|
-
parse?: (value: unknown) => unknown;
|
|
273
|
-
parseAsync?: (value: unknown) => Promise<unknown>;
|
|
274
|
-
readonly "~standard"?: {
|
|
275
|
-
readonly types?: {
|
|
276
|
-
input: unknown;
|
|
277
|
-
output: unknown;
|
|
278
|
-
};
|
|
279
|
-
validate(value: unknown): unknown;
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
type RouteSchemaInput<T> = T extends {
|
|
283
|
-
_input: infer I;
|
|
284
|
-
} ? I : T extends {
|
|
285
|
-
"~standard": {
|
|
286
|
-
types?: {
|
|
287
|
-
input: infer I;
|
|
288
|
-
};
|
|
289
|
-
};
|
|
290
|
-
} ? I : unknown;
|
|
291
|
-
type RouteSchemaOutput<T> = T extends {
|
|
292
|
-
_output: infer O;
|
|
293
|
-
} ? O : T extends {
|
|
294
|
-
"~standard": {
|
|
295
|
-
types?: {
|
|
296
|
-
output: infer O;
|
|
297
|
-
};
|
|
298
|
-
};
|
|
299
|
-
} ? O : T extends {
|
|
300
|
-
parse: (...args: any[]) => infer O;
|
|
301
|
-
} ? Awaited<O> : unknown;
|
|
302
|
-
|
|
303
298
|
type RouteMethod = "GET" | "HEAD" | "QUERY" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS";
|
|
304
299
|
type RoutePathParams<Path extends string> = Path extends `${infer Head}/${infer Tail}` ? RoutePathParams<Head> & RoutePathParams<Tail> : Path extends `[[...${infer Name}]]` ? {
|
|
305
300
|
[K in Name]?: string[];
|
package/dist/routes.cjs
CHANGED
|
@@ -113,7 +113,13 @@ function recordFarmEventTrace(event) {
|
|
|
113
113
|
activeSpan.addEvent(event.type, toEventAttributes(event), event.timestamp);
|
|
114
114
|
}
|
|
115
115
|
const error = event.type === "request.error" ? void 0 : getEventError(event);
|
|
116
|
-
if (error !== void 0)
|
|
116
|
+
if (error !== void 0) {
|
|
117
|
+
if (event.type === "render.error") {
|
|
118
|
+
recordSpanException(activeSpan, error);
|
|
119
|
+
} else {
|
|
120
|
+
recordSpanError(activeSpan, error);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
117
123
|
}
|
|
118
124
|
const completedTraceContext = recordCompletedEventSpan(event, activeContext);
|
|
119
125
|
return traceContext ?? completedTraceContext;
|
|
@@ -210,12 +216,26 @@ function getCompletedSpanDescriptor(event) {
|
|
|
210
216
|
}
|
|
211
217
|
}
|
|
212
218
|
__name(getCompletedSpanDescriptor, "getCompletedSpanDescriptor");
|
|
219
|
+
function hashFarmCacheKey(value) {
|
|
220
|
+
let hash = 2166136261;
|
|
221
|
+
for (let index = 0; index < value.length; index++) {
|
|
222
|
+
hash ^= value.charCodeAt(index);
|
|
223
|
+
hash = Math.imul(hash, 16777619);
|
|
224
|
+
}
|
|
225
|
+
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
226
|
+
}
|
|
227
|
+
__name(hashFarmCacheKey, "hashFarmCacheKey");
|
|
213
228
|
function toEventAttributes(event) {
|
|
214
229
|
const attributes = {};
|
|
230
|
+
const redactKey = typeof event.type === "string" && event.type.startsWith("cache.");
|
|
215
231
|
for (const [key, value] of Object.entries(event)) {
|
|
216
232
|
if (key === "timestamp" || key === "level" || key === "error" || key === "traceId" || key === "spanId" || key === "traceSampled" || value === void 0) {
|
|
217
233
|
continue;
|
|
218
234
|
}
|
|
235
|
+
if (redactKey && key === "key" && typeof value === "string") {
|
|
236
|
+
attributes["farm.key_hash"] = hashFarmCacheKey(value);
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
219
239
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
220
240
|
attributes[`farm.${key}`] = value;
|
|
221
241
|
} else if (Array.isArray(value)) {
|
|
@@ -235,9 +255,14 @@ function getEventError(event) {
|
|
|
235
255
|
return "error" in event ? event.error : void 0;
|
|
236
256
|
}
|
|
237
257
|
__name(getEventError, "getEventError");
|
|
238
|
-
function
|
|
258
|
+
function recordSpanException(span, error) {
|
|
239
259
|
const normalized = error instanceof Error ? error : new Error(String(error));
|
|
240
260
|
span.recordException(normalized);
|
|
261
|
+
return normalized;
|
|
262
|
+
}
|
|
263
|
+
__name(recordSpanException, "recordSpanException");
|
|
264
|
+
function recordSpanError(span, error) {
|
|
265
|
+
const normalized = recordSpanException(span, error);
|
|
241
266
|
span.setStatus({ code: import_api.SpanStatusCode.ERROR, message: normalized.message });
|
|
242
267
|
}
|
|
243
268
|
__name(recordSpanError, "recordSpanError");
|
package/dist/routes.d.mts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { F as FarmRouteRuntimeConfig, L as LayoutProps, M as Metadata, b as FarmRouteRuntime, c as FarmRouteRegions, d as FarmRouteMaxDuration, e as FarmAppContext, f as PageProps, g as PluginContextProps, h as RouteModule, P as ParsedRoute } from './client-plugins-
|
|
1
|
+
import { F as FarmRouteRuntimeConfig, L as LayoutProps, M as Metadata, b as FarmRouteRuntime, c as FarmRouteRegions, d as FarmRouteMaxDuration, e as FarmAppContext, f as PageProps, g as PluginContextProps, h as RouteModule, P as ParsedRoute } from './client-plugins-B6-07YmP.mjs';
|
|
2
2
|
import { ComponentType } from 'react';
|
|
3
3
|
import { RouteDataCacheKey } from './cache.mjs';
|
|
4
4
|
import { ServerFn } from './server-fn.mjs';
|
|
5
5
|
import { FarmServerRendererRuntime } from './renderer.mjs';
|
|
6
6
|
import './lifecycle-De0vQG45.mjs';
|
|
7
|
-
import './route-
|
|
7
|
+
import './route-CvEr4Uc9.mjs';
|
|
8
8
|
import 'http';
|
|
9
9
|
import './types-Cc8l9IqS.mjs';
|
|
10
10
|
import 'db0';
|
|
11
11
|
import 'unstorage';
|
|
12
|
+
import './integration-api-BT024nuJ.mjs';
|
|
12
13
|
import '@farming-labs/orm';
|
|
13
14
|
import './types-CKwggz9n.mjs';
|
|
14
15
|
import '@farming-labs/docs';
|
package/dist/routes.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { F as FarmRouteRuntimeConfig, L as LayoutProps, M as Metadata, b as FarmRouteRuntime, c as FarmRouteRegions, d as FarmRouteMaxDuration, e as FarmAppContext, f as PageProps, g as PluginContextProps, h as RouteModule, P as ParsedRoute } from './client-plugins-
|
|
1
|
+
import { F as FarmRouteRuntimeConfig, L as LayoutProps, M as Metadata, b as FarmRouteRuntime, c as FarmRouteRegions, d as FarmRouteMaxDuration, e as FarmAppContext, f as PageProps, g as PluginContextProps, h as RouteModule, P as ParsedRoute } from './client-plugins-By6MVUX-.js';
|
|
2
2
|
import { ComponentType } from 'react';
|
|
3
3
|
import { RouteDataCacheKey } from './cache.js';
|
|
4
4
|
import { ServerFn } from './server-fn.js';
|
|
5
5
|
import { FarmServerRendererRuntime } from './renderer.js';
|
|
6
6
|
import './lifecycle-De0vQG45.js';
|
|
7
|
-
import './route-
|
|
7
|
+
import './route-4pd-EVtw.js';
|
|
8
8
|
import 'http';
|
|
9
9
|
import './types-Cc8l9IqS.js';
|
|
10
10
|
import 'db0';
|
|
11
11
|
import 'unstorage';
|
|
12
|
+
import './integration-api-BT024nuJ.js';
|
|
12
13
|
import '@farming-labs/orm';
|
|
13
14
|
import './types-CKwggz9n.js';
|
|
14
15
|
import '@farming-labs/docs';
|
package/dist/routes.mjs
CHANGED
|
@@ -19,14 +19,14 @@ import {
|
|
|
19
19
|
redirect,
|
|
20
20
|
routesBuilder,
|
|
21
21
|
scanProgrammaticPagePaths
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-LXDASSTE.mjs";
|
|
23
23
|
import "./chunk-QKVUNGAH.mjs";
|
|
24
24
|
import "./chunk-XNWHZQ6A.mjs";
|
|
25
25
|
import "./chunk-SXWF4QRU.mjs";
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-2HDOV47R.mjs";
|
|
27
|
+
import "./chunk-34IAPZBG.mjs";
|
|
28
28
|
import "./chunk-WZ5QFROO.mjs";
|
|
29
|
-
import "./chunk-
|
|
29
|
+
import "./chunk-N2FY2QZ7.mjs";
|
|
30
30
|
import "./chunk-DZU3EKQP.mjs";
|
|
31
31
|
import "./chunk-CGILA3WO.mjs";
|
|
32
32
|
export {
|
|
@@ -20,6 +20,7 @@ declare class FarmI18nRuntime {
|
|
|
20
20
|
hasMessage(locale: string, key: string): boolean;
|
|
21
21
|
getClientSnapshot(resolution: FarmLocaleResolution): FarmI18nClientSnapshot;
|
|
22
22
|
private formatMessage;
|
|
23
|
+
private readOwnMessage;
|
|
23
24
|
private resolveMessage;
|
|
24
25
|
}
|
|
25
26
|
declare function createFarmI18nRuntime(config: ResolvedFarmI18nConfig, catalogs?: FarmI18nCatalogs): FarmI18nRuntime;
|
|
@@ -20,6 +20,7 @@ declare class FarmI18nRuntime {
|
|
|
20
20
|
hasMessage(locale: string, key: string): boolean;
|
|
21
21
|
getClientSnapshot(resolution: FarmLocaleResolution): FarmI18nClientSnapshot;
|
|
22
22
|
private formatMessage;
|
|
23
|
+
private readOwnMessage;
|
|
23
24
|
private resolveMessage;
|
|
24
25
|
}
|
|
25
26
|
declare function createFarmI18nRuntime(config: ResolvedFarmI18nConfig, catalogs?: FarmI18nCatalogs): FarmI18nRuntime;
|
|
@@ -10,9 +10,9 @@ import {
|
|
|
10
10
|
runWithServerActionRequest,
|
|
11
11
|
sanitizeServerActionError,
|
|
12
12
|
validateServerActionRequest
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-35NPLKQJ.mjs";
|
|
14
14
|
import "./chunk-ZHQMHJAV.mjs";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-34IAPZBG.mjs";
|
|
16
16
|
import "./chunk-DZU3EKQP.mjs";
|
|
17
17
|
import "./chunk-CGILA3WO.mjs";
|
|
18
18
|
export {
|
|
@@ -55,6 +55,26 @@ function notifyClientObserver(observer, args, label = "Client lifecycle") {
|
|
|
55
55
|
}
|
|
56
56
|
__name(notifyClientObserver, "notifyClientObserver");
|
|
57
57
|
|
|
58
|
+
// src/mutation-retry.ts
|
|
59
|
+
async function invokeMutationWithRetry(invoke, retry, shouldContinue) {
|
|
60
|
+
const maxRetries = Math.max(0, retry?.count ?? 0);
|
|
61
|
+
let attempt = 0;
|
|
62
|
+
while (true) {
|
|
63
|
+
try {
|
|
64
|
+
return await invoke();
|
|
65
|
+
} catch (error) {
|
|
66
|
+
if (attempt >= maxRetries || !shouldContinue()) throw error;
|
|
67
|
+
attempt += 1;
|
|
68
|
+
const delay = typeof retry?.delay === "function" ? retry.delay(attempt) : retry?.delay ?? 0;
|
|
69
|
+
if (delay > 0) {
|
|
70
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
71
|
+
if (!shouldContinue()) throw error;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
__name(invokeMutationWithRetry, "invokeMutationWithRetry");
|
|
77
|
+
|
|
58
78
|
// src/server-fn-client.ts
|
|
59
79
|
function useServerFn(serverFn, options = {}) {
|
|
60
80
|
const { initialResult = null, resetOnSubmit = true } = options;
|
|
@@ -106,7 +126,12 @@ function useServerFn(serverFn, options = {}) {
|
|
|
106
126
|
};
|
|
107
127
|
});
|
|
108
128
|
try {
|
|
109
|
-
const result = await
|
|
129
|
+
const result = await invokeMutationWithRetry(
|
|
130
|
+
() => serverFn(input),
|
|
131
|
+
options.retry,
|
|
132
|
+
// A reset disowns this submission; stop scheduling retries then.
|
|
133
|
+
() => requestId >= lastResetIdRef.current
|
|
134
|
+
);
|
|
110
135
|
const isLatestRequest = requestId === requestIdRef.current;
|
|
111
136
|
setActionState((current) => {
|
|
112
137
|
if (requestId < lastResetIdRef.current) return current;
|
|
@@ -163,7 +188,14 @@ function useServerFn(serverFn, options = {}) {
|
|
|
163
188
|
throw error;
|
|
164
189
|
}
|
|
165
190
|
},
|
|
166
|
-
[
|
|
191
|
+
[
|
|
192
|
+
options.optimistic,
|
|
193
|
+
options.retry,
|
|
194
|
+
options.rollbackOnError,
|
|
195
|
+
resetOnSubmit,
|
|
196
|
+
serverFn,
|
|
197
|
+
setActionState
|
|
198
|
+
]
|
|
167
199
|
);
|
|
168
200
|
const formAction = (0, import_react.useCallback)(
|
|
169
201
|
async (formData) => {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { FormHTMLAttributes, ComponentType } from 'react';
|
|
2
2
|
import { ServerFn } from './server-fn.mjs';
|
|
3
|
+
import { R as RetryOptions } from './client-DWoLZ3QU.mjs';
|
|
3
4
|
import './cache.mjs';
|
|
4
5
|
import './server-fn-error-DDh14a0V.mjs';
|
|
6
|
+
import './integration-api-BT024nuJ.mjs';
|
|
7
|
+
import './client-cache-CCK-fCe0.mjs';
|
|
8
|
+
import './route-CvEr4Uc9.mjs';
|
|
5
9
|
|
|
6
10
|
type ServerFnActionStatus = "idle" | "pending" | "success" | "error";
|
|
7
11
|
type ServerFnSubmit<TInput, TResult> = [unknown] extends [TInput] ? (input?: TInput | FormData) => Promise<TResult> : (input: TInput | FormData) => Promise<TResult>;
|
|
@@ -16,6 +20,8 @@ type UseServerFnOptions<TResult, TError extends Error = Error, TInput = unknown>
|
|
|
16
20
|
throwOnFormError?: boolean;
|
|
17
21
|
optimistic?: (context: ServerFnOptimisticContext<TInput, TResult>) => TResult | null | undefined;
|
|
18
22
|
rollbackOnError?: boolean;
|
|
23
|
+
/** Retry failed submissions with the API client's retry shape. Defaults to no retries. */
|
|
24
|
+
retry?: RetryOptions;
|
|
19
25
|
onSuccess?: (result: TResult) => void;
|
|
20
26
|
onError?: (error: TError) => void;
|
|
21
27
|
onSettled?: (result: TResult | null, error: TError | null) => void;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { FormHTMLAttributes, ComponentType } from 'react';
|
|
2
2
|
import { ServerFn } from './server-fn.js';
|
|
3
|
+
import { R as RetryOptions } from './client-DuQuQC1h.js';
|
|
3
4
|
import './cache.js';
|
|
4
5
|
import './server-fn-error-DDh14a0V.js';
|
|
6
|
+
import './integration-api-BT024nuJ.js';
|
|
7
|
+
import './client-cache-BMxuFqwH.js';
|
|
8
|
+
import './route-4pd-EVtw.js';
|
|
5
9
|
|
|
6
10
|
type ServerFnActionStatus = "idle" | "pending" | "success" | "error";
|
|
7
11
|
type ServerFnSubmit<TInput, TResult> = [unknown] extends [TInput] ? (input?: TInput | FormData) => Promise<TResult> : (input: TInput | FormData) => Promise<TResult>;
|
|
@@ -16,6 +20,8 @@ type UseServerFnOptions<TResult, TError extends Error = Error, TInput = unknown>
|
|
|
16
20
|
throwOnFormError?: boolean;
|
|
17
21
|
optimistic?: (context: ServerFnOptimisticContext<TInput, TResult>) => TResult | null | undefined;
|
|
18
22
|
rollbackOnError?: boolean;
|
|
23
|
+
/** Retry failed submissions with the API client's retry shape. Defaults to no retries. */
|
|
24
|
+
retry?: RetryOptions;
|
|
19
25
|
onSuccess?: (result: TResult) => void;
|
|
20
26
|
onError?: (error: TError) => void;
|
|
21
27
|
onSettled?: (result: TResult | null, error: TError | null) => void;
|
package/dist/server-fn.cjs
CHANGED
|
@@ -46,16 +46,29 @@ function getFarmCacheInvalidationState() {
|
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
__name(getFarmCacheInvalidationState, "getFarmCacheInvalidationState");
|
|
49
|
+
function warnFarmCacheListenerError(scope, error) {
|
|
50
|
+
const detail = error instanceof Error ? error.stack ?? error.message : String(error);
|
|
51
|
+
console.warn(`[farm:cache] ${scope} listener failed: ${detail}`);
|
|
52
|
+
}
|
|
53
|
+
__name(warnFarmCacheListenerError, "warnFarmCacheListenerError");
|
|
49
54
|
function notifyFarmCacheInvalidation(key) {
|
|
50
55
|
if (typeof key !== "string" || key.length === 0) return;
|
|
51
56
|
for (const listener of getFarmCacheInvalidationState().listeners) {
|
|
52
|
-
|
|
57
|
+
try {
|
|
58
|
+
listener(key);
|
|
59
|
+
} catch (error) {
|
|
60
|
+
warnFarmCacheListenerError("invalidation", error);
|
|
61
|
+
}
|
|
53
62
|
}
|
|
54
63
|
}
|
|
55
64
|
__name(notifyFarmCacheInvalidation, "notifyFarmCacheInvalidation");
|
|
56
65
|
function notifyFarmCacheTask(task) {
|
|
57
66
|
for (const listener of getFarmCacheInvalidationState().taskListeners) {
|
|
58
|
-
|
|
67
|
+
try {
|
|
68
|
+
listener(task);
|
|
69
|
+
} catch (error) {
|
|
70
|
+
warnFarmCacheListenerError("task", error);
|
|
71
|
+
}
|
|
59
72
|
}
|
|
60
73
|
}
|
|
61
74
|
__name(notifyFarmCacheTask, "notifyFarmCacheTask");
|
|
@@ -235,7 +248,13 @@ function recordFarmEventTrace(event) {
|
|
|
235
248
|
activeSpan.addEvent(event.type, toEventAttributes(event), event.timestamp);
|
|
236
249
|
}
|
|
237
250
|
const error = event.type === "request.error" ? void 0 : getEventError(event);
|
|
238
|
-
if (error !== void 0)
|
|
251
|
+
if (error !== void 0) {
|
|
252
|
+
if (event.type === "render.error") {
|
|
253
|
+
recordSpanException(activeSpan, error);
|
|
254
|
+
} else {
|
|
255
|
+
recordSpanError(activeSpan, error);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
239
258
|
}
|
|
240
259
|
const completedTraceContext = recordCompletedEventSpan(event, activeContext);
|
|
241
260
|
return traceContext ?? completedTraceContext;
|
|
@@ -332,12 +351,26 @@ function getCompletedSpanDescriptor(event) {
|
|
|
332
351
|
}
|
|
333
352
|
}
|
|
334
353
|
__name(getCompletedSpanDescriptor, "getCompletedSpanDescriptor");
|
|
354
|
+
function hashFarmCacheKey(value) {
|
|
355
|
+
let hash = 2166136261;
|
|
356
|
+
for (let index = 0; index < value.length; index++) {
|
|
357
|
+
hash ^= value.charCodeAt(index);
|
|
358
|
+
hash = Math.imul(hash, 16777619);
|
|
359
|
+
}
|
|
360
|
+
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
361
|
+
}
|
|
362
|
+
__name(hashFarmCacheKey, "hashFarmCacheKey");
|
|
335
363
|
function toEventAttributes(event) {
|
|
336
364
|
const attributes = {};
|
|
365
|
+
const redactKey = typeof event.type === "string" && event.type.startsWith("cache.");
|
|
337
366
|
for (const [key, value] of Object.entries(event)) {
|
|
338
367
|
if (key === "timestamp" || key === "level" || key === "error" || key === "traceId" || key === "spanId" || key === "traceSampled" || value === void 0) {
|
|
339
368
|
continue;
|
|
340
369
|
}
|
|
370
|
+
if (redactKey && key === "key" && typeof value === "string") {
|
|
371
|
+
attributes["farm.key_hash"] = hashFarmCacheKey(value);
|
|
372
|
+
continue;
|
|
373
|
+
}
|
|
341
374
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
342
375
|
attributes[`farm.${key}`] = value;
|
|
343
376
|
} else if (Array.isArray(value)) {
|
|
@@ -357,9 +390,14 @@ function getEventError(event) {
|
|
|
357
390
|
return "error" in event ? event.error : void 0;
|
|
358
391
|
}
|
|
359
392
|
__name(getEventError, "getEventError");
|
|
360
|
-
function
|
|
393
|
+
function recordSpanException(span, error) {
|
|
361
394
|
const normalized = error instanceof Error ? error : new Error(String(error));
|
|
362
395
|
span.recordException(normalized);
|
|
396
|
+
return normalized;
|
|
397
|
+
}
|
|
398
|
+
__name(recordSpanException, "recordSpanException");
|
|
399
|
+
function recordSpanError(span, error) {
|
|
400
|
+
const normalized = recordSpanException(span, error);
|
|
363
401
|
span.setStatus({ code: import_api.SpanStatusCode.ERROR, message: normalized.message });
|
|
364
402
|
}
|
|
365
403
|
__name(recordSpanError, "recordSpanError");
|
package/dist/server-fn.mjs
CHANGED
|
@@ -3,19 +3,19 @@ import {
|
|
|
3
3
|
_parseServerFnSchema,
|
|
4
4
|
createServerFn,
|
|
5
5
|
createServerMiddleware
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-I3OOUWO5.mjs";
|
|
7
7
|
import {
|
|
8
8
|
FARM_SERVER_FN_FAILURE_SYMBOL,
|
|
9
9
|
ServerActionError,
|
|
10
10
|
ServerFnFailure,
|
|
11
11
|
createServerFnTransportError,
|
|
12
12
|
isServerFnFailure
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-35NPLKQJ.mjs";
|
|
14
14
|
import "./chunk-ZHQMHJAV.mjs";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-2HDOV47R.mjs";
|
|
16
|
+
import "./chunk-34IAPZBG.mjs";
|
|
17
17
|
import "./chunk-WZ5QFROO.mjs";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-N2FY2QZ7.mjs";
|
|
19
19
|
import "./chunk-LM2YNO4U.mjs";
|
|
20
20
|
import "./chunk-DZU3EKQP.mjs";
|
|
21
21
|
import "./chunk-CGILA3WO.mjs";
|