theokit 0.36.0 → 0.36.1

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.
Files changed (48) hide show
  1. package/dist/{actions-virtual-module-BCN7IEQC.js → actions-virtual-module-3KSP3WPJ.js} +3 -3
  2. package/dist/{actions-virtual-module-AX6UMYF5.js → actions-virtual-module-SYGQE6JQ.js} +2 -2
  3. package/dist/{agent-4FJK6PRR.js → agent-DX5LHD6X.js} +2 -2
  4. package/dist/{app-typed-client-U3OCOWYT.js → app-typed-client-ESMMLPYK.js} +2 -2
  5. package/dist/{app-typed-client-LM2PNOCL.js → app-typed-client-N4TRX5FI.js} +3 -3
  6. package/dist/{build-YQ3AWJV2.js → build-3C2KQPME.js} +2 -2
  7. package/dist/{chunk-WR4F4EEZ.js → chunk-3KD2O6DC.js} +54 -2
  8. package/dist/chunk-3KD2O6DC.js.map +1 -0
  9. package/dist/{chunk-F46GSPV7.js → chunk-DISADTFZ.js} +2 -2
  10. package/dist/{chunk-5VRQVXHH.js → chunk-MNQC5XEJ.js} +7 -41
  11. package/dist/{chunk-5VRQVXHH.js.map → chunk-MNQC5XEJ.js.map} +1 -1
  12. package/dist/{chunk-KXA37ONC.js → chunk-RPMKF6BC.js} +2 -2
  13. package/dist/{chunk-S7L6H3KP.js → chunk-RVJAM77M.js} +2 -38
  14. package/dist/{chunk-S7L6H3KP.js.map → chunk-RVJAM77M.js.map} +1 -1
  15. package/dist/{chunk-OOS5LB5Y.js → chunk-T4TCLEFB.js} +8 -8
  16. package/dist/{chunk-4MTCKE5I.js → chunk-UDG6JPVP.js} +2 -2
  17. package/dist/{chunk-TGTNRUH3.js → chunk-WL4AX5FI.js} +54 -2
  18. package/dist/chunk-WL4AX5FI.js.map +1 -0
  19. package/dist/cli/index.js +5 -5
  20. package/dist/{dev-PESPUGQU.js → dev-CNPT7COE.js} +5 -5
  21. package/dist/index.js +3 -3
  22. package/dist/{internal-api-CS3AG7MT.js → internal-api-4IXBITVV.js} +2 -2
  23. package/dist/{internal-api-CCRY3HN4.js → internal-api-5JKDYRGM.js} +3 -3
  24. package/dist/{mcp-FMZSFEEQ.js → mcp-INKDONQS.js} +2 -2
  25. package/dist/server/http/index.js +1 -1
  26. package/dist/server/index.js +2 -2
  27. package/dist/{start-CHMKI2KH.js → start-LNJZNKF6.js} +4 -4
  28. package/dist/vite-plugin/index.js +3 -3
  29. package/dist/{vite-plugin-T3EXDNQQ.js → vite-plugin-NC5ETNMV.js} +5 -5
  30. package/package.json +2 -2
  31. package/dist/chunk-TGTNRUH3.js.map +0 -1
  32. package/dist/chunk-WR4F4EEZ.js.map +0 -1
  33. /package/dist/{actions-virtual-module-BCN7IEQC.js.map → actions-virtual-module-3KSP3WPJ.js.map} +0 -0
  34. /package/dist/{actions-virtual-module-AX6UMYF5.js.map → actions-virtual-module-SYGQE6JQ.js.map} +0 -0
  35. /package/dist/{agent-4FJK6PRR.js.map → agent-DX5LHD6X.js.map} +0 -0
  36. /package/dist/{app-typed-client-U3OCOWYT.js.map → app-typed-client-ESMMLPYK.js.map} +0 -0
  37. /package/dist/{app-typed-client-LM2PNOCL.js.map → app-typed-client-N4TRX5FI.js.map} +0 -0
  38. /package/dist/{build-YQ3AWJV2.js.map → build-3C2KQPME.js.map} +0 -0
  39. /package/dist/{chunk-F46GSPV7.js.map → chunk-DISADTFZ.js.map} +0 -0
  40. /package/dist/{chunk-KXA37ONC.js.map → chunk-RPMKF6BC.js.map} +0 -0
  41. /package/dist/{chunk-OOS5LB5Y.js.map → chunk-T4TCLEFB.js.map} +0 -0
  42. /package/dist/{chunk-4MTCKE5I.js.map → chunk-UDG6JPVP.js.map} +0 -0
  43. /package/dist/{dev-PESPUGQU.js.map → dev-CNPT7COE.js.map} +0 -0
  44. /package/dist/{internal-api-CCRY3HN4.js.map → internal-api-4IXBITVV.js.map} +0 -0
  45. /package/dist/{internal-api-CS3AG7MT.js.map → internal-api-5JKDYRGM.js.map} +0 -0
  46. /package/dist/{mcp-FMZSFEEQ.js.map → mcp-INKDONQS.js.map} +0 -0
  47. /package/dist/{start-CHMKI2KH.js.map → start-LNJZNKF6.js.map} +0 -0
  48. /package/dist/{vite-plugin-T3EXDNQQ.js.map → vite-plugin-NC5ETNMV.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import "tsx/esm";
3
- import "./chunk-KXA37ONC.js";
4
- import "./chunk-WR4F4EEZ.js";
3
+ import "./chunk-RPMKF6BC.js";
4
+ import "./chunk-3KD2O6DC.js";
5
5
  import "./chunk-NQRNDPZJ.js";
6
6
  import "./chunk-L4GCEMNW.js";
7
7
  import {
@@ -211,4 +211,4 @@ export const actions = manifest
211
211
  export {
212
212
  actionsVirtualModule
213
213
  };
214
- //# sourceMappingURL=actions-virtual-module-BCN7IEQC.js.map
214
+ //# sourceMappingURL=actions-virtual-module-3KSP3WPJ.js.map
@@ -1,5 +1,5 @@
1
1
  import "./chunk-RSVN727G.js";
2
- import "./chunk-TGTNRUH3.js";
2
+ import "./chunk-WL4AX5FI.js";
3
3
  import "./chunk-GY5Q27BJ.js";
4
4
  import "./chunk-5QW7IQQU.js";
5
5
  import "./chunk-WFNLNIJX.js";
@@ -221,4 +221,4 @@ export const actions = manifest
221
221
  export {
222
222
  actionsVirtualModule
223
223
  };
224
- //# sourceMappingURL=actions-virtual-module-AX6UMYF5.js.map
224
+ //# sourceMappingURL=actions-virtual-module-SYGQE6JQ.js.map
@@ -3,7 +3,7 @@ import "tsx/esm";
3
3
  import {
4
4
  agentCommand,
5
5
  createAgentSsrLoader
6
- } from "./chunk-F46GSPV7.js";
6
+ } from "./chunk-DISADTFZ.js";
7
7
  import "./chunk-M6NMS5LR.js";
8
8
  import "./chunk-GDN3PXFH.js";
9
9
  import "./chunk-L4GCEMNW.js";
@@ -12,4 +12,4 @@ export {
12
12
  agentCommand,
13
13
  createAgentSsrLoader
14
14
  };
15
- //# sourceMappingURL=agent-4FJK6PRR.js.map
15
+ //# sourceMappingURL=agent-DX5LHD6X.js.map
@@ -1,5 +1,5 @@
1
1
  import "./chunk-RSVN727G.js";
2
- import "./chunk-TGTNRUH3.js";
2
+ import "./chunk-WL4AX5FI.js";
3
3
  import "./chunk-GY5Q27BJ.js";
4
4
  import "./chunk-5QW7IQQU.js";
5
5
  import "./chunk-WFNLNIJX.js";
@@ -296,4 +296,4 @@ export {
296
296
  emitClientDts,
297
297
  generateClientDts
298
298
  };
299
- //# sourceMappingURL=app-typed-client-U3OCOWYT.js.map
299
+ //# sourceMappingURL=app-typed-client-ESMMLPYK.js.map
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import "tsx/esm";
3
- import "./chunk-KXA37ONC.js";
4
- import "./chunk-WR4F4EEZ.js";
3
+ import "./chunk-RPMKF6BC.js";
4
+ import "./chunk-3KD2O6DC.js";
5
5
  import {
6
6
  generateManifest
7
7
  } from "./chunk-NQRNDPZJ.js";
@@ -286,4 +286,4 @@ export {
286
286
  emitClientDts,
287
287
  generateClientDts
288
288
  };
289
- //# sourceMappingURL=app-typed-client-LM2PNOCL.js.map
289
+ //# sourceMappingURL=app-typed-client-N4TRX5FI.js.map
@@ -533,7 +533,7 @@ async function buildCommand(options) {
533
533
  `);
534
534
  }
535
535
  async function runAdapterBuild(target, config, cwd) {
536
- const { theoPluginAsync } = await import("./vite-plugin-T3EXDNQQ.js");
536
+ const { theoPluginAsync } = await import("./vite-plugin-NC5ETNMV.js");
537
537
  const { default: react } = await import("@vitejs/plugin-react");
538
538
  const ctx = {
539
539
  // `react()` may return Plugin or Plugin[] depending on version; spread the
@@ -619,4 +619,4 @@ function relativize3(absPath, root) {
619
619
  export {
620
620
  buildCommand
621
621
  };
622
- //# sourceMappingURL=build-YQ3AWJV2.js.map
622
+ //# sourceMappingURL=build-3C2KQPME.js.map
@@ -711,6 +711,56 @@ async function runMiddlewareAndContext(req, res, loadModule, serverDir) {
711
711
  return { ctx, aborted: false };
712
712
  }
713
713
 
714
+ // src/server/http/node-request.ts
715
+ import { Readable } from "stream";
716
+ function pickHeaderString(value) {
717
+ if (typeof value === "string") return value;
718
+ if (Array.isArray(value)) {
719
+ for (const v of value) if (typeof v === "string" && v.length > 0) return v;
720
+ }
721
+ return void 0;
722
+ }
723
+ function synthesizeAbsoluteUrl(req) {
724
+ const host = pickHeaderString(req.headers.host) ?? "localhost";
725
+ return `http://${host}${req.url ?? "/"}`;
726
+ }
727
+ function nodeHeadersToWeb(req) {
728
+ const headers = new Headers();
729
+ for (const [key, value] of Object.entries(req.headers)) {
730
+ if (value === void 0) continue;
731
+ if (Array.isArray(value)) {
732
+ headers.set(key, value.join(", "));
733
+ } else {
734
+ headers.set(key, value);
735
+ }
736
+ }
737
+ return headers;
738
+ }
739
+ function incomingMessageToWebRequest(req) {
740
+ const url = synthesizeAbsoluteUrl(req);
741
+ const headers = nodeHeadersToWeb(req);
742
+ const method = (req.method ?? "GET").toUpperCase();
743
+ const hasBody = method !== "GET" && method !== "HEAD";
744
+ if (!hasBody) {
745
+ return new Request(url, { method, headers });
746
+ }
747
+ const webStream = Readable.toWeb(req);
748
+ return new Request(url, {
749
+ method,
750
+ headers,
751
+ body: webStream,
752
+ // EC-2: Node 18+ requires `duplex: 'half'` when body is a stream.
753
+ // The `RequestInit` type omits it (Web spec gap); cast accordingly.
754
+ ...{ duplex: "half" }
755
+ });
756
+ }
757
+ function incomingMessageToHandlerRequest(req) {
758
+ return new Request(synthesizeAbsoluteUrl(req), {
759
+ method: (req.method ?? "GET").toUpperCase(),
760
+ headers: nodeHeadersToWeb(req)
761
+ });
762
+ }
763
+
714
764
  // src/server/http/execute.ts
715
765
  var CSRF_PROTECTED_METHODS = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
716
766
  async function pipeWebStreamToResponse(body, res, ctx) {
@@ -856,7 +906,8 @@ async function executeRoute(ctx) {
856
906
  if (preResult.shortCircuited) return;
857
907
  }
858
908
  const callableHandler = handler;
859
- const handlerResult = await callableHandler({ query, body, params, request: req, ctx: ctx2 });
909
+ const webRequest = incomingMessageToHandlerRequest(req);
910
+ const handlerResult = await callableHandler({ query, body, params, request: webRequest, ctx: ctx2 });
860
911
  if (handlerResult === void 0 || handlerResult === null) {
861
912
  sendJson(res, null, rc.status ?? 204, transformer);
862
913
  if (pluginRunner) await pluginRunner.runOnResponse(buildPluginCtx(ctx2));
@@ -2092,6 +2143,7 @@ export {
2092
2143
  safeAudit,
2093
2144
  validateCsrfRequest,
2094
2145
  sendError,
2146
+ incomingMessageToWebRequest,
2095
2147
  executeRoute,
2096
2148
  executeAction,
2097
2149
  findSuggestion,
@@ -2103,4 +2155,4 @@ export {
2103
2155
  applySecurityHeaders,
2104
2156
  generateNonce
2105
2157
  };
2106
- //# sourceMappingURL=chunk-WR4F4EEZ.js.map
2158
+ //# sourceMappingURL=chunk-3KD2O6DC.js.map