@vibesdotdev/infra-core 0.0.1 → 1.0.0-rc.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.
- package/LICENSE +18 -0
- package/README.md +33 -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-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.d.ts +8 -4
- package/dist/deployment.d.ts.map +1 -1
- package/dist/deployment.js +30 -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 +34 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -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 +62 -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 +381 -0
- package/dist/kinds/build-job.kind.d.ts.map +1 -0
- package/dist/kinds/build-job.kind.js +216 -0
- package/dist/kinds/build-job.kind.js.map +1 -0
- package/dist/kinds/cache.kind.d.ts +39 -92
- package/dist/kinds/cache.kind.d.ts.map +1 -1
- package/dist/kinds/cache.kind.js +26 -51
- 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 +138 -0
- package/dist/kinds/compute-source.kind.d.ts.map +1 -0
- package/dist/kinds/compute-source.kind.js +145 -0
- package/dist/kinds/compute-source.kind.js.map +1 -0
- package/dist/kinds/compute-sources.descriptors.d.ts +45 -0
- package/dist/kinds/compute-sources.descriptors.d.ts.map +1 -0
- package/dist/kinds/compute-sources.descriptors.js +93 -0
- package/dist/kinds/compute-sources.descriptors.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-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 +40 -15
- package/dist/kinds/index.d.ts.map +1 -1
- package/dist/kinds/index.js +39 -14
- package/dist/kinds/index.js.map +1 -1
- package/dist/kinds/inventory.kind.d.ts +326 -0
- package/dist/kinds/inventory.kind.d.ts.map +1 -0
- package/dist/kinds/inventory.kind.js +188 -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 +27 -31
- package/dist/kinds/package-registry.kind.d.ts.map +1 -1
- package/dist/kinds/package-registry.kind.js +13 -26
- 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 -36
- package/dist/kinds/sandbox.kind.d.ts.map +1 -1
- package/dist/kinds/sandbox.kind.js +80 -34
- 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 +40 -0
- package/dist/kinds/spend-guard.kind.d.ts.map +1 -0
- package/dist/kinds/spend-guard.kind.js +133 -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 +115 -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 +291 -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 +336 -0
- package/dist/schemas/deployment-provider.d.ts.map +1 -0
- package/dist/schemas/deployment-provider.js +198 -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 +190 -20
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +137 -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 +132 -0
- package/dist/web-app-projection.d.ts.map +1 -0
- package/dist/web-app-projection.js +93 -0
- package/dist/web-app-projection.js.map +1 -0
- package/package.json +89 -39
- 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
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kind: infra/drift
|
|
3
|
+
*
|
|
4
|
+
* Generic drift descriptor. Reports differences between declared infra
|
|
5
|
+
* descriptors and the live provider state. Drift entries cover missing
|
|
6
|
+
* resources, unmanaged resources, stale resources, unsafe public exposure,
|
|
7
|
+
* and unexpected cost drivers.
|
|
8
|
+
*/
|
|
9
|
+
import * as z from 'zod/v4';
|
|
10
|
+
import type { RuntimeDescriptor } from '@vibesdotdev/kernel/schemas/descriptor';
|
|
11
|
+
import type { KindContext } from '@vibesdotdev/kernel/schemas/kind';
|
|
12
|
+
export declare const DriftKindSchema: z.ZodEnum<{
|
|
13
|
+
missing: "missing";
|
|
14
|
+
unmanaged: "unmanaged";
|
|
15
|
+
stale: "stale";
|
|
16
|
+
"unsafe-public": "unsafe-public";
|
|
17
|
+
"cost-driver": "cost-driver";
|
|
18
|
+
"config-drift": "config-drift";
|
|
19
|
+
}>;
|
|
20
|
+
export type DriftKind = z.infer<typeof DriftKindSchema>;
|
|
21
|
+
export declare const DriftSeveritySchema: z.ZodEnum<{
|
|
22
|
+
info: "info";
|
|
23
|
+
critical: "critical";
|
|
24
|
+
warning: "warning";
|
|
25
|
+
}>;
|
|
26
|
+
export type DriftSeverity = z.infer<typeof DriftSeveritySchema>;
|
|
27
|
+
export declare const DriftEntrySchema: z.ZodObject<{
|
|
28
|
+
kind: z.ZodEnum<{
|
|
29
|
+
missing: "missing";
|
|
30
|
+
unmanaged: "unmanaged";
|
|
31
|
+
stale: "stale";
|
|
32
|
+
"unsafe-public": "unsafe-public";
|
|
33
|
+
"cost-driver": "cost-driver";
|
|
34
|
+
"config-drift": "config-drift";
|
|
35
|
+
}>;
|
|
36
|
+
severity: z.ZodDefault<z.ZodEnum<{
|
|
37
|
+
info: "info";
|
|
38
|
+
critical: "critical";
|
|
39
|
+
warning: "warning";
|
|
40
|
+
}>>;
|
|
41
|
+
resourceKind: z.ZodString;
|
|
42
|
+
resourceId: z.ZodOptional<z.ZodString>;
|
|
43
|
+
resourceName: z.ZodOptional<z.ZodString>;
|
|
44
|
+
message: z.ZodString;
|
|
45
|
+
expected: z.ZodOptional<z.ZodUnknown>;
|
|
46
|
+
actual: z.ZodOptional<z.ZodUnknown>;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
export type DriftEntry = z.infer<typeof DriftEntrySchema>;
|
|
49
|
+
export declare const DriftReportSchema: z.ZodObject<{
|
|
50
|
+
provider: z.ZodString;
|
|
51
|
+
collectedAt: z.ZodString;
|
|
52
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
53
|
+
kind: z.ZodEnum<{
|
|
54
|
+
missing: "missing";
|
|
55
|
+
unmanaged: "unmanaged";
|
|
56
|
+
stale: "stale";
|
|
57
|
+
"unsafe-public": "unsafe-public";
|
|
58
|
+
"cost-driver": "cost-driver";
|
|
59
|
+
"config-drift": "config-drift";
|
|
60
|
+
}>;
|
|
61
|
+
severity: z.ZodDefault<z.ZodEnum<{
|
|
62
|
+
info: "info";
|
|
63
|
+
critical: "critical";
|
|
64
|
+
warning: "warning";
|
|
65
|
+
}>>;
|
|
66
|
+
resourceKind: z.ZodString;
|
|
67
|
+
resourceId: z.ZodOptional<z.ZodString>;
|
|
68
|
+
resourceName: z.ZodOptional<z.ZodString>;
|
|
69
|
+
message: z.ZodString;
|
|
70
|
+
expected: z.ZodOptional<z.ZodUnknown>;
|
|
71
|
+
actual: z.ZodOptional<z.ZodUnknown>;
|
|
72
|
+
}, z.core.$strip>>;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
export type DriftReport = z.infer<typeof DriftReportSchema>;
|
|
75
|
+
export declare const DriftDescriptorSchema: z.ZodObject<{
|
|
76
|
+
id: z.ZodString;
|
|
77
|
+
name: z.ZodOptional<z.ZodString>;
|
|
78
|
+
description: z.ZodOptional<z.ZodString>;
|
|
79
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
80
|
+
hardware: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
81
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
capabilityId: z.ZodOptional<z.ZodString>;
|
|
84
|
+
requiredContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
85
|
+
optionalContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
86
|
+
config: z.ZodOptional<z.ZodUnknown>;
|
|
87
|
+
retention: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
88
|
+
maxAgeDays: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
maxEntries: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
maxBytes: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
cascadeFrom: z.ZodOptional<z.ZodString>;
|
|
92
|
+
ageField: z.ZodOptional<z.ZodString>;
|
|
93
|
+
reason: z.ZodString;
|
|
94
|
+
enforcedBy: z.ZodOptional<z.ZodString>;
|
|
95
|
+
}, z.core.$strip>]>>;
|
|
96
|
+
kind: z.ZodLiteral<"infra/drift">;
|
|
97
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
export type DriftDescriptor = z.infer<typeof DriftDescriptorSchema>;
|
|
100
|
+
export interface DriftImplementation {
|
|
101
|
+
/** Compute drift between declared and live resources. */
|
|
102
|
+
detect(opts?: {
|
|
103
|
+
kinds?: string[];
|
|
104
|
+
}): Promise<DriftReport>;
|
|
105
|
+
}
|
|
106
|
+
declare class DefaultDriftImplementation {
|
|
107
|
+
readonly descriptor: RuntimeDescriptor;
|
|
108
|
+
readonly context: KindContext;
|
|
109
|
+
/** The descriptor as this kind's schema reads it. */
|
|
110
|
+
readonly config: DriftDescriptor;
|
|
111
|
+
constructor(descriptor: RuntimeDescriptor, context: KindContext);
|
|
112
|
+
}
|
|
113
|
+
export declare const driftKind: import("@vibesdotdev/kernel").RuntimeKindDescriptorRecord<DefaultDriftImplementation>;
|
|
114
|
+
export {};
|
|
115
|
+
//# sourceMappingURL=drift.kind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drift.kind.d.ts","sourceRoot":"","sources":["../../src/kinds/drift.kind.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAIpE,eAAO,MAAM,eAAe;;;;;;;EAO1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,mBAAmB;;;;EAA0C,CAAC;AAC3E,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;iBAS3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;iBAI5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAO5D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;iBAAkB,CAAC;AACrD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,MAAM,WAAW,mBAAmB;IACnC,yDAAyD;IACzD,MAAM,CAAC,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CAC1D;AAED,cAAM,0BAA0B;aAId,UAAU,EAAE,iBAAiB;aAC7B,OAAO,EAAE,WAAW;IAJrC,qDAAqD;IACrD,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;gBAEhB,UAAU,EAAE,iBAAiB,EAC7B,OAAO,EAAE,WAAW;CAKrC;AAED,eAAO,MAAM,SAAS,uFAKpB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kind: infra/drift
|
|
3
|
+
*
|
|
4
|
+
* Generic drift descriptor. Reports differences between declared infra
|
|
5
|
+
* descriptors and the live provider state. Drift entries cover missing
|
|
6
|
+
* resources, unmanaged resources, stale resources, unsafe public exposure,
|
|
7
|
+
* and unexpected cost drivers.
|
|
8
|
+
*/
|
|
9
|
+
import * as z from 'zod/v4';
|
|
10
|
+
import { createRuntimeKind } from '@vibesdotdev/kernel/factory/kind';
|
|
11
|
+
import { RuntimeDescriptorSchema } from '@vibesdotdev/kernel/schemas/descriptor';
|
|
12
|
+
import { readKindDescriptor } from "./read-descriptor.js";
|
|
13
|
+
import { INFRA_DISCOVERY_PATTERNS } from "./discovery.js";
|
|
14
|
+
export const DriftKindSchema = z.enum([
|
|
15
|
+
'missing',
|
|
16
|
+
'unmanaged',
|
|
17
|
+
'stale',
|
|
18
|
+
'unsafe-public',
|
|
19
|
+
'cost-driver',
|
|
20
|
+
'config-drift'
|
|
21
|
+
]);
|
|
22
|
+
export const DriftSeveritySchema = z.enum(['info', 'warning', 'critical']);
|
|
23
|
+
export const DriftEntrySchema = z.object({
|
|
24
|
+
kind: DriftKindSchema,
|
|
25
|
+
severity: DriftSeveritySchema.default('warning'),
|
|
26
|
+
resourceKind: z.string(),
|
|
27
|
+
resourceId: z.string().optional(),
|
|
28
|
+
resourceName: z.string().optional(),
|
|
29
|
+
message: z.string(),
|
|
30
|
+
expected: z.unknown().optional(),
|
|
31
|
+
actual: z.unknown().optional()
|
|
32
|
+
});
|
|
33
|
+
export const DriftReportSchema = z.object({
|
|
34
|
+
provider: z.string(),
|
|
35
|
+
collectedAt: z.string(),
|
|
36
|
+
entries: z.array(DriftEntrySchema)
|
|
37
|
+
});
|
|
38
|
+
const DriftBaseSchema = RuntimeDescriptorSchema.extend({
|
|
39
|
+
kind: z.literal('infra/drift'),
|
|
40
|
+
provider: z.string().min(1).optional()
|
|
41
|
+
});
|
|
42
|
+
export const DriftDescriptorSchema = DriftBaseSchema;
|
|
43
|
+
class DefaultDriftImplementation {
|
|
44
|
+
descriptor;
|
|
45
|
+
context;
|
|
46
|
+
/** The descriptor as this kind's schema reads it. */
|
|
47
|
+
config;
|
|
48
|
+
constructor(descriptor, context) {
|
|
49
|
+
this.descriptor = descriptor;
|
|
50
|
+
this.context = context;
|
|
51
|
+
this.config = readKindDescriptor(DriftDescriptorSchema, descriptor);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export const driftKind = createRuntimeKind({
|
|
55
|
+
id: 'infra/drift',
|
|
56
|
+
descriptorSchema: DriftDescriptorSchema,
|
|
57
|
+
defaultImplementation: DefaultDriftImplementation,
|
|
58
|
+
discoveryPatterns: INFRA_DISCOVERY_PATTERNS
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=drift.kind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drift.kind.js","sourceRoot":"","sources":["../../src/kinds/drift.kind.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAGjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAA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Q,EAAE;CACtC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC;AAQrD,MAAM,0BAA0B;IAId;IACA;IAJjB,qDAAqD;IAC5C,MAAM,CAAkB;IACjC,YACiB,UAA6B,EAC7B,OAAoB;QADpB,eAAU,GAAV,UAAU,CAAmB;QAC7B,YAAO,GAAP,OAAO,CAAa;QAEpC,IAAI,CAAC,MAAM,GAAG,kBAAkB,CAAC,qBAAqB,EAAE,UAAU,CAAC,CAAC;IACrE,CAAC;CAED;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,iBAAiB,CAA8C;IACvF,EAAE,EAAE,aAAa;IACjB,gBAAgB,EAAE,qBAAqB;IACvC,qBAAqB,EAAE,0BAA0B;IACjD,iBAAiB,EAAE,wBAAwB;CAC3C,CAAC,CAAC"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infra Edge TLS Kind
|
|
3
|
+
*
|
|
4
|
+
* Provider-agnostic schema for the TLS policy an edge/CDN uses when it
|
|
5
|
+
* connects to an origin. This governs the edge→origin leg only; the
|
|
6
|
+
* browser→edge leg is certificate and hostname configuration, not this kind.
|
|
7
|
+
*
|
|
8
|
+
* The policy is modeled per hostname rather than per zone because a zone
|
|
9
|
+
* routinely fronts origins with different certificate maturity: a hardened
|
|
10
|
+
* origin needs `verified`, while a legacy origin with a self-signed or
|
|
11
|
+
* expired certificate still answers only under `opportunistic`. A zone-wide
|
|
12
|
+
* value forces the weakest origin's policy onto every hostname.
|
|
13
|
+
*
|
|
14
|
+
* `opportunistic` is a loop hazard, not merely weak: when the edge speaks
|
|
15
|
+
* plaintext to an origin that redirects to HTTPS, a same-zone subrequest
|
|
16
|
+
* bounces between edge and origin until the edge gives up. Any hostname whose
|
|
17
|
+
* origin redirects HTTP to HTTPS must be `verified` or `encrypted`.
|
|
18
|
+
*/
|
|
19
|
+
import * as z from 'zod/v4';
|
|
20
|
+
import type { InfraAuthorityFingerprint } from './inventory.kind.ts';
|
|
21
|
+
/**
|
|
22
|
+
* - `verified`: encrypt and require a valid certificate for the origin hostname.
|
|
23
|
+
* - `encrypted`: encrypt without validating the origin certificate.
|
|
24
|
+
* - `opportunistic`: connect in plaintext when the origin allows it.
|
|
25
|
+
* - `off`: never encrypt the edge→origin leg.
|
|
26
|
+
*/
|
|
27
|
+
declare const OriginTlsPolicySchema: z.ZodEnum<{
|
|
28
|
+
off: "off";
|
|
29
|
+
verified: "verified";
|
|
30
|
+
encrypted: "encrypted";
|
|
31
|
+
opportunistic: "opportunistic";
|
|
32
|
+
}>;
|
|
33
|
+
export type OriginTlsPolicy = z.infer<typeof OriginTlsPolicySchema>;
|
|
34
|
+
declare const EdgeTlsPolicySchema: z.ZodObject<{
|
|
35
|
+
hostnames: z.ZodArray<z.ZodString>;
|
|
36
|
+
policy: z.ZodEnum<{
|
|
37
|
+
off: "off";
|
|
38
|
+
verified: "verified";
|
|
39
|
+
encrypted: "encrypted";
|
|
40
|
+
opportunistic: "opportunistic";
|
|
41
|
+
}>;
|
|
42
|
+
description: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
export type EdgeTlsPolicy = z.infer<typeof EdgeTlsPolicySchema>;
|
|
45
|
+
export type EdgeTlsPolicyInput = z.input<typeof EdgeTlsPolicySchema>;
|
|
46
|
+
declare const EdgeTlsBaseSchema: z.ZodObject<{
|
|
47
|
+
id: z.ZodString;
|
|
48
|
+
name: z.ZodOptional<z.ZodString>;
|
|
49
|
+
description: z.ZodOptional<z.ZodString>;
|
|
50
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
51
|
+
hardware: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
52
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
53
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
capabilityId: z.ZodOptional<z.ZodString>;
|
|
55
|
+
requiredContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
56
|
+
optionalContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
57
|
+
config: z.ZodOptional<z.ZodUnknown>;
|
|
58
|
+
retention: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
59
|
+
maxAgeDays: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
maxEntries: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
maxBytes: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
cascadeFrom: z.ZodOptional<z.ZodString>;
|
|
63
|
+
ageField: z.ZodOptional<z.ZodString>;
|
|
64
|
+
reason: z.ZodString;
|
|
65
|
+
enforcedBy: z.ZodOptional<z.ZodString>;
|
|
66
|
+
}, z.core.$strip>]>>;
|
|
67
|
+
kind: z.ZodLiteral<"infra/edge-tls">;
|
|
68
|
+
adapter: z.ZodString;
|
|
69
|
+
adapterConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
70
|
+
zone: z.ZodOptional<z.ZodString>;
|
|
71
|
+
environment: z.ZodDefault<z.ZodString>;
|
|
72
|
+
policies: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
73
|
+
hostnames: z.ZodArray<z.ZodString>;
|
|
74
|
+
policy: z.ZodEnum<{
|
|
75
|
+
off: "off";
|
|
76
|
+
verified: "verified";
|
|
77
|
+
encrypted: "encrypted";
|
|
78
|
+
opportunistic: "opportunistic";
|
|
79
|
+
}>;
|
|
80
|
+
description: z.ZodOptional<z.ZodString>;
|
|
81
|
+
}, z.core.$strip>>>;
|
|
82
|
+
}, z.core.$strip>;
|
|
83
|
+
export type InfraEdgeTlsDescriptor = z.infer<typeof EdgeTlsBaseSchema>;
|
|
84
|
+
export type InfraEdgeTlsDescriptorInput = z.input<typeof EdgeTlsBaseSchema>;
|
|
85
|
+
/** A policy as it exists on the provider, carrying provider-assigned identity. */
|
|
86
|
+
export interface LiveEdgeTlsPolicy {
|
|
87
|
+
providerId: string;
|
|
88
|
+
zone: string;
|
|
89
|
+
hostnames: string[];
|
|
90
|
+
/** Null when the provider reports a value outside this kind's enum. */
|
|
91
|
+
policy: OriginTlsPolicy | null;
|
|
92
|
+
/** Raw provider value, kept so unmapped policies stay visible as evidence. */
|
|
93
|
+
providerValue: string;
|
|
94
|
+
/** Provider-native match condition, kept as evidence of what really matches. */
|
|
95
|
+
expression: string;
|
|
96
|
+
enabled: boolean;
|
|
97
|
+
description?: string;
|
|
98
|
+
/**
|
|
99
|
+
* False when the live shape is outside what this kind writes — a compound
|
|
100
|
+
* rule, or a condition that is not a plain hostname set. Unmanaged policies
|
|
101
|
+
* are reported but never rewritten.
|
|
102
|
+
*/
|
|
103
|
+
managed: boolean;
|
|
104
|
+
}
|
|
105
|
+
export interface EdgeTlsZoneDefault {
|
|
106
|
+
zone: string;
|
|
107
|
+
/** Null when the provider reports a value outside this kind's enum. */
|
|
108
|
+
policy: OriginTlsPolicy | null;
|
|
109
|
+
providerValue: string;
|
|
110
|
+
/** False when the provider forbids changing the default on this plan. */
|
|
111
|
+
editable: boolean;
|
|
112
|
+
}
|
|
113
|
+
export interface EdgeTlsSnapshot {
|
|
114
|
+
zone: string;
|
|
115
|
+
default: EdgeTlsZoneDefault;
|
|
116
|
+
policies: LiveEdgeTlsPolicy[];
|
|
117
|
+
/**
|
|
118
|
+
* Configuration a co-tenant owns in the same provider container, which a
|
|
119
|
+
* write must carry forward untouched. Non-zero here means this kind is not
|
|
120
|
+
* the only author, so a full-replacement write would destroy work.
|
|
121
|
+
*/
|
|
122
|
+
coTenantRules: number;
|
|
123
|
+
}
|
|
124
|
+
export interface EdgeTlsWriteResult {
|
|
125
|
+
providerId: string;
|
|
126
|
+
created: boolean;
|
|
127
|
+
/** Co-tenant configuration re-sent verbatim by this write. */
|
|
128
|
+
preservedRules: number;
|
|
129
|
+
/** Total entries in the provider container after the write. */
|
|
130
|
+
totalRules: number;
|
|
131
|
+
}
|
|
132
|
+
export interface EdgeTlsDeleteResult {
|
|
133
|
+
/** Policies removed outright because the hostname was their only member. */
|
|
134
|
+
removed: string[];
|
|
135
|
+
/** Policies kept but narrowed because they also covered other hostnames. */
|
|
136
|
+
narrowed: string[];
|
|
137
|
+
preservedRules: number;
|
|
138
|
+
totalRules: number;
|
|
139
|
+
}
|
|
140
|
+
export interface EdgeTlsZoneDefaultChange {
|
|
141
|
+
zone: string;
|
|
142
|
+
from: OriginTlsPolicy | null;
|
|
143
|
+
to: OriginTlsPolicy;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Implementation contract every provider implements.
|
|
147
|
+
*
|
|
148
|
+
* `setPolicy` is idempotent on the hostname set: it updates the live policy
|
|
149
|
+
* for exactly those hostnames rather than adding a second policy that would
|
|
150
|
+
* race it. Providers that store policies in a shared, wholesale-replaced
|
|
151
|
+
* container must merge co-tenant entries forward; the reported
|
|
152
|
+
* `preservedRules` is the evidence that they did.
|
|
153
|
+
*/
|
|
154
|
+
export interface EdgeTlsImplementation {
|
|
155
|
+
/** Redacted authority used by the latest provider request. */
|
|
156
|
+
getAuthority?(): Promise<InfraAuthorityFingerprint>;
|
|
157
|
+
/** Live per-hostname policies plus the zone default, optionally narrowed. */
|
|
158
|
+
read(filter?: {
|
|
159
|
+
hostname?: string;
|
|
160
|
+
}): Promise<EdgeTlsSnapshot>;
|
|
161
|
+
setPolicy(policy: EdgeTlsPolicyInput): Promise<EdgeTlsWriteResult>;
|
|
162
|
+
/** Drop one hostname's policy. Absence is not an error. */
|
|
163
|
+
deletePolicy(filter: {
|
|
164
|
+
hostname: string;
|
|
165
|
+
}): Promise<EdgeTlsDeleteResult>;
|
|
166
|
+
/**
|
|
167
|
+
* Change the zone-wide default. `verified` breaks every hostname whose
|
|
168
|
+
* origin does not serve a valid certificate for its own name, including
|
|
169
|
+
* hostnames with no per-hostname policy of their own, so implementations
|
|
170
|
+
* refuse the call until the caller acknowledges that blast radius.
|
|
171
|
+
*/
|
|
172
|
+
setZoneDefault(policy: OriginTlsPolicy, options: {
|
|
173
|
+
acknowledgeOriginBreakage: boolean;
|
|
174
|
+
}): Promise<EdgeTlsZoneDefaultChange>;
|
|
175
|
+
/**
|
|
176
|
+
* Diff desired against live for the hostname sets in `desired`. Policies
|
|
177
|
+
* outside those sets are never reported for deletion — this kind is
|
|
178
|
+
* additive by default so it can coexist with co-tenant policies.
|
|
179
|
+
*/
|
|
180
|
+
diff(desired: EdgeTlsPolicyInput[]): Promise<{
|
|
181
|
+
create: EdgeTlsPolicy[];
|
|
182
|
+
update: Array<{
|
|
183
|
+
providerId: string;
|
|
184
|
+
from: LiveEdgeTlsPolicy;
|
|
185
|
+
to: EdgeTlsPolicy;
|
|
186
|
+
}>;
|
|
187
|
+
unchanged: LiveEdgeTlsPolicy[];
|
|
188
|
+
}>;
|
|
189
|
+
}
|
|
190
|
+
export declare const edgeTlsKind: import("@vibesdotdev/kernel").RuntimeKindDescriptorRecord<EdgeTlsImplementation>;
|
|
191
|
+
export type InfraEdgeTlsKind = InfraEdgeTlsDescriptor;
|
|
192
|
+
export type InfraEdgeTlsKindInput = InfraEdgeTlsDescriptorInput;
|
|
193
|
+
export { EdgeTlsBaseSchema as InfraEdgeTlsDescriptorSchema, EdgeTlsPolicySchema, OriginTlsPolicySchema };
|
|
194
|
+
//# sourceMappingURL=edge-tls.kind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge-tls.kind.d.ts","sourceRoot":"","sources":["../../src/kinds/edge-tls.kind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAI5B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAErE;;;;;GAKG;AACH,QAAA,MAAM,qBAAqB;;;;;EAA4D,CAAC;AAExF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,QAAA,M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AAK,CAAC;YAAE,UAAU,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,iBAAiB,CAAC;YAAC,EAAE,EAAE,aAAa,CAAA;SAAE,CAAC,CAAC;QAClF,SAAS,EAAE,iBAAiB,EAAE,CAAC;KAC/B,CAAC,CAAC;CACH;AAED,eAAO,MAAM,WAAW,kFAItB,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AACtD,MAAM,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAEhE,OAAO,EACN,iBAAiB,IAAI,4BAA4B,EACjD,mBAAmB,EACnB,qBAAqB,EACrB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infra Edge TLS Kind
|
|
3
|
+
*
|
|
4
|
+
* Provider-agnostic schema for the TLS policy an edge/CDN uses when it
|
|
5
|
+
* connects to an origin. This governs the edge→origin leg only; the
|
|
6
|
+
* browser→edge leg is certificate and hostname configuration, not this kind.
|
|
7
|
+
*
|
|
8
|
+
* The policy is modeled per hostname rather than per zone because a zone
|
|
9
|
+
* routinely fronts origins with different certificate maturity: a hardened
|
|
10
|
+
* origin needs `verified`, while a legacy origin with a self-signed or
|
|
11
|
+
* expired certificate still answers only under `opportunistic`. A zone-wide
|
|
12
|
+
* value forces the weakest origin's policy onto every hostname.
|
|
13
|
+
*
|
|
14
|
+
* `opportunistic` is a loop hazard, not merely weak: when the edge speaks
|
|
15
|
+
* plaintext to an origin that redirects to HTTPS, a same-zone subrequest
|
|
16
|
+
* bounces between edge and origin until the edge gives up. Any hostname whose
|
|
17
|
+
* origin redirects HTTP to HTTPS must be `verified` or `encrypted`.
|
|
18
|
+
*/
|
|
19
|
+
import * as z from 'zod/v4';
|
|
20
|
+
import { createRuntimeKind } from '@vibesdotdev/kernel/factory/kind';
|
|
21
|
+
import { RuntimeDescriptorSchema } from '@vibesdotdev/kernel/schemas/descriptor';
|
|
22
|
+
import { INFRA_DISCOVERY_PATTERNS } from "./discovery.js";
|
|
23
|
+
/**
|
|
24
|
+
* - `verified`: encrypt and require a valid certificate for the origin hostname.
|
|
25
|
+
* - `encrypted`: encrypt without validating the origin certificate.
|
|
26
|
+
* - `opportunistic`: connect in plaintext when the origin allows it.
|
|
27
|
+
* - `off`: never encrypt the edge→origin leg.
|
|
28
|
+
*/
|
|
29
|
+
const OriginTlsPolicySchema = z.enum(['verified', 'encrypted', 'opportunistic', 'off']);
|
|
30
|
+
const EdgeTlsPolicySchema = z.object({
|
|
31
|
+
/**
|
|
32
|
+
* Hostnames this policy applies to. Treated as a set: order and case do
|
|
33
|
+
* not change identity, so an equivalent declaration resolves to the same
|
|
34
|
+
* live policy instead of adding a second one.
|
|
35
|
+
*/
|
|
36
|
+
hostnames: z.array(z.string().min(1)).min(1),
|
|
37
|
+
policy: OriginTlsPolicySchema,
|
|
38
|
+
/** Operator note stored with the policy where the provider supports it. */
|
|
39
|
+
description: z.string().optional()
|
|
40
|
+
});
|
|
41
|
+
const EdgeTlsBaseSchema = RuntimeDescriptorSchema.extend({
|
|
42
|
+
kind: z.literal('infra/edge-tls'),
|
|
43
|
+
/** Adapter id (e.g. 'cloudflare-edge-tls'). */
|
|
44
|
+
adapter: z.string().min(1),
|
|
45
|
+
adapterConfig: z.record(z.string(), z.unknown()).optional(),
|
|
46
|
+
/** Apex zone this descriptor is authoritative for (e.g. `vibes.dev`). */
|
|
47
|
+
zone: z.string().min(1).optional(),
|
|
48
|
+
/** Environment name for credential resolution via `vibes secrets`. */
|
|
49
|
+
environment: z.string().default('local'),
|
|
50
|
+
policies: z.array(EdgeTlsPolicySchema).default([])
|
|
51
|
+
});
|
|
52
|
+
export const edgeTlsKind = createRuntimeKind({
|
|
53
|
+
id: 'infra/edge-tls',
|
|
54
|
+
descriptorSchema: EdgeTlsBaseSchema,
|
|
55
|
+
discoveryPatterns: INFRA_DISCOVERY_PATTERNS
|
|
56
|
+
});
|
|
57
|
+
export { EdgeTlsBaseSchema as InfraEdgeTlsDescriptorSchema, EdgeTlsPolicySchema, OriginTlsPolicySchema };
|
|
58
|
+
//# sourceMappingURL=edge-tls.kind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge-tls.kind.js","sourceRoot":"","sources":["../../src/kinds/edge-tls.kind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAG1D;;;;;GAKG;AACH,MAAM,qBAAqB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,KAAK,CAAC,CAAC,CAAC;AAIxF,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC;;;;OAIG;IACH,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5C,MAAM,EAAE,qBAAqB;IAC7B,2EAA2E;IAC3E,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC;AAKH,MAAM,iBAAiB,GAAG,uBAAuB,CAAC,MAAM,CAAC;IACxD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC;IACjC,+CAA+C;IAC/C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,aAAa,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC3D,yEAAyE;IACzE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAClC,sEAAsE;IACtE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;IACxC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CAClD,CAAC,CAAC;AA8GH,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAgD;IAC3F,EAAE,EAAE,gBAAgB;IACpB,gBAAgB,EAAE,iBAAiB;IACnC,iBAAiB,EAAE,wBAAwB;CAC3C,CAAC,CAAC;AAKH,OAAO,EACN,iBAAiB,IAAI,4BAA4B,EACjD,mBAAmB,EACnB,qBAAqB,EACrB,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kind: infra/firewall
|
|
3
|
+
*
|
|
4
|
+
* Provider-neutral firewall descriptor. Used both for compute-level firewalls
|
|
5
|
+
* (e.g., DigitalOcean cloud firewall, attached to droplets) and the DOKS
|
|
6
|
+
* control-plane firewall.
|
|
7
|
+
*
|
|
8
|
+
* `config` is an open, adapter-keyed shape (DigitalOcean's firewall config
|
|
9
|
+
* lives in `@vibesdotdev/integrations-digitalocean`); this kind names no
|
|
10
|
+
* provider, so a config for any adapter parses here and the adapter
|
|
11
|
+
* validates its own grammar.
|
|
12
|
+
*/
|
|
13
|
+
import * as z from 'zod/v4';
|
|
14
|
+
import type { RuntimeDescriptor } from '@vibesdotdev/kernel/schemas/descriptor';
|
|
15
|
+
import type { KindContext } from '@vibesdotdev/kernel/schemas/kind';
|
|
16
|
+
export declare const FirewallRuleSchema: z.ZodObject<{
|
|
17
|
+
protocol: z.ZodEnum<{
|
|
18
|
+
tcp: "tcp";
|
|
19
|
+
udp: "udp";
|
|
20
|
+
icmp: "icmp";
|
|
21
|
+
}>;
|
|
22
|
+
ports: z.ZodOptional<z.ZodString>;
|
|
23
|
+
sources: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
24
|
+
destinations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
export type FirewallRule = z.infer<typeof FirewallRuleSchema>;
|
|
27
|
+
/**
|
|
28
|
+
* Adapter-specific configuration: the adapter id plus its own fields. Each
|
|
29
|
+
* adapter package defines and parses its own config schema; this kind names
|
|
30
|
+
* no provider, so a config for any adapter — including one contributed by a
|
|
31
|
+
* user plugin — parses here, and the adapter validates its own grammar.
|
|
32
|
+
*/
|
|
33
|
+
export declare const FirewallConfigSchema: z.ZodObject<{
|
|
34
|
+
adapter: z.ZodString;
|
|
35
|
+
}, z.core.$loose>;
|
|
36
|
+
export type FirewallConfig = z.infer<typeof FirewallConfigSchema>;
|
|
37
|
+
export declare const FirewallDescriptorSchema: z.ZodObject<{
|
|
38
|
+
id: z.ZodString;
|
|
39
|
+
name: z.ZodOptional<z.ZodString>;
|
|
40
|
+
description: z.ZodOptional<z.ZodString>;
|
|
41
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
42
|
+
hardware: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
43
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
44
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
capabilityId: z.ZodOptional<z.ZodString>;
|
|
46
|
+
requiredContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
47
|
+
optionalContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
48
|
+
retention: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
49
|
+
maxAgeDays: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
maxEntries: z.ZodOptional<z.ZodNumber>;
|
|
51
|
+
maxBytes: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
cascadeFrom: z.ZodOptional<z.ZodString>;
|
|
53
|
+
ageField: z.ZodOptional<z.ZodString>;
|
|
54
|
+
reason: z.ZodString;
|
|
55
|
+
enforcedBy: z.ZodOptional<z.ZodString>;
|
|
56
|
+
}, z.core.$strip>]>>;
|
|
57
|
+
kind: z.ZodLiteral<"infra/firewall">;
|
|
58
|
+
inboundRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
59
|
+
protocol: z.ZodEnum<{
|
|
60
|
+
tcp: "tcp";
|
|
61
|
+
udp: "udp";
|
|
62
|
+
icmp: "icmp";
|
|
63
|
+
}>;
|
|
64
|
+
ports: z.ZodOptional<z.ZodString>;
|
|
65
|
+
sources: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
66
|
+
destinations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
67
|
+
}, z.core.$strip>>>;
|
|
68
|
+
outboundRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
69
|
+
protocol: z.ZodEnum<{
|
|
70
|
+
tcp: "tcp";
|
|
71
|
+
udp: "udp";
|
|
72
|
+
icmp: "icmp";
|
|
73
|
+
}>;
|
|
74
|
+
ports: z.ZodOptional<z.ZodString>;
|
|
75
|
+
sources: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
76
|
+
destinations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
77
|
+
}, z.core.$strip>>>;
|
|
78
|
+
config: z.ZodOptional<z.ZodObject<{
|
|
79
|
+
adapter: z.ZodString;
|
|
80
|
+
}, z.core.$loose>>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
export type FirewallDescriptor = z.infer<typeof FirewallDescriptorSchema>;
|
|
83
|
+
declare class DefaultFirewallImplementation {
|
|
84
|
+
readonly descriptor: RuntimeDescriptor;
|
|
85
|
+
readonly context: KindContext;
|
|
86
|
+
/** The descriptor as this kind's schema reads it. */
|
|
87
|
+
readonly config: FirewallDescriptor;
|
|
88
|
+
constructor(descriptor: RuntimeDescriptor, context: KindContext);
|
|
89
|
+
}
|
|
90
|
+
export declare const firewallKind: import("@vibesdotdev/kernel").RuntimeKindDescriptorRecord<DefaultFirewallImplementation>;
|
|
91
|
+
export {};
|
|
92
|
+
//# sourceMappingURL=firewall.kind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firewall.kind.d.ts","sourceRoot":"","sources":["../../src/kinds/firewall.kind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAIpE,eAAO,MAAM,kBAAkB;;;;;;;;;iBAK7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAQ9D;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;iBAE/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,cAAM,6BAA6B;aAIjB,UAAU,EAAE,iBAAiB;aAC7B,OAAO,EAAE,WAAW;IAJrC,qDAAqD;IACrD,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;gBAEnB,UAAU,EAAE,iBAAiB,EAC7B,OAAO,EAAE,WAAW;CAKrC;AAED,eAAO,MAAM,YAAY,0FAKvB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kind: infra/firewall
|
|
3
|
+
*
|
|
4
|
+
* Provider-neutral firewall descriptor. Used both for compute-level firewalls
|
|
5
|
+
* (e.g., DigitalOcean cloud firewall, attached to droplets) and the DOKS
|
|
6
|
+
* control-plane firewall.
|
|
7
|
+
*
|
|
8
|
+
* `config` is an open, adapter-keyed shape (DigitalOcean's firewall config
|
|
9
|
+
* lives in `@vibesdotdev/integrations-digitalocean`); this kind names no
|
|
10
|
+
* provider, so a config for any adapter parses here and the adapter
|
|
11
|
+
* validates its own grammar.
|
|
12
|
+
*/
|
|
13
|
+
import * as z from 'zod/v4';
|
|
14
|
+
import { createRuntimeKind } from '@vibesdotdev/kernel/factory/kind';
|
|
15
|
+
import { RuntimeDescriptorSchema } from '@vibesdotdev/kernel/schemas/descriptor';
|
|
16
|
+
import { readKindDescriptor } from "./read-descriptor.js";
|
|
17
|
+
import { INFRA_DISCOVERY_PATTERNS } from "./discovery.js";
|
|
18
|
+
export const FirewallRuleSchema = z.object({
|
|
19
|
+
protocol: z.enum(['tcp', 'udp', 'icmp']),
|
|
20
|
+
ports: z.string().optional(),
|
|
21
|
+
sources: z.array(z.string()).optional(),
|
|
22
|
+
destinations: z.array(z.string()).optional()
|
|
23
|
+
});
|
|
24
|
+
const FirewallBaseSchema = RuntimeDescriptorSchema.extend({
|
|
25
|
+
kind: z.literal('infra/firewall'),
|
|
26
|
+
inboundRules: z.array(FirewallRuleSchema).optional(),
|
|
27
|
+
outboundRules: z.array(FirewallRuleSchema).optional()
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Adapter-specific configuration: the adapter id plus its own fields. Each
|
|
31
|
+
* adapter package defines and parses its own config schema; this kind names
|
|
32
|
+
* no provider, so a config for any adapter — including one contributed by a
|
|
33
|
+
* user plugin — parses here, and the adapter validates its own grammar.
|
|
34
|
+
*/
|
|
35
|
+
export const FirewallConfigSchema = z.looseObject({
|
|
36
|
+
adapter: z.string().min(1)
|
|
37
|
+
});
|
|
38
|
+
export const FirewallDescriptorSchema = FirewallBaseSchema.extend({
|
|
39
|
+
/** Adapter-specific configuration, parsed by the adapter that owns it. */
|
|
40
|
+
config: FirewallConfigSchema.optional()
|
|
41
|
+
});
|
|
42
|
+
class DefaultFirewallImplementation {
|
|
43
|
+
descriptor;
|
|
44
|
+
context;
|
|
45
|
+
/** The descriptor as this kind's schema reads it. */
|
|
46
|
+
config;
|
|
47
|
+
constructor(descriptor, context) {
|
|
48
|
+
this.descriptor = descriptor;
|
|
49
|
+
this.context = context;
|
|
50
|
+
this.config = readKindDescriptor(FirewallDescriptorSchema, descriptor);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export const firewallKind = createRuntimeKind({
|
|
54
|
+
id: 'infra/firewall',
|
|
55
|
+
descriptorSchema: FirewallDescriptorSchema,
|
|
56
|
+
defaultImplementation: DefaultFirewallImplementation,
|
|
57
|
+
discoveryPatterns: INFRA_DISCOVERY_PATTERNS
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=firewall.kind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firewall.kind.js","sourceRoot":"","sources":["../../src/kinds/firewall.kind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAGjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACxC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,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