@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.
- package/LICENSE +18 -0
- package/README.md +34 -63
- package/dist/bootstrap/seed.descriptor.d.ts +1 -1
- package/dist/bootstrap/seed.descriptor.d.ts.map +1 -1
- package/dist/bootstrap/seed.descriptor.js +1 -1
- package/dist/bootstrap/seed.descriptor.js.map +1 -1
- package/dist/bootstrap/seed.impl-shape.d.ts +1 -1
- package/dist/bootstrap/seed.impl-shape.d.ts.map +1 -1
- package/dist/bootstrap/seed.kind.d.ts +1 -3
- package/dist/bootstrap/seed.kind.d.ts.map +1 -1
- package/dist/bootstrap/seed.kind.js +17 -4
- package/dist/bootstrap/seed.kind.js.map +1 -1
- package/dist/bootstrap/seed.runner.d.ts +9 -2
- package/dist/bootstrap/seed.runner.d.ts.map +1 -1
- package/dist/bootstrap/seed.runner.js +37 -18
- package/dist/bootstrap/seed.runner.js.map +1 -1
- package/dist/capped-id.d.ts +19 -0
- package/dist/capped-id.d.ts.map +1 -0
- package/dist/capped-id.js +64 -0
- package/dist/capped-id.js.map +1 -0
- package/dist/cli/generate/artifact/artifact.cli-command.descriptor.d.ts +23 -0
- package/dist/cli/generate/artifact/artifact.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/generate/artifact/artifact.cli-command.descriptor.js +33 -0
- package/dist/cli/generate/artifact/artifact.cli-command.descriptor.js.map +1 -0
- package/dist/cli/generate/artifact/artifact.cli-command.impl.d.ts +24 -0
- package/dist/cli/generate/artifact/artifact.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/generate/artifact/artifact.cli-command.impl.js +73 -0
- package/dist/cli/generate/artifact/artifact.cli-command.impl.js.map +1 -0
- package/dist/cli/generate/context.d.ts +17 -0
- package/dist/cli/generate/context.d.ts.map +1 -0
- package/dist/cli/generate/context.js +24 -0
- package/dist/cli/generate/context.js.map +1 -0
- package/dist/cli/generate/generate/generate.cli-command.descriptor.d.ts +30 -0
- package/dist/cli/generate/generate/generate.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/generate/generate/generate.cli-command.descriptor.js +25 -0
- package/dist/cli/generate/generate/generate.cli-command.descriptor.js.map +1 -0
- package/dist/cli/generate/generate/generate.cli-command.impl.d.ts +25 -0
- package/dist/cli/generate/generate/generate.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/generate/generate/generate.cli-command.impl.js +64 -0
- package/dist/cli/generate/generate/generate.cli-command.impl.js.map +1 -0
- package/dist/cli/generate/generate-core.d.ts +51 -0
- package/dist/cli/generate/generate-core.d.ts.map +1 -0
- package/dist/cli/generate/generate-core.js +172 -0
- package/dist/cli/generate/generate-core.js.map +1 -0
- package/dist/cli/generate/index.d.ts +5 -0
- package/dist/cli/generate/index.d.ts.map +1 -0
- package/dist/cli/generate/index.js +5 -0
- package/dist/cli/generate/index.js.map +1 -0
- package/dist/credentials/resolve.d.ts +82 -22
- package/dist/credentials/resolve.d.ts.map +1 -1
- package/dist/credentials/resolve.js +251 -77
- package/dist/credentials/resolve.js.map +1 -1
- package/dist/deployment-budget.d.ts +319 -0
- package/dist/deployment-budget.d.ts.map +1 -0
- package/dist/deployment-budget.js +660 -0
- package/dist/deployment-budget.js.map +1 -0
- package/dist/deployment-environment.d.ts +30 -0
- package/dist/deployment-environment.d.ts.map +1 -0
- package/dist/deployment-environment.js +53 -0
- package/dist/deployment-environment.js.map +1 -0
- package/dist/deployment-graph.d.ts +185 -0
- package/dist/deployment-graph.d.ts.map +1 -0
- package/dist/deployment-graph.js +705 -0
- package/dist/deployment-graph.js.map +1 -0
- package/dist/deployment.d.ts +25 -4
- package/dist/deployment.d.ts.map +1 -1
- package/dist/deployment.js +105 -0
- package/dist/deployment.js.map +1 -1
- package/dist/doks/cloud/base.d.ts +49 -0
- package/dist/doks/cloud/base.d.ts.map +1 -0
- package/dist/doks/cloud/base.js +138 -0
- package/dist/doks/cloud/base.js.map +1 -0
- package/dist/doks/cloud/factory.d.ts +18 -0
- package/dist/doks/cloud/factory.d.ts.map +1 -0
- package/dist/doks/cloud/factory.js +22 -0
- package/dist/doks/cloud/factory.js.map +1 -0
- package/dist/doks/cloud/index.d.ts +5 -0
- package/dist/doks/cloud/index.d.ts.map +1 -0
- package/dist/doks/cloud/index.js +4 -0
- package/dist/doks/cloud/index.js.map +1 -0
- package/dist/doks/types.d.ts +95 -0
- package/dist/doks/types.d.ts.map +1 -0
- package/dist/doks/types.js +14 -0
- package/dist/doks/types.js.map +1 -0
- package/dist/generate/index.d.ts +29 -0
- package/dist/generate/index.d.ts.map +1 -0
- package/dist/generate/index.js +28 -0
- package/dist/generate/index.js.map +1 -0
- package/dist/generate/infra-generate.plugin.d.ts +3 -0
- package/dist/generate/infra-generate.plugin.d.ts.map +1 -0
- package/dist/generate/infra-generate.plugin.js +23 -0
- package/dist/generate/infra-generate.plugin.js.map +1 -0
- package/dist/generate/plugin.d.ts +2 -0
- package/dist/generate/plugin.d.ts.map +1 -0
- package/dist/generate/plugin.js +2 -0
- package/dist/generate/plugin.js.map +1 -0
- package/dist/heartbeat/cron-heartbeat.d.ts +97 -0
- package/dist/heartbeat/cron-heartbeat.d.ts.map +1 -0
- package/dist/heartbeat/cron-heartbeat.js +200 -0
- package/dist/heartbeat/cron-heartbeat.js.map +1 -0
- package/dist/index.d.ts +37 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -14
- package/dist/index.js.map +1 -1
- package/dist/infra.plugin.d.ts +1 -1
- package/dist/infra.plugin.d.ts.map +1 -1
- package/dist/infra.plugin.js +64 -12
- package/dist/infra.plugin.js.map +1 -1
- package/dist/kinds/alerts.kind.d.ts +64 -25
- package/dist/kinds/alerts.kind.d.ts.map +1 -1
- package/dist/kinds/alerts.kind.js +43 -16
- package/dist/kinds/alerts.kind.js.map +1 -1
- package/dist/kinds/artifact.kind.d.ts +58 -10
- package/dist/kinds/artifact.kind.d.ts.map +1 -1
- package/dist/kinds/artifact.kind.js +26 -9
- package/dist/kinds/artifact.kind.js.map +1 -1
- package/dist/kinds/billing.kind.d.ts +88 -0
- package/dist/kinds/billing.kind.d.ts.map +1 -0
- package/dist/kinds/billing.kind.js +48 -0
- package/dist/kinds/billing.kind.js.map +1 -0
- package/dist/kinds/build-job.kind.d.ts +383 -0
- package/dist/kinds/build-job.kind.d.ts.map +1 -0
- package/dist/kinds/build-job.kind.js +218 -0
- package/dist/kinds/build-job.kind.js.map +1 -0
- package/dist/kinds/cache-byte-store.d.ts +23 -0
- package/dist/kinds/cache-byte-store.d.ts.map +1 -0
- package/dist/kinds/cache-byte-store.js +9 -0
- package/dist/kinds/cache-byte-store.js.map +1 -0
- package/dist/kinds/cache.kind.d.ts +38 -94
- package/dist/kinds/cache.kind.d.ts.map +1 -1
- package/dist/kinds/cache.kind.js +39 -50
- package/dist/kinds/cache.kind.js.map +1 -1
- package/dist/kinds/cluster.kind.d.ts +154 -0
- package/dist/kinds/cluster.kind.d.ts.map +1 -0
- package/dist/kinds/cluster.kind.js +99 -0
- package/dist/kinds/cluster.kind.js.map +1 -0
- package/dist/kinds/compute-source.kind.d.ts +155 -0
- package/dist/kinds/compute-source.kind.d.ts.map +1 -0
- package/dist/kinds/compute-source.kind.js +158 -0
- package/dist/kinds/compute-source.kind.js.map +1 -0
- package/dist/kinds/container-registry.kind.d.ts +62 -0
- package/dist/kinds/container-registry.kind.d.ts.map +1 -0
- package/dist/kinds/container-registry.kind.js +47 -0
- package/dist/kinds/container-registry.kind.js.map +1 -0
- package/dist/kinds/database-migrator.kind.d.ts +6 -0
- package/dist/kinds/database-migrator.kind.d.ts.map +1 -0
- package/dist/kinds/database-migrator.kind.js +28 -0
- package/dist/kinds/database-migrator.kind.js.map +1 -0
- package/dist/kinds/database.kind.d.ts +114 -93
- package/dist/kinds/database.kind.d.ts.map +1 -1
- package/dist/kinds/database.kind.js +93 -54
- package/dist/kinds/database.kind.js.map +1 -1
- package/dist/kinds/deployment-provider.kind.d.ts +5 -0
- package/dist/kinds/deployment-provider.kind.d.ts.map +1 -0
- package/dist/kinds/deployment-provider.kind.js +11 -0
- package/dist/kinds/deployment-provider.kind.js.map +1 -0
- package/dist/kinds/discovery.d.ts +5 -12
- package/dist/kinds/discovery.d.ts.map +1 -1
- package/dist/kinds/discovery.js +5 -17
- package/dist/kinds/discovery.js.map +1 -1
- package/dist/kinds/dns.kind.d.ts +162 -0
- package/dist/kinds/dns.kind.d.ts.map +1 -0
- package/dist/kinds/dns.kind.js +54 -0
- package/dist/kinds/dns.kind.js.map +1 -0
- package/dist/kinds/drift.kind.d.ts +115 -0
- package/dist/kinds/drift.kind.d.ts.map +1 -0
- package/dist/kinds/drift.kind.js +60 -0
- package/dist/kinds/drift.kind.js.map +1 -0
- package/dist/kinds/edge-hostname.kind.d.ts +124 -0
- package/dist/kinds/edge-hostname.kind.d.ts.map +1 -0
- package/dist/kinds/edge-hostname.kind.js +87 -0
- package/dist/kinds/edge-hostname.kind.js.map +1 -0
- package/dist/kinds/edge-tls.kind.d.ts +194 -0
- package/dist/kinds/edge-tls.kind.d.ts.map +1 -0
- package/dist/kinds/edge-tls.kind.js +58 -0
- package/dist/kinds/edge-tls.kind.js.map +1 -0
- package/dist/kinds/firewall.kind.d.ts +92 -0
- package/dist/kinds/firewall.kind.d.ts.map +1 -0
- package/dist/kinds/firewall.kind.js +59 -0
- package/dist/kinds/firewall.kind.js.map +1 -0
- package/dist/kinds/git-hosting.kind.d.ts +36 -38
- package/dist/kinds/git-hosting.kind.d.ts.map +1 -1
- package/dist/kinds/git-hosting.kind.js +23 -34
- package/dist/kinds/git-hosting.kind.js.map +1 -1
- package/dist/kinds/index.d.ts +41 -15
- package/dist/kinds/index.d.ts.map +1 -1
- package/dist/kinds/index.js +40 -14
- package/dist/kinds/index.js.map +1 -1
- package/dist/kinds/inventory.kind.d.ts +245 -0
- package/dist/kinds/inventory.kind.d.ts.map +1 -0
- package/dist/kinds/inventory.kind.js +243 -0
- package/dist/kinds/inventory.kind.js.map +1 -0
- package/dist/kinds/load-balancer.kind.d.ts +135 -0
- package/dist/kinds/load-balancer.kind.d.ts.map +1 -0
- package/dist/kinds/load-balancer.kind.js +71 -0
- package/dist/kinds/load-balancer.kind.js.map +1 -0
- package/dist/kinds/logs.kind.d.ts +74 -3
- package/dist/kinds/logs.kind.d.ts.map +1 -1
- package/dist/kinds/logs.kind.js +26 -17
- package/dist/kinds/logs.kind.js.map +1 -1
- package/dist/kinds/nfs.kind.d.ts +67 -0
- package/dist/kinds/nfs.kind.d.ts.map +1 -0
- package/dist/kinds/nfs.kind.js +45 -0
- package/dist/kinds/nfs.kind.js.map +1 -0
- package/dist/kinds/node-pool.kind.d.ts +134 -0
- package/dist/kinds/node-pool.kind.d.ts.map +1 -0
- package/dist/kinds/node-pool.kind.js +88 -0
- package/dist/kinds/node-pool.kind.js.map +1 -0
- package/dist/kinds/object-storage.kind.d.ts +50 -24
- package/dist/kinds/object-storage.kind.d.ts.map +1 -1
- package/dist/kinds/object-storage.kind.js +40 -23
- package/dist/kinds/object-storage.kind.js.map +1 -1
- package/dist/kinds/observability.kind.d.ts +104 -6
- package/dist/kinds/observability.kind.d.ts.map +1 -1
- package/dist/kinds/observability.kind.js +67 -9
- package/dist/kinds/observability.kind.js.map +1 -1
- package/dist/kinds/package-registry.kind.d.ts +141 -35
- package/dist/kinds/package-registry.kind.d.ts.map +1 -1
- package/dist/kinds/package-registry.kind.js +55 -25
- package/dist/kinds/package-registry.kind.js.map +1 -1
- package/dist/kinds/queue.kind.d.ts +67 -63
- package/dist/kinds/queue.kind.d.ts.map +1 -1
- package/dist/kinds/queue.kind.js +55 -33
- package/dist/kinds/queue.kind.js.map +1 -1
- package/dist/kinds/read-descriptor.d.ts +15 -0
- package/dist/kinds/read-descriptor.d.ts.map +1 -0
- package/dist/kinds/read-descriptor.js +11 -0
- package/dist/kinds/read-descriptor.js.map +1 -0
- package/dist/kinds/rum.kind.d.ts +36 -6
- package/dist/kinds/rum.kind.d.ts.map +1 -1
- package/dist/kinds/rum.kind.js +6 -7
- package/dist/kinds/rum.kind.js.map +1 -1
- package/dist/kinds/sandbox.kind.d.ts +136 -40
- package/dist/kinds/sandbox.kind.d.ts.map +1 -1
- package/dist/kinds/sandbox.kind.js +82 -43
- package/dist/kinds/sandbox.kind.js.map +1 -1
- package/dist/kinds/select-compute-source.d.ts +72 -0
- package/dist/kinds/select-compute-source.d.ts.map +1 -0
- package/dist/kinds/select-compute-source.js +170 -0
- package/dist/kinds/select-compute-source.js.map +1 -0
- package/dist/kinds/service-release.kind.d.ts +771 -0
- package/dist/kinds/service-release.kind.d.ts.map +1 -0
- package/dist/kinds/service-release.kind.js +676 -0
- package/dist/kinds/service-release.kind.js.map +1 -0
- package/dist/kinds/spend-guard.kind.d.ts +41 -0
- package/dist/kinds/spend-guard.kind.d.ts.map +1 -0
- package/dist/kinds/spend-guard.kind.js +140 -0
- package/dist/kinds/spend-guard.kind.js.map +1 -0
- package/dist/kinds/utilization.kind.d.ts +88 -0
- package/dist/kinds/utilization.kind.d.ts.map +1 -0
- package/dist/kinds/utilization.kind.js +62 -0
- package/dist/kinds/utilization.kind.js.map +1 -0
- package/dist/kinds/volume.kind.d.ts +54 -0
- package/dist/kinds/volume.kind.d.ts.map +1 -0
- package/dist/kinds/volume.kind.js +39 -0
- package/dist/kinds/volume.kind.js.map +1 -0
- package/dist/kinds/vpc.kind.d.ts +61 -0
- package/dist/kinds/vpc.kind.d.ts.map +1 -0
- package/dist/kinds/vpc.kind.js +51 -0
- package/dist/kinds/vpc.kind.js.map +1 -0
- package/dist/kinds/web-app.kind.d.ts +118 -45
- package/dist/kinds/web-app.kind.d.ts.map +1 -1
- package/dist/kinds/web-app.kind.js +69 -42
- package/dist/kinds/web-app.kind.js.map +1 -1
- package/dist/kinds/worker.kind.d.ts +129 -188
- package/dist/kinds/worker.kind.d.ts.map +1 -1
- package/dist/kinds/worker.kind.js +45 -123
- package/dist/kinds/worker.kind.js.map +1 -1
- package/dist/schemas/database-migration.d.ts +173 -0
- package/dist/schemas/database-migration.d.ts.map +1 -0
- package/dist/schemas/database-migration.js +88 -0
- package/dist/schemas/database-migration.js.map +1 -0
- package/dist/schemas/deployment-environment.d.ts +11 -0
- package/dist/schemas/deployment-environment.d.ts.map +1 -0
- package/dist/schemas/deployment-environment.js +9 -0
- package/dist/schemas/deployment-environment.js.map +1 -0
- package/dist/schemas/deployment-provider.d.ts +383 -0
- package/dist/schemas/deployment-provider.d.ts.map +1 -0
- package/dist/schemas/deployment-provider.js +211 -0
- package/dist/schemas/deployment-provider.js.map +1 -0
- package/dist/schemas/log-stream.d.ts +27 -0
- package/dist/schemas/log-stream.d.ts.map +1 -0
- package/dist/schemas/log-stream.js +31 -0
- package/dist/schemas/log-stream.js.map +1 -0
- package/dist/schemas/spend-guard.d.ts +155 -0
- package/dist/schemas/spend-guard.d.ts.map +1 -0
- package/dist/schemas/spend-guard.js +61 -0
- package/dist/schemas/spend-guard.js.map +1 -0
- package/dist/schemas.d.ts +195 -20
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +151 -31
- package/dist/schemas.js.map +1 -1
- package/dist/service.d.ts +87 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +199 -0
- package/dist/service.js.map +1 -0
- package/dist/settle-work.d.ts +20 -0
- package/dist/settle-work.d.ts.map +1 -0
- package/dist/settle-work.js +22 -0
- package/dist/settle-work.js.map +1 -0
- package/dist/web-app-projection.d.ts +208 -0
- package/dist/web-app-projection.d.ts.map +1 -0
- package/dist/web-app-projection.js +95 -0
- package/dist/web-app-projection.js.map +1 -0
- package/package.json +123 -40
- package/SPEC.md +0 -169
- package/src/bootstrap/index.ts +0 -15
- package/src/bootstrap/seed.descriptor.ts +0 -24
- package/src/bootstrap/seed.impl-shape.ts +0 -5
- package/src/bootstrap/seed.kind.ts +0 -26
- package/src/bootstrap/seed.runner.ts +0 -87
- package/src/credentials/resolve.ts +0 -205
- package/src/deployment.ts +0 -57
- package/src/index.ts +0 -149
- package/src/infra.plugin.ts +0 -54
- package/src/kinds/alerts.kind.ts +0 -164
- package/src/kinds/artifact.kind.ts +0 -96
- package/src/kinds/cache.kind.ts +0 -104
- package/src/kinds/database.kind.ts +0 -120
- package/src/kinds/discovery.ts +0 -26
- package/src/kinds/git-hosting.kind.ts +0 -100
- package/src/kinds/index.ts +0 -139
- package/src/kinds/logs.kind.ts +0 -104
- package/src/kinds/object-storage.kind.ts +0 -101
- package/src/kinds/observability.kind.ts +0 -178
- package/src/kinds/package-registry.kind.ts +0 -95
- package/src/kinds/queue.kind.ts +0 -102
- package/src/kinds/rum.kind.ts +0 -135
- package/src/kinds/sandbox.kind.ts +0 -115
- package/src/kinds/web-app.kind.ts +0 -103
- package/src/kinds/worker.kind.ts +0 -203
- package/src/schemas.ts +0 -127
package/src/kinds/worker.kind.ts
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Kind: infra/worker
|
|
3
|
-
*
|
|
4
|
-
* Describes a background worker process.
|
|
5
|
-
*
|
|
6
|
-
* Schema shape: strict common base + `config` discriminated union.
|
|
7
|
-
*
|
|
8
|
-
* - The base defines fields universal across adapters: id/kind/name +
|
|
9
|
-
* the worker shape (entrypoint, queues, concurrency, scaling, env).
|
|
10
|
-
* - Adapter-specific fields (namespace, image, healthPort, …) live under
|
|
11
|
-
* `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 { deploymentEnvRequirementSchema } from '../schemas.ts';
|
|
19
|
-
import { INFRA_DISCOVERY_PATTERN, extractStem } from './discovery.ts';
|
|
20
|
-
|
|
21
|
-
export const WorkerScalingSchema = z.object({
|
|
22
|
-
min: z.number().int().nonnegative().default(1),
|
|
23
|
-
max: z.number().int().positive().default(1),
|
|
24
|
-
cpu: z.string().optional(),
|
|
25
|
-
memory: z.string().optional()
|
|
26
|
-
});
|
|
27
|
-
export type WorkerScaling = z.infer<typeof WorkerScalingSchema>;
|
|
28
|
-
|
|
29
|
-
const WorkerBaseSchema = RuntimeDescriptorSchema.extend({
|
|
30
|
-
kind: z.literal('infra/worker'),
|
|
31
|
-
|
|
32
|
-
/** Path to worker entrypoint (e.g., 'packages/workers/src/ai/entrypoint.ts'). */
|
|
33
|
-
entrypoint: z.string().min(1).optional(),
|
|
34
|
-
|
|
35
|
-
/** Queue names this worker consumes from. */
|
|
36
|
-
queues: z.array(z.string().min(1)).optional(),
|
|
37
|
-
|
|
38
|
-
/** Worker concurrency. */
|
|
39
|
-
concurrency: z.number().int().positive().optional(),
|
|
40
|
-
|
|
41
|
-
/** Scaling configuration. */
|
|
42
|
-
scaling: WorkerScalingSchema.optional(),
|
|
43
|
-
|
|
44
|
-
/** Environment variable requirements. */
|
|
45
|
-
env: z.array(deploymentEnvRequirementSchema).optional()
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
export const DoksDeploymentWorkerConfigSchema = z.object({
|
|
49
|
-
/** Kubernetes namespace (default: vibes). */
|
|
50
|
-
namespace: z.string().min(1).default('vibes'),
|
|
51
|
-
/** Container image (default: vibes/{id}:latest). */
|
|
52
|
-
image: z.string().min(1).optional(),
|
|
53
|
-
/** Health probe port (default: 8080). */
|
|
54
|
-
healthPort: z.number().int().positive().default(8080),
|
|
55
|
-
/** Health probe path (default: /healthz). */
|
|
56
|
-
healthPath: z.string().min(1).default('/healthz'),
|
|
57
|
-
/** Readiness probe path (default: /readyz). */
|
|
58
|
-
readyPath: z.string().min(1).default('/readyz')
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
export const CloudflareWorkersWorkerConfigSchema = z.object({
|
|
62
|
-
/** Cloudflare Workers script name (e.g., "vibes-jobs"). */
|
|
63
|
-
cfWorkerName: z.string().min(1),
|
|
64
|
-
/** Path to the `_worker.js` entry point relative to outputDir. */
|
|
65
|
-
workerEntry: z.string().min(1).default('_worker.js'),
|
|
66
|
-
/** Compatibility date for wrangler. */
|
|
67
|
-
compatibilityDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional(),
|
|
68
|
-
/** Compatibility flags for wrangler. */
|
|
69
|
-
compatibilityFlags: z.array(z.string()).default(['nodejs_compat']),
|
|
70
|
-
/** Environment variables to include. */
|
|
71
|
-
env: z.record(z.string(), z.string()).default({}),
|
|
72
|
-
/** Cloudflare Secrets Store ID for secret bindings. */
|
|
73
|
-
secretsStoreId: z.string().min(1).optional(),
|
|
74
|
-
/**
|
|
75
|
-
* Detailed queue-consumer config. When present, these override the
|
|
76
|
-
* coarse `queues: string[]` field on the base descriptor and let
|
|
77
|
-
* declarations control batch size, retries, and dead-letter routing.
|
|
78
|
-
*/
|
|
79
|
-
consumers: z
|
|
80
|
-
.array(
|
|
81
|
-
z.object({
|
|
82
|
-
queue: z.string().min(1),
|
|
83
|
-
maxBatchSize: z.number().int().positive().default(10),
|
|
84
|
-
maxRetries: z.number().int().min(0).default(3),
|
|
85
|
-
deadLetterQueue: z.string().optional()
|
|
86
|
-
})
|
|
87
|
-
)
|
|
88
|
-
.default([]),
|
|
89
|
-
/** Durable Object class bindings. */
|
|
90
|
-
durableObjects: z
|
|
91
|
-
.array(
|
|
92
|
-
z.object({
|
|
93
|
-
binding: z.string().regex(/^[_A-Z0-9]+$/),
|
|
94
|
-
className: z.string().min(1),
|
|
95
|
-
scriptName: z.string().min(1).optional()
|
|
96
|
-
})
|
|
97
|
-
)
|
|
98
|
-
.default([]),
|
|
99
|
-
/** Durable Object migrations. */
|
|
100
|
-
migrations: z
|
|
101
|
-
.array(
|
|
102
|
-
z.object({
|
|
103
|
-
tag: z.string().min(1),
|
|
104
|
-
newClasses: z.array(z.string().min(1)).optional(),
|
|
105
|
-
renamedClasses: z
|
|
106
|
-
.array(z.object({ from: z.string().min(1), to: z.string().min(1) }))
|
|
107
|
-
.optional(),
|
|
108
|
-
deletedClasses: z.array(z.string().min(1)).optional(),
|
|
109
|
-
newSqliteClasses: z.array(z.string().min(1)).optional()
|
|
110
|
-
})
|
|
111
|
-
)
|
|
112
|
-
.default([]),
|
|
113
|
-
/** Service bindings — call other Workers from this Worker. */
|
|
114
|
-
services: z
|
|
115
|
-
.array(
|
|
116
|
-
z.object({
|
|
117
|
-
binding: z.string().regex(/^[_A-Z0-9]+$/),
|
|
118
|
-
service: z.string().min(1),
|
|
119
|
-
environment: z.string().min(1).optional()
|
|
120
|
-
})
|
|
121
|
-
)
|
|
122
|
-
.default([]),
|
|
123
|
-
/** D1 database bindings. */
|
|
124
|
-
d1Databases: z
|
|
125
|
-
.array(
|
|
126
|
-
z.object({
|
|
127
|
-
binding: z.string().regex(/^[_A-Z0-9]+$/),
|
|
128
|
-
databaseName: z.string().min(1),
|
|
129
|
-
databaseId: z.string().min(1)
|
|
130
|
-
})
|
|
131
|
-
)
|
|
132
|
-
.default([]),
|
|
133
|
-
/** KV namespace bindings. */
|
|
134
|
-
kvNamespaces: z
|
|
135
|
-
.array(
|
|
136
|
-
z.object({
|
|
137
|
-
binding: z.string().min(1),
|
|
138
|
-
id: z.string().min(1)
|
|
139
|
-
})
|
|
140
|
-
)
|
|
141
|
-
.default([]),
|
|
142
|
-
/** R2 bucket bindings. */
|
|
143
|
-
r2Buckets: z
|
|
144
|
-
.array(
|
|
145
|
-
z.object({
|
|
146
|
-
binding: z.string().min(1),
|
|
147
|
-
bucketName: z.string().min(1)
|
|
148
|
-
})
|
|
149
|
-
)
|
|
150
|
-
.default([]),
|
|
151
|
-
/** Queue producer bindings (worker can also produce to queues). */
|
|
152
|
-
queueProducers: z
|
|
153
|
-
.array(
|
|
154
|
-
z.object({
|
|
155
|
-
queue: z.string().min(1),
|
|
156
|
-
binding: z.string().min(1)
|
|
157
|
-
})
|
|
158
|
-
)
|
|
159
|
-
.default([]),
|
|
160
|
-
/** Enable smart placement. */
|
|
161
|
-
smartPlacement: z.boolean().default(false),
|
|
162
|
-
/**
|
|
163
|
-
* Whether this is a job-consumer Worker. When true, deploy step
|
|
164
|
-
* auto-injects the JOB_RESULT_STORE Durable Object binding +
|
|
165
|
-
* initial migration via `generateJobConsumerWorkerConfig` from
|
|
166
|
-
* `@vibesdotdev/infra-cloudflare`.
|
|
167
|
-
*/
|
|
168
|
-
jobConsumer: z.boolean().default(false)
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
export const WorkerConfigSchema = z.union([
|
|
172
|
-
DoksDeploymentWorkerConfigSchema.extend({ adapter: z.literal('doks-deployment') }),
|
|
173
|
-
CloudflareWorkersWorkerConfigSchema.extend({ adapter: z.literal('cloudflare-workers') })
|
|
174
|
-
]);
|
|
175
|
-
|
|
176
|
-
export const WorkerDescriptorSchema = WorkerBaseSchema.extend({
|
|
177
|
-
/**
|
|
178
|
-
* Adapter-specific configuration. Discriminated union — each adapter
|
|
179
|
-
* package defines its own config schema under its discriminator key.
|
|
180
|
-
*/
|
|
181
|
-
config: WorkerConfigSchema.optional()
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
export type WorkerDescriptor = z.infer<typeof WorkerDescriptorSchema>;
|
|
185
|
-
|
|
186
|
-
class DefaultWorkerImplementation {
|
|
187
|
-
constructor(
|
|
188
|
-
public readonly descriptor: RuntimeDescriptor,
|
|
189
|
-
public readonly context: unknown
|
|
190
|
-
) {}
|
|
191
|
-
|
|
192
|
-
get config(): WorkerDescriptor {
|
|
193
|
-
return this.descriptor as WorkerDescriptor;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
export const workerKind = createRuntimeKind<WorkerDescriptor, DefaultWorkerImplementation>({
|
|
198
|
-
id: 'infra/worker',
|
|
199
|
-
descriptorSchema: WorkerDescriptorSchema,
|
|
200
|
-
defaultImplementation: DefaultWorkerImplementation,
|
|
201
|
-
discoveryPattern: INFRA_DISCOVERY_PATTERN,
|
|
202
|
-
extractStem
|
|
203
|
-
});
|
package/src/schemas.ts
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import * as z from 'zod/v4';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Deployment providers with active adapter implementations.
|
|
5
|
-
* Only providers backed by adapter packages are enumerated.
|
|
6
|
-
* - cloudflare-workers: via infra-cloudflare
|
|
7
|
-
* - digitalocean-app: via infra-doks
|
|
8
|
-
*/
|
|
9
|
-
export const deploymentProviderSchema = z.enum([
|
|
10
|
-
'cloudflare-workers',
|
|
11
|
-
'digitalocean-app'
|
|
12
|
-
]);
|
|
13
|
-
export type DeploymentProvider = z.infer<typeof deploymentProviderSchema>;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Map of valid provider × runtime combinations.
|
|
17
|
-
* Used for cross-validation in appDeploymentSchema refinement.
|
|
18
|
-
*/
|
|
19
|
-
const VALID_PROVIDER_RUNTIME_MATRIX: Record<DeploymentProvider, readonly string[]> = {
|
|
20
|
-
'cloudflare-workers': ['edge', 'worker'],
|
|
21
|
-
'digitalocean-app': ['node', 'worker']
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const appRuntimeSchema = z.enum(['edge', 'node', 'worker', 'browser']);
|
|
25
|
-
export type AppRuntime = z.infer<typeof appRuntimeSchema>;
|
|
26
|
-
|
|
27
|
-
export const deploymentOriginSchema = z.object({
|
|
28
|
-
hostname: z.string().min(1),
|
|
29
|
-
origin: z.string().url(),
|
|
30
|
-
kind: z.enum(['primary', 'redirect', 'preview', 'internal']).default('primary'),
|
|
31
|
-
description: z.string().optional()
|
|
32
|
-
});
|
|
33
|
-
export type DeploymentOrigin = z.infer<typeof deploymentOriginSchema>;
|
|
34
|
-
|
|
35
|
-
export const deploymentBuildSchema = z.object({
|
|
36
|
-
workspaceRootDir: z.string().min(1).default('.'),
|
|
37
|
-
appDir: z.string().min(1),
|
|
38
|
-
installCommand: z.string().min(1).optional(),
|
|
39
|
-
buildCommand: z.string().min(1),
|
|
40
|
-
outputDir: z.string().min(1)
|
|
41
|
-
});
|
|
42
|
-
export type DeploymentBuild = z.infer<typeof deploymentBuildSchema>;
|
|
43
|
-
|
|
44
|
-
export const deploymentEnvRequirementSchema = z.object({
|
|
45
|
-
name: z.string().regex(/^[_A-Z0-9]+$/),
|
|
46
|
-
public: z.boolean().optional(),
|
|
47
|
-
required: z.boolean().optional(),
|
|
48
|
-
value: z.string().optional(),
|
|
49
|
-
secret: z.boolean().optional(),
|
|
50
|
-
description: z.string().optional(),
|
|
51
|
-
/**
|
|
52
|
-
* Override the secret name in the remote store. Defaults to `name` when omitted.
|
|
53
|
-
* Only meaningful when `secret: true` and the deployment targets a shared
|
|
54
|
-
* Secrets Store binding (e.g. `secrets_store_secrets[].secret_name`).
|
|
55
|
-
*/
|
|
56
|
-
storeKey: z.string().min(1).optional()
|
|
57
|
-
});
|
|
58
|
-
export type DeploymentEnvRequirement = z.infer<typeof deploymentEnvRequirementSchema>;
|
|
59
|
-
|
|
60
|
-
export const deploymentDependencySchema = z.object({
|
|
61
|
-
appId: z.string().min(1),
|
|
62
|
-
reason: z.string().min(1)
|
|
63
|
-
});
|
|
64
|
-
export type DeploymentDependency = z.infer<typeof deploymentDependencySchema>;
|
|
65
|
-
|
|
66
|
-
export const deploymentUpstreamSchema = z.object({
|
|
67
|
-
name: z.string().min(1),
|
|
68
|
-
origin: z.string().url(),
|
|
69
|
-
purpose: z.string().min(1),
|
|
70
|
-
originEnvVar: z
|
|
71
|
-
.string()
|
|
72
|
-
.regex(/^[_A-Z0-9]+$/)
|
|
73
|
-
.optional()
|
|
74
|
-
});
|
|
75
|
-
export type DeploymentUpstream = z.infer<typeof deploymentUpstreamSchema>;
|
|
76
|
-
|
|
77
|
-
export const appDeploymentSchema = z
|
|
78
|
-
.object({
|
|
79
|
-
appId: z.string().min(1),
|
|
80
|
-
appName: z.string().min(1),
|
|
81
|
-
provider: deploymentProviderSchema,
|
|
82
|
-
runtime: appRuntimeSchema,
|
|
83
|
-
build: deploymentBuildSchema,
|
|
84
|
-
origins: z.array(deploymentOriginSchema).min(1),
|
|
85
|
-
env: z.array(deploymentEnvRequirementSchema).default([]),
|
|
86
|
-
dependsOn: z.array(deploymentDependencySchema).default([]),
|
|
87
|
-
upstreams: z.array(deploymentUpstreamSchema).default([]),
|
|
88
|
-
tags: z.array(z.string()).default([]),
|
|
89
|
-
/** Cloudflare KV namespace bindings (provider-specific extension). */
|
|
90
|
-
kvNamespaces: z
|
|
91
|
-
.array(
|
|
92
|
-
z.object({
|
|
93
|
-
binding: z.string().min(1),
|
|
94
|
-
id: z.string().min(1),
|
|
95
|
-
preview_id: z.string().optional()
|
|
96
|
-
})
|
|
97
|
-
)
|
|
98
|
-
.default([]),
|
|
99
|
-
/**
|
|
100
|
-
* One-off commands to run before the Worker deploy (e.g. DB migrations,
|
|
101
|
-
* seed scripts, cache warmers). Executed sequentially in the appDir.
|
|
102
|
-
*/
|
|
103
|
-
preDeployCommands: z
|
|
104
|
-
.array(
|
|
105
|
-
z.object({
|
|
106
|
-
command: z.string().min(1),
|
|
107
|
-
description: z.string().optional()
|
|
108
|
-
})
|
|
109
|
-
)
|
|
110
|
-
.default([])
|
|
111
|
-
})
|
|
112
|
-
.refine(
|
|
113
|
-
(data: { provider: DeploymentProvider; runtime: string }) => {
|
|
114
|
-
const validRuntimes = VALID_PROVIDER_RUNTIME_MATRIX[data.provider];
|
|
115
|
-
return validRuntimes.includes(data.runtime);
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
error: (issue) => {
|
|
119
|
-
const data = issue.input as { provider: DeploymentProvider; runtime: string };
|
|
120
|
-
return `Invalid runtime "${data.runtime}" for provider "${data.provider}". Valid runtimes: ${VALID_PROVIDER_RUNTIME_MATRIX[data.provider].join(', ')}`;
|
|
121
|
-
},
|
|
122
|
-
path: ['runtime']
|
|
123
|
-
}
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
export type AppDeploymentInput = z.input<typeof appDeploymentSchema>;
|
|
127
|
-
export type AppDeployment = z.infer<typeof appDeploymentSchema>;
|