@vibesdotdev/infra-core 0.0.1
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/README.md +78 -0
- package/SPEC.md +169 -0
- package/dist/bootstrap/index.d.ts +5 -0
- package/dist/bootstrap/index.d.ts.map +1 -0
- package/dist/bootstrap/index.js +4 -0
- package/dist/bootstrap/index.js.map +1 -0
- package/dist/bootstrap/seed.descriptor.d.ts +31 -0
- package/dist/bootstrap/seed.descriptor.d.ts.map +1 -0
- package/dist/bootstrap/seed.descriptor.js +18 -0
- package/dist/bootstrap/seed.descriptor.js.map +1 -0
- package/dist/bootstrap/seed.impl-shape.d.ts +5 -0
- package/dist/bootstrap/seed.impl-shape.d.ts.map +1 -0
- package/dist/bootstrap/seed.impl-shape.js +2 -0
- package/dist/bootstrap/seed.impl-shape.js.map +1 -0
- package/dist/bootstrap/seed.kind.d.ts +5 -0
- package/dist/bootstrap/seed.kind.d.ts.map +1 -0
- package/dist/bootstrap/seed.kind.js +14 -0
- package/dist/bootstrap/seed.kind.js.map +1 -0
- package/dist/bootstrap/seed.runner.d.ts +18 -0
- package/dist/bootstrap/seed.runner.d.ts.map +1 -0
- package/dist/bootstrap/seed.runner.js +59 -0
- package/dist/bootstrap/seed.runner.js.map +1 -0
- package/dist/credentials/resolve.d.ts +80 -0
- package/dist/credentials/resolve.d.ts.map +1 -0
- package/dist/credentials/resolve.js +128 -0
- package/dist/credentials/resolve.js.map +1 -0
- package/dist/deployment.d.ts +9 -0
- package/dist/deployment.d.ts.map +1 -0
- package/dist/deployment.js +25 -0
- package/dist/deployment.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/infra.plugin.d.ts +18 -0
- package/dist/infra.plugin.d.ts.map +1 -0
- package/dist/infra.plugin.js +52 -0
- package/dist/infra.plugin.js.map +1 -0
- package/dist/kinds/alerts.kind.d.ts +192 -0
- package/dist/kinds/alerts.kind.d.ts.map +1 -0
- package/dist/kinds/alerts.kind.js +116 -0
- package/dist/kinds/alerts.kind.js.map +1 -0
- package/dist/kinds/artifact.kind.d.ts +96 -0
- package/dist/kinds/artifact.kind.d.ts.map +1 -0
- package/dist/kinds/artifact.kind.js +53 -0
- package/dist/kinds/artifact.kind.js.map +1 -0
- package/dist/kinds/cache.kind.d.ts +128 -0
- package/dist/kinds/cache.kind.d.ts.map +1 -0
- package/dist/kinds/cache.kind.js +90 -0
- package/dist/kinds/cache.kind.js.map +1 -0
- package/dist/kinds/database.kind.d.ts +141 -0
- package/dist/kinds/database.kind.d.ts.map +1 -0
- package/dist/kinds/database.kind.js +103 -0
- package/dist/kinds/database.kind.js.map +1 -0
- package/dist/kinds/discovery.d.ts +20 -0
- package/dist/kinds/discovery.d.ts.map +1 -0
- package/dist/kinds/discovery.js +25 -0
- package/dist/kinds/discovery.js.map +1 -0
- package/dist/kinds/git-hosting.kind.d.ts +98 -0
- package/dist/kinds/git-hosting.kind.d.ts.map +1 -0
- package/dist/kinds/git-hosting.kind.js +81 -0
- package/dist/kinds/git-hosting.kind.js.map +1 -0
- package/dist/kinds/index.d.ts +16 -0
- package/dist/kinds/index.d.ts.map +1 -0
- package/dist/kinds/index.js +16 -0
- package/dist/kinds/index.js.map +1 -0
- package/dist/kinds/logs.kind.d.ts +91 -0
- package/dist/kinds/logs.kind.d.ts.map +1 -0
- package/dist/kinds/logs.kind.js +73 -0
- package/dist/kinds/logs.kind.js.map +1 -0
- package/dist/kinds/object-storage.kind.d.ts +85 -0
- package/dist/kinds/object-storage.kind.d.ts.map +1 -0
- package/dist/kinds/object-storage.kind.js +81 -0
- package/dist/kinds/object-storage.kind.js.map +1 -0
- package/dist/kinds/observability.kind.d.ts +176 -0
- package/dist/kinds/observability.kind.d.ts.map +1 -0
- package/dist/kinds/observability.kind.js +120 -0
- package/dist/kinds/observability.kind.js.map +1 -0
- package/dist/kinds/package-registry.kind.d.ts +89 -0
- package/dist/kinds/package-registry.kind.d.ts.map +1 -0
- package/dist/kinds/package-registry.kind.js +78 -0
- package/dist/kinds/package-registry.kind.js.map +1 -0
- package/dist/kinds/queue.kind.d.ts +113 -0
- package/dist/kinds/queue.kind.d.ts.map +1 -0
- package/dist/kinds/queue.kind.js +86 -0
- package/dist/kinds/queue.kind.js.map +1 -0
- package/dist/kinds/rum.kind.d.ts +113 -0
- package/dist/kinds/rum.kind.d.ts.map +1 -0
- package/dist/kinds/rum.kind.js +80 -0
- package/dist/kinds/rum.kind.js.map +1 -0
- package/dist/kinds/sandbox.kind.d.ts +111 -0
- package/dist/kinds/sandbox.kind.d.ts.map +1 -0
- package/dist/kinds/sandbox.kind.js +94 -0
- package/dist/kinds/sandbox.kind.js.map +1 -0
- package/dist/kinds/web-app.kind.d.ts +99 -0
- package/dist/kinds/web-app.kind.d.ts.map +1 -0
- package/dist/kinds/web-app.kind.js +86 -0
- package/dist/kinds/web-app.kind.js.map +1 -0
- package/dist/kinds/worker.kind.d.ts +244 -0
- package/dist/kinds/worker.kind.d.ts.map +1 -0
- package/dist/kinds/worker.kind.js +171 -0
- package/dist/kinds/worker.kind.js.map +1 -0
- package/dist/schemas.d.ts +125 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +102 -0
- package/dist/schemas.js.map +1 -0
- package/package.json +92 -0
- package/src/bootstrap/index.ts +15 -0
- package/src/bootstrap/seed.descriptor.ts +24 -0
- package/src/bootstrap/seed.impl-shape.ts +5 -0
- package/src/bootstrap/seed.kind.ts +26 -0
- package/src/bootstrap/seed.runner.ts +87 -0
- package/src/credentials/resolve.ts +205 -0
- package/src/deployment.ts +57 -0
- package/src/index.ts +149 -0
- package/src/infra.plugin.ts +54 -0
- package/src/kinds/alerts.kind.ts +164 -0
- package/src/kinds/artifact.kind.ts +96 -0
- package/src/kinds/cache.kind.ts +104 -0
- package/src/kinds/database.kind.ts +120 -0
- package/src/kinds/discovery.ts +26 -0
- package/src/kinds/git-hosting.kind.ts +100 -0
- package/src/kinds/index.ts +139 -0
- package/src/kinds/logs.kind.ts +104 -0
- package/src/kinds/object-storage.kind.ts +101 -0
- package/src/kinds/observability.kind.ts +178 -0
- package/src/kinds/package-registry.kind.ts +95 -0
- package/src/kinds/queue.kind.ts +102 -0
- package/src/kinds/rum.kind.ts +135 -0
- package/src/kinds/sandbox.kind.ts +115 -0
- package/src/kinds/web-app.kind.ts +103 -0
- package/src/kinds/worker.kind.ts +203 -0
- package/src/schemas.ts +127 -0
|
@@ -0,0 +1,116 @@
|
|
|
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
|
+
import * as z from 'zod/v4';
|
|
19
|
+
import { createRuntimeKind } from '@vibesdotdev/runtime/factory/kind';
|
|
20
|
+
import { RuntimeDescriptorSchema } from '@vibesdotdev/runtime/schemas/descriptor';
|
|
21
|
+
import { INFRA_DISCOVERY_PATTERN, extractStem } from "./discovery.js";
|
|
22
|
+
/**
|
|
23
|
+
* Delivery channel for an alert. Provider impls translate these to
|
|
24
|
+
* native delivery slots (e.g. CF's `mechanisms.email[]`).
|
|
25
|
+
*/
|
|
26
|
+
const AlertMechanismSchema = z.discriminatedUnion('kind', [
|
|
27
|
+
z.object({
|
|
28
|
+
kind: z.literal('email'),
|
|
29
|
+
/** Email address — must be a verified destination on the provider. */
|
|
30
|
+
target: z.email()
|
|
31
|
+
}),
|
|
32
|
+
z.object({
|
|
33
|
+
kind: z.literal('webhook'),
|
|
34
|
+
/** Outbound webhook URL. */
|
|
35
|
+
target: z.string().url(),
|
|
36
|
+
/** Optional secret name (in the active secrets store) used for HMAC signing. */
|
|
37
|
+
secretRef: z.string().optional()
|
|
38
|
+
}),
|
|
39
|
+
z.object({
|
|
40
|
+
kind: z.literal('pagerduty'),
|
|
41
|
+
/** PagerDuty integration key (Events API v2). */
|
|
42
|
+
target: z.string().min(1)
|
|
43
|
+
}),
|
|
44
|
+
z.object({
|
|
45
|
+
kind: z.literal('slack'),
|
|
46
|
+
/** Slack webhook URL (Incoming Webhooks). */
|
|
47
|
+
target: z.string().url()
|
|
48
|
+
})
|
|
49
|
+
]);
|
|
50
|
+
/**
|
|
51
|
+
* Cross-provider alert categories. Each maps to one or more native
|
|
52
|
+
* alert types per provider.
|
|
53
|
+
*/
|
|
54
|
+
const AlertTypeSchema = z.enum([
|
|
55
|
+
/** Total cost crossed a dollar threshold for the current billing period. */
|
|
56
|
+
'budget',
|
|
57
|
+
/** Per-product usage crossed a numeric threshold (events/req/GB/etc.). */
|
|
58
|
+
'usage',
|
|
59
|
+
/** Worker/service error rate over a rolling window. */
|
|
60
|
+
'error-rate',
|
|
61
|
+
/** P99 latency or wall-time crossed a threshold. */
|
|
62
|
+
'latency',
|
|
63
|
+
/** Catch-all for provider-specific types not yet modeled here. */
|
|
64
|
+
'custom'
|
|
65
|
+
]);
|
|
66
|
+
const AlertWindowSchema = z.enum(['5m', '15m', '1h', '6h', '24h', '7d', '30d']);
|
|
67
|
+
const AlertPolicySchema = z.object({
|
|
68
|
+
/** Stable id for diffing. Auto-generated when omitted. */
|
|
69
|
+
id: z.string().min(1).optional(),
|
|
70
|
+
/** Human-readable name (also surfaced by the provider). */
|
|
71
|
+
name: z.string().min(1),
|
|
72
|
+
type: AlertTypeSchema,
|
|
73
|
+
/**
|
|
74
|
+
* Threshold value. `budget` reads it as USD (or local currency).
|
|
75
|
+
* `usage`/`error-rate`/`latency` read it as units defined by the
|
|
76
|
+
* filter (event count, %, ms).
|
|
77
|
+
*/
|
|
78
|
+
threshold: z.number().nonnegative(),
|
|
79
|
+
/** Optional secondary threshold for tiered alerts. */
|
|
80
|
+
warningThreshold: z.number().nonnegative().optional(),
|
|
81
|
+
/** Rolling window for `usage`/`error-rate`/`latency`. Ignored for `budget`. */
|
|
82
|
+
window: AlertWindowSchema.optional(),
|
|
83
|
+
/**
|
|
84
|
+
* Adapter-specific filters. Examples:
|
|
85
|
+
* { product: 'workers_observability' } // usage on a specific CF product
|
|
86
|
+
* { worker: 'vibes-account' } // error-rate scoped to one worker
|
|
87
|
+
* { native_alert_type: 'health_check_status_notification' } // custom escape
|
|
88
|
+
*/
|
|
89
|
+
filters: z.record(z.string(), z.string()).default({}),
|
|
90
|
+
mechanisms: z.array(AlertMechanismSchema).min(1),
|
|
91
|
+
enabled: z.boolean().default(true),
|
|
92
|
+
description: z.string().optional()
|
|
93
|
+
});
|
|
94
|
+
const AlertsBaseSchema = RuntimeDescriptorSchema.extend({
|
|
95
|
+
kind: z.literal('infra/alerts'),
|
|
96
|
+
/** Adapter id (e.g. 'cloudflare-alerts', 'do-monitoring'). */
|
|
97
|
+
adapter: z.string().min(1),
|
|
98
|
+
adapterConfig: z.record(z.string(), z.unknown()).optional(),
|
|
99
|
+
/**
|
|
100
|
+
* Default environment name for credential resolution via `vibes
|
|
101
|
+
* secrets`. Defaults to 'local' since the CLI / dev workflow is
|
|
102
|
+
* the primary caller; production Workers that consume this adapter
|
|
103
|
+
* read credentials from CF Secrets Store bindings directly, not
|
|
104
|
+
* through this descriptor.
|
|
105
|
+
*/
|
|
106
|
+
environment: z.string().default('local'),
|
|
107
|
+
policies: z.array(AlertPolicySchema).default([])
|
|
108
|
+
});
|
|
109
|
+
export const alertsKind = createRuntimeKind({
|
|
110
|
+
id: 'infra/alerts',
|
|
111
|
+
descriptorSchema: AlertsBaseSchema,
|
|
112
|
+
discoveryPattern: INFRA_DISCOVERY_PATTERN,
|
|
113
|
+
extractStem
|
|
114
|
+
});
|
|
115
|
+
export { AlertsBaseSchema as InfraAlertsDescriptorSchema, AlertPolicySchema, AlertMechanismSchema, AlertTypeSchema, AlertWindowSchema };
|
|
116
|
+
//# sourceMappingURL=alerts.kind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alerts.kind.js","sourceRoot":"","sources":["../../src/kinds/alerts.kind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEtE;;;GAGG;AACH,MAAM,oBAAoB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IACzD,CAAC,CAAC,MAAM,CAAC;QACR,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;QACxB,sEAAsE;QACtE,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE;KACjB,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACR,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;QAC1B,4BAA4B;QAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;QACxB,gFAAgF;QAChF,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAChC,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACR,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,C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|
+
*
|
|
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
|
+
/**
|
|
18
|
+
* Minimal base schema for artifact descriptors.
|
|
19
|
+
*
|
|
20
|
+
* Implementations extend this with their own fields (source resources,
|
|
21
|
+
* output format, generation options, etc.).
|
|
22
|
+
*/
|
|
23
|
+
declare const ArtifactBaseSchema: z.ZodObject<{
|
|
24
|
+
id: z.ZodString;
|
|
25
|
+
name: z.ZodOptional<z.ZodString>;
|
|
26
|
+
description: z.ZodOptional<z.ZodString>;
|
|
27
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
28
|
+
hardware: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
29
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
requiredContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
32
|
+
optionalContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
33
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
34
|
+
kind: z.ZodLiteral<"infra/artifact">;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
/**
|
|
37
|
+
* Generic artifact generator interface.
|
|
38
|
+
*
|
|
39
|
+
* Implementations define their own input/output shapes.
|
|
40
|
+
*/
|
|
41
|
+
export interface ArtifactGenerator {
|
|
42
|
+
/**
|
|
43
|
+
* Generate artifact content.
|
|
44
|
+
*
|
|
45
|
+
* @param options - Implementation-specific options (descriptor, context, etc.)
|
|
46
|
+
* @returns Generated artifact (content + metadata)
|
|
47
|
+
*/
|
|
48
|
+
generate(options?: unknown): Promise<ArtifactOutput>;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Generated artifact output (generic shape).
|
|
52
|
+
*
|
|
53
|
+
* Implementations may return more specific types.
|
|
54
|
+
*/
|
|
55
|
+
export interface ArtifactOutput {
|
|
56
|
+
/** Generated content (string for text formats, Buffer for binary) */
|
|
57
|
+
content: string | Buffer;
|
|
58
|
+
/** Recommended filename (including extension) */
|
|
59
|
+
filename: string;
|
|
60
|
+
/** Full output path */
|
|
61
|
+
path: string;
|
|
62
|
+
/** Optional metadata */
|
|
63
|
+
metadata?: Record<string, unknown>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Artifact descriptor type (base shape, implementations extend)
|
|
67
|
+
*/
|
|
68
|
+
export type ArtifactDescriptor = z.infer<typeof ArtifactBaseSchema>;
|
|
69
|
+
/**
|
|
70
|
+
* Artifact descriptor schema
|
|
71
|
+
*/
|
|
72
|
+
export declare const ArtifactDescriptorSchema: z.ZodObject<{
|
|
73
|
+
id: z.ZodString;
|
|
74
|
+
name: z.ZodOptional<z.ZodString>;
|
|
75
|
+
description: z.ZodOptional<z.ZodString>;
|
|
76
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
77
|
+
hardware: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
78
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
79
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
80
|
+
requiredContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
81
|
+
optionalContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
82
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
83
|
+
kind: z.ZodLiteral<"infra/artifact">;
|
|
84
|
+
}, z.core.$strip>;
|
|
85
|
+
/**
|
|
86
|
+
* Artifact kind descriptor for runtime registration.
|
|
87
|
+
*
|
|
88
|
+
* Note: This kind has no default implementation. Adapters must register
|
|
89
|
+
* their own implementations via runtime plugins.
|
|
90
|
+
*/
|
|
91
|
+
declare class NoOpArtifactImplementation implements ArtifactGenerator {
|
|
92
|
+
generate(options?: unknown): Promise<ArtifactOutput>;
|
|
93
|
+
}
|
|
94
|
+
export declare const artifactKind: import("@vibesdotdev/runtime/schemas/kind").RuntimeKindDescriptorRecord<NoOpArtifactImplementation>;
|
|
95
|
+
export { INFRA_DISCOVERY_PATTERN, extractStem } from './discovery.ts';
|
|
96
|
+
//# sourceMappingURL=artifact.kind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact.kind.d.ts","sourceRoot":"","sources":["../../src/kinds/artifact.kind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAM5B;;;;;GAKG;AACH,QAAA,MAAM,kBAAkB;;;;;;;;;;;;iBAEtB,CAAC;AAEH;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CACrD;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC9B,qEAAqE;IACrE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;iBAAqB,CAAC;AAE3D;;;;;GAKG;AACH,cAAM,0BAA2B,YAAW,iBAAiB;IACtD,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC;CAK1D;AAED,eAAO,MAAM,YAAY,qGAMvB,CAAC;AAGH,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
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 { INFRA_DISCOVERY_PATTERN, extractStem } from "./discovery.js";
|
|
20
|
+
/**
|
|
21
|
+
* Minimal base schema for artifact descriptors.
|
|
22
|
+
*
|
|
23
|
+
* Implementations extend this with their own fields (source resources,
|
|
24
|
+
* output format, generation options, etc.).
|
|
25
|
+
*/
|
|
26
|
+
const ArtifactBaseSchema = RuntimeDescriptorSchema.extend({
|
|
27
|
+
kind: z.literal('infra/artifact')
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Artifact descriptor schema
|
|
31
|
+
*/
|
|
32
|
+
export const ArtifactDescriptorSchema = ArtifactBaseSchema;
|
|
33
|
+
/**
|
|
34
|
+
* Artifact kind descriptor for runtime registration.
|
|
35
|
+
*
|
|
36
|
+
* Note: This kind has no default implementation. Adapters must register
|
|
37
|
+
* their own implementations via runtime plugins.
|
|
38
|
+
*/
|
|
39
|
+
class NoOpArtifactImplementation {
|
|
40
|
+
async generate(options) {
|
|
41
|
+
throw new Error('No artifact generator registered. Adapter plugins (infra-kubernetes, infra-helm, etc.) must register implementations.');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export const artifactKind = createRuntimeKind({
|
|
45
|
+
id: 'infra/artifact',
|
|
46
|
+
descriptorSchema: ArtifactDescriptorSchema,
|
|
47
|
+
defaultImplementation: NoOpArtifactImplementation,
|
|
48
|
+
discoveryPattern: INFRA_DISCOVERY_PATTERN,
|
|
49
|
+
extractStem
|
|
50
|
+
});
|
|
51
|
+
// Re-export discovery helpers
|
|
52
|
+
export { INFRA_DISCOVERY_PATTERN, extractStem } from "./discovery.js";
|
|
53
|
+
//# sourceMappingURL=artifact.kind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact.kind.js","sourceRoot":"","sources":["../../src/kinds/artifact.kind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,kBAAkB,GAAG,uBAAuB,CAAC,MAAM,CAAC;IACzD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC;CACjC,CAAC,CAAC;AAsCH;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,0BAA0B;IAC/B,KAAK,CAAC,QAAQ,CAAC,OAAiB;QAC/B,MAAM,IAAI,KAAK,CACd,uHAAuH,CACvH,CAAC;IACH,CAAC;CACD;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,iBAAiB,CAAiD;IAC7F,EAAE,EAAE,gBAAgB;IACpB,gBAAgB,EAAE,wBAAwB;IAC1C,qBAAqB,EAAE,0BAA0B;IACjD,gBAAgB,EAAE,uBAAuB;IACzC,WAAW;CACX,CAAC,CAAC;AAEH,8BAA8B;AAC9B,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
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 type { RuntimeKindDescriptorRecord } from '@vibesdotdev/runtime/schemas/kind';
|
|
15
|
+
import type { RuntimeDescriptor } from '@vibesdotdev/runtime/schemas/descriptor';
|
|
16
|
+
export declare const DOManagedRedisConfigSchema: z.ZodObject<{
|
|
17
|
+
maxMemory: z.ZodOptional<z.ZodString>;
|
|
18
|
+
eviction: z.ZodOptional<z.ZodEnum<{
|
|
19
|
+
lru: "lru";
|
|
20
|
+
lfu: "lfu";
|
|
21
|
+
ttl: "ttl";
|
|
22
|
+
}>>;
|
|
23
|
+
region: z.ZodDefault<z.ZodString>;
|
|
24
|
+
version: z.ZodDefault<z.ZodString>;
|
|
25
|
+
numNodes: z.ZodDefault<z.ZodNumber>;
|
|
26
|
+
size: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export declare const CloudflareKVCacheConfigSchema: z.ZodObject<{
|
|
29
|
+
namespace: z.ZodString;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
export declare const DOKSRedisCacheConfigSchema: z.ZodObject<{
|
|
32
|
+
namespace: z.ZodDefault<z.ZodString>;
|
|
33
|
+
image: z.ZodOptional<z.ZodString>;
|
|
34
|
+
version: z.ZodDefault<z.ZodString>;
|
|
35
|
+
maxMemory: z.ZodOptional<z.ZodString>;
|
|
36
|
+
eviction: z.ZodOptional<z.ZodEnum<{
|
|
37
|
+
lru: "lru";
|
|
38
|
+
lfu: "lfu";
|
|
39
|
+
ttl: "ttl";
|
|
40
|
+
}>>;
|
|
41
|
+
storageSize: z.ZodDefault<z.ZodString>;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
export declare const CacheConfigSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
44
|
+
maxMemory: z.ZodOptional<z.ZodString>;
|
|
45
|
+
eviction: z.ZodOptional<z.ZodEnum<{
|
|
46
|
+
lru: "lru";
|
|
47
|
+
lfu: "lfu";
|
|
48
|
+
ttl: "ttl";
|
|
49
|
+
}>>;
|
|
50
|
+
region: z.ZodDefault<z.ZodString>;
|
|
51
|
+
version: z.ZodDefault<z.ZodString>;
|
|
52
|
+
numNodes: z.ZodDefault<z.ZodNumber>;
|
|
53
|
+
size: z.ZodOptional<z.ZodString>;
|
|
54
|
+
adapter: z.ZodLiteral<"do-managed-redis">;
|
|
55
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
56
|
+
namespace: z.ZodString;
|
|
57
|
+
adapter: z.ZodLiteral<"cloudflare-kv">;
|
|
58
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
59
|
+
namespace: z.ZodDefault<z.ZodString>;
|
|
60
|
+
image: z.ZodOptional<z.ZodString>;
|
|
61
|
+
version: z.ZodDefault<z.ZodString>;
|
|
62
|
+
maxMemory: z.ZodOptional<z.ZodString>;
|
|
63
|
+
eviction: z.ZodOptional<z.ZodEnum<{
|
|
64
|
+
lru: "lru";
|
|
65
|
+
lfu: "lfu";
|
|
66
|
+
ttl: "ttl";
|
|
67
|
+
}>>;
|
|
68
|
+
storageSize: z.ZodDefault<z.ZodString>;
|
|
69
|
+
adapter: z.ZodLiteral<"doks-redis">;
|
|
70
|
+
}, z.core.$strip>]>;
|
|
71
|
+
export declare const CacheDescriptorSchema: z.ZodObject<{
|
|
72
|
+
id: z.ZodString;
|
|
73
|
+
name: z.ZodOptional<z.ZodString>;
|
|
74
|
+
description: z.ZodOptional<z.ZodString>;
|
|
75
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
76
|
+
hardware: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
77
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
78
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
requiredContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
80
|
+
optionalContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
81
|
+
kind: z.ZodLiteral<"infra/cache">;
|
|
82
|
+
engine: z.ZodOptional<z.ZodString>;
|
|
83
|
+
maxMemory: z.ZodOptional<z.ZodString>;
|
|
84
|
+
eviction: z.ZodOptional<z.ZodEnum<{
|
|
85
|
+
lru: "lru";
|
|
86
|
+
lfu: "lfu";
|
|
87
|
+
ttl: "ttl";
|
|
88
|
+
}>>;
|
|
89
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
90
|
+
config: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
91
|
+
maxMemory: z.ZodOptional<z.ZodString>;
|
|
92
|
+
eviction: z.ZodOptional<z.ZodEnum<{
|
|
93
|
+
lru: "lru";
|
|
94
|
+
lfu: "lfu";
|
|
95
|
+
ttl: "ttl";
|
|
96
|
+
}>>;
|
|
97
|
+
region: z.ZodDefault<z.ZodString>;
|
|
98
|
+
version: z.ZodDefault<z.ZodString>;
|
|
99
|
+
numNodes: z.ZodDefault<z.ZodNumber>;
|
|
100
|
+
size: z.ZodOptional<z.ZodString>;
|
|
101
|
+
adapter: z.ZodLiteral<"do-managed-redis">;
|
|
102
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
103
|
+
namespace: z.ZodString;
|
|
104
|
+
adapter: z.ZodLiteral<"cloudflare-kv">;
|
|
105
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
106
|
+
namespace: z.ZodDefault<z.ZodString>;
|
|
107
|
+
image: z.ZodOptional<z.ZodString>;
|
|
108
|
+
version: z.ZodDefault<z.ZodString>;
|
|
109
|
+
maxMemory: z.ZodOptional<z.ZodString>;
|
|
110
|
+
eviction: z.ZodOptional<z.ZodEnum<{
|
|
111
|
+
lru: "lru";
|
|
112
|
+
lfu: "lfu";
|
|
113
|
+
ttl: "ttl";
|
|
114
|
+
}>>;
|
|
115
|
+
storageSize: z.ZodDefault<z.ZodString>;
|
|
116
|
+
adapter: z.ZodLiteral<"doks-redis">;
|
|
117
|
+
}, z.core.$strip>]>>;
|
|
118
|
+
}, z.core.$strip>;
|
|
119
|
+
export type CacheDescriptor = z.infer<typeof CacheDescriptorSchema>;
|
|
120
|
+
declare class DefaultCacheImplementation {
|
|
121
|
+
readonly descriptor: RuntimeDescriptor;
|
|
122
|
+
readonly context: unknown;
|
|
123
|
+
constructor(descriptor: RuntimeDescriptor, context: unknown);
|
|
124
|
+
get config(): CacheDescriptor;
|
|
125
|
+
}
|
|
126
|
+
export declare const cacheKind: RuntimeKindDescriptorRecord<DefaultCacheImplementation>;
|
|
127
|
+
export {};
|
|
128
|
+
//# sourceMappingURL=cache.kind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.kind.d.ts","sourceRoot":"","sources":["../../src/kinds/cache.kind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAErF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAmBjF,eAAO,MAAM,0BAA0B;;;;;;;;;;;iBAarC,CAAC;AAEH,eAAO,MAAM,6BAA6B;;iBAGxC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;iBAarC,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAI5B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,cAAM,0BAA0B;aAEd,UAAU,EAAE,iBAAiB;aAC7B,OAAO,EAAE,OAAO;gBADhB,UAAU,EAAE,iBAAiB,EAC7B,OAAO,EAAE,OAAO;IAGjC,IAAI,MAAM,IAAI,eAAe,CAE5B;CACD;AAED,eAAO,MAAM,SAAS,yDAMpB,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
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 { RuntimeDescriptorSchema } from '@vibesdotdev/runtime/schemas/descriptor';
|
|
16
|
+
import { INFRA_DISCOVERY_PATTERN, extractStem } from "./discovery.js";
|
|
17
|
+
const CacheBaseSchema = RuntimeDescriptorSchema.extend({
|
|
18
|
+
kind: z.literal('infra/cache'),
|
|
19
|
+
/** Cache engine (e.g., 'cloudflare-kv', 'redis'). */
|
|
20
|
+
engine: z.string().min(1).optional(),
|
|
21
|
+
/** Maximum memory hint. */
|
|
22
|
+
maxMemory: z.string().optional(),
|
|
23
|
+
/** Eviction policy. */
|
|
24
|
+
eviction: z.enum(['lru', 'lfu', 'ttl']).optional(),
|
|
25
|
+
/** Logical namespace within the cache. */
|
|
26
|
+
namespace: z.string().optional()
|
|
27
|
+
});
|
|
28
|
+
export const DOManagedRedisConfigSchema = z.object({
|
|
29
|
+
/** Max memory allocation (e.g., '256mb', '1gb'). */
|
|
30
|
+
maxMemory: z.string().min(1).optional(),
|
|
31
|
+
/** Eviction policy: lru, lfu, or ttl. */
|
|
32
|
+
eviction: z.enum(['lru', 'lfu', 'ttl']).optional(),
|
|
33
|
+
/** DO region (default: nyc1). */
|
|
34
|
+
region: z.string().min(1).default('nyc1'),
|
|
35
|
+
/** Redis version (default: 7). */
|
|
36
|
+
version: z.string().min(1).default('7'),
|
|
37
|
+
/** Number of nodes (default: 1). */
|
|
38
|
+
numNodes: z.number().int().positive().default(1),
|
|
39
|
+
/** Database size tier (optional, derived from maxMemory if not set). */
|
|
40
|
+
size: z.string().min(1).optional()
|
|
41
|
+
});
|
|
42
|
+
export const CloudflareKVCacheConfigSchema = z.object({
|
|
43
|
+
/** Logical namespace within the KV store. */
|
|
44
|
+
namespace: z.string().min(1)
|
|
45
|
+
});
|
|
46
|
+
export const DOKSRedisCacheConfigSchema = z.object({
|
|
47
|
+
/** Kubernetes namespace (default: vibes). */
|
|
48
|
+
namespace: z.string().min(1).default('vibes'),
|
|
49
|
+
/** Container image (default: redis:{version}). */
|
|
50
|
+
image: z.string().min(1).optional(),
|
|
51
|
+
/** Redis version (default: 7). */
|
|
52
|
+
version: z.string().min(1).default('7'),
|
|
53
|
+
/** Max memory allocation (e.g., '256mb'). */
|
|
54
|
+
maxMemory: z.string().optional(),
|
|
55
|
+
/** Eviction policy: lru, lfu, or ttl. */
|
|
56
|
+
eviction: z.enum(['lru', 'lfu', 'ttl']).optional(),
|
|
57
|
+
/** Storage size (default: 1Gi). */
|
|
58
|
+
storageSize: z.string().min(1).default('1Gi')
|
|
59
|
+
});
|
|
60
|
+
export const CacheConfigSchema = z.union([
|
|
61
|
+
DOManagedRedisConfigSchema.extend({ adapter: z.literal('do-managed-redis') }),
|
|
62
|
+
CloudflareKVCacheConfigSchema.extend({ adapter: z.literal('cloudflare-kv') }),
|
|
63
|
+
DOKSRedisCacheConfigSchema.extend({ adapter: z.literal('doks-redis') })
|
|
64
|
+
]);
|
|
65
|
+
export const CacheDescriptorSchema = CacheBaseSchema.extend({
|
|
66
|
+
/**
|
|
67
|
+
* Adapter-specific configuration. Discriminated union — each adapter
|
|
68
|
+
* package defines its own config schema under its discriminator key.
|
|
69
|
+
*/
|
|
70
|
+
config: CacheConfigSchema.optional()
|
|
71
|
+
});
|
|
72
|
+
class DefaultCacheImplementation {
|
|
73
|
+
descriptor;
|
|
74
|
+
context;
|
|
75
|
+
constructor(descriptor, context) {
|
|
76
|
+
this.descriptor = descriptor;
|
|
77
|
+
this.context = context;
|
|
78
|
+
}
|
|
79
|
+
get config() {
|
|
80
|
+
return this.descriptor;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export const cacheKind = createRuntimeKind({
|
|
84
|
+
id: 'infra/cache',
|
|
85
|
+
descriptorSchema: CacheDescriptorSchema,
|
|
86
|
+
defaultImplementation: DefaultCacheImplementation,
|
|
87
|
+
discoveryPattern: INFRA_DISCOVERY_PATTERN,
|
|
88
|
+
extractStem
|
|
89
|
+
});
|
|
90
|
+
//# sourceMappingURL=cache.kind.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AM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;CAC7C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC;IACxC,0BAA0B,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;IAC7E,6BAA6B,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;IAC7E,0BAA0B,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;CACvE,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC,MAAM,CAAC;IAC3D;;;OAGG;IACH,MAAM,EAAE,iBAAiB,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAC;AAIH,MAAM,0BAA0B;IAEd;IACA;IAFjB,YACiB,UAA6B,EAC7B,OAAgB;QADhB,eAAU,GAAV,UAAU,CAAmB;QAC7B,YAAO,GAAP,OAAO,CAAS;IAC9B,CAAC;IAEJ,IAAI,MAAM;QACT,OAAO,IAAI,CAAC,UAA6B,CAAC;IAC3C,CAAC;CACD;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,iBAAiB,CAA8C;IACvF,EAAE,EAAE,aAAa;IACjB,gBAAgB,EAAE,qBAAqB;IACvC,qBAAqB,EAAE,0BAA0B;IACjD,gBAAgB,EAAE,uBAAuB;IACzC,WAAW;CACX,CAAC,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
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 type { RuntimeKindDescriptorRecord } from '@vibesdotdev/runtime/schemas/kind';
|
|
15
|
+
import type { RuntimeDescriptor } from '@vibesdotdev/runtime/schemas/descriptor';
|
|
16
|
+
export declare const DatabaseBackupSchema: z.ZodObject<{
|
|
17
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
18
|
+
schedule: z.ZodOptional<z.ZodString>;
|
|
19
|
+
retention: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export type DatabaseBackup = z.infer<typeof DatabaseBackupSchema>;
|
|
22
|
+
export declare const DoksDatabaseConfigSchema: z.ZodObject<{
|
|
23
|
+
namespace: z.ZodDefault<z.ZodString>;
|
|
24
|
+
storageSize: z.ZodDefault<z.ZodString>;
|
|
25
|
+
resources: z.ZodOptional<z.ZodObject<{
|
|
26
|
+
requests: z.ZodOptional<z.ZodObject<{
|
|
27
|
+
cpu: z.ZodString;
|
|
28
|
+
memory: z.ZodString;
|
|
29
|
+
}, z.core.$strip>>;
|
|
30
|
+
limits: z.ZodOptional<z.ZodObject<{
|
|
31
|
+
cpu: z.ZodString;
|
|
32
|
+
memory: z.ZodString;
|
|
33
|
+
}, z.core.$strip>>;
|
|
34
|
+
}, z.core.$strip>>;
|
|
35
|
+
version: z.ZodDefault<z.ZodString>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export declare const DOManagedPostgresConfigSchema: z.ZodObject<{
|
|
38
|
+
size: z.ZodDefault<z.ZodString>;
|
|
39
|
+
region: z.ZodDefault<z.ZodString>;
|
|
40
|
+
version: z.ZodDefault<z.ZodString>;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
export declare const TursoDatabaseConfigSchema: z.ZodObject<{
|
|
43
|
+
database: z.ZodOptional<z.ZodString>;
|
|
44
|
+
region: z.ZodDefault<z.ZodString>;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
export declare const CloudflareD1ConfigSchema: z.ZodObject<{
|
|
47
|
+
adapter: z.ZodLiteral<"cloudflare-d1">;
|
|
48
|
+
binding: z.ZodDefault<z.ZodString>;
|
|
49
|
+
databaseName: z.ZodString;
|
|
50
|
+
consumerAppId: z.ZodString;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
export declare const DatabaseConfigSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
53
|
+
namespace: z.ZodDefault<z.ZodString>;
|
|
54
|
+
storageSize: z.ZodDefault<z.ZodString>;
|
|
55
|
+
resources: z.ZodOptional<z.ZodObject<{
|
|
56
|
+
requests: z.ZodOptional<z.ZodObject<{
|
|
57
|
+
cpu: z.ZodString;
|
|
58
|
+
memory: z.ZodString;
|
|
59
|
+
}, z.core.$strip>>;
|
|
60
|
+
limits: z.ZodOptional<z.ZodObject<{
|
|
61
|
+
cpu: z.ZodString;
|
|
62
|
+
memory: z.ZodString;
|
|
63
|
+
}, z.core.$strip>>;
|
|
64
|
+
}, z.core.$strip>>;
|
|
65
|
+
version: z.ZodDefault<z.ZodString>;
|
|
66
|
+
adapter: z.ZodLiteral<"doks-statefulset">;
|
|
67
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
68
|
+
size: z.ZodDefault<z.ZodString>;
|
|
69
|
+
region: z.ZodDefault<z.ZodString>;
|
|
70
|
+
version: z.ZodDefault<z.ZodString>;
|
|
71
|
+
adapter: z.ZodLiteral<"do-managed-postgres">;
|
|
72
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
73
|
+
database: z.ZodOptional<z.ZodString>;
|
|
74
|
+
region: z.ZodDefault<z.ZodString>;
|
|
75
|
+
adapter: z.ZodLiteral<"turso">;
|
|
76
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
77
|
+
adapter: z.ZodLiteral<"cloudflare-d1">;
|
|
78
|
+
binding: z.ZodDefault<z.ZodString>;
|
|
79
|
+
databaseName: z.ZodString;
|
|
80
|
+
consumerAppId: z.ZodString;
|
|
81
|
+
}, z.core.$strip>]>;
|
|
82
|
+
export declare const DatabaseDescriptorSchema: z.ZodObject<{
|
|
83
|
+
id: z.ZodString;
|
|
84
|
+
name: z.ZodOptional<z.ZodString>;
|
|
85
|
+
description: z.ZodOptional<z.ZodString>;
|
|
86
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
87
|
+
hardware: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
88
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
89
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
requiredContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
91
|
+
optionalContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
92
|
+
kind: z.ZodLiteral<"infra/database">;
|
|
93
|
+
engine: z.ZodOptional<z.ZodString>;
|
|
94
|
+
size: z.ZodOptional<z.ZodString>;
|
|
95
|
+
replicas: z.ZodOptional<z.ZodNumber>;
|
|
96
|
+
backups: z.ZodOptional<z.ZodObject<{
|
|
97
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
98
|
+
schedule: z.ZodOptional<z.ZodString>;
|
|
99
|
+
retention: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}, z.core.$strip>>;
|
|
101
|
+
config: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
102
|
+
namespace: z.ZodDefault<z.ZodString>;
|
|
103
|
+
storageSize: z.ZodDefault<z.ZodString>;
|
|
104
|
+
resources: z.ZodOptional<z.ZodObject<{
|
|
105
|
+
requests: z.ZodOptional<z.ZodObject<{
|
|
106
|
+
cpu: z.ZodString;
|
|
107
|
+
memory: z.ZodString;
|
|
108
|
+
}, z.core.$strip>>;
|
|
109
|
+
limits: z.ZodOptional<z.ZodObject<{
|
|
110
|
+
cpu: z.ZodString;
|
|
111
|
+
memory: z.ZodString;
|
|
112
|
+
}, z.core.$strip>>;
|
|
113
|
+
}, z.core.$strip>>;
|
|
114
|
+
version: z.ZodDefault<z.ZodString>;
|
|
115
|
+
adapter: z.ZodLiteral<"doks-statefulset">;
|
|
116
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
117
|
+
size: z.ZodDefault<z.ZodString>;
|
|
118
|
+
region: z.ZodDefault<z.ZodString>;
|
|
119
|
+
version: z.ZodDefault<z.ZodString>;
|
|
120
|
+
adapter: z.ZodLiteral<"do-managed-postgres">;
|
|
121
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
122
|
+
database: z.ZodOptional<z.ZodString>;
|
|
123
|
+
region: z.ZodDefault<z.ZodString>;
|
|
124
|
+
adapter: z.ZodLiteral<"turso">;
|
|
125
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
126
|
+
adapter: z.ZodLiteral<"cloudflare-d1">;
|
|
127
|
+
binding: z.ZodDefault<z.ZodString>;
|
|
128
|
+
databaseName: z.ZodString;
|
|
129
|
+
consumerAppId: z.ZodString;
|
|
130
|
+
}, z.core.$strip>]>>;
|
|
131
|
+
}, z.core.$strip>;
|
|
132
|
+
export type DatabaseDescriptor = z.infer<typeof DatabaseDescriptorSchema>;
|
|
133
|
+
declare class DefaultDatabaseImplementation {
|
|
134
|
+
readonly descriptor: RuntimeDescriptor;
|
|
135
|
+
readonly context: unknown;
|
|
136
|
+
constructor(descriptor: RuntimeDescriptor, context: unknown);
|
|
137
|
+
get config(): DatabaseDescriptor;
|
|
138
|
+
}
|
|
139
|
+
export declare const databaseKind: RuntimeKindDescriptorRecord<DefaultDatabaseImplementation>;
|
|
140
|
+
export {};
|
|
141
|
+
//# sourceMappingURL=database.kind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.kind.d.ts","sourceRoot":"","sources":["../../src/kinds/database.kind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAErF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAGjF,eAAO,MAAM,oBAAoB;;;;iBAI/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAkBlE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;iBAcnC,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;iBAOxC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;iBAKpC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;iBASnC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAK/B,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,cAAM,6BAA6B;aAEjB,UAAU,EAAE,iBAAiB;aAC7B,OAAO,EAAE,OAAO;gBADhB,UAAU,EAAE,iBAAiB,EAC7B,OAAO,EAAE,OAAO;IAGjC,IAAI,MAAM,IAAI,kBAAkB,CAE/B;CACD;AAED,eAAO,MAAM,YAAY,4DAMvB,CAAC"}
|