@pithy-sh/core 0.1.2 → 0.1.4

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 (393) hide show
  1. package/dist/address/address.d.ts +57 -0
  2. package/dist/address/address.d.ts.map +1 -0
  3. package/dist/address/address.js +71 -0
  4. package/dist/audit/auditEvent.d.ts +89 -0
  5. package/dist/audit/auditEvent.d.ts.map +1 -0
  6. package/dist/audit/auditEvent.js +69 -0
  7. package/dist/audit/recorder.d.ts +18 -0
  8. package/dist/audit/recorder.d.ts.map +1 -0
  9. package/dist/audit/recorder.js +8 -0
  10. package/dist/capability/bindings.d.ts +62 -0
  11. package/dist/capability/bindings.d.ts.map +1 -0
  12. package/dist/capability/bindings.js +97 -0
  13. package/dist/capability/capability.d.ts +501 -0
  14. package/dist/capability/capability.d.ts.map +1 -0
  15. package/dist/capability/capability.js +16 -0
  16. package/dist/capability/client.d.ts +70 -0
  17. package/dist/capability/client.d.ts.map +1 -0
  18. package/dist/capability/client.js +86 -0
  19. package/dist/capability/compose.d.ts +25 -0
  20. package/dist/capability/compose.d.ts.map +1 -0
  21. package/dist/capability/compose.js +54 -0
  22. package/dist/capability/composition.d.ts +26 -0
  23. package/dist/capability/composition.d.ts.map +1 -0
  24. package/dist/capability/composition.js +84 -0
  25. package/dist/capability/config.d.ts +7 -0
  26. package/dist/capability/config.d.ts.map +1 -0
  27. package/dist/capability/config.js +14 -0
  28. package/dist/capability/devSecret.d.ts +32 -0
  29. package/dist/capability/devSecret.d.ts.map +1 -0
  30. package/dist/capability/devSecret.js +28 -0
  31. package/dist/capability/manifest.d.ts +298 -0
  32. package/dist/capability/manifest.d.ts.map +1 -0
  33. package/dist/capability/manifest.js +356 -0
  34. package/dist/capability/secretOrigin.d.ts +121 -0
  35. package/dist/capability/secretOrigin.d.ts.map +1 -0
  36. package/dist/capability/secretOrigin.js +134 -0
  37. package/dist/capability/settings.d.ts +119 -0
  38. package/dist/capability/settings.d.ts.map +1 -0
  39. package/dist/capability/settings.js +66 -0
  40. package/dist/capability/validateBindings.d.ts +4 -0
  41. package/dist/capability/validateBindings.d.ts.map +1 -0
  42. package/dist/capability/validateBindings.js +34 -0
  43. package/dist/capability/vanishingKey.d.ts +31 -0
  44. package/dist/capability/vanishingKey.d.ts.map +1 -0
  45. package/dist/capability/vanishingKey.js +79 -0
  46. package/dist/controlPlane/audit/actions.d.ts +70 -0
  47. package/dist/controlPlane/audit/actions.d.ts.map +1 -0
  48. package/dist/controlPlane/audit/actions.js +76 -0
  49. package/dist/controlPlane/capability.d.ts +47 -0
  50. package/dist/controlPlane/capability.d.ts.map +1 -0
  51. package/dist/controlPlane/capability.js +138 -0
  52. package/dist/controlPlane/config/config.d.ts +19 -0
  53. package/dist/controlPlane/config/config.d.ts.map +1 -0
  54. package/dist/controlPlane/config/config.js +85 -0
  55. package/dist/controlPlane/context.d.ts +27 -0
  56. package/dist/controlPlane/context.d.ts.map +1 -0
  57. package/dist/controlPlane/context.js +29 -0
  58. package/dist/controlPlane/data/connection.d.ts +79 -0
  59. package/dist/controlPlane/data/connection.d.ts.map +1 -0
  60. package/dist/controlPlane/data/connection.js +55 -0
  61. package/dist/controlPlane/data/keyLifecycle.d.ts +62 -0
  62. package/dist/controlPlane/data/keyLifecycle.d.ts.map +1 -0
  63. package/dist/controlPlane/data/keyLifecycle.js +126 -0
  64. package/dist/controlPlane/data/replay.d.ts +18 -0
  65. package/dist/controlPlane/data/replay.d.ts.map +1 -0
  66. package/dist/controlPlane/data/replay.js +20 -0
  67. package/dist/controlPlane/data/tables.d.ts +34 -0
  68. package/dist/controlPlane/data/tables.d.ts.map +1 -0
  69. package/dist/controlPlane/data/tables.js +37 -0
  70. package/dist/controlPlane/discovery/adminRoute.d.ts +313 -0
  71. package/dist/controlPlane/discovery/adminRoute.d.ts.map +1 -0
  72. package/dist/controlPlane/discovery/adminRoute.js +136 -0
  73. package/dist/controlPlane/discovery/configuration.d.ts +108 -0
  74. package/dist/controlPlane/discovery/configuration.d.ts.map +1 -0
  75. package/dist/controlPlane/discovery/configuration.js +187 -0
  76. package/dist/controlPlane/discovery/drift.d.ts +64 -0
  77. package/dist/controlPlane/discovery/drift.d.ts.map +1 -0
  78. package/dist/controlPlane/discovery/drift.js +58 -0
  79. package/dist/controlPlane/discovery/health.d.ts +99 -0
  80. package/dist/controlPlane/discovery/health.d.ts.map +1 -0
  81. package/dist/controlPlane/discovery/health.js +151 -0
  82. package/dist/controlPlane/discovery/healthSummary.d.ts +236 -0
  83. package/dist/controlPlane/discovery/healthSummary.d.ts.map +1 -0
  84. package/dist/controlPlane/discovery/healthSummary.js +278 -0
  85. package/dist/controlPlane/error/errors.d.ts +67 -0
  86. package/dist/controlPlane/error/errors.d.ts.map +1 -0
  87. package/dist/controlPlane/error/errors.js +79 -0
  88. package/dist/controlPlane/http/cors.d.ts +112 -0
  89. package/dist/controlPlane/http/cors.d.ts.map +1 -0
  90. package/dist/controlPlane/http/cors.js +192 -0
  91. package/dist/controlPlane/http/guard.d.ts +77 -0
  92. package/dist/controlPlane/http/guard.d.ts.map +1 -0
  93. package/dist/controlPlane/http/guard.js +142 -0
  94. package/dist/controlPlane/http/handlers.d.ts +179 -0
  95. package/dist/controlPlane/http/handlers.d.ts.map +1 -0
  96. package/dist/controlPlane/http/handlers.js +245 -0
  97. package/dist/controlPlane/http/responses.d.ts +99 -0
  98. package/dist/controlPlane/http/responses.d.ts.map +1 -0
  99. package/dist/controlPlane/http/responses.js +63 -0
  100. package/dist/controlPlane/http/routes.d.ts +40 -0
  101. package/dist/controlPlane/http/routes.d.ts.map +1 -0
  102. package/dist/controlPlane/http/routes.js +83 -0
  103. package/dist/controlPlane/http/schemas.d.ts +39 -0
  104. package/dist/controlPlane/http/schemas.d.ts.map +1 -0
  105. package/dist/controlPlane/http/schemas.js +31 -0
  106. package/dist/controlPlane/http/verify.d.ts +84 -0
  107. package/dist/controlPlane/http/verify.d.ts.map +1 -0
  108. package/dist/controlPlane/http/verify.js +65 -0
  109. package/dist/controlPlane/migrations/0001_init.d.ts +51 -0
  110. package/dist/controlPlane/migrations/0001_init.d.ts.map +1 -0
  111. package/dist/controlPlane/migrations/0001_init.js +65 -0
  112. package/dist/controlPlane/replay/d1Guard.d.ts +29 -0
  113. package/dist/controlPlane/replay/d1Guard.d.ts.map +1 -0
  114. package/dist/controlPlane/replay/d1Guard.js +39 -0
  115. package/dist/controlPlane/replay/guard.d.ts +52 -0
  116. package/dist/controlPlane/replay/guard.d.ts.map +1 -0
  117. package/dist/controlPlane/replay/guard.js +0 -0
  118. package/dist/controlPlane/replay/kvGuard.d.ts +99 -0
  119. package/dist/controlPlane/replay/kvGuard.d.ts.map +1 -0
  120. package/dist/controlPlane/replay/kvGuard.js +101 -0
  121. package/dist/controlPlane/scope/scope.d.ts +68 -0
  122. package/dist/controlPlane/scope/scope.d.ts.map +1 -0
  123. package/dist/controlPlane/scope/scope.js +63 -0
  124. package/dist/controlPlane/token/base64url.d.ts +10 -0
  125. package/dist/controlPlane/token/base64url.d.ts.map +1 -0
  126. package/dist/controlPlane/token/base64url.js +48 -0
  127. package/dist/controlPlane/token/claims.d.ts +83 -0
  128. package/dist/controlPlane/token/claims.d.ts.map +1 -0
  129. package/dist/controlPlane/token/claims.js +86 -0
  130. package/dist/controlPlane/token/digest.d.ts +44 -0
  131. package/dist/controlPlane/token/digest.d.ts.map +1 -0
  132. package/dist/controlPlane/token/digest.js +56 -0
  133. package/dist/controlPlane/token/jws.d.ts +52 -0
  134. package/dist/controlPlane/token/jws.d.ts.map +1 -0
  135. package/dist/controlPlane/token/jws.js +65 -0
  136. package/dist/controlPlane/token/mint.d.ts +56 -0
  137. package/dist/controlPlane/token/mint.d.ts.map +1 -0
  138. package/dist/controlPlane/token/mint.js +55 -0
  139. package/dist/controlPlane/wire.d.ts +122 -0
  140. package/dist/controlPlane/wire.d.ts.map +1 -0
  141. package/dist/controlPlane/wire.js +123 -0
  142. package/dist/createBackend.d.ts +58 -0
  143. package/dist/createBackend.d.ts.map +1 -0
  144. package/dist/createBackend.js +170 -0
  145. package/dist/createEntrypoint.d.ts +53 -0
  146. package/dist/createEntrypoint.d.ts.map +1 -0
  147. package/dist/createEntrypoint.js +52 -0
  148. package/dist/data/boundParameters.d.ts +83 -0
  149. package/dist/data/boundParameters.d.ts.map +1 -0
  150. package/dist/data/boundParameters.js +162 -0
  151. package/dist/data/codecs.d.ts +34 -0
  152. package/dist/data/codecs.d.ts.map +1 -0
  153. package/dist/data/codecs.js +135 -0
  154. package/dist/data/cursor.d.ts +81 -0
  155. package/dist/data/cursor.d.ts.map +1 -0
  156. package/dist/data/cursor.js +104 -0
  157. package/dist/data/databases.d.ts +55 -0
  158. package/dist/data/databases.d.ts.map +1 -0
  159. package/dist/data/databases.js +32 -0
  160. package/dist/data/db.d.ts +42 -0
  161. package/dist/data/db.d.ts.map +1 -0
  162. package/dist/data/db.js +24 -0
  163. package/dist/data/withD1Retry.d.ts +91 -0
  164. package/dist/data/withD1Retry.d.ts.map +1 -0
  165. package/dist/data/withD1Retry.js +152 -0
  166. package/dist/entitlement/entitlement.d.ts +118 -0
  167. package/dist/entitlement/entitlement.d.ts.map +1 -0
  168. package/dist/entitlement/entitlement.js +59 -0
  169. package/dist/entitlement/gateScan.d.ts +26 -0
  170. package/dist/entitlement/gateScan.d.ts.map +1 -0
  171. package/dist/entitlement/gateScan.js +96 -0
  172. package/dist/entitlement/require.d.ts +12 -0
  173. package/dist/entitlement/require.d.ts.map +1 -0
  174. package/dist/entitlement/require.js +123 -0
  175. package/dist/env/ambient.d.ts +52 -0
  176. package/dist/env/ambient.d.ts.map +1 -0
  177. package/dist/env/ambient.js +35 -0
  178. package/dist/env/ci.d.ts +36 -0
  179. package/dist/env/ci.d.ts.map +1 -0
  180. package/dist/env/ci.js +40 -0
  181. package/dist/env/stem.d.ts +23 -0
  182. package/dist/env/stem.d.ts.map +1 -0
  183. package/dist/env/stem.js +29 -0
  184. package/dist/error/cause.d.ts +143 -0
  185. package/dist/error/cause.d.ts.map +1 -0
  186. package/dist/error/cause.js +192 -0
  187. package/dist/error/client.d.ts +35 -0
  188. package/dist/error/client.d.ts.map +1 -0
  189. package/dist/error/client.js +38 -0
  190. package/dist/error/extend.d.ts +101 -0
  191. package/dist/error/extend.d.ts.map +1 -0
  192. package/dist/error/extend.js +76 -0
  193. package/dist/error/http.d.ts +1516 -0
  194. package/dist/error/http.d.ts.map +1 -0
  195. package/dist/error/http.js +72 -0
  196. package/dist/error/payload.d.ts +3034 -0
  197. package/dist/error/payload.d.ts.map +1 -0
  198. package/dist/error/payload.js +1110 -0
  199. package/dist/error/pithyError.d.ts +154 -0
  200. package/dist/error/pithyError.d.ts.map +1 -0
  201. package/dist/error/pithyError.js +197 -0
  202. package/dist/error/terminal.d.ts +28 -0
  203. package/dist/error/terminal.d.ts.map +1 -0
  204. package/dist/error/terminal.js +33 -0
  205. package/dist/http/authContext.d.ts +21 -0
  206. package/dist/http/authContext.d.ts.map +1 -0
  207. package/dist/http/authContext.js +23 -0
  208. package/dist/http/routeContract.d.ts +39 -0
  209. package/dist/http/routeContract.d.ts.map +1 -0
  210. package/dist/http/routeContract.js +82 -0
  211. package/dist/http/sameOrigin.d.ts +47 -0
  212. package/dist/http/sameOrigin.d.ts.map +1 -0
  213. package/dist/http/sameOrigin.js +24 -0
  214. package/dist/http/signedWebhook.d.ts +225 -0
  215. package/dist/http/signedWebhook.d.ts.map +1 -0
  216. package/dist/http/signedWebhook.js +247 -0
  217. package/dist/http/validation.d.ts +37 -0
  218. package/dist/http/validation.d.ts.map +1 -0
  219. package/dist/http/validation.js +14 -0
  220. package/dist/http/verification.d.ts +10 -0
  221. package/dist/http/verification.d.ts.map +1 -0
  222. package/dist/http/verification.js +17 -0
  223. package/dist/i18n/acceptLanguage.d.ts +22 -0
  224. package/dist/i18n/acceptLanguage.d.ts.map +1 -0
  225. package/dist/i18n/acceptLanguage.js +55 -0
  226. package/dist/i18n/catalog.d.ts +39 -0
  227. package/dist/i18n/catalog.d.ts.map +1 -0
  228. package/dist/i18n/catalog.js +57 -0
  229. package/dist/i18n/locale.d.ts +74 -0
  230. package/dist/i18n/locale.d.ts.map +1 -0
  231. package/dist/i18n/locale.js +109 -0
  232. package/dist/i18n/localeMarker.d.ts +29 -0
  233. package/dist/i18n/localeMarker.d.ts.map +1 -0
  234. package/dist/i18n/localeMarker.js +112 -0
  235. package/dist/i18n/match.d.ts +26 -0
  236. package/dist/i18n/match.d.ts.map +1 -0
  237. package/dist/i18n/match.js +88 -0
  238. package/dist/i18n/registry.d.ts +25 -0
  239. package/dist/i18n/registry.d.ts.map +1 -0
  240. package/dist/i18n/registry.js +51 -0
  241. package/dist/i18n/translator.d.ts +107 -0
  242. package/dist/i18n/translator.d.ts.map +1 -0
  243. package/dist/i18n/translator.js +80 -0
  244. package/dist/index.d.ts +32 -0
  245. package/dist/index.d.ts.map +1 -0
  246. package/dist/index.js +17 -0
  247. package/dist/kv/kv.d.ts +166 -0
  248. package/dist/kv/kv.d.ts.map +1 -0
  249. package/dist/kv/kv.js +261 -0
  250. package/dist/kv/namespaces.d.ts +58 -0
  251. package/dist/kv/namespaces.d.ts.map +1 -0
  252. package/dist/kv/namespaces.js +40 -0
  253. package/dist/logger/local.d.ts +41 -0
  254. package/dist/logger/local.d.ts.map +1 -0
  255. package/dist/logger/local.js +45 -0
  256. package/dist/logger/logger.d.ts +56 -0
  257. package/dist/logger/logger.d.ts.map +1 -0
  258. package/dist/logger/logger.js +83 -0
  259. package/dist/logger/record.d.ts +919 -0
  260. package/dist/logger/record.d.ts.map +1 -0
  261. package/dist/logger/record.js +79 -0
  262. package/dist/logger/worker.d.ts +74 -0
  263. package/dist/logger/worker.d.ts.map +1 -0
  264. package/dist/logger/worker.js +54 -0
  265. package/dist/migrations/batch.d.ts +10 -0
  266. package/dist/migrations/batch.d.ts.map +1 -0
  267. package/dist/migrations/batch.js +193 -0
  268. package/dist/migrations/bookkeeping.d.ts +24 -0
  269. package/dist/migrations/bookkeeping.d.ts.map +1 -0
  270. package/dist/migrations/bookkeeping.js +57 -0
  271. package/dist/migrations/owner.d.ts +41 -0
  272. package/dist/migrations/owner.d.ts.map +1 -0
  273. package/dist/migrations/owner.js +105 -0
  274. package/dist/migrations/registry.d.ts +36 -0
  275. package/dist/migrations/registry.d.ts.map +1 -0
  276. package/dist/migrations/registry.js +70 -0
  277. package/dist/migrations/runner.d.ts +67 -0
  278. package/dist/migrations/runner.d.ts.map +1 -0
  279. package/dist/migrations/runner.js +218 -0
  280. package/dist/naming/domains.d.ts +108 -0
  281. package/dist/naming/domains.d.ts.map +1 -0
  282. package/dist/naming/domains.js +156 -0
  283. package/dist/naming/environment.d.ts +118 -0
  284. package/dist/naming/environment.d.ts.map +1 -0
  285. package/dist/naming/environment.js +190 -0
  286. package/dist/naming/feature.d.ts +68 -0
  287. package/dist/naming/feature.d.ts.map +1 -0
  288. package/dist/naming/feature.js +106 -0
  289. package/dist/naming/limits.d.ts +229 -0
  290. package/dist/naming/limits.d.ts.map +1 -0
  291. package/dist/naming/limits.js +187 -0
  292. package/dist/naming/provisionScope.d.ts +91 -0
  293. package/dist/naming/provisionScope.d.ts.map +1 -0
  294. package/dist/naming/provisionScope.js +65 -0
  295. package/dist/naming/resource.d.ts +169 -0
  296. package/dist/naming/resource.d.ts.map +1 -0
  297. package/dist/naming/resource.js +220 -0
  298. package/dist/naming/resourceNames.d.ts +83 -0
  299. package/dist/naming/resourceNames.d.ts.map +1 -0
  300. package/dist/naming/resourceNames.js +102 -0
  301. package/dist/naming/segment.d.ts +29 -0
  302. package/dist/naming/segment.d.ts.map +1 -0
  303. package/dist/naming/segment.js +31 -0
  304. package/dist/projection/asRead.d.ts +72 -0
  305. package/dist/projection/asRead.d.ts.map +1 -0
  306. package/dist/projection/asRead.js +169 -0
  307. package/dist/projection/published.d.ts +95 -0
  308. package/dist/projection/published.d.ts.map +1 -0
  309. package/dist/projection/published.js +114 -0
  310. package/dist/schema/describedness.d.ts +55 -0
  311. package/dist/schema/describedness.d.ts.map +1 -0
  312. package/dist/schema/describedness.js +180 -0
  313. package/dist/seed/compose.d.ts +41 -0
  314. package/dist/seed/compose.d.ts.map +1 -0
  315. package/dist/seed/compose.js +51 -0
  316. package/dist/seed/devLogin.d.ts +50 -0
  317. package/dist/seed/devLogin.d.ts.map +1 -0
  318. package/dist/seed/devLogin.js +52 -0
  319. package/dist/seed/exampleIdentities.d.ts +58 -0
  320. package/dist/seed/exampleIdentities.d.ts.map +1 -0
  321. package/dist/seed/exampleIdentities.js +26 -0
  322. package/dist/seed/metadata.d.ts +20 -0
  323. package/dist/seed/metadata.d.ts.map +1 -0
  324. package/dist/seed/metadata.js +27 -0
  325. package/dist/seed/seed.d.ts +264 -0
  326. package/dist/seed/seed.d.ts.map +1 -0
  327. package/dist/seed/seed.js +37 -0
  328. package/dist/seed/seededRows.d.ts +26 -0
  329. package/dist/seed/seededRows.d.ts.map +1 -0
  330. package/dist/seed/seededRows.js +20 -0
  331. package/dist/seed/writeD1.d.ts +43 -0
  332. package/dist/seed/writeD1.d.ts.map +1 -0
  333. package/dist/seed/writeD1.js +73 -0
  334. package/dist/seed/writeKv.d.ts +29 -0
  335. package/dist/seed/writeKv.d.ts.map +1 -0
  336. package/dist/seed/writeKv.js +63 -0
  337. package/dist/semver/semver.d.ts +62 -0
  338. package/dist/semver/semver.d.ts.map +1 -0
  339. package/dist/semver/semver.js +137 -0
  340. package/dist/text/comments.d.ts +62 -0
  341. package/dist/text/comments.d.ts.map +1 -0
  342. package/dist/text/comments.js +161 -0
  343. package/dist/version.generated.d.ts +5 -0
  344. package/dist/version.generated.d.ts.map +1 -0
  345. package/dist/version.generated.js +7 -0
  346. package/dist/worker/health.d.ts +39 -0
  347. package/dist/worker/health.d.ts.map +1 -0
  348. package/dist/worker/health.js +41 -0
  349. package/dist/worker/identity.d.ts +191 -0
  350. package/dist/worker/identity.d.ts.map +1 -0
  351. package/dist/worker/identity.js +162 -0
  352. package/dist/workflow/bindings.d.ts +41 -0
  353. package/dist/workflow/bindings.d.ts.map +1 -0
  354. package/dist/workflow/bindings.js +53 -0
  355. package/dist/workflow/dispatch.d.ts +98 -0
  356. package/dist/workflow/dispatch.d.ts.map +1 -0
  357. package/dist/workflow/dispatch.js +148 -0
  358. package/dist/workflow/dispatchRoute.d.ts +80 -0
  359. package/dist/workflow/dispatchRoute.d.ts.map +1 -0
  360. package/dist/workflow/dispatchRoute.js +134 -0
  361. package/dist/workflow/faults.d.ts +97 -0
  362. package/dist/workflow/faults.d.ts.map +1 -0
  363. package/dist/workflow/faults.js +111 -0
  364. package/dist/workflow/host.d.ts +176 -0
  365. package/dist/workflow/host.d.ts.map +1 -0
  366. package/dist/workflow/host.js +116 -0
  367. package/dist/workflow/hostEntry.d.ts +50 -0
  368. package/dist/workflow/hostEntry.d.ts.map +1 -0
  369. package/dist/workflow/hostEntry.js +24 -0
  370. package/dist/workflow/hostEnv.d.ts +143 -0
  371. package/dist/workflow/hostEnv.d.ts.map +1 -0
  372. package/dist/workflow/hostEnv.js +170 -0
  373. package/dist/workflow/loopback.d.ts +52 -0
  374. package/dist/workflow/loopback.d.ts.map +1 -0
  375. package/dist/workflow/loopback.js +76 -0
  376. package/dist/workflow/naming.d.ts +79 -0
  377. package/dist/workflow/naming.d.ts.map +1 -0
  378. package/dist/workflow/naming.js +138 -0
  379. package/dist/workflow/register.d.ts +19 -0
  380. package/dist/workflow/register.d.ts.map +1 -0
  381. package/dist/workflow/register.js +40 -0
  382. package/dist/workflow/schemas.d.ts +44 -0
  383. package/dist/workflow/schemas.d.ts.map +1 -0
  384. package/dist/workflow/schemas.js +43 -0
  385. package/dist/workflow/spec.d.ts +81 -0
  386. package/dist/workflow/spec.d.ts.map +1 -0
  387. package/dist/workflow/spec.js +0 -0
  388. package/dist/workflow/stepMessage.d.ts +122 -0
  389. package/dist/workflow/stepMessage.d.ts.map +1 -0
  390. package/dist/workflow/stepMessage.js +152 -0
  391. package/package.json +20 -9
  392. package/src/capability/manifest.ts +21 -0
  393. package/src/version.generated.ts +1 -1
@@ -0,0 +1,86 @@
1
+ import { fromZodError } from "../error/pithyError.js";
2
+ import { refusesVanishingKey } from "./vanishingKey.js";
3
+ import { z } from "zod";
4
+ //#region src/capability/client.ts
5
+ /**
6
+ * Who has to go and fix a projection that states a key which vanishes. The guard names them, and for a
7
+ * projection that is the capability author, not the adopter.
8
+ */
9
+ const SUBJECT = "A capability's client projection";
10
+ /** Whether a value is a plain record — `{}` or `Object.create(null)`, never a `Date`, `Map`, or class. */
11
+ function isPlainRecord(value) {
12
+ if (typeof value !== "object" || value === null) return false;
13
+ const prototype = Object.getPrototypeOf(value);
14
+ return prototype === Object.prototype || prototype === null;
15
+ }
16
+ /**
17
+ * The JSON value space, as a schema. `z.lazy` carries the recursion. The record branch is guarded by
18
+ * a plain-object check first: `z.record` alone accepts a `Date` (it has no own enumerable keys) and
19
+ * would quietly project it as `{}`. A non-finite number is rejected for the same reason — `JSON.stringify`
20
+ * turns `NaN` into `null`, which is a silent value change, not a projection.
21
+ *
22
+ * `refusesVanishingKey` is the third check of the same kind, and the one this schema was missing: a
23
+ * `__proto__` key written by a capability is dropped by `z.record` with no issue raised, so it never
24
+ * reaches the bundle and nothing says it was written. See `vanishingKey.ts`.
25
+ *
26
+ * It wraps the **whole value**, outside the union, and both halves of that matter. Whole value, because
27
+ * this is the recursion: every string, array and object in a projection is a `JsonValue`, so guarding it
28
+ * once covers a space nobody can enumerate, at a depth nobody has to predict. Non-objects pass the check
29
+ * by definition, so the cost is a `typeof` per node. Outside the union, because a refusal raised by one
30
+ * branch of a union is reported as the union's own — measured, the message for a key one level down was
31
+ * `Invalid input`, and out here it is the guard's own sentence at the key's own path.
32
+ *
33
+ * Below an array it is `Invalid union` again, with the guard's sentence nested in `issue.errors`. That is
34
+ * how this union reports every rejection it makes — a `Date` at the same depth reads the same way today —
35
+ * so it is the union's shape to fix, not this guard's, and it is written here so the next reader knows it
36
+ * was seen rather than missed.
37
+ */
38
+ const JsonValue = refusesVanishingKey(z.lazy(() => z.union([
39
+ z.string(),
40
+ z.number().refine((value) => Number.isFinite(value), { error: "Expected a finite number." }),
41
+ z.boolean(),
42
+ z.null(),
43
+ z.array(JsonValue),
44
+ z.custom(isPlainRecord, { error: "Expected a plain JSON object." }).pipe(z.record(z.string(), JsonValue))
45
+ ])), SUBJECT).describe("Any JSON value — string, finite number, boolean, null, array, or plain object.");
46
+ /**
47
+ * What a capability's client projection is resolved against. A projection is per build, not per
48
+ * request: the plugin inlines the result into the bundle, so the only axis it varies on is the
49
+ * environment being built for (a Turnstile sitekey differs between staging and production).
50
+ */
51
+ const ClientProjectionContext = z.object({ environment: z.string().min(1).describe("The environment this bundle is built for — `dev`, `staging`, `production`, or an adopter's own name. Per-environment config (a Turnstile sitekey) resolves against it.") }).describe("The build-time context a capability's client projection is resolved against.");
52
+ /**
53
+ * One capability's client-safe projection — the **only** values of its config that may reach a
54
+ * browser bundle. `enabled` is always present so a screen can branch (`false` means the capability is
55
+ * absent, or configured in a way this environment cannot render); everything else is the capability's
56
+ * own JSON, validated by the catchall. This validation is the security boundary of `virtual:pithy/*`:
57
+ * a capability cannot smuggle a function, a `Date`, or an unserializable value into the bundle, and a
58
+ * new config field never ships to browsers unless its capability adds it here on purpose.
59
+ *
60
+ * Guarded a second time, and this is the one place in the file where that is not redundant. `JsonValue`
61
+ * covers every object *inside* a projection; the projection's own top level is this object, parsed by the
62
+ * object branch rather than the record one, and Zod drops `__proto__` there too. So the recursion closes
63
+ * everything below the root and the root closes itself. Two sites, and the walk in `vanishingKey.test.ts`
64
+ * is what says they are the only two.
65
+ */
66
+ const PROJECTION_DESCRIPTION = "A capability's client-safe projection — the only config values that reach a browser bundle.";
67
+ const ClientProjection = refusesVanishingKey(z.object({ enabled: z.boolean().describe("Whether the capability is composed and usable in this environment. `false` means a screen must branch, not render.") }).catchall(JsonValue).describe(PROJECTION_DESCRIPTION), SUBJECT).describe(PROJECTION_DESCRIPTION);
68
+ /**
69
+ * Resolve one capability's client projection, validated. An absent capability, or one that declares no
70
+ * projection, is `{ enabled: false }` — never an error, because a front end is written against the
71
+ * capabilities it may have, not the ones it does. A declared projection is parsed through
72
+ * {@link ClientProjection}, so a non-JSON value is a build failure rather than a broken bundle.
73
+ */
74
+ function resolveClientProjection(capability, context) {
75
+ if (!capability?.client) return { enabled: false };
76
+ const resolvedContext = ClientProjectionContext.parse(context);
77
+ const projected = ClientProjection.safeParse(capability.client(resolvedContext));
78
+ if (!projected.success) throw fromZodError(projected.error, {
79
+ message: `The ${capability.name} capability's client projection is not JSON.`,
80
+ action: `Return only JSON values from the ${capability.name} capability's \`client\` projection — no functions, dates, or undefined.`,
81
+ detail: `environment=${resolvedContext.environment}`
82
+ });
83
+ return projected.data;
84
+ }
85
+ //#endregion
86
+ export { ClientProjection, ClientProjectionContext, JsonValue, resolveClientProjection };
@@ -0,0 +1,25 @@
1
+ import type { Capability } from "./capability";
2
+ /** A logical group bound to one CF binding, holding named items — D1 tables, or KV stores. */
3
+ export interface BindingGroup<Item> {
4
+ /** The CF binding this group lives in (a D1 or KV binding name in the Worker env). */
5
+ binding: string;
6
+ /** The named items in this group: table name → schema, or store name → spec. */
7
+ items: Record<string, Item>;
8
+ }
9
+ /**
10
+ * Adapt a capability's domain map (`databases`, `kvNamespaces`, …) — each entry a `{ binding, … }`
11
+ * spec — into the neutral {@link BindingGroup} shape `composeBindingGroups` consumes, projecting the
12
+ * domain item field (`tables`, `stores`) to `items`. One place to add the next binding type.
13
+ */
14
+ export declare function bindingGroupsFrom<Spec extends {
15
+ binding: string;
16
+ }, Item>(map: Record<string, Spec> | undefined, items: (spec: Spec) => Record<string, Item>): Record<string, BindingGroup<Item>> | undefined;
17
+ /**
18
+ * Merge a binding-backed group that capabilities contribute to — D1 `databases` (items are tables)
19
+ * or KV `kvNamespaces` (items are stores). Capabilities targeting the same group name merge their
20
+ * items (the project-wide contents, per group); a binding mismatch for one name, or an item name
21
+ * claimed twice in one group, is an author conflict caught here at assembly (internal — names are
22
+ * not secret). `groupLabel`/`itemLabel` make the error read in the caller's vocabulary.
23
+ */
24
+ export declare function composeBindingGroups<Item>(capabilities: Capability[], select: (cap: Capability) => Record<string, BindingGroup<Item>> | undefined, groupLabel: string, itemLabel: string): Record<string, BindingGroup<Item>>;
25
+ //# sourceMappingURL=compose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../../src/capability/compose.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,8FAA8F;AAC9F,MAAM,WAAW,YAAY,CAAC,IAAI;IAChC,sFAAsF;IACtF,OAAO,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,SAAS;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,IAAI,EACtE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,SAAS,EACrC,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAC1C,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAKhD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EACvC,YAAY,EAAE,UAAU,EAAE,EAC1B,MAAM,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,EAC3E,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,CAkCpC"}
@@ -0,0 +1,54 @@
1
+ import { InternalError } from "../error/pithyError.js";
2
+ //#region src/capability/compose.ts
3
+ /**
4
+ * Adapt a capability's domain map (`databases`, `kvNamespaces`, …) — each entry a `{ binding, … }`
5
+ * spec — into the neutral {@link BindingGroup} shape `composeBindingGroups` consumes, projecting the
6
+ * domain item field (`tables`, `stores`) to `items`. One place to add the next binding type.
7
+ */
8
+ function bindingGroupsFrom(map, items) {
9
+ if (!map) return void 0;
10
+ return Object.fromEntries(Object.entries(map).map(([name, spec]) => [name, {
11
+ binding: spec.binding,
12
+ items: items(spec)
13
+ }]));
14
+ }
15
+ /**
16
+ * Merge a binding-backed group that capabilities contribute to — D1 `databases` (items are tables)
17
+ * or KV `kvNamespaces` (items are stores). Capabilities targeting the same group name merge their
18
+ * items (the project-wide contents, per group); a binding mismatch for one name, or an item name
19
+ * claimed twice in one group, is an author conflict caught here at assembly (internal — names are
20
+ * not secret). `groupLabel`/`itemLabel` make the error read in the caller's vocabulary.
21
+ */
22
+ function composeBindingGroups(capabilities, select, groupLabel, itemLabel) {
23
+ const merged = {};
24
+ const groupOwner = {};
25
+ const itemOwners = /* @__PURE__ */ new Map();
26
+ for (const cap of capabilities) for (const [name, group] of Object.entries(select(cap) ?? {})) {
27
+ let target = merged[name];
28
+ let owners = itemOwners.get(name);
29
+ if (!target || !owners) {
30
+ target = {
31
+ binding: group.binding,
32
+ items: {}
33
+ };
34
+ owners = {};
35
+ merged[name] = target;
36
+ itemOwners.set(name, owners);
37
+ groupOwner[name] = cap.name;
38
+ } else if (target.binding !== group.binding) throw new InternalError({
39
+ message: `${groupLabel} "${name}" is bound to "${target.binding}" by capability "${groupOwner[name]}" but to "${group.binding}" by "${cap.name}".`,
40
+ action: `Use one binding per ${groupLabel} name across capabilities.`
41
+ });
42
+ for (const [item, value] of Object.entries(group.items)) {
43
+ if (item in target.items) throw new InternalError({
44
+ message: `Duplicate ${itemLabel} "${item}" in ${groupLabel} "${name}": declared by capabilities "${owners[item]}" and "${cap.name}".`,
45
+ action: `Rename one ${itemLabel} — every ${itemLabel} name within a ${groupLabel} must be unique.`
46
+ });
47
+ target.items[item] = value;
48
+ owners[item] = cap.name;
49
+ }
50
+ }
51
+ return merged;
52
+ }
53
+ //#endregion
54
+ export { bindingGroupsFrom, composeBindingGroups };
@@ -0,0 +1,26 @@
1
+ import type { Capability } from "./capability";
2
+ /**
3
+ * Record the composed set. Called once by `createBackend`, after every `compose` hook has run — so a
4
+ * capability found here is one whose own wiring is already complete, not one mid-assembly.
5
+ */
6
+ export declare function recordComposition(capabilities: readonly Capability[]): void;
7
+ /** Forget it. For a test that needs the un-composed state back; a deployed Worker never calls this. */
8
+ export declare function forgetComposition(): void;
9
+ /**
10
+ * The composed capabilities, or a raised wiring fault.
11
+ *
12
+ * Empty is not an answer. A caller asking this has already decided it needs a composed seam, and an
13
+ * empty array would send it down a "the capability is not composed" path that is indistinguishable from
14
+ * "no backend was assembled" — two very different things to tell somebody reading a log at 3am.
15
+ */
16
+ export declare function composedCapabilities(): readonly Capability[];
17
+ /**
18
+ * One composed capability by name, narrowed by its own type guard, or a raised wiring fault naming it.
19
+ *
20
+ * The guard is the capability's own (`isEmailCapability`, and its peers), so the narrowing is the
21
+ * capability's declaration rather than a cast here — a capability composed under the right name but
22
+ * without its seams attached is caught as the wiring failure it is, not returned as something whose
23
+ * methods are missing at the call site.
24
+ */
25
+ export declare function composedCapability<T extends Capability>(name: string, is: (capability: Capability) => boolean): T;
26
+ //# sourceMappingURL=composition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition.d.ts","sourceRoot":"","sources":["../../src/capability/composition.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAyC/C;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,SAAS,UAAU,EAAE,GAAG,IAAI,CAE3E;AAED,uGAAuG;AACvG,wBAAgB,iBAAiB,IAAI,IAAI,CAExC;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,IAAI,SAAS,UAAU,EAAE,CAS5D;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,OAAO,GAAG,CAAC,CAajH"}
@@ -0,0 +1,84 @@
1
+ import { InternalError } from "../error/pithyError.js";
2
+ //#region src/capability/composition.ts
3
+ /**
4
+ * The composed set, reachable from module scope — **so a Workflow can find it** (pithy-sh/pithy#356).
5
+ *
6
+ * ## The gap this closes
7
+ *
8
+ * A capability's `compose` hook receives every other composed capability, so a route can hold
9
+ * `@pithy-sh/email`'s bound `enqueue` and call it. `@pithy-sh/auth` does exactly that for magic links,
10
+ * and an adopter copies the pattern for its own mail.
11
+ *
12
+ * **A Workflow class cannot.** The runtime constructs it with the worker `env` and nothing else. `env`
13
+ * carries `DB`, `EMAIL_SENDER` and every other binding, but a composed seam is a closure `compose`
14
+ * handed out, not a binding — and there was no way back from a durable step to the composed set. The
15
+ * two ways past it were both wrong and both the adopter's to take: rebuild the seam from `env` plus a
16
+ * restated identity (the same sending address in a second place, free to drift from `pithy.config.ts`),
17
+ * or pass the closure through Workflow params (which are serialized, and a closure is not). So a durable
18
+ * job could never send mail, and `pithy-sh/dashboard`'s monthly key-rotation notice was written, tested,
19
+ * and reachable by nothing.
20
+ *
21
+ * ## Why module scope is the right place, and what it costs
22
+ *
23
+ * `createBackend` runs at module load, and Cloudflare requires a Workflow class to be exported from the
24
+ * same worker entrypoint that exports the `fetch` handler — so the composition has already happened, in
25
+ * this isolate, by the time any step body runs. That is the same reasoning
26
+ * `@pithy-sh/secrets`' shared accessor is built on, and it is worth being explicit that it is a
27
+ * *reasoned* singleton rather than a convenient global: one worker assembles one backend.
28
+ *
29
+ * The cost is that a second `createBackend` in one isolate replaces the first. In a deployed Worker that
30
+ * cannot happen; in a test file it can, so {@link recordComposition} replaces wholesale rather than
31
+ * merging — a half-remembered composition would be worse than none — and {@link forgetComposition}
32
+ * exists so a suite can return to the un-composed state and assert what happens there.
33
+ *
34
+ * **Nothing here is a service locator for application code.** A route has `c.var`, and a capability has
35
+ * its `compose` hook; both are better, both are typed, and both stay the way to reach a seam. This is
36
+ * for the one caller that has neither.
37
+ */
38
+ /** The composed set, or null before any backend has been assembled in this isolate. */
39
+ let composed = null;
40
+ /**
41
+ * Record the composed set. Called once by `createBackend`, after every `compose` hook has run — so a
42
+ * capability found here is one whose own wiring is already complete, not one mid-assembly.
43
+ */
44
+ function recordComposition(capabilities) {
45
+ composed = [...capabilities];
46
+ }
47
+ /** Forget it. For a test that needs the un-composed state back; a deployed Worker never calls this. */
48
+ function forgetComposition() {
49
+ composed = null;
50
+ }
51
+ /**
52
+ * The composed capabilities, or a raised wiring fault.
53
+ *
54
+ * Empty is not an answer. A caller asking this has already decided it needs a composed seam, and an
55
+ * empty array would send it down a "the capability is not composed" path that is indistinguishable from
56
+ * "no backend was assembled" — two very different things to tell somebody reading a log at 3am.
57
+ */
58
+ function composedCapabilities() {
59
+ if (composed === null) throw new InternalError({
60
+ message: "This job could not reach the application's capabilities.",
61
+ action: "Export the Workflow class from the same worker entrypoint that calls createBackend.",
62
+ detail: "composedCapabilities() was called before any createBackend ran in this isolate."
63
+ });
64
+ return composed;
65
+ }
66
+ /**
67
+ * One composed capability by name, narrowed by its own type guard, or a raised wiring fault naming it.
68
+ *
69
+ * The guard is the capability's own (`isEmailCapability`, and its peers), so the narrowing is the
70
+ * capability's declaration rather than a cast here — a capability composed under the right name but
71
+ * without its seams attached is caught as the wiring failure it is, not returned as something whose
72
+ * methods are missing at the call site.
73
+ */
74
+ function composedCapability(name, is) {
75
+ const found = composedCapabilities().find((capability) => capability.name === name && is(capability));
76
+ if (!found) throw new InternalError({
77
+ message: `The "${name}" capability is not composed, so this job could not run.`,
78
+ action: `Add ${name}(...) to createBackend's capabilities (run \`pithy add ${name}\`).`,
79
+ detail: `no composed capability named "${name}" carrying its seams was found.`
80
+ });
81
+ return found;
82
+ }
83
+ //#endregion
84
+ export { composedCapabilities, composedCapability, forgetComposition, recordComposition };
@@ -0,0 +1,7 @@
1
+ import { z } from "zod";
2
+ import type { Capability } from "./capability";
3
+ /** Compose each capability's config schema into one object keyed by capability name. */
4
+ export declare function composeConfig(capabilities: Capability[]): z.ZodObject<Record<string, z.ZodType>>;
5
+ /** Validate raw config input against the composed schema; throws on mismatch. */
6
+ export declare function loadConfig(capabilities: Capability[], input: unknown): Record<string, Record<string, unknown>>;
7
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/capability/config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,YAAY,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAMhG;AAED,iFAAiF;AACjF,wBAAgB,UAAU,CAAC,YAAY,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAE9G"}
@@ -0,0 +1,14 @@
1
+ import { z } from "zod";
2
+ //#region src/capability/config.ts
3
+ /** Compose each capability's config schema into one object keyed by capability name. */
4
+ function composeConfig(capabilities) {
5
+ const shape = {};
6
+ for (const cap of capabilities) if (cap.config) shape[cap.name] = cap.config;
7
+ return z.object(shape);
8
+ }
9
+ /** Validate raw config input against the composed schema; throws on mismatch. */
10
+ function loadConfig(capabilities, input) {
11
+ return composeConfig(capabilities).parse(input);
12
+ }
13
+ //#endregion
14
+ export { composeConfig, loadConfig };
@@ -0,0 +1,32 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * A secret whose value is **arbitrary**, and can therefore be minted for local dev.
4
+ *
5
+ * The rule, stated once and here: a secret is generatable when nothing outside the project has to
6
+ * agree with its value. A session signing key is; an OAuth client secret registered with a provider,
7
+ * or a Stripe key, is not — a generated value there authenticates against nothing, and hides a real
8
+ * gap behind one that looks filled in.
9
+ *
10
+ * It lives in core, and in its own module, because both ends need it and neither can import the
11
+ * other: the owning capability declares it on its `@pithy-sh/secrets` registry entry, and the CLI
12
+ * reads the same declaration off `pithy.manifest.json` — which it must, since `pithy add` wires a
13
+ * capability without ever executing it.
14
+ */
15
+ export declare const DevSecretValue: z.ZodEnum<{
16
+ random: "random";
17
+ }>;
18
+ export type DevSecretValue = z.infer<typeof DevSecretValue>;
19
+ /**
20
+ * One declared dev secret, as a manifest carries it: the registry name, and how its value is minted.
21
+ *
22
+ * The manifest's projection of the registry entry's `devValue`. Each capability's own tests assert the
23
+ * two agree, the way `requiredBindings` and `peerCapabilities` already mirror the runtime capability.
24
+ */
25
+ export declare const DevSecret: z.ZodObject<{
26
+ name: z.ZodString;
27
+ devValue: z.ZodEnum<{
28
+ random: "random";
29
+ }>;
30
+ }, z.core.$strip>;
31
+ export type DevSecret = z.infer<typeof DevSecret>;
32
+ //# sourceMappingURL=devSecret.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devSecret.d.ts","sourceRoot":"","sources":["../../src/capability/devSecret.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,cAAc;;EAE6E,CAAC;AACzG,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D;;;;;GAKG;AACH,eAAO,MAAM,SAAS;;;;;iBAUoE,CAAC;AAC3F,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { z } from "zod";
2
+ //#region src/capability/devSecret.ts
3
+ /**
4
+ * A secret whose value is **arbitrary**, and can therefore be minted for local dev.
5
+ *
6
+ * The rule, stated once and here: a secret is generatable when nothing outside the project has to
7
+ * agree with its value. A session signing key is; an OAuth client secret registered with a provider,
8
+ * or a Stripe key, is not — a generated value there authenticates against nothing, and hides a real
9
+ * gap behind one that looks filled in.
10
+ *
11
+ * It lives in core, and in its own module, because both ends need it and neither can import the
12
+ * other: the owning capability declares it on its `@pithy-sh/secrets` registry entry, and the CLI
13
+ * reads the same declaration off `pithy.manifest.json` — which it must, since `pithy add` wires a
14
+ * capability without ever executing it.
15
+ */
16
+ const DevSecretValue = z.enum(["random"]).describe("How `pithy add` mints a secret's dev value. `random` is a random string and nothing else.");
17
+ /**
18
+ * One declared dev secret, as a manifest carries it: the registry name, and how its value is minted.
19
+ *
20
+ * The manifest's projection of the registry entry's `devValue`. Each capability's own tests assert the
21
+ * two agree, the way `requiredBindings` and `peerCapabilities` already mirror the runtime capability.
22
+ */
23
+ const DevSecret = z.object({
24
+ name: z.string().min(1).describe("The registry name the secret is declared under — also the `.dev.vars` key, since local dev resolves every secret from its injected string."),
25
+ devValue: DevSecretValue.describe("How the dev value is minted. Must match the registry entry's `devValue`.")
26
+ }).describe("A secret whose dev value `pithy add` mints, because its value is arbitrary.");
27
+ //#endregion
28
+ export { DevSecret, DevSecretValue };