@vibesdotdev/infra-core 0.0.1 → 1.0.0-rc.11

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 (332) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +34 -63
  3. package/dist/bootstrap/seed.descriptor.d.ts +1 -1
  4. package/dist/bootstrap/seed.descriptor.d.ts.map +1 -1
  5. package/dist/bootstrap/seed.descriptor.js +1 -1
  6. package/dist/bootstrap/seed.descriptor.js.map +1 -1
  7. package/dist/bootstrap/seed.impl-shape.d.ts +1 -1
  8. package/dist/bootstrap/seed.impl-shape.d.ts.map +1 -1
  9. package/dist/bootstrap/seed.kind.d.ts +1 -3
  10. package/dist/bootstrap/seed.kind.d.ts.map +1 -1
  11. package/dist/bootstrap/seed.kind.js +17 -4
  12. package/dist/bootstrap/seed.kind.js.map +1 -1
  13. package/dist/bootstrap/seed.runner.d.ts +9 -2
  14. package/dist/bootstrap/seed.runner.d.ts.map +1 -1
  15. package/dist/bootstrap/seed.runner.js +37 -18
  16. package/dist/bootstrap/seed.runner.js.map +1 -1
  17. package/dist/capped-id.d.ts +19 -0
  18. package/dist/capped-id.d.ts.map +1 -0
  19. package/dist/capped-id.js +64 -0
  20. package/dist/capped-id.js.map +1 -0
  21. package/dist/cli/generate/artifact/artifact.cli-command.descriptor.d.ts +23 -0
  22. package/dist/cli/generate/artifact/artifact.cli-command.descriptor.d.ts.map +1 -0
  23. package/dist/cli/generate/artifact/artifact.cli-command.descriptor.js +33 -0
  24. package/dist/cli/generate/artifact/artifact.cli-command.descriptor.js.map +1 -0
  25. package/dist/cli/generate/artifact/artifact.cli-command.impl.d.ts +24 -0
  26. package/dist/cli/generate/artifact/artifact.cli-command.impl.d.ts.map +1 -0
  27. package/dist/cli/generate/artifact/artifact.cli-command.impl.js +73 -0
  28. package/dist/cli/generate/artifact/artifact.cli-command.impl.js.map +1 -0
  29. package/dist/cli/generate/context.d.ts +17 -0
  30. package/dist/cli/generate/context.d.ts.map +1 -0
  31. package/dist/cli/generate/context.js +24 -0
  32. package/dist/cli/generate/context.js.map +1 -0
  33. package/dist/cli/generate/generate/generate.cli-command.descriptor.d.ts +30 -0
  34. package/dist/cli/generate/generate/generate.cli-command.descriptor.d.ts.map +1 -0
  35. package/dist/cli/generate/generate/generate.cli-command.descriptor.js +25 -0
  36. package/dist/cli/generate/generate/generate.cli-command.descriptor.js.map +1 -0
  37. package/dist/cli/generate/generate/generate.cli-command.impl.d.ts +25 -0
  38. package/dist/cli/generate/generate/generate.cli-command.impl.d.ts.map +1 -0
  39. package/dist/cli/generate/generate/generate.cli-command.impl.js +64 -0
  40. package/dist/cli/generate/generate/generate.cli-command.impl.js.map +1 -0
  41. package/dist/cli/generate/generate-core.d.ts +51 -0
  42. package/dist/cli/generate/generate-core.d.ts.map +1 -0
  43. package/dist/cli/generate/generate-core.js +172 -0
  44. package/dist/cli/generate/generate-core.js.map +1 -0
  45. package/dist/cli/generate/index.d.ts +5 -0
  46. package/dist/cli/generate/index.d.ts.map +1 -0
  47. package/dist/cli/generate/index.js +5 -0
  48. package/dist/cli/generate/index.js.map +1 -0
  49. package/dist/credentials/resolve.d.ts +82 -22
  50. package/dist/credentials/resolve.d.ts.map +1 -1
  51. package/dist/credentials/resolve.js +251 -77
  52. package/dist/credentials/resolve.js.map +1 -1
  53. package/dist/deployment-budget.d.ts +319 -0
  54. package/dist/deployment-budget.d.ts.map +1 -0
  55. package/dist/deployment-budget.js +660 -0
  56. package/dist/deployment-budget.js.map +1 -0
  57. package/dist/deployment-environment.d.ts +30 -0
  58. package/dist/deployment-environment.d.ts.map +1 -0
  59. package/dist/deployment-environment.js +53 -0
  60. package/dist/deployment-environment.js.map +1 -0
  61. package/dist/deployment-graph.d.ts +185 -0
  62. package/dist/deployment-graph.d.ts.map +1 -0
  63. package/dist/deployment-graph.js +705 -0
  64. package/dist/deployment-graph.js.map +1 -0
  65. package/dist/deployment.d.ts +25 -4
  66. package/dist/deployment.d.ts.map +1 -1
  67. package/dist/deployment.js +105 -0
  68. package/dist/deployment.js.map +1 -1
  69. package/dist/doks/cloud/base.d.ts +49 -0
  70. package/dist/doks/cloud/base.d.ts.map +1 -0
  71. package/dist/doks/cloud/base.js +138 -0
  72. package/dist/doks/cloud/base.js.map +1 -0
  73. package/dist/doks/cloud/factory.d.ts +18 -0
  74. package/dist/doks/cloud/factory.d.ts.map +1 -0
  75. package/dist/doks/cloud/factory.js +22 -0
  76. package/dist/doks/cloud/factory.js.map +1 -0
  77. package/dist/doks/cloud/index.d.ts +5 -0
  78. package/dist/doks/cloud/index.d.ts.map +1 -0
  79. package/dist/doks/cloud/index.js +4 -0
  80. package/dist/doks/cloud/index.js.map +1 -0
  81. package/dist/doks/types.d.ts +95 -0
  82. package/dist/doks/types.d.ts.map +1 -0
  83. package/dist/doks/types.js +14 -0
  84. package/dist/doks/types.js.map +1 -0
  85. package/dist/generate/index.d.ts +29 -0
  86. package/dist/generate/index.d.ts.map +1 -0
  87. package/dist/generate/index.js +28 -0
  88. package/dist/generate/index.js.map +1 -0
  89. package/dist/generate/infra-generate.plugin.d.ts +3 -0
  90. package/dist/generate/infra-generate.plugin.d.ts.map +1 -0
  91. package/dist/generate/infra-generate.plugin.js +23 -0
  92. package/dist/generate/infra-generate.plugin.js.map +1 -0
  93. package/dist/generate/plugin.d.ts +2 -0
  94. package/dist/generate/plugin.d.ts.map +1 -0
  95. package/dist/generate/plugin.js +2 -0
  96. package/dist/generate/plugin.js.map +1 -0
  97. package/dist/heartbeat/cron-heartbeat.d.ts +97 -0
  98. package/dist/heartbeat/cron-heartbeat.d.ts.map +1 -0
  99. package/dist/heartbeat/cron-heartbeat.js +200 -0
  100. package/dist/heartbeat/cron-heartbeat.js.map +1 -0
  101. package/dist/index.d.ts +37 -22
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js +29 -14
  104. package/dist/index.js.map +1 -1
  105. package/dist/infra.plugin.d.ts +1 -1
  106. package/dist/infra.plugin.d.ts.map +1 -1
  107. package/dist/infra.plugin.js +64 -12
  108. package/dist/infra.plugin.js.map +1 -1
  109. package/dist/kinds/alerts.kind.d.ts +64 -25
  110. package/dist/kinds/alerts.kind.d.ts.map +1 -1
  111. package/dist/kinds/alerts.kind.js +43 -16
  112. package/dist/kinds/alerts.kind.js.map +1 -1
  113. package/dist/kinds/artifact.kind.d.ts +58 -10
  114. package/dist/kinds/artifact.kind.d.ts.map +1 -1
  115. package/dist/kinds/artifact.kind.js +26 -9
  116. package/dist/kinds/artifact.kind.js.map +1 -1
  117. package/dist/kinds/billing.kind.d.ts +88 -0
  118. package/dist/kinds/billing.kind.d.ts.map +1 -0
  119. package/dist/kinds/billing.kind.js +48 -0
  120. package/dist/kinds/billing.kind.js.map +1 -0
  121. package/dist/kinds/build-job.kind.d.ts +383 -0
  122. package/dist/kinds/build-job.kind.d.ts.map +1 -0
  123. package/dist/kinds/build-job.kind.js +218 -0
  124. package/dist/kinds/build-job.kind.js.map +1 -0
  125. package/dist/kinds/cache-byte-store.d.ts +23 -0
  126. package/dist/kinds/cache-byte-store.d.ts.map +1 -0
  127. package/dist/kinds/cache-byte-store.js +9 -0
  128. package/dist/kinds/cache-byte-store.js.map +1 -0
  129. package/dist/kinds/cache.kind.d.ts +38 -94
  130. package/dist/kinds/cache.kind.d.ts.map +1 -1
  131. package/dist/kinds/cache.kind.js +39 -50
  132. package/dist/kinds/cache.kind.js.map +1 -1
  133. package/dist/kinds/cluster.kind.d.ts +154 -0
  134. package/dist/kinds/cluster.kind.d.ts.map +1 -0
  135. package/dist/kinds/cluster.kind.js +99 -0
  136. package/dist/kinds/cluster.kind.js.map +1 -0
  137. package/dist/kinds/compute-source.kind.d.ts +155 -0
  138. package/dist/kinds/compute-source.kind.d.ts.map +1 -0
  139. package/dist/kinds/compute-source.kind.js +158 -0
  140. package/dist/kinds/compute-source.kind.js.map +1 -0
  141. package/dist/kinds/container-registry.kind.d.ts +62 -0
  142. package/dist/kinds/container-registry.kind.d.ts.map +1 -0
  143. package/dist/kinds/container-registry.kind.js +47 -0
  144. package/dist/kinds/container-registry.kind.js.map +1 -0
  145. package/dist/kinds/database-migrator.kind.d.ts +6 -0
  146. package/dist/kinds/database-migrator.kind.d.ts.map +1 -0
  147. package/dist/kinds/database-migrator.kind.js +28 -0
  148. package/dist/kinds/database-migrator.kind.js.map +1 -0
  149. package/dist/kinds/database.kind.d.ts +114 -93
  150. package/dist/kinds/database.kind.d.ts.map +1 -1
  151. package/dist/kinds/database.kind.js +93 -54
  152. package/dist/kinds/database.kind.js.map +1 -1
  153. package/dist/kinds/deployment-provider.kind.d.ts +5 -0
  154. package/dist/kinds/deployment-provider.kind.d.ts.map +1 -0
  155. package/dist/kinds/deployment-provider.kind.js +11 -0
  156. package/dist/kinds/deployment-provider.kind.js.map +1 -0
  157. package/dist/kinds/discovery.d.ts +5 -12
  158. package/dist/kinds/discovery.d.ts.map +1 -1
  159. package/dist/kinds/discovery.js +5 -17
  160. package/dist/kinds/discovery.js.map +1 -1
  161. package/dist/kinds/dns.kind.d.ts +162 -0
  162. package/dist/kinds/dns.kind.d.ts.map +1 -0
  163. package/dist/kinds/dns.kind.js +54 -0
  164. package/dist/kinds/dns.kind.js.map +1 -0
  165. package/dist/kinds/drift.kind.d.ts +115 -0
  166. package/dist/kinds/drift.kind.d.ts.map +1 -0
  167. package/dist/kinds/drift.kind.js +60 -0
  168. package/dist/kinds/drift.kind.js.map +1 -0
  169. package/dist/kinds/edge-hostname.kind.d.ts +124 -0
  170. package/dist/kinds/edge-hostname.kind.d.ts.map +1 -0
  171. package/dist/kinds/edge-hostname.kind.js +87 -0
  172. package/dist/kinds/edge-hostname.kind.js.map +1 -0
  173. package/dist/kinds/edge-tls.kind.d.ts +194 -0
  174. package/dist/kinds/edge-tls.kind.d.ts.map +1 -0
  175. package/dist/kinds/edge-tls.kind.js +58 -0
  176. package/dist/kinds/edge-tls.kind.js.map +1 -0
  177. package/dist/kinds/firewall.kind.d.ts +92 -0
  178. package/dist/kinds/firewall.kind.d.ts.map +1 -0
  179. package/dist/kinds/firewall.kind.js +59 -0
  180. package/dist/kinds/firewall.kind.js.map +1 -0
  181. package/dist/kinds/git-hosting.kind.d.ts +36 -38
  182. package/dist/kinds/git-hosting.kind.d.ts.map +1 -1
  183. package/dist/kinds/git-hosting.kind.js +23 -34
  184. package/dist/kinds/git-hosting.kind.js.map +1 -1
  185. package/dist/kinds/index.d.ts +41 -15
  186. package/dist/kinds/index.d.ts.map +1 -1
  187. package/dist/kinds/index.js +40 -14
  188. package/dist/kinds/index.js.map +1 -1
  189. package/dist/kinds/inventory.kind.d.ts +245 -0
  190. package/dist/kinds/inventory.kind.d.ts.map +1 -0
  191. package/dist/kinds/inventory.kind.js +243 -0
  192. package/dist/kinds/inventory.kind.js.map +1 -0
  193. package/dist/kinds/load-balancer.kind.d.ts +135 -0
  194. package/dist/kinds/load-balancer.kind.d.ts.map +1 -0
  195. package/dist/kinds/load-balancer.kind.js +71 -0
  196. package/dist/kinds/load-balancer.kind.js.map +1 -0
  197. package/dist/kinds/logs.kind.d.ts +74 -3
  198. package/dist/kinds/logs.kind.d.ts.map +1 -1
  199. package/dist/kinds/logs.kind.js +26 -17
  200. package/dist/kinds/logs.kind.js.map +1 -1
  201. package/dist/kinds/nfs.kind.d.ts +67 -0
  202. package/dist/kinds/nfs.kind.d.ts.map +1 -0
  203. package/dist/kinds/nfs.kind.js +45 -0
  204. package/dist/kinds/nfs.kind.js.map +1 -0
  205. package/dist/kinds/node-pool.kind.d.ts +134 -0
  206. package/dist/kinds/node-pool.kind.d.ts.map +1 -0
  207. package/dist/kinds/node-pool.kind.js +88 -0
  208. package/dist/kinds/node-pool.kind.js.map +1 -0
  209. package/dist/kinds/object-storage.kind.d.ts +50 -24
  210. package/dist/kinds/object-storage.kind.d.ts.map +1 -1
  211. package/dist/kinds/object-storage.kind.js +40 -23
  212. package/dist/kinds/object-storage.kind.js.map +1 -1
  213. package/dist/kinds/observability.kind.d.ts +104 -6
  214. package/dist/kinds/observability.kind.d.ts.map +1 -1
  215. package/dist/kinds/observability.kind.js +67 -9
  216. package/dist/kinds/observability.kind.js.map +1 -1
  217. package/dist/kinds/package-registry.kind.d.ts +141 -35
  218. package/dist/kinds/package-registry.kind.d.ts.map +1 -1
  219. package/dist/kinds/package-registry.kind.js +55 -25
  220. package/dist/kinds/package-registry.kind.js.map +1 -1
  221. package/dist/kinds/queue.kind.d.ts +67 -63
  222. package/dist/kinds/queue.kind.d.ts.map +1 -1
  223. package/dist/kinds/queue.kind.js +55 -33
  224. package/dist/kinds/queue.kind.js.map +1 -1
  225. package/dist/kinds/read-descriptor.d.ts +15 -0
  226. package/dist/kinds/read-descriptor.d.ts.map +1 -0
  227. package/dist/kinds/read-descriptor.js +11 -0
  228. package/dist/kinds/read-descriptor.js.map +1 -0
  229. package/dist/kinds/rum.kind.d.ts +36 -6
  230. package/dist/kinds/rum.kind.d.ts.map +1 -1
  231. package/dist/kinds/rum.kind.js +6 -7
  232. package/dist/kinds/rum.kind.js.map +1 -1
  233. package/dist/kinds/sandbox.kind.d.ts +136 -40
  234. package/dist/kinds/sandbox.kind.d.ts.map +1 -1
  235. package/dist/kinds/sandbox.kind.js +82 -43
  236. package/dist/kinds/sandbox.kind.js.map +1 -1
  237. package/dist/kinds/select-compute-source.d.ts +72 -0
  238. package/dist/kinds/select-compute-source.d.ts.map +1 -0
  239. package/dist/kinds/select-compute-source.js +170 -0
  240. package/dist/kinds/select-compute-source.js.map +1 -0
  241. package/dist/kinds/service-release.kind.d.ts +771 -0
  242. package/dist/kinds/service-release.kind.d.ts.map +1 -0
  243. package/dist/kinds/service-release.kind.js +676 -0
  244. package/dist/kinds/service-release.kind.js.map +1 -0
  245. package/dist/kinds/spend-guard.kind.d.ts +41 -0
  246. package/dist/kinds/spend-guard.kind.d.ts.map +1 -0
  247. package/dist/kinds/spend-guard.kind.js +140 -0
  248. package/dist/kinds/spend-guard.kind.js.map +1 -0
  249. package/dist/kinds/utilization.kind.d.ts +88 -0
  250. package/dist/kinds/utilization.kind.d.ts.map +1 -0
  251. package/dist/kinds/utilization.kind.js +62 -0
  252. package/dist/kinds/utilization.kind.js.map +1 -0
  253. package/dist/kinds/volume.kind.d.ts +54 -0
  254. package/dist/kinds/volume.kind.d.ts.map +1 -0
  255. package/dist/kinds/volume.kind.js +39 -0
  256. package/dist/kinds/volume.kind.js.map +1 -0
  257. package/dist/kinds/vpc.kind.d.ts +61 -0
  258. package/dist/kinds/vpc.kind.d.ts.map +1 -0
  259. package/dist/kinds/vpc.kind.js +51 -0
  260. package/dist/kinds/vpc.kind.js.map +1 -0
  261. package/dist/kinds/web-app.kind.d.ts +118 -45
  262. package/dist/kinds/web-app.kind.d.ts.map +1 -1
  263. package/dist/kinds/web-app.kind.js +69 -42
  264. package/dist/kinds/web-app.kind.js.map +1 -1
  265. package/dist/kinds/worker.kind.d.ts +129 -188
  266. package/dist/kinds/worker.kind.d.ts.map +1 -1
  267. package/dist/kinds/worker.kind.js +45 -123
  268. package/dist/kinds/worker.kind.js.map +1 -1
  269. package/dist/schemas/database-migration.d.ts +173 -0
  270. package/dist/schemas/database-migration.d.ts.map +1 -0
  271. package/dist/schemas/database-migration.js +88 -0
  272. package/dist/schemas/database-migration.js.map +1 -0
  273. package/dist/schemas/deployment-environment.d.ts +11 -0
  274. package/dist/schemas/deployment-environment.d.ts.map +1 -0
  275. package/dist/schemas/deployment-environment.js +9 -0
  276. package/dist/schemas/deployment-environment.js.map +1 -0
  277. package/dist/schemas/deployment-provider.d.ts +383 -0
  278. package/dist/schemas/deployment-provider.d.ts.map +1 -0
  279. package/dist/schemas/deployment-provider.js +211 -0
  280. package/dist/schemas/deployment-provider.js.map +1 -0
  281. package/dist/schemas/log-stream.d.ts +27 -0
  282. package/dist/schemas/log-stream.d.ts.map +1 -0
  283. package/dist/schemas/log-stream.js +31 -0
  284. package/dist/schemas/log-stream.js.map +1 -0
  285. package/dist/schemas/spend-guard.d.ts +155 -0
  286. package/dist/schemas/spend-guard.d.ts.map +1 -0
  287. package/dist/schemas/spend-guard.js +61 -0
  288. package/dist/schemas/spend-guard.js.map +1 -0
  289. package/dist/schemas.d.ts +195 -20
  290. package/dist/schemas.d.ts.map +1 -1
  291. package/dist/schemas.js +151 -31
  292. package/dist/schemas.js.map +1 -1
  293. package/dist/service.d.ts +87 -0
  294. package/dist/service.d.ts.map +1 -0
  295. package/dist/service.js +199 -0
  296. package/dist/service.js.map +1 -0
  297. package/dist/settle-work.d.ts +20 -0
  298. package/dist/settle-work.d.ts.map +1 -0
  299. package/dist/settle-work.js +22 -0
  300. package/dist/settle-work.js.map +1 -0
  301. package/dist/web-app-projection.d.ts +208 -0
  302. package/dist/web-app-projection.d.ts.map +1 -0
  303. package/dist/web-app-projection.js +95 -0
  304. package/dist/web-app-projection.js.map +1 -0
  305. package/package.json +123 -40
  306. package/SPEC.md +0 -169
  307. package/src/bootstrap/index.ts +0 -15
  308. package/src/bootstrap/seed.descriptor.ts +0 -24
  309. package/src/bootstrap/seed.impl-shape.ts +0 -5
  310. package/src/bootstrap/seed.kind.ts +0 -26
  311. package/src/bootstrap/seed.runner.ts +0 -87
  312. package/src/credentials/resolve.ts +0 -205
  313. package/src/deployment.ts +0 -57
  314. package/src/index.ts +0 -149
  315. package/src/infra.plugin.ts +0 -54
  316. package/src/kinds/alerts.kind.ts +0 -164
  317. package/src/kinds/artifact.kind.ts +0 -96
  318. package/src/kinds/cache.kind.ts +0 -104
  319. package/src/kinds/database.kind.ts +0 -120
  320. package/src/kinds/discovery.ts +0 -26
  321. package/src/kinds/git-hosting.kind.ts +0 -100
  322. package/src/kinds/index.ts +0 -139
  323. package/src/kinds/logs.kind.ts +0 -104
  324. package/src/kinds/object-storage.kind.ts +0 -101
  325. package/src/kinds/observability.kind.ts +0 -178
  326. package/src/kinds/package-registry.kind.ts +0 -95
  327. package/src/kinds/queue.kind.ts +0 -102
  328. package/src/kinds/rum.kind.ts +0 -135
  329. package/src/kinds/sandbox.kind.ts +0 -115
  330. package/src/kinds/web-app.kind.ts +0 -103
  331. package/src/kinds/worker.kind.ts +0 -203
  332. package/src/schemas.ts +0 -127
package/src/index.ts DELETED
@@ -1,149 +0,0 @@
1
- export {
2
- createAppDeployment,
3
- createDeploymentOrigin,
4
- createDeploymentEnvRequirement,
5
- createDeploymentDependency,
6
- getPrimaryOrigin,
7
- getUpstreamOriginEnv
8
- } from './deployment.ts';
9
- export type {
10
- AppDeployment,
11
- AppDeploymentInput,
12
- DeploymentDependency,
13
- DeploymentEnvRequirement,
14
- DeploymentOrigin,
15
- DeploymentUpstream
16
- } from './deployment.ts';
17
- export {
18
- deploymentProviderSchema,
19
- appRuntimeSchema,
20
- deploymentOriginSchema,
21
- deploymentBuildSchema,
22
- deploymentEnvRequirementSchema,
23
- deploymentDependencySchema,
24
- deploymentUpstreamSchema,
25
- appDeploymentSchema
26
- } from './schemas.ts';
27
- export type {
28
- DeploymentProvider,
29
- AppRuntime,
30
- DeploymentOrigin as DeploymentOriginType,
31
- DeploymentBuild,
32
- DeploymentEnvRequirement as DeploymentEnvRequirementType,
33
- DeploymentDependency as DeploymentDependencyType,
34
- DeploymentUpstream as DeploymentUpstreamType,
35
- AppDeploymentInput as AppDeploymentInputType,
36
- AppDeployment as AppDeploymentType
37
- } from './schemas.ts';
38
- export {
39
- webAppKind, WebAppDescriptorSchema, WebAppConfigSchema, CloudflareWorkersWebAppConfigSchema, DigitalOceanAppWebAppConfigSchema
40
- } from './kinds/index.ts';
41
- export type { WebAppDescriptor, WebAppDependency } from './kinds/index.ts';
42
- export {
43
- workerKind, WorkerDescriptorSchema, WorkerConfigSchema, DoksDeploymentWorkerConfigSchema, WorkerScalingSchema
44
- } from './kinds/index.ts';
45
- export type { WorkerDescriptor, WorkerScaling } from './kinds/index.ts';
46
- export {
47
- databaseKind, DatabaseDescriptorSchema, DatabaseConfigSchema, DoksDatabaseConfigSchema, DOManagedPostgresConfigSchema, TursoDatabaseConfigSchema, CloudflareD1ConfigSchema, DatabaseBackupSchema
48
- } from './kinds/index.ts';
49
- export type { DatabaseDescriptor, DatabaseBackup } from './kinds/index.ts';
50
- export {
51
- queueKind, QueueDescriptorSchema, QueueConfigSchema, DoksQueueConfigSchema, QueueTopicSchema
52
- } from './kinds/index.ts';
53
- export type { QueueDescriptor, QueueTopic } from './kinds/index.ts';
54
- export { cacheKind, CacheDescriptorSchema, CacheConfigSchema, DOManagedRedisConfigSchema } from './kinds/index.ts';
55
- export type { CacheDescriptor } from './kinds/index.ts';
56
- export {
57
- objectStorageKind, ObjectStorageDescriptorSchema, ObjectStorageConfigSchema, DOSpacesConfigSchema, CorsRuleSchema, LifecycleRuleSchema
58
- } from './kinds/index.ts';
59
- export type { ObjectStorageDescriptor, CorsRule, LifecycleRule } from './kinds/index.ts';
60
- export {
61
- sandboxKind, SandboxDescriptorSchema, SandboxConfigSchema, CloudflareSandboxConfigSchema, DockerSandboxConfigSchema, DigitalOceanDropletSandboxConfigSchema, SandboxOutboundProxySchema, SandboxResourceLimitsSchema
62
- } from './kinds/index.ts';
63
- export type { SandboxDescriptor, SandboxOutboundProxy, SandboxResourceLimits } from './kinds/index.ts';
64
- export {
65
- gitHostingKind, GitHostingDescriptorSchema, GitHostingConfigSchema, GiteaDoksGitHostingConfigSchema, GitHostingTypeSchema, GitHostingAuthMethodSchema
66
- } from './kinds/index.ts';
67
- export type { GitHostingDescriptor, GitHostingType, GitHostingAuthMethod } from './kinds/index.ts';
68
- export {
69
- packageRegistryKind, PackageRegistryDescriptorSchema, PackageRegistryConfigSchema, VerdaccioDoksPackageRegistryConfigSchema, PackageRegistryTypeSchema
70
- } from './kinds/index.ts';
71
- export type { PackageRegistryDescriptor, PackageRegistryType } from './kinds/index.ts';
72
- export {
73
- logsKind, InfraLogsDescriptorSchema, type InfraLogsDescriptor, type InfraLogsDescriptorInput, type InfraLogsKind, type InfraLogsKindInput, type LogsImplementation
74
- } from './kinds/index.ts';
75
- export {
76
- artifactKind,
77
- ArtifactDescriptorSchema,
78
- type ArtifactDescriptor,
79
- type ArtifactGenerator,
80
- type ArtifactOutput
81
- } from './kinds/index.ts';
82
- export { INFRA_DISCOVERY_PATTERN, extractStem } from './kinds/index.ts';
83
- export {
84
- alertsKind,
85
- InfraAlertsDescriptorSchema,
86
- AlertPolicySchema,
87
- AlertMechanismSchema,
88
- AlertTypeSchema,
89
- AlertWindowSchema,
90
- type InfraAlertsDescriptor,
91
- type InfraAlertsDescriptorInput,
92
- type InfraAlertsKind,
93
- type InfraAlertsKindInput,
94
- type AlertsImplementation,
95
- type AlertPolicy,
96
- type AlertMechanism,
97
- type AlertType
98
- } from './kinds/index.ts';
99
- export {
100
- observabilityKind,
101
- InfraObservabilityDescriptorSchema,
102
- ObservabilityScopeSchema,
103
- ObservabilitySettingsSchema,
104
- type InfraObservabilityDescriptor,
105
- type InfraObservabilityDescriptorInput,
106
- type InfraObservabilityKind,
107
- type InfraObservabilityKindInput,
108
- type ObservabilityImplementation,
109
- type ObservabilityScope,
110
- type ObservabilitySettings,
111
- type ObservabilitySnapshot,
112
- type SetObservabilityInput,
113
- type SetObservabilityResult
114
- } from './kinds/index.ts';
115
- export {
116
- rumKind,
117
- InfraRumDescriptorSchema,
118
- RumPrivacySchema,
119
- RumInjectionSchema,
120
- type InfraRumDescriptor,
121
- type InfraRumDescriptorInput,
122
- type InfraRumKind,
123
- type InfraRumKindInput,
124
- type RumImplementation,
125
- type RumSiteSnapshot,
126
- type RumPrivacy,
127
- type RumInjection
128
- } from './kinds/index.ts';
129
- export {
130
- resolveAdapterCredential,
131
- resolveAdapterCredentials,
132
- type EnvironmentTier,
133
- type ResolveAdapterCredentialOptions,
134
- type ResolvedAdapterCredential
135
- } from './credentials/resolve.ts';
136
- export {
137
- bootstrapSeedKind,
138
- bootstrapSeedConditionSchema,
139
- bootstrapSeedDescriptorSchema,
140
- bootstrapSeedModeSchema,
141
- runBootstrapSeeds,
142
- type BootstrapSeedCondition,
143
- type BootstrapSeedDescriptor,
144
- type BootstrapSeedImpl,
145
- type BootstrapSeedMode,
146
- type BootstrapSeedRunOptions,
147
- type BootstrapSeedRunResult
148
- } from './bootstrap/index.ts';
149
- export { default as infraPlugin } from './infra.plugin';
@@ -1,54 +0,0 @@
1
- /**
2
- * Infrastructure Runtime Plugin
3
- *
4
- * Registers all infra resource kinds with the runtime.
5
- */
6
-
7
- import { createRuntimePlugin } from '@vibesdotdev/runtime/factory/plugin';
8
- import { webAppKind } from './kinds/web-app.kind';
9
- import { workerKind } from './kinds/worker.kind';
10
- import { databaseKind } from './kinds/database.kind';
11
- import { queueKind } from './kinds/queue.kind';
12
- import { cacheKind } from './kinds/cache.kind';
13
- import { objectStorageKind } from './kinds/object-storage.kind';
14
- import { sandboxKind } from './kinds/sandbox.kind';
15
- import { gitHostingKind } from './kinds/git-hosting.kind';
16
- import { packageRegistryKind } from './kinds/package-registry.kind';
17
- import { logsKind } from './kinds/logs.kind';
18
- import { alertsKind } from './kinds/alerts.kind.ts';
19
- import { observabilityKind } from './kinds/observability.kind.ts';
20
- import { rumKind } from './kinds/rum.kind.ts';
21
- import { bootstrapSeedKind } from './bootstrap/index.ts';
22
-
23
- /**
24
- * Note on layering: inference is an apps/ai domain concern, not an infra kind.
25
- * Existing runtime kinds `ai/provider`, `ai/adapter`, `ai/model`, and
26
- * `ai/generation` already express "who/how/where inference runs", and the
27
- * runtime's hardware scope + connectionMode qualifier + priority already
28
- * select between consumer-direct, consumer-worker, cloud-worker, and
29
- * cloud-via-API strategies. New strategies (CF Unified Inference, Agents
30
- * Week bindings) should be added as new `ai/provider` descriptors + adapters,
31
- * not as a parallel `infra/inference` kind.
32
- */
33
-
34
- export default createRuntimePlugin({
35
- id: 'infra',
36
- name: 'Infrastructure',
37
- description: 'Resource kinds for deployable infrastructure',
38
- kinds: [
39
- webAppKind,
40
- workerKind,
41
- databaseKind,
42
- queueKind,
43
- cacheKind,
44
- objectStorageKind,
45
- sandboxKind,
46
- gitHostingKind,
47
- packageRegistryKind,
48
- logsKind,
49
- alertsKind,
50
- observabilityKind,
51
- rumKind,
52
- bootstrapSeedKind
53
- ]
54
- });
@@ -1,164 +0,0 @@
1
- /**
2
- * Infra Alerts Kind
3
- *
4
- * Provider-agnostic schema for alerting / notification policies that
5
- * span billing (budget + per-product usage), reliability (error rate,
6
- * latency), and operational lifecycle (deploys, subscription changes).
7
- *
8
- * Per-provider implementations (cloudflare-alerts, do-monitoring,
9
- * cloudwatch-alarms) map this shape onto the native API. Where a
10
- * provider doesn't support a `type`, the impl rejects with a clear
11
- * "unsupported" error rather than silently falling back.
12
- *
13
- * Configuration is declarative — typically encoded in an
14
- * `infra/account.config.ts` or `infra/alerts.infra.ts` file alongside
15
- * `infra/dns.ts`. The CLI (`vibes infra alerts list|create|delete`)
16
- * wraps the same primitive for one-off ops and drift detection.
17
- */
18
-
19
- import * as z from 'zod/v4';
20
- import { createRuntimeKind } from '@vibesdotdev/runtime/factory/kind';
21
- import { RuntimeDescriptorSchema } from '@vibesdotdev/runtime/schemas/descriptor';
22
- import { INFRA_DISCOVERY_PATTERN, extractStem } from './discovery.ts';
23
-
24
- /**
25
- * Delivery channel for an alert. Provider impls translate these to
26
- * native delivery slots (e.g. CF's `mechanisms.email[]`).
27
- */
28
- const AlertMechanismSchema = z.discriminatedUnion('kind', [
29
- z.object({
30
- kind: z.literal('email'),
31
- /** Email address — must be a verified destination on the provider. */
32
- target: z.email()
33
- }),
34
- z.object({
35
- kind: z.literal('webhook'),
36
- /** Outbound webhook URL. */
37
- target: z.string().url(),
38
- /** Optional secret name (in the active secrets store) used for HMAC signing. */
39
- secretRef: z.string().optional()
40
- }),
41
- z.object({
42
- kind: z.literal('pagerduty'),
43
- /** PagerDuty integration key (Events API v2). */
44
- target: z.string().min(1)
45
- }),
46
- z.object({
47
- kind: z.literal('slack'),
48
- /** Slack webhook URL (Incoming Webhooks). */
49
- target: z.string().url()
50
- })
51
- ]);
52
-
53
- export type AlertMechanism = z.infer<typeof AlertMechanismSchema>;
54
-
55
- /**
56
- * Cross-provider alert categories. Each maps to one or more native
57
- * alert types per provider.
58
- */
59
- const AlertTypeSchema = z.enum([
60
- /** Total cost crossed a dollar threshold for the current billing period. */
61
- 'budget',
62
- /** Per-product usage crossed a numeric threshold (events/req/GB/etc.). */
63
- 'usage',
64
- /** Worker/service error rate over a rolling window. */
65
- 'error-rate',
66
- /** P99 latency or wall-time crossed a threshold. */
67
- 'latency',
68
- /** Catch-all for provider-specific types not yet modeled here. */
69
- 'custom'
70
- ]);
71
-
72
- export type AlertType = z.infer<typeof AlertTypeSchema>;
73
-
74
- const AlertWindowSchema = z.enum(['5m', '15m', '1h', '6h', '24h', '7d', '30d']);
75
-
76
- const AlertPolicySchema = z.object({
77
- /** Stable id for diffing. Auto-generated when omitted. */
78
- id: z.string().min(1).optional(),
79
- /** Human-readable name (also surfaced by the provider). */
80
- name: z.string().min(1),
81
- type: AlertTypeSchema,
82
- /**
83
- * Threshold value. `budget` reads it as USD (or local currency).
84
- * `usage`/`error-rate`/`latency` read it as units defined by the
85
- * filter (event count, %, ms).
86
- */
87
- threshold: z.number().nonnegative(),
88
- /** Optional secondary threshold for tiered alerts. */
89
- warningThreshold: z.number().nonnegative().optional(),
90
- /** Rolling window for `usage`/`error-rate`/`latency`. Ignored for `budget`. */
91
- window: AlertWindowSchema.optional(),
92
- /**
93
- * Adapter-specific filters. Examples:
94
- * { product: 'workers_observability' } // usage on a specific CF product
95
- * { worker: 'vibes-account' } // error-rate scoped to one worker
96
- * { native_alert_type: 'health_check_status_notification' } // custom escape
97
- */
98
- filters: z.record(z.string(), z.string()).default({}),
99
- mechanisms: z.array(AlertMechanismSchema).min(1),
100
- enabled: z.boolean().default(true),
101
- description: z.string().optional()
102
- });
103
-
104
- export type AlertPolicy = z.infer<typeof AlertPolicySchema>;
105
-
106
- const AlertsBaseSchema = RuntimeDescriptorSchema.extend({
107
- kind: z.literal('infra/alerts'),
108
- /** Adapter id (e.g. 'cloudflare-alerts', 'do-monitoring'). */
109
- adapter: z.string().min(1),
110
- adapterConfig: z.record(z.string(), z.unknown()).optional(),
111
- /**
112
- * Default environment name for credential resolution via `vibes
113
- * secrets`. Defaults to 'local' since the CLI / dev workflow is
114
- * the primary caller; production Workers that consume this adapter
115
- * read credentials from CF Secrets Store bindings directly, not
116
- * through this descriptor.
117
- */
118
- environment: z.string().default('local'),
119
- policies: z.array(AlertPolicySchema).default([])
120
- });
121
-
122
- export type InfraAlertsDescriptor = z.infer<typeof AlertsBaseSchema>;
123
- export type InfraAlertsDescriptorInput = z.input<typeof AlertsBaseSchema>;
124
-
125
- /**
126
- * Implementation contract every provider implements. Operations are
127
- * idempotent: `applyPolicies` reconciles the live policy set to the
128
- * desired set without trampling unrelated policies on the provider.
129
- */
130
- export interface AlertsImplementation {
131
- /** List policies currently configured on the provider. */
132
- listPolicies(): Promise<Array<AlertPolicy & { providerId: string }>>;
133
- /** Create a single policy. Returns the provider-assigned id. */
134
- createPolicy(policy: AlertPolicy): Promise<{ providerId: string }>;
135
- /** Delete a policy by provider id. */
136
- deletePolicy(providerId: string): Promise<void>;
137
- /**
138
- * Diff desired (descriptor) against live; return the set of policies
139
- * that need create/update/delete. Empty arrays = in sync.
140
- */
141
- diff(desired: AlertPolicy[]): Promise<{
142
- create: AlertPolicy[];
143
- update: Array<{ providerId: string; policy: AlertPolicy }>;
144
- delete: Array<{ providerId: string; name: string }>;
145
- }>;
146
- }
147
-
148
- export const alertsKind = createRuntimeKind<InfraAlertsDescriptor, AlertsImplementation>({
149
- id: 'infra/alerts',
150
- descriptorSchema: AlertsBaseSchema,
151
- discoveryPattern: INFRA_DISCOVERY_PATTERN,
152
- extractStem
153
- });
154
-
155
- export type InfraAlertsKind = InfraAlertsDescriptor;
156
- export type InfraAlertsKindInput = InfraAlertsDescriptorInput;
157
-
158
- export {
159
- AlertsBaseSchema as InfraAlertsDescriptorSchema,
160
- AlertPolicySchema,
161
- AlertMechanismSchema,
162
- AlertTypeSchema,
163
- AlertWindowSchema
164
- };
@@ -1,96 +0,0 @@
1
- /**
2
- * Kind: infra/artifact
3
- *
4
- * Generic descriptor for generatable infrastructure artifacts.
5
- *
6
- * This kind is intentionally unopinionated about what gets generated.
7
- * Adapter implementations (infra-kubernetes, infra-helm, infra-cloudflare, etc.)
8
- * define their own descriptor shapes and generation logic.
9
- *
10
- * Usage pattern:
11
- * 1. Adapters register artifact generators with custom descriptors
12
- * 2. Query: runtime.query('infra/artifact').all()
13
- * 3. Resolve implementation and call its generate method
14
- * 4. Implementation returns artifact content (format determined by impl)
15
- */
16
- import * as z from 'zod/v4';
17
- import { createRuntimeKind } from '@vibesdotdev/runtime/factory/kind';
18
- import { RuntimeDescriptorSchema } from '@vibesdotdev/runtime/schemas/descriptor';
19
- import type { RuntimeDescriptor } from '@vibesdotdev/runtime/schemas/descriptor';
20
- import { INFRA_DISCOVERY_PATTERN, extractStem } from './discovery.ts';
21
-
22
- /**
23
- * Minimal base schema for artifact descriptors.
24
- *
25
- * Implementations extend this with their own fields (source resources,
26
- * output format, generation options, etc.).
27
- */
28
- const ArtifactBaseSchema = RuntimeDescriptorSchema.extend({
29
- kind: z.literal('infra/artifact')
30
- });
31
-
32
- /**
33
- * Generic artifact generator interface.
34
- *
35
- * Implementations define their own input/output shapes.
36
- */
37
- export interface ArtifactGenerator {
38
- /**
39
- * Generate artifact content.
40
- *
41
- * @param options - Implementation-specific options (descriptor, context, etc.)
42
- * @returns Generated artifact (content + metadata)
43
- */
44
- generate(options?: unknown): Promise<ArtifactOutput>;
45
- }
46
-
47
- /**
48
- * Generated artifact output (generic shape).
49
- *
50
- * Implementations may return more specific types.
51
- */
52
- export interface ArtifactOutput {
53
- /** Generated content (string for text formats, Buffer for binary) */
54
- content: string | Buffer;
55
- /** Recommended filename (including extension) */
56
- filename: string;
57
- /** Full output path */
58
- path: string;
59
- /** Optional metadata */
60
- metadata?: Record<string, unknown>;
61
- }
62
-
63
- /**
64
- * Artifact descriptor type (base shape, implementations extend)
65
- */
66
- export type ArtifactDescriptor = z.infer<typeof ArtifactBaseSchema>;
67
-
68
- /**
69
- * Artifact descriptor schema
70
- */
71
- export const ArtifactDescriptorSchema = ArtifactBaseSchema;
72
-
73
- /**
74
- * Artifact kind descriptor for runtime registration.
75
- *
76
- * Note: This kind has no default implementation. Adapters must register
77
- * their own implementations via runtime plugins.
78
- */
79
- class NoOpArtifactImplementation implements ArtifactGenerator {
80
- async generate(options?: unknown): Promise<ArtifactOutput> {
81
- throw new Error(
82
- 'No artifact generator registered. Adapter plugins (infra-kubernetes, infra-helm, etc.) must register implementations.'
83
- );
84
- }
85
- }
86
-
87
- export const artifactKind = createRuntimeKind<ArtifactDescriptor, NoOpArtifactImplementation>({
88
- id: 'infra/artifact',
89
- descriptorSchema: ArtifactDescriptorSchema,
90
- defaultImplementation: NoOpArtifactImplementation,
91
- discoveryPattern: INFRA_DISCOVERY_PATTERN,
92
- extractStem
93
- });
94
-
95
- // Re-export discovery helpers
96
- export { INFRA_DISCOVERY_PATTERN, extractStem } from './discovery.ts';
@@ -1,104 +0,0 @@
1
- /**
2
- * Kind: infra/cache
3
- *
4
- * Describes a cache service.
5
- *
6
- * Schema shape: strict common base + `config` discriminated union.
7
- *
8
- * - The base defines fields universal across adapters: id/kind/name +
9
- * the cache shape (engine, maxMemory, eviction, namespace).
10
- * - Adapter-specific fields (region, version, numNodes, size, …)
11
- * live under `config`. Each adapter package defines its own concrete schema.
12
- */
13
- import * as z from 'zod/v4';
14
- import { createRuntimeKind } from '@vibesdotdev/runtime/factory/kind';
15
- import type { RuntimeKindDescriptorRecord } from '@vibesdotdev/runtime/schemas/kind';
16
- import { RuntimeDescriptorSchema } from '@vibesdotdev/runtime/schemas/descriptor';
17
- import type { RuntimeDescriptor } from '@vibesdotdev/runtime/schemas/descriptor';
18
- import { INFRA_DISCOVERY_PATTERN, extractStem } from './discovery.ts';
19
-
20
- const CacheBaseSchema = RuntimeDescriptorSchema.extend({
21
- kind: z.literal('infra/cache'),
22
-
23
- /** Cache engine (e.g., 'cloudflare-kv', 'redis'). */
24
- engine: z.string().min(1).optional(),
25
-
26
- /** Maximum memory hint. */
27
- maxMemory: z.string().optional(),
28
-
29
- /** Eviction policy. */
30
- eviction: z.enum(['lru', 'lfu', 'ttl']).optional(),
31
-
32
- /** Logical namespace within the cache. */
33
- namespace: z.string().optional()
34
- });
35
-
36
- export const DOManagedRedisConfigSchema = z.object({
37
- /** Max memory allocation (e.g., '256mb', '1gb'). */
38
- maxMemory: z.string().min(1).optional(),
39
- /** Eviction policy: lru, lfu, or ttl. */
40
- eviction: z.enum(['lru', 'lfu', 'ttl']).optional(),
41
- /** DO region (default: nyc1). */
42
- region: z.string().min(1).default('nyc1'),
43
- /** Redis version (default: 7). */
44
- version: z.string().min(1).default('7'),
45
- /** Number of nodes (default: 1). */
46
- numNodes: z.number().int().positive().default(1),
47
- /** Database size tier (optional, derived from maxMemory if not set). */
48
- size: z.string().min(1).optional()
49
- });
50
-
51
- export const CloudflareKVCacheConfigSchema = z.object({
52
- /** Logical namespace within the KV store. */
53
- namespace: z.string().min(1)
54
- });
55
-
56
- export const DOKSRedisCacheConfigSchema = z.object({
57
- /** Kubernetes namespace (default: vibes). */
58
- namespace: z.string().min(1).default('vibes'),
59
- /** Container image (default: redis:{version}). */
60
- image: z.string().min(1).optional(),
61
- /** Redis version (default: 7). */
62
- version: z.string().min(1).default('7'),
63
- /** Max memory allocation (e.g., '256mb'). */
64
- maxMemory: z.string().optional(),
65
- /** Eviction policy: lru, lfu, or ttl. */
66
- eviction: z.enum(['lru', 'lfu', 'ttl']).optional(),
67
- /** Storage size (default: 1Gi). */
68
- storageSize: z.string().min(1).default('1Gi')
69
- });
70
-
71
- export const CacheConfigSchema = z.union([
72
- DOManagedRedisConfigSchema.extend({ adapter: z.literal('do-managed-redis') }),
73
- CloudflareKVCacheConfigSchema.extend({ adapter: z.literal('cloudflare-kv') }),
74
- DOKSRedisCacheConfigSchema.extend({ adapter: z.literal('doks-redis') })
75
- ]);
76
-
77
- export const CacheDescriptorSchema = CacheBaseSchema.extend({
78
- /**
79
- * Adapter-specific configuration. Discriminated union — each adapter
80
- * package defines its own config schema under its discriminator key.
81
- */
82
- config: CacheConfigSchema.optional()
83
- });
84
-
85
- export type CacheDescriptor = z.infer<typeof CacheDescriptorSchema>;
86
-
87
- class DefaultCacheImplementation {
88
- constructor(
89
- public readonly descriptor: RuntimeDescriptor,
90
- public readonly context: unknown
91
- ) {}
92
-
93
- get config(): CacheDescriptor {
94
- return this.descriptor as CacheDescriptor;
95
- }
96
- }
97
-
98
- export const cacheKind = createRuntimeKind<CacheDescriptor, DefaultCacheImplementation>({
99
- id: 'infra/cache',
100
- descriptorSchema: CacheDescriptorSchema,
101
- defaultImplementation: DefaultCacheImplementation,
102
- discoveryPattern: INFRA_DISCOVERY_PATTERN,
103
- extractStem
104
- });
@@ -1,120 +0,0 @@
1
- /**
2
- * Kind: infra/database
3
- *
4
- * Describes a database instance.
5
- *
6
- * Schema shape: strict common base + `config` discriminated union.
7
- *
8
- * - The base defines fields universal across adapters: id/kind/name +
9
- * the database shape (engine, size, replicas, backups).
10
- * - Adapter-specific fields (namespace, storageSize, version, region, …)
11
- * live under `config`. Each adapter package defines its own concrete schema.
12
- */
13
- import * as z from 'zod/v4';
14
- import { createRuntimeKind } from '@vibesdotdev/runtime/factory/kind';
15
- import type { RuntimeKindDescriptorRecord } from '@vibesdotdev/runtime/schemas/kind';
16
- import { RuntimeDescriptorSchema } from '@vibesdotdev/runtime/schemas/descriptor';
17
- import type { RuntimeDescriptor } from '@vibesdotdev/runtime/schemas/descriptor';
18
- import { INFRA_DISCOVERY_PATTERN, extractStem } from './discovery.ts';
19
-
20
- export const DatabaseBackupSchema = z.object({
21
- enabled: z.boolean().default(false),
22
- schedule: z.string().optional(),
23
- retention: z.string().optional()
24
- });
25
- export type DatabaseBackup = z.infer<typeof DatabaseBackupSchema>;
26
-
27
- const DatabaseBaseSchema = RuntimeDescriptorSchema.extend({
28
- kind: z.literal('infra/database'),
29
-
30
- /** Database engine (e.g., 'turso', 'postgres'). */
31
- engine: z.string().min(1).optional(),
32
-
33
- /** Instance size hint. */
34
- size: z.string().optional(),
35
-
36
- /** Replica count. */
37
- replicas: z.number().int().nonnegative().optional(),
38
-
39
- /** Backup configuration. */
40
- backups: DatabaseBackupSchema.optional()
41
- });
42
-
43
- export const DoksDatabaseConfigSchema = z.object({
44
- /** Kubernetes namespace (default: vibes). */
45
- namespace: z.string().min(1).default('vibes'),
46
- /** Storage size for pgdata volume (default: 10Gi). */
47
- storageSize: z.string().min(1).default('10Gi'),
48
- /** Container resources. */
49
- resources: z
50
- .object({
51
- requests: z.object({ cpu: z.string().min(1), memory: z.string().min(1) }).optional(),
52
- limits: z.object({ cpu: z.string().min(1), memory: z.string().min(1) }).optional()
53
- })
54
- .optional(),
55
- /** Postgres version tag (default: 16-alpine). */
56
- version: z.string().min(1).default('16-alpine')
57
- });
58
-
59
- export const DOManagedPostgresConfigSchema = z.object({
60
- /** Database size tier (default: db-s-1vcpu-1gb). */
61
- size: z.string().min(1).default('db-s-1vcpu-1gb'),
62
- /** DO region (default: nyc1). */
63
- region: z.string().min(1).default('nyc1'),
64
- /** Postgres version (default: 16). */
65
- version: z.string().min(1).default('16')
66
- });
67
-
68
- export const TursoDatabaseConfigSchema = z.object({
69
- /** Turso database name (defaults to descriptor id). */
70
- database: z.string().min(1).optional(),
71
- /** Edge region for replication (default: aws:iad1). */
72
- region: z.string().min(1).default('aws:iad1')
73
- });
74
-
75
- export const CloudflareD1ConfigSchema = z.object({
76
- /** D1 adapter name (always 'cloudflare-d1'). */
77
- adapter: z.literal('cloudflare-d1'),
78
- /** Binding name for D1 in Cloudflare Workers (default: 'DB'). */
79
- binding: z.string().min(1).default('DB'),
80
- /** D1 database name. */
81
- databaseName: z.string().min(1),
82
- /** ID of the consuming app (for wrangler.jsonc generation). */
83
- consumerAppId: z.string().min(1)
84
- });
85
-
86
- export const DatabaseConfigSchema = z.union([
87
- DoksDatabaseConfigSchema.extend({ adapter: z.literal('doks-statefulset') }),
88
- DOManagedPostgresConfigSchema.extend({ adapter: z.literal('do-managed-postgres') }),
89
- TursoDatabaseConfigSchema.extend({ adapter: z.literal('turso') }),
90
- CloudflareD1ConfigSchema
91
- ]);
92
-
93
- export const DatabaseDescriptorSchema = DatabaseBaseSchema.extend({
94
- /**
95
- * Adapter-specific configuration. Discriminated union — each adapter
96
- * package defines its own config schema under its discriminator key.
97
- */
98
- config: DatabaseConfigSchema.optional()
99
- });
100
-
101
- export type DatabaseDescriptor = z.infer<typeof DatabaseDescriptorSchema>;
102
-
103
- class DefaultDatabaseImplementation {
104
- constructor(
105
- public readonly descriptor: RuntimeDescriptor,
106
- public readonly context: unknown
107
- ) {}
108
-
109
- get config(): DatabaseDescriptor {
110
- return this.descriptor as DatabaseDescriptor;
111
- }
112
- }
113
-
114
- export const databaseKind = createRuntimeKind<DatabaseDescriptor, DefaultDatabaseImplementation>({
115
- id: 'infra/database',
116
- descriptorSchema: DatabaseDescriptorSchema,
117
- defaultImplementation: DefaultDatabaseImplementation,
118
- discoveryPattern: INFRA_DISCOVERY_PATTERN,
119
- extractStem
120
- });