theokit 0.75.0 → 0.76.0

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 (211) hide show
  1. package/README.md +80 -1
  2. package/dist/{actions-virtual-module-MIQPBAZW.js → actions-virtual-module-34PJIOI6.js} +11 -9
  3. package/dist/actions-virtual-module-34PJIOI6.js.map +1 -0
  4. package/dist/{actions-virtual-module-QEI6QPK4.js → actions-virtual-module-HS4W7HQU.js} +6 -5
  5. package/dist/{actions-virtual-module-QEI6QPK4.js.map → actions-virtual-module-HS4W7HQU.js.map} +1 -1
  6. package/dist/adapters/agent-mount.js +9 -7
  7. package/dist/{agent-IIF6JUWX.js → agent-HCK5RHH7.js} +4 -3
  8. package/dist/{app-typed-client-CHSITA46.js → app-typed-client-BWITJLJA.js} +6 -5
  9. package/dist/{app-typed-client-CHSITA46.js.map → app-typed-client-BWITJLJA.js.map} +1 -1
  10. package/dist/{app-typed-client-XQJXF646.js → app-typed-client-FR4M4VND.js} +11 -9
  11. package/dist/app-typed-client-FR4M4VND.js.map +1 -0
  12. package/dist/{aws-lambda-K5Y6XS5V.js → aws-lambda-XT7ZDJ6B.js} +3 -3
  13. package/dist/{build-QIO4VAW2.js → build-Y3CWTWP6.js} +25 -93
  14. package/dist/build-Y3CWTWP6.js.map +1 -0
  15. package/dist/{bun-VPXMWFBA.js → bun-PJLDELDT.js} +5 -5
  16. package/dist/{chunk-D7STTNQN.js → chunk-2FZYZHZM.js} +3 -3
  17. package/dist/{chunk-RKRFJRJ3.js → chunk-2SGNODVJ.js} +31 -17
  18. package/dist/chunk-2SGNODVJ.js.map +1 -0
  19. package/dist/chunk-2SQ7YAU3.js +85 -0
  20. package/dist/chunk-2SQ7YAU3.js.map +1 -0
  21. package/dist/{chunk-SYIQV4UH.js → chunk-33DGAR6Q.js} +2 -2
  22. package/dist/{chunk-CLSYYO5F.js → chunk-3HRANFEN.js} +2 -2
  23. package/dist/{chunk-EW5IG7GA.js → chunk-42TYMRBG.js} +1 -1
  24. package/dist/{chunk-EW5IG7GA.js.map → chunk-42TYMRBG.js.map} +1 -1
  25. package/dist/{chunk-BINRCILF.js → chunk-4JRXZTVQ.js} +4 -13
  26. package/dist/chunk-4JRXZTVQ.js.map +1 -0
  27. package/dist/{chunk-ICXXHV4V.js → chunk-54BIQFP4.js} +4 -13
  28. package/dist/chunk-54BIQFP4.js.map +1 -0
  29. package/dist/{chunk-NX3P5MLH.js → chunk-C2BRSL4W.js} +50 -6
  30. package/dist/chunk-C2BRSL4W.js.map +1 -0
  31. package/dist/{chunk-6RVWPEKK.js → chunk-C5FBN5LO.js} +88 -24
  32. package/dist/chunk-C5FBN5LO.js.map +1 -0
  33. package/dist/{chunk-NLHAYGQQ.js → chunk-G3DDIEYE.js} +4 -2
  34. package/dist/chunk-G3DDIEYE.js.map +1 -0
  35. package/dist/{chunk-R4AMIBZL.js → chunk-GLD7UXOG.js} +5 -5
  36. package/dist/chunk-GLD7UXOG.js.map +1 -0
  37. package/dist/{chunk-3MKRDJQ2.js → chunk-I27DTFV4.js} +273 -75
  38. package/dist/chunk-I27DTFV4.js.map +1 -0
  39. package/dist/chunk-ISTKIQNY.js +67 -0
  40. package/dist/chunk-ISTKIQNY.js.map +1 -0
  41. package/dist/chunk-IXXZBZF7.js +70 -0
  42. package/dist/chunk-IXXZBZF7.js.map +1 -0
  43. package/dist/{chunk-PVNMLZ5G.js → chunk-JO462JZM.js} +2 -2
  44. package/dist/chunk-KKLXKR2B.js +469 -0
  45. package/dist/chunk-KKLXKR2B.js.map +1 -0
  46. package/dist/{chunk-RY6D4EXL.js → chunk-LCP5FT55.js} +25 -4
  47. package/dist/{chunk-RY6D4EXL.js.map → chunk-LCP5FT55.js.map} +1 -1
  48. package/dist/{chunk-D2R5SJEL.js → chunk-MAJZ2L3A.js} +2 -2
  49. package/dist/{chunk-D2R5SJEL.js.map → chunk-MAJZ2L3A.js.map} +1 -1
  50. package/dist/chunk-NF7LXSXZ.js +19 -0
  51. package/dist/chunk-NF7LXSXZ.js.map +1 -0
  52. package/dist/{chunk-VPK7ABMB.js → chunk-NWUZMJN2.js} +3 -3
  53. package/dist/{chunk-EVKNHQWG.js → chunk-OO3PHTRT.js} +45 -4
  54. package/dist/chunk-OO3PHTRT.js.map +1 -0
  55. package/dist/{chunk-2Z7TANA4.js → chunk-PVI6HM6E.js} +3 -3
  56. package/dist/{chunk-4X43VTST.js → chunk-TODO6J42.js} +1 -1
  57. package/dist/chunk-TODO6J42.js.map +1 -0
  58. package/dist/{chunk-ZDCCILMP.js → chunk-TQTEKNOL.js} +2 -69
  59. package/dist/chunk-TQTEKNOL.js.map +1 -0
  60. package/dist/{chunk-MX63AWEK.js → chunk-VXDTQO3S.js} +22 -6
  61. package/dist/{chunk-MX63AWEK.js.map → chunk-VXDTQO3S.js.map} +1 -1
  62. package/dist/{chunk-OZB2TKGJ.js → chunk-W2I6L4IJ.js} +2 -2
  63. package/dist/{chunk-2BMJQMTH.js → chunk-XDLFOATW.js} +5 -5
  64. package/dist/{chunk-RQKMY3JW.js → chunk-XI4FALFZ.js} +3 -3
  65. package/dist/chunk-XI4FALFZ.js.map +1 -0
  66. package/dist/{chunk-47VNWTL4.js → chunk-XXHR7X35.js} +9 -5
  67. package/dist/chunk-XXHR7X35.js.map +1 -0
  68. package/dist/{chunk-2FHNJ7LI.js → chunk-Z76QQR7I.js} +2 -2
  69. package/dist/chunk-ZICY2CD7.js +16 -0
  70. package/dist/chunk-ZICY2CD7.js.map +1 -0
  71. package/dist/{chunk-I5PDEWZZ.js → chunk-ZQJORKBM.js} +9 -3
  72. package/dist/chunk-ZQJORKBM.js.map +1 -0
  73. package/dist/cli/index.js +21 -15
  74. package/dist/cli/index.js.map +1 -1
  75. package/dist/{cloudflare-PRTTYWRD.js → cloudflare-F7KLBOU4.js} +7 -7
  76. package/dist/{cloudflare-PRTTYWRD.js.map → cloudflare-F7KLBOU4.js.map} +1 -1
  77. package/dist/{config-support-HUZ4DXR7.js → config-support-2TER2BYD.js} +28 -21
  78. package/dist/config-support-2TER2BYD.js.map +1 -0
  79. package/dist/cron-lock-C3YpKDz2.d.ts +33 -0
  80. package/dist/db-ZWDKD57T.js +86 -0
  81. package/dist/db-ZWDKD57T.js.map +1 -0
  82. package/dist/{deno-deploy-M5V3PYWU.js → deno-deploy-LJ5JQQVR.js} +5 -5
  83. package/dist/{dev-J2XZIENF.js → dev-R6U3JOYM.js} +60 -11
  84. package/dist/dev-R6U3JOYM.js.map +1 -0
  85. package/dist/{dev-emit-AXTJK56H.js → dev-emit-BR6ERY63.js} +9 -5
  86. package/dist/dev-emit-BR6ERY63.js.map +1 -0
  87. package/dist/{dev-emit-XAPVJBM4.js → dev-emit-GFGLZZOH.js} +2 -2
  88. package/dist/{engine-singleton-X4R7AZBJ.js → engine-singleton-BQ5QOMTC.js} +15 -9
  89. package/dist/{engine-singleton-X4R7AZBJ.js.map → engine-singleton-BQ5QOMTC.js.map} +1 -1
  90. package/dist/{generate-RW3NO3NR.js → generate-2VAWEL7X.js} +205 -65
  91. package/dist/generate-2VAWEL7X.js.map +1 -0
  92. package/dist/{index-CmkWlIDO.d.ts → index-DfsJ3Qhk.d.ts} +1 -1
  93. package/dist/index.d.ts +12 -3
  94. package/dist/index.js +12 -10
  95. package/dist/index.js.map +1 -1
  96. package/dist/{info-6NAUW5XY.js → info-IPMW56PI.js} +4 -4
  97. package/dist/{internal-api-R7TTYMCY.js → internal-api-6RAOYIET.js} +6 -5
  98. package/dist/{internal-api-A5HA7TYF.js → internal-api-LJOFLJSS.js} +13 -10
  99. package/dist/job-backend-WvUs5rO1.d.ts +119 -0
  100. package/dist/{load-config-CLFWJOXN.js → load-config-USRR4GXP.js} +4 -4
  101. package/dist/{mcp-MWTG3LRA.js → mcp-FBXEX45H.js} +5 -4
  102. package/dist/{mcp-MWTG3LRA.js.map → mcp-FBXEX45H.js.map} +1 -1
  103. package/dist/{netlify-NI4HYDKN.js → netlify-ZPQNREFH.js} +2 -2
  104. package/dist/{node-LORYECWI.js → node-3EV3CVWB.js} +2 -2
  105. package/dist/{observability-bootstrap-DOWRMADT.js → observability-bootstrap-DMJ7R6WA.js} +3 -3
  106. package/dist/{openapi-RVFUXXCR.js → openapi-CA3E3LZH.js} +5 -5
  107. package/dist/{preview-ML4CFUD6.js → preview-AX2TMD26.js} +3 -3
  108. package/dist/registry-3D2KR7UE.js +34 -0
  109. package/dist/{routes-SMNSI2ZX.js → routes-BJ7GGRCV.js} +4 -4
  110. package/dist/{schema-DJH3IOVR.js → schema-FBM2UH72.js} +3 -3
  111. package/dist/{schemas-2R2J64ZH.js → schemas-BUR6PWSA.js} +2 -2
  112. package/dist/server/agent/index.d.ts +1 -1
  113. package/dist/server/agent/index.js +2 -1
  114. package/dist/server/cost/index.d.ts +2 -2
  115. package/dist/server/cost/index.js +1 -1
  116. package/dist/server/cost/sqlite/index.d.ts +2 -2
  117. package/dist/server/cost/sqlite/index.js +1 -1
  118. package/dist/server/cron/index.d.ts +20 -7
  119. package/dist/server/cron/index.js +5 -2
  120. package/dist/server/http/index.d.ts +2 -2
  121. package/dist/server/http/index.js +9 -7
  122. package/dist/server/index.d.ts +8 -7
  123. package/dist/server/index.js +42 -27
  124. package/dist/server/index.js.map +1 -1
  125. package/dist/server/jobs/index.d.ts +85 -44
  126. package/dist/server/jobs/index.js +8 -2
  127. package/dist/server/observability/index.js +8 -7
  128. package/dist/server/storage/index.d.ts +2 -2
  129. package/dist/server/storage/index.js +4 -1
  130. package/dist/server/webhook/index.d.ts +4 -5
  131. package/dist/server/webhook/index.js +1 -1
  132. package/dist/{server-boundary-ZT6HN7ON.js → server-boundary-EKIGYL7B.js} +6 -5
  133. package/dist/{server-boundary-ZT6HN7ON.js.map → server-boundary-EKIGYL7B.js.map} +1 -1
  134. package/dist/{server-boundary-HYLYGFZY.js → server-boundary-WSGVQAXP.js} +11 -9
  135. package/dist/server-boundary-WSGVQAXP.js.map +1 -0
  136. package/dist/{start-L5TGWGLU.js → start-4FY3TLM7.js} +118 -185
  137. package/dist/start-4FY3TLM7.js.map +1 -0
  138. package/dist/{static-O2RZ5NLR.js → static-VNN4HYRN.js} +2 -2
  139. package/dist/{storage-manager-BtG38jYl.d.ts → storage-manager-Clu2RBpH.d.ts} +15 -3
  140. package/dist/{storage-manager-3O5PDO6O.js → storage-manager-O3APCXYX.js} +46 -5
  141. package/dist/storage-manager-O3APCXYX.js.map +1 -0
  142. package/dist/{storage-types-CFGPFIdB.d.ts → storage-types-ndO0ZZqH.d.ts} +2 -2
  143. package/dist/{theo-cloud-B4R7GCWK.js → theo-cloud-243SPOIA.js} +2 -2
  144. package/dist/{vercel-INHLOCSZ.js → vercel-EXKSZ2OQ.js} +5 -5
  145. package/dist/vite-plugin/index.js +12 -10
  146. package/dist/{vite-plugin-OJND2LU5.js → vite-plugin-LE42ZIGV.js} +10 -9
  147. package/dist/{whatsapp-D_Fnl1LX.d.ts → whatsapp-4W2eK2ij.d.ts} +1 -1
  148. package/package.json +5 -5
  149. package/dist/actions-virtual-module-MIQPBAZW.js.map +0 -1
  150. package/dist/app-typed-client-XQJXF646.js.map +0 -1
  151. package/dist/build-QIO4VAW2.js.map +0 -1
  152. package/dist/chunk-3MKRDJQ2.js.map +0 -1
  153. package/dist/chunk-47VNWTL4.js.map +0 -1
  154. package/dist/chunk-4X43VTST.js.map +0 -1
  155. package/dist/chunk-6RVWPEKK.js.map +0 -1
  156. package/dist/chunk-BINRCILF.js.map +0 -1
  157. package/dist/chunk-EVKNHQWG.js.map +0 -1
  158. package/dist/chunk-I5PDEWZZ.js.map +0 -1
  159. package/dist/chunk-ICXXHV4V.js.map +0 -1
  160. package/dist/chunk-IDEZ7FU2.js +0 -18
  161. package/dist/chunk-IDEZ7FU2.js.map +0 -1
  162. package/dist/chunk-NLHAYGQQ.js.map +0 -1
  163. package/dist/chunk-NX3P5MLH.js.map +0 -1
  164. package/dist/chunk-R4AMIBZL.js.map +0 -1
  165. package/dist/chunk-RKRFJRJ3.js.map +0 -1
  166. package/dist/chunk-RQKMY3JW.js.map +0 -1
  167. package/dist/chunk-YCF3N4JS.js +0 -26
  168. package/dist/chunk-YCF3N4JS.js.map +0 -1
  169. package/dist/chunk-ZDCCILMP.js.map +0 -1
  170. package/dist/config-support-HUZ4DXR7.js.map +0 -1
  171. package/dist/db-IVVCQE5Z.js +0 -76
  172. package/dist/db-IVVCQE5Z.js.map +0 -1
  173. package/dist/dev-J2XZIENF.js.map +0 -1
  174. package/dist/dev-emit-AXTJK56H.js.map +0 -1
  175. package/dist/generate-RW3NO3NR.js.map +0 -1
  176. package/dist/job-backend-CgC8Xf33.d.ts +0 -68
  177. package/dist/registry-SUE4HJXL.js +0 -34
  178. package/dist/server-boundary-HYLYGFZY.js.map +0 -1
  179. package/dist/start-L5TGWGLU.js.map +0 -1
  180. package/dist/storage-manager-3O5PDO6O.js.map +0 -1
  181. /package/dist/{agent-IIF6JUWX.js.map → agent-HCK5RHH7.js.map} +0 -0
  182. /package/dist/{aws-lambda-K5Y6XS5V.js.map → aws-lambda-XT7ZDJ6B.js.map} +0 -0
  183. /package/dist/{bun-VPXMWFBA.js.map → bun-PJLDELDT.js.map} +0 -0
  184. /package/dist/{chunk-D7STTNQN.js.map → chunk-2FZYZHZM.js.map} +0 -0
  185. /package/dist/{chunk-SYIQV4UH.js.map → chunk-33DGAR6Q.js.map} +0 -0
  186. /package/dist/{chunk-CLSYYO5F.js.map → chunk-3HRANFEN.js.map} +0 -0
  187. /package/dist/{chunk-PVNMLZ5G.js.map → chunk-JO462JZM.js.map} +0 -0
  188. /package/dist/{chunk-VPK7ABMB.js.map → chunk-NWUZMJN2.js.map} +0 -0
  189. /package/dist/{chunk-2Z7TANA4.js.map → chunk-PVI6HM6E.js.map} +0 -0
  190. /package/dist/{chunk-OZB2TKGJ.js.map → chunk-W2I6L4IJ.js.map} +0 -0
  191. /package/dist/{chunk-2BMJQMTH.js.map → chunk-XDLFOATW.js.map} +0 -0
  192. /package/dist/{chunk-2FHNJ7LI.js.map → chunk-Z76QQR7I.js.map} +0 -0
  193. /package/dist/{deno-deploy-M5V3PYWU.js.map → deno-deploy-LJ5JQQVR.js.map} +0 -0
  194. /package/dist/{dev-emit-XAPVJBM4.js.map → dev-emit-GFGLZZOH.js.map} +0 -0
  195. /package/dist/{info-6NAUW5XY.js.map → info-IPMW56PI.js.map} +0 -0
  196. /package/dist/{internal-api-R7TTYMCY.js.map → internal-api-6RAOYIET.js.map} +0 -0
  197. /package/dist/{internal-api-A5HA7TYF.js.map → internal-api-LJOFLJSS.js.map} +0 -0
  198. /package/dist/{load-config-CLFWJOXN.js.map → load-config-USRR4GXP.js.map} +0 -0
  199. /package/dist/{netlify-NI4HYDKN.js.map → netlify-ZPQNREFH.js.map} +0 -0
  200. /package/dist/{node-LORYECWI.js.map → node-3EV3CVWB.js.map} +0 -0
  201. /package/dist/{observability-bootstrap-DOWRMADT.js.map → observability-bootstrap-DMJ7R6WA.js.map} +0 -0
  202. /package/dist/{openapi-RVFUXXCR.js.map → openapi-CA3E3LZH.js.map} +0 -0
  203. /package/dist/{preview-ML4CFUD6.js.map → preview-AX2TMD26.js.map} +0 -0
  204. /package/dist/{registry-SUE4HJXL.js.map → registry-3D2KR7UE.js.map} +0 -0
  205. /package/dist/{routes-SMNSI2ZX.js.map → routes-BJ7GGRCV.js.map} +0 -0
  206. /package/dist/{schema-DJH3IOVR.js.map → schema-FBM2UH72.js.map} +0 -0
  207. /package/dist/{schemas-2R2J64ZH.js.map → schemas-BUR6PWSA.js.map} +0 -0
  208. /package/dist/{static-O2RZ5NLR.js.map → static-VNN4HYRN.js.map} +0 -0
  209. /package/dist/{theo-cloud-B4R7GCWK.js.map → theo-cloud-243SPOIA.js.map} +0 -0
  210. /package/dist/{vercel-INHLOCSZ.js.map → vercel-EXKSZ2OQ.js.map} +0 -0
  211. /package/dist/{vite-plugin-OJND2LU5.js.map → vite-plugin-LE42ZIGV.js.map} +0 -0
@@ -1,7 +1,8 @@
1
- import { J as JobBackend, a as JobEnqueueInput, b as JobLease } from '../../job-backend-CgC8Xf33.js';
2
- export { N as NonRetryableError } from '../../job-backend-CgC8Xf33.js';
3
- import { S as StorageManager, P as PostgresFactory } from '../../storage-manager-BtG38jYl.js';
4
- import { b as PoolLike } from '../../storage-types-CFGPFIdB.js';
1
+ import { J as JobBackend, a as JobEnqueueInput, b as JobLease, c as JobLeaseFence, e as JobNackOptions } from '../../job-backend-WvUs5rO1.js';
2
+ export { d as JobLeaseLostError, N as NonRetryableError } from '../../job-backend-WvUs5rO1.js';
3
+ import { P as PostgresCronLockOptions, C as CronLock } from '../../cron-lock-C3YpKDz2.js';
4
+ import { S as StorageManager, P as PostgresFactory } from '../../storage-manager-Clu2RBpH.js';
5
+ import { P as PoolLike } from '../../storage-types-ndO0ZZqH.js';
5
6
 
6
7
  /**
7
8
  * Job primitive types (R0.5.5-9).
@@ -38,9 +39,9 @@ interface JobOptions<TInput = unknown> {
38
39
  input?: {
39
40
  parse: (value: unknown) => TInput;
40
41
  };
41
- /** Maximum dispatch attempts (default 1 — no retry surprise per ADR-0003). */
42
+ /** Maximum dispatch attempts (default 1, so nothing retries unless the job asks for it). */
42
43
  maxAttempts?: number;
43
- /** Handler. Returns `void` per ADR-0003 — no workflow API. */
44
+ /** Handler. Returns `void`: there is no workflow API. */
44
45
  handler: (ctx: JobContext<TInput>) => Promise<void> | void;
45
46
  }
46
47
  interface JobDefinition<TInput = unknown> {
@@ -58,7 +59,7 @@ interface JobDefinition<TInput = unknown> {
58
59
  * effect; the build-time scanner (T2.3) discovers definitions by walking
59
60
  * `server/jobs/` and emits `.theokit/jobs.json`.
60
61
  *
61
- * Per ADR-0003, handler returns `void` (or `Promise<void>`); no workflow
62
+ * The handler returns `void` (or `Promise<void>`); no workflow
62
63
  * API. To run another job after this one, call `ctx.queue.enqueue` from
63
64
  * the handler.
64
65
  *
@@ -100,9 +101,14 @@ declare class DuplicateContextKeyError extends Error {
100
101
  *
101
102
  * Zero external dependencies. Storage is two Maps:
102
103
  * - `pending: Map<jobId, PendingEntry>` — all enqueued jobs (locked or not)
103
- * - `idempotencyMap: Map<key, { jobId; expiresAt }>` — dedup window
104
+ * - `idempotencyMap: Map<name + key, { key; jobId; expiresAt }>` — dedup
105
+ * window, scoped to the job name like PostgresJobBackend's unique index
104
106
  *
105
- * Per ADR-0002: this is one of two first-party backends shipped in core.
107
+ * A job that fails for good is dropped with a `console.warn` naming it and its
108
+ * last error; this backend keeps no failed jobs and retries immediately, with
109
+ * no backoff. `PostgresJobBackend` keeps failed jobs and backs off.
110
+ *
111
+ * This is one of two first-party backends shipped in core.
106
112
  * Production deploys plug in PostgresJobBackend (T3.1).
107
113
  *
108
114
  * EC-104 (jobs-crons-webhooks-cost-tracking-plan): registers a
@@ -125,12 +131,13 @@ declare class InMemoryJobBackend implements JobBackend {
125
131
  batchSize?: number;
126
132
  lockSeconds?: number;
127
133
  }): Promise<JobLease[]>;
128
- ack(jobId: string): Promise<void>;
129
- nack(jobId: string, opts: {
130
- error: string;
131
- nonRetryable?: boolean;
132
- }): Promise<void>;
133
- idempotency(key: string, ttlSeconds: number): Promise<{
134
+ ack(jobId: string, fence?: JobLeaseFence): Promise<void>;
135
+ nack(jobId: string, opts: JobNackOptions): Promise<void>;
136
+ /**
137
+ * The job holding `key` within its window, or null. With `name`, only that job type's key
138
+ * matches, as `enqueue` deduplicates on (name, key); without it, the first job holding the key.
139
+ */
140
+ idempotency(key: string, ttlSeconds: number, name?: string): Promise<{
134
141
  jobId: string;
135
142
  } | null>;
136
143
  /**
@@ -147,6 +154,11 @@ interface PostgresJobBackendOptions {
147
154
  pool: PoolLike;
148
155
  /** Table name override (default `theokit_jobs`). */
149
156
  tableName?: string;
157
+ /**
158
+ * Seconds a failed job waits before its next attempt, given the attempts made so far (1 after
159
+ * the first failure). Default: exponential, `min(2^attempts, 3600)`.
160
+ */
161
+ retryDelaySeconds?: (attempts: number) => number;
150
162
  }
151
163
  declare class PostgresJobBackend implements JobBackend {
152
164
  #private;
@@ -166,9 +178,14 @@ declare class PostgresJobBackend implements JobBackend {
166
178
  * Errors thrown by the manager (unknown dbName, dangling server reference,
167
179
  * manager already disposed) propagate to the caller with actionable text.
168
180
  *
169
- * @see ADR-0007
170
181
  */
171
182
  static fromStorageManager(manager: StorageManager, dbName: string, factory: PostgresFactory, options?: Omit<PostgresJobBackendOptions, 'pool'>): PostgresJobBackend;
183
+ /**
184
+ * A cron lock on this backend's pool, so replicas sharing the job database fire each cron tick
185
+ * once between them. `theokit start` uses it automatically when this is the configured
186
+ * `jobs.backend` and `cron.lock` is not set (usetheokit/theokit#1016).
187
+ */
188
+ cronLock(options?: PostgresCronLockOptions): CronLock;
172
189
  /**
173
190
  * Create or upgrade the schema. Idempotent (uses IF NOT EXISTS).
174
191
  * Call once at process start; safe to re-run on every deploy.
@@ -181,12 +198,21 @@ declare class PostgresJobBackend implements JobBackend {
181
198
  batchSize?: number;
182
199
  lockSeconds?: number;
183
200
  }): Promise<JobLease[]>;
184
- ack(jobId: string): Promise<void>;
185
- nack(jobId: string, opts: {
186
- error: string;
187
- nonRetryable?: boolean;
188
- }): Promise<void>;
189
- idempotency(key: string, _ttlSeconds: number): Promise<{
201
+ ack(jobId: string, fence?: JobLeaseFence): Promise<void>;
202
+ /**
203
+ * Record a failure. The job is retried after `retryDelaySeconds(attempts)` while attempts remain,
204
+ * and kept as failed (`failed_at`, `last_error`) once they are exhausted or the failure is
205
+ * non-retryable. It was DELETEd in that case, with its input and its error, so a job that failed
206
+ * for good left no record (usetheokit/theokit#1014).
207
+ */
208
+ nack(jobId: string, opts: JobNackOptions): Promise<void>;
209
+ /**
210
+ * The job holding `key`, or null. Pass `name` to scope the lookup the way the UNIQUE INDEX and
211
+ * `enqueue` do, on (name, idempotency_key): without it, two job types sharing a key can return
212
+ * each other's id (usetheokit/theokit#1015). A failed job still holds its key; an acked one does
213
+ * not, because `ack` deletes the row. `ttlSeconds` is not used: the window is the row's life.
214
+ */
215
+ idempotency(key: string, _ttlSeconds: number, name?: string): Promise<{
190
216
  jobId: string;
191
217
  } | null>;
192
218
  }
@@ -205,7 +231,7 @@ declare class PostgresJobBackend implements JobBackend {
205
231
  * Invariants:
206
232
  * - Outbox NEVER dispatches before commit. Backend.enqueue is NEVER
207
233
  * called on the request hot path.
208
- * - Handler throws → ZERO jobs dispatched. KEY guarantee from ADR-0003.
234
+ * - Handler throws → ZERO jobs dispatched. This is the outbox's key guarantee.
209
235
  *
210
236
  * EC-107: when `backend.enqueue` throws DURING flush (after response
211
237
  * committed), we log + continue. The response is already gone; partial
@@ -244,7 +270,7 @@ interface EnqueueOptions {
244
270
  delaySeconds?: number;
245
271
  }
246
272
  /**
247
- * Typed queue client. Per ADR-0003, `enqueue` returns `void` and buffers
273
+ * Typed queue client. `enqueue` returns `void` and buffers
248
274
  * to the per-request outbox. `enqueueWithId` is the log-correlation
249
275
  * variant that resolves to `{ jobId }` AFTER the outbox flushes.
250
276
  *
@@ -275,7 +301,7 @@ interface CreateQueueClientOptions {
275
301
  *
276
302
  * The backend is referenced only to resolve `enqueueWithId` jobIds at
277
303
  * flush time — `enqueue` itself does NOT call backend on the hot path
278
- * (transactional outbox guarantee per ADR-0003).
304
+ * (the transactional outbox guarantee).
279
305
  */
280
306
  declare function createQueueClient(backend: JobBackend, outbox: Outbox, opts?: CreateQueueClientOptions): QueueClient;
281
307
  /**
@@ -286,24 +312,6 @@ declare function createQueueClient(backend: JobBackend, outbox: Outbox, opts?: C
286
312
  */
287
313
  declare function createOutboxDispatcher(backend: JobBackend): (entry: JobEnqueueInput) => Promise<unknown>;
288
314
 
289
- /**
290
- * Job runner — pulls leases from a backend and invokes the matching
291
- * handler. Each invocation wires up `JobContext` with:
292
- * - `traceId` extracted from the lease's `traceparent` header (W3C
293
- * Trace Context per R0.5.9), OR a fresh generated trace_id when
294
- * the upstream had no traceparent OR it was malformed.
295
- * - `attempt` from the lease.
296
- * - `signal` that aborts when the lease times out.
297
- *
298
- * `tick()` runs one dequeue+dispatch cycle and returns when all leases
299
- * have been ack'd or nack'd. Production deploys call `tick()` in a loop
300
- * with backoff (the loop is outside this module's scope).
301
- *
302
- * EC-6 (trace continuity edge): when a lease has no traceparent OR a
303
- * malformed one, the handler still gets a valid traceId (generated) —
304
- * never null/undefined. The job MAY itself enqueue child jobs that
305
- * continue the new trace_id.
306
- */
307
315
  interface JobRunner {
308
316
  /** Run one dequeue+dispatch cycle. */
309
317
  tick(opts?: {
@@ -313,6 +321,39 @@ interface JobRunner {
313
321
  }
314
322
  declare function createJobRunner(backend: JobBackend, definitions: readonly JobDefinition[]): JobRunner;
315
323
 
324
+ /**
325
+ * The loop around `JobRunner.tick()`.
326
+ *
327
+ * `tick()` runs one dequeue-and-dispatch cycle and left the loop to its caller, and `theokit start`
328
+ * never wrote one, so jobs were enqueued into a backend nothing drained (usetheokit/theokit#1010).
329
+ * This is that loop, shared by `theokit start`, `theokit dev` and anyone running a worker process
330
+ * of their own:
331
+ *
332
+ * - a tick that leased jobs is followed by another at once, so a backlog drains at full speed;
333
+ * - an empty tick waits `pollIntervalMs` before asking again;
334
+ * - a tick that throws (the database is down) is logged and retried with exponential backoff
335
+ * capped at `maxErrorBackoffMs`, so an outage neither kills the process nor spins;
336
+ * - `stop()` lets the tick in progress finish (its jobs are acked or nacked) and resolves after it.
337
+ * A wait in progress is cut short.
338
+ */
339
+ interface JobWorkerOptions {
340
+ /** Wait after a tick that leased nothing. Default 1000 ms. */
341
+ pollIntervalMs?: number;
342
+ /** Leases per tick, passed to `tick()`. Default 10. */
343
+ batchSize?: number;
344
+ /** Lease duration per job, passed to `tick()`. Default 30 s. */
345
+ lockSeconds?: number;
346
+ /** Ceiling of the backoff after consecutive failed ticks. Default 30 000 ms. */
347
+ maxErrorBackoffMs?: number;
348
+ }
349
+ interface JobWorker {
350
+ /** Start polling. A second call is a no-op. */
351
+ start(): void;
352
+ /** Stop polling; resolves once the tick in progress, if any, has finished. */
353
+ stop(): Promise<void>;
354
+ }
355
+ declare function createJobWorker(runner: JobRunner, options?: JobWorkerOptions): JobWorker;
356
+
316
357
  interface JobNode {
317
358
  readonly name: string;
318
359
  readonly filePath: string;
@@ -342,4 +383,4 @@ interface JobManifest {
342
383
  declare function buildJobManifest(nodes: readonly JobNode[], projectRoot?: string): JobManifest;
343
384
  declare function writeJobManifest(path: string, input: readonly JobNode[] | JobManifest, projectRoot?: string): void;
344
385
 
345
- export { DuplicateContextKeyError, DuplicateJobNameError, type EnqueueOptions, InMemoryJobBackend, type InMemoryJobBackendOptions, JOB_MANIFEST_SCHEMA_VERSION, JobBackend, type JobContext, type JobDefinition, JobEnqueueInput, JobLease, type JobManifest, type JobManifestEntry, type JobNode, type JobOptions, type JobRegistry, type JobRunner, type Outbox, type OutboxFlushOptions, PoolLike, PostgresJobBackend, type PostgresJobBackendOptions, type QueueClient, buildJobManifest, createJobRunner, createOutbox, createOutboxDispatcher, createQueueClient, defineJob, scanJobs, writeJobManifest };
386
+ export { DuplicateContextKeyError, DuplicateJobNameError, type EnqueueOptions, InMemoryJobBackend, type InMemoryJobBackendOptions, JOB_MANIFEST_SCHEMA_VERSION, JobBackend, type JobContext, type JobDefinition, JobEnqueueInput, JobLease, JobLeaseFence, type JobManifest, type JobManifestEntry, JobNackOptions, type JobNode, type JobOptions, type JobRegistry, type JobRunner, type JobWorker, type JobWorkerOptions, type Outbox, type OutboxFlushOptions, PoolLike, PostgresJobBackend, type PostgresJobBackendOptions, type QueueClient, buildJobManifest, createJobRunner, createJobWorker, createOutbox, createOutboxDispatcher, createQueueClient, defineJob, scanJobs, writeJobManifest };
@@ -2,21 +2,25 @@ import {
2
2
  DuplicateJobNameError,
3
3
  InMemoryJobBackend,
4
4
  JOB_MANIFEST_SCHEMA_VERSION,
5
+ JobLeaseLostError,
5
6
  NonRetryableError,
6
7
  PostgresJobBackend,
7
8
  buildJobManifest,
8
9
  createJobRunner,
10
+ createJobWorker,
9
11
  defineJob,
10
12
  scanJobs,
11
13
  writeJobManifest
12
- } from "../../chunk-3MKRDJQ2.js";
14
+ } from "../../chunk-I27DTFV4.js";
13
15
  import {
14
16
  DuplicateContextKeyError,
15
17
  createOutbox,
16
18
  createOutboxDispatcher,
17
19
  createQueueClient
18
20
  } from "../../chunk-47FFT43U.js";
19
- import "../../chunk-IDEZ7FU2.js";
21
+ import "../../chunk-TQTEKNOL.js";
22
+ import "../../chunk-CHTAWXC2.js";
23
+ import "../../chunk-ISTKIQNY.js";
20
24
  import "../../chunk-UMNXCU3K.js";
21
25
  import "../../chunk-AHYOVVJ7.js";
22
26
  import "../../chunk-SOYOYGWY.js";
@@ -27,10 +31,12 @@ export {
27
31
  DuplicateJobNameError,
28
32
  InMemoryJobBackend,
29
33
  JOB_MANIFEST_SCHEMA_VERSION,
34
+ JobLeaseLostError,
30
35
  NonRetryableError,
31
36
  PostgresJobBackend,
32
37
  buildJobManifest,
33
38
  createJobRunner,
39
+ createJobWorker,
34
40
  createOutbox,
35
41
  createOutboxDispatcher,
36
42
  createQueueClient,
@@ -14,19 +14,20 @@ import {
14
14
  createObservabilityPlugin,
15
15
  resolveAdapter,
16
16
  serializeSpansToOtlp
17
- } from "../../chunk-PVNMLZ5G.js";
17
+ } from "../../chunk-JO462JZM.js";
18
+ import "../../chunk-IXXZBZF7.js";
19
+ import {
20
+ JsonStdoutSink,
21
+ createNoOpLogger,
22
+ safeAudit
23
+ } from "../../chunk-AVQU5CQF.js";
18
24
  import {
19
25
  _resetWarnOnceForTests,
20
26
  createLogger,
21
27
  logRequest,
22
28
  warnOnce
23
- } from "../../chunk-ZDCCILMP.js";
29
+ } from "../../chunk-TQTEKNOL.js";
24
30
  import "../../chunk-CHTAWXC2.js";
25
- import {
26
- JsonStdoutSink,
27
- createNoOpLogger,
28
- safeAudit
29
- } from "../../chunk-AVQU5CQF.js";
30
31
  import "../../chunk-UMNXCU3K.js";
31
32
  import "../../chunk-XTHN6JBX.js";
32
33
  export {
@@ -1,5 +1,5 @@
1
- export { P as PostgresFactory, R as RedisFactory, S as StorageManager, g as getStorageManager } from '../../storage-manager-BtG38jYl.js';
2
- export { G as GenericFactory, b as PoolLike, P as PostgresDatabaseConfig, d as RedisLike, R as RedisServerConfig, a as ServerConfig, S as StorageAdapter, c as StorageConfig, T as TlsConfig } from '../../storage-types-CFGPFIdB.js';
1
+ export { P as PostgresFactory, R as RedisFactory, S as StorageManager, g as getStorageManager } from '../../storage-manager-Clu2RBpH.js';
2
+ export { G as GenericFactory, P as PoolLike, b as PostgresDatabaseConfig, d as RedisLike, R as RedisServerConfig, a as ServerConfig, S as StorageAdapter, c as StorageConfig, T as TlsConfig } from '../../storage-types-ndO0ZZqH.js';
3
3
 
4
4
  interface UnstorageInstance<T> {
5
5
  getItem(key: string): Promise<T | null>;
@@ -3,7 +3,10 @@ import {
3
3
  getStorageManager,
4
4
  useDatabase,
5
5
  useUnstorage
6
- } from "../../chunk-EVKNHQWG.js";
6
+ } from "../../chunk-OO3PHTRT.js";
7
+ import "../../chunk-TQTEKNOL.js";
8
+ import "../../chunk-CHTAWXC2.js";
9
+ import "../../chunk-ZICY2CD7.js";
7
10
  import "../../chunk-XTHN6JBX.js";
8
11
  export {
9
12
  StorageManager,
@@ -1,5 +1,5 @@
1
- import { D as DefineWebhookOptions, c as WebhookDefinition, V as VerifyFn } from '../../whatsapp-D_Fnl1LX.js';
2
- export { S as SubscribeFn, a as SubscribeResult, b as VerifyResult, W as WebhookContext, d as WhatsAppSubscribeOptions, e as WhatsAppWebhookOptions, w as whatsapp, f as whatsappSubscribe } from '../../whatsapp-D_Fnl1LX.js';
1
+ import { D as DefineWebhookOptions, c as WebhookDefinition, V as VerifyFn } from '../../whatsapp-4W2eK2ij.js';
2
+ export { S as SubscribeFn, a as SubscribeResult, b as VerifyResult, W as WebhookContext, d as WhatsAppSubscribeOptions, e as WhatsAppWebhookOptions, w as whatsapp, f as whatsappSubscribe } from '../../whatsapp-4W2eK2ij.js';
3
3
 
4
4
  /**
5
5
  * Constant-time byte comparison.
@@ -72,14 +72,13 @@ declare function readRawBody(request: Request, options?: ReadRawBodyOptions): Pr
72
72
 
73
73
  /**
74
74
  * Declare a webhook handler with first-class signature verification
75
- * (R0.5.10, ADR-0005). Pure identity helper — returns the definition
75
+ * (R0.5.10). Pure identity helper — returns the definition
76
76
  * unchanged for downstream dispatch.
77
77
  *
78
78
  * @example
79
79
  * ```ts
80
80
  * // server/webhooks/stripe.ts
81
- * import { defineWebhook } from 'theokit/server'
82
- * import { stripe } from 'theokit/server/webhook/providers'
81
+ * import { defineWebhook, stripe } from 'theokit/server/webhook'
83
82
  *
84
83
  * export default defineWebhook({
85
84
  * verify: stripe({ secret: process.env.STRIPE_WEBHOOK_SECRET! }),
@@ -13,7 +13,7 @@ import {
13
13
  timingSafeEqual,
14
14
  whatsapp,
15
15
  whatsappSubscribe
16
- } from "../../chunk-EW5IG7GA.js";
16
+ } from "../../chunk-42TYMRBG.js";
17
17
  import "../../chunk-UMNXCU3K.js";
18
18
  import "../../chunk-XTHN6JBX.js";
19
19
  export {
@@ -3,11 +3,11 @@ import "tsx/esm";
3
3
  import {
4
4
  resolveTheoRootDir
5
5
  } from "./chunk-FDOOBTXJ.js";
6
- import "./chunk-RQKMY3JW.js";
7
- import "./chunk-BINRCILF.js";
6
+ import "./chunk-XI4FALFZ.js";
7
+ import "./chunk-4JRXZTVQ.js";
8
8
  import "./chunk-FNJVSFEC.js";
9
9
  import "./chunk-WSMLSIS5.js";
10
- import "./chunk-MX63AWEK.js";
10
+ import "./chunk-VXDTQO3S.js";
11
11
  import "./chunk-C27VRUVN.js";
12
12
  import "./chunk-7UZZHCRN.js";
13
13
  import "./chunk-FNAEKJHO.js";
@@ -17,7 +17,8 @@ import {
17
17
  } from "./chunk-4WP7A7RX.js";
18
18
  import "./chunk-Z7CJHDLS.js";
19
19
  import "./chunk-O5JZ6ROY.js";
20
- import "./chunk-D2R5SJEL.js";
20
+ import "./chunk-MAJZ2L3A.js";
21
+ import "./chunk-NF7LXSXZ.js";
21
22
  import "./chunk-VQIUTCK2.js";
22
23
 
23
24
  // src/vite-plugin/server-boundary.ts
@@ -131,4 +132,4 @@ export {
131
132
  ServerOnlyImportError,
132
133
  serverOnlyImportBoundary
133
134
  };
134
- //# sourceMappingURL=server-boundary-ZT6HN7ON.js.map
135
+ //# sourceMappingURL=server-boundary-EKIGYL7B.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/vite-plugin/server-boundary.ts"],"sourcesContent":["/* eslint-disable security/detect-non-literal-fs-filename --\n * Build-time boundary check. The only paths handed to `fs` are derived from an import specifier\n * already inside the module graph, and every one of them is on the throw path — the check has\n * already decided to fail the build by the time a file is probed. No HTTP input reaches here.\n */\nimport { existsSync, statSync } from 'node:fs'\nimport { dirname, isAbsolute, join, relative, resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nimport type { Plugin } from 'vite'\n\nimport { ACTION_SCHEMAS_DIR } from '../server/internal-api.js'\n\nimport { resolveTheoRootDir } from './resolve-theo-root.js'\n\n/**\n * The framework's server surface, as one specifier.\n *\n * Every server entry point in `packages/theo/package.json` is `./server` or a `./server/<name>`\n * subpath, so this prefix covers the whole surface without listing it — and a subpath added to the\n * `exports` map tomorrow is covered on the day it ships rather than the day someone remembers this\n * file. `tests/unit/server-boundary-rule.test.ts` reads that map and\n * asserts the correspondence in both directions, so the prefix cannot quietly start over- or\n * under-matching.\n */\nconst THEO_SERVER_SPECIFIER = 'theokit/server'\n\n/** Extensions the boundary probes when naming the file behind a specifier. */\nconst SOURCE_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx', '.mts', '.mjs', '.cts', '.cjs'] as const\n\ninterface ServerOnlyImportErrorOptions {\n /** The server-only module, named the way the reader should recognise it. */\n module: string\n /** The file whose import statement crossed the boundary. */\n importer: string\n /** The specifier exactly as written, when it differs from `module`. */\n specifier?: string\n}\n\n/**\n * Thrown by the server-only import boundary when a module that runs on the server is pulled into\n * the CLIENT module graph.\n *\n * The failure it replaces was not the absence of one. `theokit build` already failed on this\n * mistake — with `\"resolve\" is not exported by \"__vite-browser-external\"`, pointing at a framework\n * chunk, after thirty lines of externalisation warnings (usetheokit/theokit#373). That names the\n * bundler's difficulty, not the author's. Worse, it is an accident: it happens because Node\n * builtins do not exist in a browser, so a server module that imported none of them would have\n * bundled cleanly and shipped.\n *\n * This error makes the boundary a rule instead of a side effect, and names the two things the\n * author needs — the module, and the file that imported it — the way `RouterConventionError` and\n * `MissingRoutePolicyError` already do for a bad route filename and an undeclared policy.\n */\nexport class ServerOnlyImportError extends Error {\n override readonly name = 'ServerOnlyImportError'\n /** The server-only module, as named in the message. */\n readonly module: string\n /** The importing file, as named in the message. */\n readonly importer: string\n\n constructor(opts: ServerOnlyImportErrorOptions) {\n const wroteSomethingElse = opts.specifier !== undefined && opts.specifier !== opts.module\n const message = [\n `Server-only import in the client bundle: ${opts.module} cannot be imported from client code.`,\n ``,\n ` Imported: ${opts.module}`,\n ...(wroteSomethingElse ? [` Written: ${String(opts.specifier)}`] : []),\n ` From: ${opts.importer}`,\n ``,\n `That module runs on the server. It reads the file system, opens the database and holds`,\n `your secrets, so a browser bundle containing it ships all three to every visitor.`,\n ``,\n `Call the server from client code instead:`,\n ``,\n // Both bindings are the ones the virtual modules actually export — `client` from\n // `app-typed-client.ts` and `actions` from `actions-virtual-module.ts`. A remedy naming a\n // symbol nobody exports reads as actionable and is not, so\n // `tests/unit/server-boundary-rule.test.ts` asserts both against the emitters — the same\n // discipline `tests/unit/policy-gate-remedy-is-importable.test.ts` applies to the policy gate.\n ` import { client } from '@theo/client' // typed from your server/routes/**`,\n ` import { actions } from '@theo/actions' // typed from your server/actions/**`,\n ``,\n `Need only the TYPES? Add \\`type\\` to the import — a type-only import is erased before the`,\n `bundler ever sees it:`,\n ``,\n ` import type { ... } from '${opts.specifier ?? opts.module}'`,\n ``,\n `And if this file is itself server code, move it under your server directory, so the client`,\n `graph has no way to reach it.`,\n ].join('\\n')\n super(message)\n this.module = opts.module\n this.importer = opts.importer\n }\n}\n\n/** True when `child` is inside `parent` (and is not `parent` itself). */\nfunction isUnder(child: string, parent: string): boolean {\n const rel = relative(parent, child)\n return rel !== '' && !rel.startsWith('..') && !isAbsolute(rel)\n}\n\n/**\n * Name the file a specifier points at.\n *\n * A TypeScript ESM import writes `./health.js` for a file called `health.ts`, and an author told\n * to look at `server/routes/health.js` will open a file that does not exist. Runs only when the\n * boundary has already decided to throw, so the probing costs nothing on a passing build; falls\n * back to the unresolved path rather than inventing one.\n */\nfunction nameSourceFile(target: string): string {\n if (existsSync(target) && statSync(target).isFile()) return target\n const stem = target.replace(/\\.[cm]?[jt]sx?$/, '')\n for (const ext of SOURCE_EXTENSIONS) {\n if (existsSync(`${stem}${ext}`)) return `${stem}${ext}`\n }\n for (const ext of SOURCE_EXTENSIONS) {\n if (existsSync(join(target, `index${ext}`))) return join(target, `index${ext}`)\n }\n return target\n}\n\n/** Render a path relative to the project root, keeping it absolute when it lives outside. */\nfunction forHumans(path: string, projectRoot: string): string {\n return isUnder(path, projectRoot) ? relative(projectRoot, path) : path\n}\n\n/**\n * Name a file inside the framework's own server tree the way its `package.json` publishes it.\n *\n * Two normalisations, both undoing something a bundler did to a specifier the author never wrote:\n *\n * - **The alias mangle.** `config-hook.ts` aliases the STRING `theokit/server` to a FILE, and a\n * Vite string alias replaces by prefix, so `theokit/server/define` reaches this plugin as\n * `…/server/index.ts/define`. That mid-path `/index.ts/` is the mangle — the same shape that\n * surfaced as `ENOTDIR` in usetheokit/theokit#373 — and stripping it recovers `define`.\n * - **The barrel file.** `./server` and `./server/define` publish as `…/index.js` in `dist` and\n * `…/index.ts` in source; a trailing barrel segment is not part of the specifier.\n *\n * The result is the string a reader can grep for in `packages/theo/package.json`.\n */\nfunction frameworkServerSpecifier(target: string, theoServerDir: string): string {\n const demangled = target.replace(/[\\\\/]index\\.[cm]?[jt]sx?(?=[\\\\/])/, '')\n const subpath = relative(theoServerDir, demangled)\n .replace(/\\\\/g, '/')\n .replace(/(^|\\/)index\\.[cm]?[jt]sx?$/, '')\n return subpath === '' ? THEO_SERVER_SPECIFIER : `${THEO_SERVER_SPECIFIER}/${subpath}`\n}\n\nexport interface ServerBoundaryOptions {\n /** Absolute project root — paths in the message are shown relative to it. */\n projectRoot: string\n /** Absolute backend root (config `serverDir`, default `<projectRoot>/server`). */\n serverDir: string\n}\n\n/**\n * Refuse a server-only module in the client module graph, by name.\n *\n * ## Where the check lives, and why here\n *\n * In `resolveId`, at `enforce: 'pre'`. Three reasons, in the order they mattered:\n *\n * 1. **It is the only hook that sees the triple the message needs** — specifier, importer, and\n * whether this is the client graph or the SSR one. A `package.json` `exports` map has no\n * client/server condition a bundler honours for a build, and a standalone gate over `dist/`\n * would have to rebuild the module graph Rollup just built.\n * 2. **`pre` runs ahead of the alias cascade.** `config-hook.ts` aliases `theokit/server` to a\n * FILE, and a Vite string alias matches by prefix, so `theokit/server/define` used to resolve\n * to `…/server/index.js/define` and fail with `ENOTDIR` — the second half of #373. Catching the\n * specifier before the alias replaces it turns that into the same named refusal as the bare\n * import. (The alias bug itself is untouched here — it is usetheokit/theokit#377, and it still\n * breaks `theokit/client/core`, a published entry point that no boundary should refuse.)\n * 3. **It is on the path a consumer runs.** `theokit build` → `runAdapterBuild` → `nodeAdapter` →\n * `viteBuild({ plugins: await ctx.makeVitePlugins(…) })` → `theoPluginAsync`, which returns this\n * plugin. Nothing has to opt in, and `tests/integration/server-only-import-boundary.test.ts`\n * exercises that chain rather than calling the hook.\n *\n * ## What counts as server-only\n *\n * Two rules, and one exception that is not a special case so much as the framework's own\n * declaration:\n *\n * - Anything under the published `theokit/server` surface (see {@link THEO_SERVER_SPECIFIER}).\n * - Anything under the project's own `serverDir`, EXCEPT `actions/<ACTION_SCHEMAS_DIR>/**`, which\n * the `@theo/actions` facade deliberately imports into the client bundle. The exception reads\n * the same constant the action scanner uses, so renaming the convention cannot turn a shipped\n * feature into a build error on one side only.\n *\n * The second rule exists so the message names the page the author wrote. Without it a client page\n * importing `server/routes/health.ts` still fails — health.ts imports `theokit/server/define` — but\n * the importer named is `health.ts`, one hop away from the mistake.\n *\n * ## What it deliberately does not do\n *\n * It does not walk the import chain to report how a deeply nested server module was reached, and it\n * does not fire on the SSR graph, in `theokit build --target` SSR passes or under `ssrLoadModule`,\n * where importing server code is the entire point.\n */\nexport function serverOnlyImportBoundary(opts: ServerBoundaryOptions): Plugin {\n const projectRoot = opts.projectRoot\n const serverDir = opts.serverDir\n const isomorphicSchemasDir = join(serverDir, 'actions', ACTION_SCHEMAS_DIR)\n // The framework's own server tree on disk — `src/server` in this workspace, `dist/server` in an\n // installed copy. Resolved through the same helper `theoPlugin()` uses for its aliases, so the\n // boundary and the aliases can never point at different trees.\n const theoServerDir = join(resolveTheoRootDir(dirname(fileURLToPath(import.meta.url))), 'server')\n\n return {\n name: 'theo:server-only-import-boundary',\n enforce: 'pre',\n\n resolveId(source, importer, options) {\n // The SSR graph is allowed — and required — to import server code.\n if (options.ssr === true) return undefined\n // An entry point has no importer, so the message could not name one. A `theokit/server`\n // entry is a deliberate act in someone's Vite config, not the accident this catches.\n if (importer === undefined) return undefined\n\n // The specifier as the author wrote it. Reached only when no alias rewrote it first —\n // Vite's own alias plugin runs ahead of every `enforce: 'pre'` plugin, and `config-hook.ts`\n // installs an alias for exactly this prefix. Kept anyway so the boundary holds for a\n // consumer whose Vite config does not carry that alias.\n if (source === THEO_SERVER_SPECIFIER || source.startsWith(`${THEO_SERVER_SPECIFIER}/`)) {\n throw new ServerOnlyImportError({\n module: source,\n importer: forHumans(importer, projectRoot),\n })\n }\n\n // A bare specifier can never be a file, so only relative and absolute sources are resolved —\n // which keeps the common case to two string comparisons.\n if (source.startsWith('.') || isAbsolute(source)) {\n const target = isAbsolute(source) ? source : resolve(dirname(importer), source)\n\n // The framework's server surface, recognised by PATH because that is the form it arrives\n // in after the alias. Matching the tree rather than the specifier also catches a deep\n // reach into `theokit`'s internals that no `exports` subpath names.\n if (isUnder(target, theoServerDir)) {\n throw new ServerOnlyImportError({\n module: frameworkServerSpecifier(target, theoServerDir),\n importer: forHumans(importer, projectRoot),\n })\n }\n\n if (isUnder(target, serverDir) && !isUnder(target, isomorphicSchemasDir)) {\n throw new ServerOnlyImportError({\n module: forHumans(nameSourceFile(target), projectRoot),\n importer: forHumans(importer, projectRoot),\n specifier: source,\n })\n }\n }\n\n return undefined\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAKA,SAAS,YAAY,gBAAgB;AACrC,SAAS,SAAS,YAAY,MAAM,UAAU,eAAe;AAC7D,SAAS,qBAAqB;AAkB9B,IAAM,wBAAwB;AAG9B,IAAM,oBAAoB,CAAC,OAAO,QAAQ,OAAO,QAAQ,QAAQ,QAAQ,QAAQ,MAAM;AA0BhF,IAAM,wBAAN,cAAoC,MAAM;AAAA,EAC7B,OAAO;AAAA;AAAA,EAEhB;AAAA;AAAA,EAEA;AAAA,EAET,YAAY,MAAoC;AAC9C,UAAM,qBAAqB,KAAK,cAAc,UAAa,KAAK,cAAc,KAAK;AACnF,UAAM,UAAU;AAAA,MACd,4CAA4C,KAAK,MAAM;AAAA,MACvD;AAAA,MACA,eAAe,KAAK,MAAM;AAAA,MAC1B,GAAI,qBAAqB,CAAC,eAAe,OAAO,KAAK,SAAS,CAAC,EAAE,IAAI,CAAC;AAAA,MACtE,eAAe,KAAK,QAAQ;AAAA,MAC5B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,+BAA+B,KAAK,aAAa,KAAK,MAAM;AAAA,MAC5D;AAAA,MACA;AAAA,MACA;AAAA,IACF,EAAE,KAAK,IAAI;AACX,UAAM,OAAO;AACb,SAAK,SAAS,KAAK;AACnB,SAAK,WAAW,KAAK;AAAA,EACvB;AACF;AAGA,SAAS,QAAQ,OAAe,QAAyB;AACvD,QAAM,MAAM,SAAS,QAAQ,KAAK;AAClC,SAAO,QAAQ,MAAM,CAAC,IAAI,WAAW,IAAI,KAAK,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BAAsB;AAAA,UAC9B,QAAQ;AAAA,UACR,UAAU,UAAU,UAAU,WAAW;AAAA,QAC3C,CAAC;AAAA,MACH;AAIA,UAAI,OAAO,WAAW,GAAG,KAAK,WAAW,MAAM,GAAG;AAChD,cAAM,SAAS,WAAW,MAAM,IAAI,SAAS,QAAQ,QAAQ,QAAQ,GAAG,MAAM;AAK9E,YAAI,QAAQ,QAAQ,aAAa,GAAG;AAClC,gBAAM,IAAI,sBAAsB;AAAA,YAC9B,QAAQ,yBAAyB,QAAQ,aAAa;AAAA,YACtD,UAAU,UAAU,UAAU,WAAW;AAAA,UAC3C,CAAC;AAAA,QACH;AAEA,YAAI,QAAQ,QAAQ,SAAS,KAAK,CAAC,QAAQ,QAAQ,oBAAoB,GAAG;AACxE,gBAAM,IAAI,sBAAsB;AAAA,YAC9B,QAAQ,UAAU,eAAe,MAAM,GAAG,WAAW;AAAA,YACrD,UAAU,UAAU,UAAU,WAAW;AAAA,YACzC,WAAW;AAAA,UACb,CAAC;AAAA,QACH;AAAA,MACF;AAEA,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/vite-plugin/server-boundary.ts"],"sourcesContent":["/* eslint-disable security/detect-non-literal-fs-filename --\n * Build-time boundary check. The only paths handed to `fs` are derived from an import specifier\n * already inside the module graph, and every one of them is on the throw path — the check has\n * already decided to fail the build by the time a file is probed. No HTTP input reaches here.\n */\nimport { existsSync, statSync } from 'node:fs'\nimport { dirname, isAbsolute, join, relative, resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nimport type { Plugin } from 'vite'\n\nimport { ACTION_SCHEMAS_DIR } from '../server/internal-api.js'\n\nimport { resolveTheoRootDir } from './resolve-theo-root.js'\n\n/**\n * The framework's server surface, as one specifier.\n *\n * Every server entry point in `packages/theo/package.json` is `./server` or a `./server/<name>`\n * subpath, so this prefix covers the whole surface without listing it — and a subpath added to the\n * `exports` map tomorrow is covered on the day it ships rather than the day someone remembers this\n * file. `tests/unit/server-boundary-rule.test.ts` reads that map and\n * asserts the correspondence in both directions, so the prefix cannot quietly start over- or\n * under-matching.\n */\nconst THEO_SERVER_SPECIFIER = 'theokit/server'\n\n/** Extensions the boundary probes when naming the file behind a specifier. */\nconst SOURCE_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx', '.mts', '.mjs', '.cts', '.cjs'] as const\n\ninterface ServerOnlyImportErrorOptions {\n /** The server-only module, named the way the reader should recognise it. */\n module: string\n /** The file whose import statement crossed the boundary. */\n importer: string\n /** The specifier exactly as written, when it differs from `module`. */\n specifier?: string\n}\n\n/**\n * Thrown by the server-only import boundary when a module that runs on the server is pulled into\n * the CLIENT module graph.\n *\n * The failure it replaces was not the absence of one. `theokit build` already failed on this\n * mistake — with `\"resolve\" is not exported by \"__vite-browser-external\"`, pointing at a framework\n * chunk, after thirty lines of externalisation warnings (usetheokit/theokit#373). That names the\n * bundler's difficulty, not the author's. Worse, it is an accident: it happens because Node\n * builtins do not exist in a browser, so a server module that imported none of them would have\n * bundled cleanly and shipped.\n *\n * This error makes the boundary a rule instead of a side effect, and names the two things the\n * author needs — the module, and the file that imported it — the way `RouterConventionError` and\n * `MissingRoutePolicyError` already do for a bad route filename and an undeclared policy.\n */\nexport class ServerOnlyImportError extends Error {\n override readonly name = 'ServerOnlyImportError'\n /** The server-only module, as named in the message. */\n readonly module: string\n /** The importing file, as named in the message. */\n readonly importer: string\n\n constructor(opts: ServerOnlyImportErrorOptions) {\n const wroteSomethingElse = opts.specifier !== undefined && opts.specifier !== opts.module\n const message = [\n `Server-only import in the client bundle: ${opts.module} cannot be imported from client code.`,\n ``,\n ` Imported: ${opts.module}`,\n ...(wroteSomethingElse ? [` Written: ${String(opts.specifier)}`] : []),\n ` From: ${opts.importer}`,\n ``,\n `That module runs on the server. It reads the file system, opens the database and holds`,\n `your secrets, so a browser bundle containing it ships all three to every visitor.`,\n ``,\n `Call the server from client code instead:`,\n ``,\n // Both bindings are the ones the virtual modules actually export — `client` from\n // `app-typed-client.ts` and `actions` from `actions-virtual-module.ts`. A remedy naming a\n // symbol nobody exports reads as actionable and is not, so\n // `tests/unit/server-boundary-rule.test.ts` asserts both against the emitters — the same\n // discipline `tests/unit/policy-gate-remedy-is-importable.test.ts` applies to the policy gate.\n ` import { client } from '@theo/client' // typed from your server/routes/**`,\n ` import { actions } from '@theo/actions' // typed from your server/actions/**`,\n ``,\n `Need only the TYPES? Add \\`type\\` to the import — a type-only import is erased before the`,\n `bundler ever sees it:`,\n ``,\n ` import type { ... } from '${opts.specifier ?? opts.module}'`,\n ``,\n `And if this file is itself server code, move it under your server directory, so the client`,\n `graph has no way to reach it.`,\n ].join('\\n')\n super(message)\n this.module = opts.module\n this.importer = opts.importer\n }\n}\n\n/** True when `child` is inside `parent` (and is not `parent` itself). */\nfunction isUnder(child: string, parent: string): boolean {\n const rel = relative(parent, child)\n return rel !== '' && !rel.startsWith('..') && !isAbsolute(rel)\n}\n\n/**\n * Name the file a specifier points at.\n *\n * A TypeScript ESM import writes `./health.js` for a file called `health.ts`, and an author told\n * to look at `server/routes/health.js` will open a file that does not exist. Runs only when the\n * boundary has already decided to throw, so the probing costs nothing on a passing build; falls\n * back to the unresolved path rather than inventing one.\n */\nfunction nameSourceFile(target: string): string {\n if (existsSync(target) && statSync(target).isFile()) return target\n const stem = target.replace(/\\.[cm]?[jt]sx?$/, '')\n for (const ext of SOURCE_EXTENSIONS) {\n if (existsSync(`${stem}${ext}`)) return `${stem}${ext}`\n }\n for (const ext of SOURCE_EXTENSIONS) {\n if (existsSync(join(target, `index${ext}`))) return join(target, `index${ext}`)\n }\n return target\n}\n\n/** Render a path relative to the project root, keeping it absolute when it lives outside. */\nfunction forHumans(path: string, projectRoot: string): string {\n return isUnder(path, projectRoot) ? relative(projectRoot, path) : path\n}\n\n/**\n * Name a file inside the framework's own server tree the way its `package.json` publishes it.\n *\n * Two normalisations, both undoing something a bundler did to a specifier the author never wrote:\n *\n * - **The alias mangle.** `config-hook.ts` aliases the STRING `theokit/server` to a FILE, and a\n * Vite string alias replaces by prefix, so `theokit/server/define` reaches this plugin as\n * `…/server/index.ts/define`. That mid-path `/index.ts/` is the mangle — the same shape that\n * surfaced as `ENOTDIR` in usetheokit/theokit#373 — and stripping it recovers `define`.\n * - **The barrel file.** `./server` and `./server/define` publish as `…/index.js` in `dist` and\n * `…/index.ts` in source; a trailing barrel segment is not part of the specifier.\n *\n * The result is the string a reader can grep for in `packages/theo/package.json`.\n */\nfunction frameworkServerSpecifier(target: string, theoServerDir: string): string {\n const demangled = target.replace(/[\\\\/]index\\.[cm]?[jt]sx?(?=[\\\\/])/, '')\n const subpath = relative(theoServerDir, demangled)\n .replace(/\\\\/g, '/')\n .replace(/(^|\\/)index\\.[cm]?[jt]sx?$/, '')\n return subpath === '' ? THEO_SERVER_SPECIFIER : `${THEO_SERVER_SPECIFIER}/${subpath}`\n}\n\nexport interface ServerBoundaryOptions {\n /** Absolute project root — paths in the message are shown relative to it. */\n projectRoot: string\n /** Absolute backend root (config `serverDir`, default `<projectRoot>/server`). */\n serverDir: string\n}\n\n/**\n * Refuse a server-only module in the client module graph, by name.\n *\n * ## Where the check lives, and why here\n *\n * In `resolveId`, at `enforce: 'pre'`. Three reasons, in the order they mattered:\n *\n * 1. **It is the only hook that sees the triple the message needs** — specifier, importer, and\n * whether this is the client graph or the SSR one. A `package.json` `exports` map has no\n * client/server condition a bundler honours for a build, and a standalone gate over `dist/`\n * would have to rebuild the module graph Rollup just built.\n * 2. **`pre` runs ahead of the alias cascade.** `config-hook.ts` aliases `theokit/server` to a\n * FILE, and a Vite string alias matches by prefix, so `theokit/server/define` used to resolve\n * to `…/server/index.js/define` and fail with `ENOTDIR` — the second half of #373. Catching the\n * specifier before the alias replaces it turns that into the same named refusal as the bare\n * import. (The alias bug itself is untouched here — it is usetheokit/theokit#377, and it still\n * breaks `theokit/client/core`, a published entry point that no boundary should refuse.)\n * 3. **It is on the path a consumer runs.** `theokit build` → `runAdapterBuild` → `nodeAdapter` →\n * `viteBuild({ plugins: await ctx.makeVitePlugins(…) })` → `theoPluginAsync`, which returns this\n * plugin. Nothing has to opt in, and `tests/integration/server-only-import-boundary.test.ts`\n * exercises that chain rather than calling the hook.\n *\n * ## What counts as server-only\n *\n * Two rules, and one exception that is not a special case so much as the framework's own\n * declaration:\n *\n * - Anything under the published `theokit/server` surface (see {@link THEO_SERVER_SPECIFIER}).\n * - Anything under the project's own `serverDir`, EXCEPT `actions/<ACTION_SCHEMAS_DIR>/**`, which\n * the `@theo/actions` facade deliberately imports into the client bundle. The exception reads\n * the same constant the action scanner uses, so renaming the convention cannot turn a shipped\n * feature into a build error on one side only.\n *\n * The second rule exists so the message names the page the author wrote. Without it a client page\n * importing `server/routes/health.ts` still fails — health.ts imports `theokit/server/define` — but\n * the importer named is `health.ts`, one hop away from the mistake.\n *\n * ## What it deliberately does not do\n *\n * It does not walk the import chain to report how a deeply nested server module was reached, and it\n * does not fire on the SSR graph, in `theokit build --target` SSR passes or under `ssrLoadModule`,\n * where importing server code is the entire point.\n */\nexport function serverOnlyImportBoundary(opts: ServerBoundaryOptions): Plugin {\n const projectRoot = opts.projectRoot\n const serverDir = opts.serverDir\n const isomorphicSchemasDir = join(serverDir, 'actions', ACTION_SCHEMAS_DIR)\n // The framework's own server tree on disk — `src/server` in this workspace, `dist/server` in an\n // installed copy. Resolved through the same helper `theoPlugin()` uses for its aliases, so the\n // boundary and the aliases can never point at different trees.\n const theoServerDir = join(resolveTheoRootDir(dirname(fileURLToPath(import.meta.url))), 'server')\n\n return {\n name: 'theo:server-only-import-boundary',\n enforce: 'pre',\n\n resolveId(source, importer, options) {\n // The SSR graph is allowed — and required — to import server code.\n if (options.ssr === true) return undefined\n // An entry point has no importer, so the message could not name one. A `theokit/server`\n // entry is a deliberate act in someone's Vite config, not the accident this catches.\n if (importer === undefined) return undefined\n\n // The specifier as the author wrote it. Reached only when no alias rewrote it first —\n // Vite's own alias plugin runs ahead of every `enforce: 'pre'` plugin, and `config-hook.ts`\n // installs an alias for exactly this prefix. Kept anyway so the boundary holds for a\n // consumer whose Vite config does not carry that alias.\n if (source === THEO_SERVER_SPECIFIER || source.startsWith(`${THEO_SERVER_SPECIFIER}/`)) {\n throw new ServerOnlyImportError({\n module: source,\n importer: forHumans(importer, projectRoot),\n })\n }\n\n // A bare specifier can never be a file, so only relative and absolute sources are resolved —\n // which keeps the common case to two string comparisons.\n if (source.startsWith('.') || isAbsolute(source)) {\n const target = isAbsolute(source) ? source : resolve(dirname(importer), source)\n\n // The framework's server surface, recognised by PATH because that is the form it arrives\n // in after the alias. Matching the tree rather than the specifier also catches a deep\n // reach into `theokit`'s internals that no `exports` subpath names.\n if (isUnder(target, theoServerDir)) {\n throw new ServerOnlyImportError({\n module: frameworkServerSpecifier(target, theoServerDir),\n importer: forHumans(importer, projectRoot),\n })\n }\n\n if (isUnder(target, serverDir) && !isUnder(target, isomorphicSchemasDir)) {\n throw new ServerOnlyImportError({\n module: forHumans(nameSourceFile(target), projectRoot),\n importer: forHumans(importer, projectRoot),\n specifier: source,\n })\n }\n }\n\n return undefined\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAKA,SAAS,YAAY,gBAAgB;AACrC,SAAS,SAAS,YAAY,MAAM,UAAU,eAAe;AAC7D,SAAS,qBAAqB;AAkB9B,IAAM,wBAAwB;AAG9B,IAAM,oBAAoB,CAAC,OAAO,QAAQ,OAAO,QAAQ,QAAQ,QAAQ,QAAQ,MAAM;AA0BhF,IAAM,wBAAN,cAAoC,MAAM;AAAA,EAC7B,OAAO;AAAA;AAAA,EAEhB;AAAA;AAAA,EAEA;AAAA,EAET,YAAY,MAAoC;AAC9C,UAAM,qBAAqB,KAAK,cAAc,UAAa,KAAK,cAAc,KAAK;AACnF,UAAM,UAAU;AAAA,MACd,4CAA4C,KAAK,MAAM;AAAA,MACvD;AAAA,MACA,eAAe,KAAK,MAAM;AAAA,MAC1B,GAAI,qBAAqB,CAAC,eAAe,OAAO,KAAK,SAAS,CA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22 @@
1
1
  import {
2
2
  resolveTheoRootDir
3
3
  } from "./chunk-7NRFZBAL.js";
4
- import "./chunk-D7STTNQN.js";
5
- import "./chunk-R4AMIBZL.js";
4
+ import "./chunk-2FZYZHZM.js";
5
+ import "./chunk-GLD7UXOG.js";
6
6
  import "./chunk-WSOAN4KN.js";
7
7
  import "./chunk-ENSFCKP6.js";
8
- import "./chunk-2Z7TANA4.js";
9
- import "./chunk-SYIQV4UH.js";
8
+ import "./chunk-PVI6HM6E.js";
9
+ import "./chunk-33DGAR6Q.js";
10
10
  import "./chunk-P6OS7652.js";
11
11
  import "./chunk-ZDUO4IYN.js";
12
12
  import "./chunk-IDWN2OSG.js";
13
13
  import "./chunk-47FFT43U.js";
14
14
  import "./chunk-NTDN54XO.js";
15
- import "./chunk-PVNMLZ5G.js";
16
- import "./chunk-ZDCCILMP.js";
17
- import "./chunk-CHTAWXC2.js";
15
+ import "./chunk-JO462JZM.js";
16
+ import "./chunk-IXXZBZF7.js";
18
17
  import "./chunk-AVQU5CQF.js";
18
+ import "./chunk-TQTEKNOL.js";
19
+ import "./chunk-CHTAWXC2.js";
19
20
  import "./chunk-VSLTKX5L.js";
20
21
  import "./chunk-SFGGRC35.js";
21
22
  import "./chunk-4Z5XO4O4.js";
@@ -27,7 +28,8 @@ import "./chunk-DV34VG3N.js";
27
28
  import "./chunk-V6Y2SMRG.js";
28
29
  import "./chunk-ACKBVBUI.js";
29
30
  import "./chunk-IZ3TIL6K.js";
30
- import "./chunk-ICXXHV4V.js";
31
+ import "./chunk-54BIQFP4.js";
32
+ import "./chunk-ZICY2CD7.js";
31
33
  import "./chunk-YSJOZEI6.js";
32
34
  import "./chunk-Z4PJMZLM.js";
33
35
  import "./chunk-UMNXCU3K.js";
@@ -147,4 +149,4 @@ export {
147
149
  ServerOnlyImportError,
148
150
  serverOnlyImportBoundary
149
151
  };
150
- //# sourceMappingURL=server-boundary-HYLYGFZY.js.map
152
+ //# sourceMappingURL=server-boundary-WSGVQAXP.js.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