anhedral 0.17.0 → 0.19.0
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 +33 -68
- package/assets/contracts/LICENSE +201 -0
- package/assets/contracts/LICENSE.environment +201 -0
- package/assets/contracts/LICENSE.operations +201 -0
- package/assets/contracts/deployment-provenance.json +15 -0
- package/assets/contracts/environment-provenance.json +11 -0
- package/assets/contracts/operations-provenance.json +12 -0
- package/assets/launch/application.server.ts.txt +13 -0
- package/assets/launch/auth-client.ts.txt +4 -0
- package/assets/launch/home.tsx.txt +20 -0
- package/assets/launch/minimal-application.server.ts.txt +5 -0
- package/assets/launch/minimal-server.ts.txt +7 -0
- package/assets/launch/oj/OJ.LICENSE +21 -0
- package/assets/launch/oj/run.mjs +82 -0
- package/assets/launch/oj/runtime.json +21 -0
- package/assets/launch/request-context.ts.txt +3 -0
- package/assets/launch/root.tsx.txt +26 -0
- package/assets/launch/router.tsx.txt +21 -0
- package/assets/launch/server.ts.txt +15 -0
- package/assets/launch/sign-in.tsx.txt +53 -0
- package/assets/launch/styles.css.txt +19 -0
- package/assets/security/credential-patterns.d.mts +3 -0
- package/assets/security/credential-patterns.mjs +59 -0
- package/assets/stack/api-index.ts.txt +6 -1
- package/assets/stack/stripe.ts.txt +30 -13
- package/assets/ui/catalog.json +36 -324
- package/dist/{platforms/web.d.ts → api-proxy.d.ts} +1 -3
- package/dist/api-proxy.js +48 -0
- package/dist/bin.js +55 -36
- package/dist/capability-catalog.d.ts +36 -57
- package/dist/capability-catalog.js +65 -67
- package/dist/capability-command.d.ts +3 -3
- package/dist/capability-command.js +146 -59
- package/dist/capability-editor.js +6 -5
- package/dist/capability-recipes.js +9 -296
- package/dist/cli-arguments.d.ts +2 -0
- package/dist/cli-arguments.js +101 -50
- package/dist/cli-commands.d.ts +1 -1
- package/dist/cli-commands.js +31 -5
- package/dist/cli-errors.d.ts +18 -0
- package/dist/cli-errors.js +63 -0
- package/dist/cli-output.d.ts +22 -0
- package/dist/cli-output.js +42 -7
- package/dist/command-runner.js +88 -0
- package/dist/command-schema.d.ts +16 -0
- package/dist/command-schema.js +496 -21
- package/dist/command-types.d.ts +1 -0
- package/dist/command-types.js +1 -0
- package/dist/completion.d.ts +2 -0
- package/dist/completion.js +201 -0
- package/dist/composition.d.ts +25 -0
- package/dist/composition.js +28 -0
- package/dist/contracts/cli-transport.d.ts +316 -0
- package/dist/contracts/cli-transport.js +236 -0
- package/dist/contracts/deployment.d.ts +233 -0
- package/dist/contracts/deployment.js +198 -0
- package/dist/contracts/environment-file.d.ts +7 -0
- package/dist/contracts/environment-file.js +112 -0
- package/dist/contracts/environment-transport.d.ts +79 -0
- package/dist/contracts/environment-transport.js +110 -0
- package/dist/contracts/production-transport.d.ts +71 -0
- package/dist/contracts/production-transport.js +56 -0
- package/dist/contracts/runtime-logs-transport.d.ts +127 -0
- package/dist/contracts/runtime-logs-transport.js +50 -0
- package/dist/contracts/source-bundle.d.ts +11 -0
- package/dist/contracts/source-bundle.js +197 -0
- package/dist/contracts/source-profile.d.ts +4 -0
- package/dist/contracts/source-profile.js +5 -0
- package/dist/contracts/staging-transport.d.ts +79 -0
- package/dist/contracts/staging-transport.js +43 -0
- package/dist/dependencies.d.ts +9 -27
- package/dist/dependencies.js +19 -66
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -1
- package/dist/launch.d.ts +27 -0
- package/dist/launch.js +262 -0
- package/dist/platform-command.d.ts +9 -0
- package/dist/platform-command.js +787 -0
- package/dist/platform-environment.d.ts +18 -0
- package/dist/platform-environment.js +257 -0
- package/dist/platform-operations.d.ts +26 -0
- package/dist/platform-operations.js +155 -0
- package/dist/platform-production.d.ts +16 -0
- package/dist/platform-production.js +135 -0
- package/dist/platform-source.d.ts +8 -0
- package/dist/platform-source.js +111 -0
- package/dist/platform-state.d.ts +15 -0
- package/dist/platform-state.js +229 -0
- package/dist/platforms/tanstack.d.ts +10 -0
- package/dist/platforms/tanstack.js +248 -0
- package/dist/registry/usage.d.ts +4 -1
- package/dist/registry/usage.js +59 -4
- package/dist/scaffold/bootstrap.d.ts +3 -3
- package/dist/scaffold/styling.d.ts +3 -2
- package/dist/transaction.js +28 -3
- package/dist/ui-catalog.d.ts +3 -5
- package/dist/ui-catalog.js +8 -24
- package/dist/ui-command.d.ts +3 -1
- package/dist/ui-command.js +74 -72
- package/dist/ui-project.d.ts +4 -2
- package/dist/ui-project.js +40 -38
- package/dist/util.js +40 -61
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/capabilities.md +23 -89
- package/docs/software-factory.md +208 -9
- package/docs/stack-standard.md +7 -17
- package/docs/ui.md +9 -22
- package/package.json +26 -22
- package/assets/stack/ai-schema.ts.txt +0 -5
- package/assets/stack/ai.ts.txt +0 -30
- package/assets/stack/desktop.rs.txt +0 -21
- package/assets/stack/events-schema.ts.txt +0 -12
- package/assets/stack/events.ts.txt +0 -59
- package/assets/stack/mobile-auth.ts.txt +0 -25
- package/assets/stack/mobile-billing.tsx.txt +0 -63
- package/assets/stack/mobile-session.tsx.txt +0 -83
- package/assets/stack/native-button.tsx.txt +0 -108
- package/assets/stack/native-global.css.txt +0 -4
- package/assets/stack/native-lib-utils.ts.txt +0 -5
- package/assets/stack/native-metro.config.js.txt +0 -6
- package/assets/stack/native-nativewind-env.d.ts.txt +0 -1
- package/assets/stack/native-tailwind.config.js.txt +0 -73
- package/assets/stack/native-text.tsx.txt +0 -89
- package/assets/stack/purchases.ts.txt +0 -65
- package/assets/stack/revenuecat.ts.txt +0 -88
- package/assets/stack/rtc-schema.ts.txt +0 -10
- package/assets/stack/rtc.ts.txt +0 -122
- package/assets/stack/web-sign-in.tsx.txt +0 -51
- package/dist/capabilities.d.ts +0 -11
- package/dist/capabilities.js +0 -14
- package/dist/dependency-order.d.ts +0 -2
- package/dist/dependency-order.js +0 -24
- package/dist/platforms/lint.d.ts +0 -1
- package/dist/platforms/lint.js +0 -5
- package/dist/platforms/web.js +0 -251
- package/dist/project-config.d.ts +0 -3
- package/dist/project-config.js +0 -16
- package/dist/registry/context.d.ts +0 -3
- package/dist/registry/context.js +0 -20
- package/dist/registry/options.d.ts +0 -2
- package/dist/registry/options.js +0 -44
- package/dist/registry/resolve.d.ts +0 -11
- package/dist/registry/resolve.js +0 -46
- package/dist/registry/types.d.ts +0 -60
- package/dist/scaffold/api.d.ts +0 -2
- package/dist/scaffold/api.js +0 -38
- package/dist/scaffold/backend.d.ts +0 -2
- package/dist/scaffold/backend.js +0 -36
- package/dist/scaffold/compose.d.ts +0 -4
- package/dist/scaffold/compose.js +0 -30
- package/dist/scaffold/database.d.ts +0 -2
- package/dist/scaffold/database.js +0 -41
- package/dist/scaffold/documentation.d.ts +0 -2
- package/dist/scaffold/documentation.js +0 -71
- package/dist/scaffold/environment.d.ts +0 -4
- package/dist/scaffold/environment.js +0 -22
- package/dist/scaffold/stack-documentation.d.ts +0 -2
- package/dist/scaffold/stack-documentation.js +0 -6
- package/dist/scaffold/storage.d.ts +0 -2
- package/dist/scaffold/storage.js +0 -21
- package/dist/scaffold/workspace.d.ts +0 -3
- package/dist/scaffold/workspace.js +0 -131
- package/dist/stack-registry.d.ts +0 -35
- package/dist/stack-registry.js +0 -189
- package/dist/standard.d.ts +0 -8
- package/dist/standard.js +0 -94
- package/dist/workspace-graph.d.ts +0 -7
- package/dist/workspace-graph.js +0 -74
- package/docs/anhedral-stack.md +0 -12
- package/docs/assets/anhedral-stack-light.png +0 -0
- package/docs/assets/anhedral-stack.png +0 -0
- package/docs/native-ui.md +0 -47
- /package/dist/{registry/types.js → command-runner.d.ts} +0 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { environmentNameSchema } from "./environment-transport.js";
|
|
3
|
+
/** Literal dotenv parsing only. Never evaluate a shell, interpolate variables,
|
|
4
|
+
* or include input values in errors. The same parser serves browser and CLI. */
|
|
5
|
+
export function parseEnvironmentFile(input) {
|
|
6
|
+
if (input.includes("\0"))
|
|
7
|
+
throw new Error("Environment files cannot contain NUL bytes.");
|
|
8
|
+
if (new TextEncoder().encode(input).length > 65536)
|
|
9
|
+
throw new Error("Environment files support at most 64 KiB.");
|
|
10
|
+
const text = input.replace(/^\uFEFF/, "").replaceAll("\r\n", "\n");
|
|
11
|
+
const entries = [];
|
|
12
|
+
const names = new Set();
|
|
13
|
+
let position = 0, line = 1;
|
|
14
|
+
const fail = (message) => {
|
|
15
|
+
throw new Error(`Line ${line}: ${message}`);
|
|
16
|
+
};
|
|
17
|
+
const space = () => {
|
|
18
|
+
while (text[position] === " " || text[position] === "\t" || text[position] === "\r")
|
|
19
|
+
position++;
|
|
20
|
+
};
|
|
21
|
+
while (position < text.length) {
|
|
22
|
+
space();
|
|
23
|
+
if (text[position] === "#")
|
|
24
|
+
while (position < text.length && text[position] !== "\n")
|
|
25
|
+
position++;
|
|
26
|
+
if (text[position] === "\n") {
|
|
27
|
+
position++;
|
|
28
|
+
line++;
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if (position === text.length)
|
|
32
|
+
break;
|
|
33
|
+
if (text.slice(position, position + 7) === "export ") {
|
|
34
|
+
position += 7;
|
|
35
|
+
space();
|
|
36
|
+
}
|
|
37
|
+
const start = position;
|
|
38
|
+
while (position < text.length && /[A-Za-z0-9_]/.test(text[position]))
|
|
39
|
+
position++;
|
|
40
|
+
const name = text.slice(start, position);
|
|
41
|
+
if (!environmentNameSchema.safeParse(name).success)
|
|
42
|
+
fail("Use an uppercase variable name.");
|
|
43
|
+
if (names.has(name))
|
|
44
|
+
fail(`Duplicate variable ${name}.`);
|
|
45
|
+
space();
|
|
46
|
+
if (text[position] !== "=")
|
|
47
|
+
fail(`Expected = after ${name}.`);
|
|
48
|
+
position++;
|
|
49
|
+
space();
|
|
50
|
+
let value = "";
|
|
51
|
+
const quote = text[position];
|
|
52
|
+
if (quote === '"' || quote === "'") {
|
|
53
|
+
position++;
|
|
54
|
+
let closed = false;
|
|
55
|
+
while (position < text.length) {
|
|
56
|
+
const character = text[position++];
|
|
57
|
+
if (character === quote) {
|
|
58
|
+
closed = true;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
if (character === "\n")
|
|
62
|
+
line++;
|
|
63
|
+
if (character === "\\" && quote === '"') {
|
|
64
|
+
const escaped = text[position];
|
|
65
|
+
const replacements = {
|
|
66
|
+
n: "\n",
|
|
67
|
+
r: "\r",
|
|
68
|
+
t: "\t",
|
|
69
|
+
"\\": "\\",
|
|
70
|
+
'"': '"',
|
|
71
|
+
};
|
|
72
|
+
if (escaped !== undefined && Object.hasOwn(replacements, escaped)) {
|
|
73
|
+
value += replacements[escaped];
|
|
74
|
+
position++;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
value += character;
|
|
79
|
+
}
|
|
80
|
+
if (!closed)
|
|
81
|
+
fail(`Unclosed quoted value for ${name}.`);
|
|
82
|
+
space();
|
|
83
|
+
if (position < text.length && text[position] !== "#" && text[position] !== "\n")
|
|
84
|
+
fail(`Unexpected text after ${name}.`);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
const valueStart = position;
|
|
88
|
+
while (position < text.length && text[position] !== "\n" && text[position] !== "#")
|
|
89
|
+
position++;
|
|
90
|
+
value = text.slice(valueStart, position).trimEnd();
|
|
91
|
+
}
|
|
92
|
+
if (value.length > 16384)
|
|
93
|
+
fail(`Value for ${name} exceeds the supported size.`);
|
|
94
|
+
names.add(name);
|
|
95
|
+
entries.push({ name, value });
|
|
96
|
+
if (entries.length > 128)
|
|
97
|
+
fail("Imports support at most 128 variables.");
|
|
98
|
+
if (text[position] === "#")
|
|
99
|
+
while (position < text.length && text[position] !== "\n")
|
|
100
|
+
position++;
|
|
101
|
+
if (text[position] === "\n") {
|
|
102
|
+
position++;
|
|
103
|
+
line++;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (!entries.length)
|
|
107
|
+
throw new Error("The environment file contains no variables.");
|
|
108
|
+
return entries;
|
|
109
|
+
}
|
|
110
|
+
export function inferredEnvironmentKind(name) {
|
|
111
|
+
return /^(NEXT_PUBLIC_|VITE_|PUBLIC_|EXPO_PUBLIC_)/.test(name) ? "config" : "secret";
|
|
112
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const projectEnvironmentSchema: z.ZodEnum<{
|
|
3
|
+
staging: "staging";
|
|
4
|
+
production: "production";
|
|
5
|
+
}>;
|
|
6
|
+
export declare const environmentNameSchema: z.ZodString;
|
|
7
|
+
export declare const environmentWriteSchema: z.ZodObject<{
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
environment: z.ZodEnum<{
|
|
10
|
+
staging: "staging";
|
|
11
|
+
production: "production";
|
|
12
|
+
}>;
|
|
13
|
+
kind: z.ZodEnum<{
|
|
14
|
+
secret: "secret";
|
|
15
|
+
config: "config";
|
|
16
|
+
}>;
|
|
17
|
+
value: z.ZodString;
|
|
18
|
+
note: z.ZodDefault<z.ZodString>;
|
|
19
|
+
expectedVersion: z.ZodNumber;
|
|
20
|
+
}, z.core.$strict>;
|
|
21
|
+
export declare const environmentDeleteSchema: z.ZodObject<{
|
|
22
|
+
name: z.ZodString;
|
|
23
|
+
environment: z.ZodEnum<{
|
|
24
|
+
staging: "staging";
|
|
25
|
+
production: "production";
|
|
26
|
+
}>;
|
|
27
|
+
expectedVersion: z.ZodNumber;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
export declare const environmentImportSchema: z.ZodObject<{
|
|
30
|
+
requestId: z.ZodUUID;
|
|
31
|
+
environment: z.ZodEnum<{
|
|
32
|
+
staging: "staging";
|
|
33
|
+
production: "production";
|
|
34
|
+
}>;
|
|
35
|
+
variables: z.ZodArray<z.ZodObject<{
|
|
36
|
+
name: z.ZodString;
|
|
37
|
+
kind: z.ZodEnum<{
|
|
38
|
+
secret: "secret";
|
|
39
|
+
config: "config";
|
|
40
|
+
}>;
|
|
41
|
+
value: z.ZodString;
|
|
42
|
+
note: z.ZodDefault<z.ZodString>;
|
|
43
|
+
expectedVersion: z.ZodNumber;
|
|
44
|
+
}, z.core.$strict>>;
|
|
45
|
+
}, z.core.$strict>;
|
|
46
|
+
export declare const environmentImportReceiptSchema: z.ZodObject<{
|
|
47
|
+
requestId: z.ZodUUID;
|
|
48
|
+
imported: z.ZodArray<z.ZodObject<{
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
kind: z.ZodEnum<{
|
|
51
|
+
secret: "secret";
|
|
52
|
+
config: "config";
|
|
53
|
+
}>;
|
|
54
|
+
environment: z.ZodEnum<{
|
|
55
|
+
staging: "staging";
|
|
56
|
+
production: "production";
|
|
57
|
+
}>;
|
|
58
|
+
version: z.ZodNumber;
|
|
59
|
+
}, z.core.$strict>>;
|
|
60
|
+
}, z.core.$strict>;
|
|
61
|
+
export type EnvironmentImport = z.infer<typeof environmentImportSchema>;
|
|
62
|
+
export type EnvironmentWrite = z.infer<typeof environmentWriteSchema>;
|
|
63
|
+
export type EnvironmentDelete = z.infer<typeof environmentDeleteSchema>;
|
|
64
|
+
export declare const environmentMetadataSchema: z.ZodObject<{
|
|
65
|
+
variables: z.ZodArray<z.ZodObject<{
|
|
66
|
+
name: z.ZodString;
|
|
67
|
+
environment: z.ZodEnum<{
|
|
68
|
+
staging: "staging";
|
|
69
|
+
production: "production";
|
|
70
|
+
}>;
|
|
71
|
+
kind: z.ZodEnum<{
|
|
72
|
+
secret: "secret";
|
|
73
|
+
config: "config";
|
|
74
|
+
}>;
|
|
75
|
+
version: z.ZodNumber;
|
|
76
|
+
note: z.ZodString;
|
|
77
|
+
}, z.core.$strict>>;
|
|
78
|
+
}, z.core.$strict>;
|
|
79
|
+
export type EnvironmentMetadata = z.infer<typeof environmentMetadataSchema>;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export const projectEnvironmentSchema = z.enum(["staging", "production"]);
|
|
4
|
+
export const environmentNameSchema = z.string().regex(/^[A-Z][A-Z0-9_]{0,127}$/);
|
|
5
|
+
const versionSchema = z.number().int().min(0).max(2147483646);
|
|
6
|
+
const reserved = /^(ANHEDRAL_|CLOUDFLARE_|CF_|NODE_|npm_|PNPM_|PATH$|HOME$|PORT$|DATABASE_URL$|DB$|FILES$|ASSETS$|AUTH_SECRET$|BETTER_AUTH_|PUBLIC_APP_URL$|WORKER_SELF_REFERENCE$|RESOURCES$)/i;
|
|
7
|
+
export const environmentWriteSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
name: environmentNameSchema,
|
|
10
|
+
environment: projectEnvironmentSchema,
|
|
11
|
+
kind: z.enum(["secret", "config"]),
|
|
12
|
+
value: z.string().min(1).max(16384),
|
|
13
|
+
note: z.string().max(500).default(""),
|
|
14
|
+
expectedVersion: versionSchema,
|
|
15
|
+
})
|
|
16
|
+
.strict()
|
|
17
|
+
.superRefine((input, ctx) => {
|
|
18
|
+
if (reserved.test(input.name))
|
|
19
|
+
ctx.addIssue({
|
|
20
|
+
code: "custom",
|
|
21
|
+
path: ["name"],
|
|
22
|
+
message: "This name is reserved for managed runtime configuration.",
|
|
23
|
+
});
|
|
24
|
+
if (input.kind === "secret" && /^(NEXT_PUBLIC_|VITE_|PUBLIC_|EXPO_PUBLIC_)/.test(input.name))
|
|
25
|
+
ctx.addIssue({
|
|
26
|
+
code: "custom",
|
|
27
|
+
path: ["name"],
|
|
28
|
+
message: "Public variables cannot contain secrets.",
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
export const environmentDeleteSchema = z
|
|
32
|
+
.object({
|
|
33
|
+
name: environmentNameSchema,
|
|
34
|
+
environment: projectEnvironmentSchema,
|
|
35
|
+
expectedVersion: versionSchema.refine((value) => value > 0),
|
|
36
|
+
})
|
|
37
|
+
.strict();
|
|
38
|
+
export const environmentImportSchema = z
|
|
39
|
+
.object({
|
|
40
|
+
requestId: z.uuid(),
|
|
41
|
+
environment: projectEnvironmentSchema,
|
|
42
|
+
variables: z
|
|
43
|
+
.array(z
|
|
44
|
+
.object({
|
|
45
|
+
name: environmentNameSchema,
|
|
46
|
+
kind: z.enum(["secret", "config"]),
|
|
47
|
+
value: z.string().min(1).max(16384),
|
|
48
|
+
note: z.string().max(500).default(""),
|
|
49
|
+
expectedVersion: versionSchema,
|
|
50
|
+
})
|
|
51
|
+
.strict())
|
|
52
|
+
.min(1)
|
|
53
|
+
.max(128),
|
|
54
|
+
})
|
|
55
|
+
.strict()
|
|
56
|
+
.superRefine((input, ctx) => {
|
|
57
|
+
const names = new Set();
|
|
58
|
+
input.variables.forEach((variable, index) => {
|
|
59
|
+
if (names.has(variable.name))
|
|
60
|
+
ctx.addIssue({
|
|
61
|
+
code: "custom",
|
|
62
|
+
path: ["variables", index, "name"],
|
|
63
|
+
message: "Variable names must be unique.",
|
|
64
|
+
});
|
|
65
|
+
names.add(variable.name);
|
|
66
|
+
const parsed = environmentWriteSchema.safeParse({
|
|
67
|
+
...variable,
|
|
68
|
+
environment: input.environment,
|
|
69
|
+
});
|
|
70
|
+
if (!parsed.success)
|
|
71
|
+
for (const issue of parsed.error.issues)
|
|
72
|
+
ctx.addIssue({
|
|
73
|
+
code: "custom",
|
|
74
|
+
path: ["variables", index, ...issue.path],
|
|
75
|
+
message: issue.message,
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
if (new TextEncoder().encode(JSON.stringify(input)).length > 65536)
|
|
79
|
+
ctx.addIssue({ code: "custom", message: "Imports support at most 64 KiB." });
|
|
80
|
+
});
|
|
81
|
+
export const environmentImportReceiptSchema = z
|
|
82
|
+
.object({
|
|
83
|
+
requestId: z.uuid(),
|
|
84
|
+
imported: z
|
|
85
|
+
.array(z
|
|
86
|
+
.object({
|
|
87
|
+
name: environmentNameSchema,
|
|
88
|
+
kind: z.enum(["secret", "config"]),
|
|
89
|
+
environment: projectEnvironmentSchema,
|
|
90
|
+
version: z.number().int().positive(),
|
|
91
|
+
})
|
|
92
|
+
.strict())
|
|
93
|
+
.max(128),
|
|
94
|
+
})
|
|
95
|
+
.strict();
|
|
96
|
+
export const environmentMetadataSchema = z
|
|
97
|
+
.object({
|
|
98
|
+
variables: z
|
|
99
|
+
.array(z
|
|
100
|
+
.object({
|
|
101
|
+
name: environmentNameSchema,
|
|
102
|
+
environment: projectEnvironmentSchema,
|
|
103
|
+
kind: z.enum(["secret", "config"]),
|
|
104
|
+
version: z.number().int().positive(),
|
|
105
|
+
note: z.string().max(500),
|
|
106
|
+
})
|
|
107
|
+
.strict())
|
|
108
|
+
.max(512),
|
|
109
|
+
})
|
|
110
|
+
.strict();
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const productionCreateSchema: z.ZodObject<{
|
|
3
|
+
requestId: z.ZodUUID;
|
|
4
|
+
candidateId: z.ZodUUID;
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
expectedGeneration: z.ZodNumber;
|
|
7
|
+
}, z.core.$strict>;
|
|
8
|
+
export declare const productionConfigurationSchema: z.ZodObject<{
|
|
9
|
+
snapshotId: z.ZodUUID;
|
|
10
|
+
digest: z.ZodString;
|
|
11
|
+
environment: z.ZodLiteral<"production">;
|
|
12
|
+
}, z.core.$strict>;
|
|
13
|
+
export declare const productionCreateReceiptSchema: z.ZodObject<{
|
|
14
|
+
id: z.ZodUUID;
|
|
15
|
+
developmentId: z.ZodUUID;
|
|
16
|
+
candidateId: z.ZodUUID;
|
|
17
|
+
requestId: z.ZodUUID;
|
|
18
|
+
generation: z.ZodNumber;
|
|
19
|
+
configuration: z.ZodObject<{
|
|
20
|
+
snapshotId: z.ZodUUID;
|
|
21
|
+
digest: z.ZodString;
|
|
22
|
+
environment: z.ZodLiteral<"production">;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
}, z.core.$strict>;
|
|
25
|
+
export declare const productionDeploymentSchema: z.ZodObject<{
|
|
26
|
+
id: z.ZodUUID;
|
|
27
|
+
developmentId: z.ZodUUID;
|
|
28
|
+
candidateId: z.ZodUUID;
|
|
29
|
+
requestId: z.ZodUUID;
|
|
30
|
+
generation: z.ZodNumber;
|
|
31
|
+
status: z.ZodEnum<{
|
|
32
|
+
queued: "queued";
|
|
33
|
+
preparing: "preparing";
|
|
34
|
+
ready: "ready";
|
|
35
|
+
published: "published";
|
|
36
|
+
failed: "failed";
|
|
37
|
+
superseded: "superseded";
|
|
38
|
+
}>;
|
|
39
|
+
sourceRevision: z.ZodString;
|
|
40
|
+
createdAt: z.ZodString;
|
|
41
|
+
updatedAt: z.ZodString;
|
|
42
|
+
}, z.core.$strict>;
|
|
43
|
+
export declare const productionStateSchema: z.ZodObject<{
|
|
44
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
45
|
+
canDeploy: z.ZodBoolean;
|
|
46
|
+
requiresIndependentApproval: z.ZodBoolean;
|
|
47
|
+
generation: z.ZodNumber;
|
|
48
|
+
activeDeploymentId: z.ZodNullable<z.ZodUUID>;
|
|
49
|
+
desiredDeploymentId: z.ZodNullable<z.ZodUUID>;
|
|
50
|
+
deployments: z.ZodArray<z.ZodObject<{
|
|
51
|
+
id: z.ZodUUID;
|
|
52
|
+
developmentId: z.ZodUUID;
|
|
53
|
+
candidateId: z.ZodUUID;
|
|
54
|
+
requestId: z.ZodUUID;
|
|
55
|
+
generation: z.ZodNumber;
|
|
56
|
+
status: z.ZodEnum<{
|
|
57
|
+
queued: "queued";
|
|
58
|
+
preparing: "preparing";
|
|
59
|
+
ready: "ready";
|
|
60
|
+
published: "published";
|
|
61
|
+
failed: "failed";
|
|
62
|
+
superseded: "superseded";
|
|
63
|
+
}>;
|
|
64
|
+
sourceRevision: z.ZodString;
|
|
65
|
+
createdAt: z.ZodString;
|
|
66
|
+
updatedAt: z.ZodString;
|
|
67
|
+
}, z.core.$strict>>;
|
|
68
|
+
}, z.core.$strict>;
|
|
69
|
+
export type ProductionCreate = z.infer<typeof productionCreateSchema>;
|
|
70
|
+
export type ProductionCreateReceipt = z.infer<typeof productionCreateReceiptSchema>;
|
|
71
|
+
export type ProductionState = z.infer<typeof productionStateSchema>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const productionDigest = z.string().regex(/^[a-f0-9]{64}$/);
|
|
4
|
+
export const productionCreateSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
requestId: z.uuid(),
|
|
7
|
+
candidateId: z.uuid(),
|
|
8
|
+
name: z
|
|
9
|
+
.string()
|
|
10
|
+
.min(3)
|
|
11
|
+
.max(48)
|
|
12
|
+
.regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/),
|
|
13
|
+
expectedGeneration: z.number().int().nonnegative(),
|
|
14
|
+
})
|
|
15
|
+
.strict();
|
|
16
|
+
export const productionConfigurationSchema = z
|
|
17
|
+
.object({
|
|
18
|
+
snapshotId: z.uuid(),
|
|
19
|
+
digest: productionDigest,
|
|
20
|
+
environment: z.literal("production"),
|
|
21
|
+
})
|
|
22
|
+
.strict();
|
|
23
|
+
export const productionCreateReceiptSchema = z
|
|
24
|
+
.object({
|
|
25
|
+
id: z.uuid(),
|
|
26
|
+
developmentId: z.uuid(),
|
|
27
|
+
candidateId: z.uuid(),
|
|
28
|
+
requestId: z.uuid(),
|
|
29
|
+
generation: z.number().int().positive(),
|
|
30
|
+
configuration: productionConfigurationSchema,
|
|
31
|
+
})
|
|
32
|
+
.strict();
|
|
33
|
+
export const productionDeploymentSchema = z
|
|
34
|
+
.object({
|
|
35
|
+
id: z.uuid(),
|
|
36
|
+
developmentId: z.uuid(),
|
|
37
|
+
candidateId: z.uuid(),
|
|
38
|
+
requestId: z.uuid(),
|
|
39
|
+
generation: z.number().int().positive(),
|
|
40
|
+
status: z.enum(["queued", "preparing", "ready", "published", "failed", "superseded"]),
|
|
41
|
+
sourceRevision: productionDigest,
|
|
42
|
+
createdAt: z.string(),
|
|
43
|
+
updatedAt: z.string(),
|
|
44
|
+
})
|
|
45
|
+
.strict();
|
|
46
|
+
export const productionStateSchema = z
|
|
47
|
+
.object({
|
|
48
|
+
enabled: z.boolean().optional(),
|
|
49
|
+
canDeploy: z.boolean(),
|
|
50
|
+
requiresIndependentApproval: z.boolean(),
|
|
51
|
+
generation: z.number().int().nonnegative(),
|
|
52
|
+
activeDeploymentId: z.uuid().nullable(),
|
|
53
|
+
desiredDeploymentId: z.uuid().nullable(),
|
|
54
|
+
deployments: z.array(productionDeploymentSchema).max(30),
|
|
55
|
+
})
|
|
56
|
+
.strict();
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const runtimeLogEnvironmentSchema: z.ZodEnum<{
|
|
3
|
+
staging: "staging";
|
|
4
|
+
production: "production";
|
|
5
|
+
}>;
|
|
6
|
+
export declare const runtimeLogLevelSchema: z.ZodEnum<{
|
|
7
|
+
debug: "debug";
|
|
8
|
+
info: "info";
|
|
9
|
+
warn: "warn";
|
|
10
|
+
error: "error";
|
|
11
|
+
}>;
|
|
12
|
+
export declare const runtimeLogSourceSchema: z.ZodEnum<{
|
|
13
|
+
request: "request";
|
|
14
|
+
console: "console";
|
|
15
|
+
exception: "exception";
|
|
16
|
+
}>;
|
|
17
|
+
export declare const runtimeLogQuerySchema: z.ZodObject<{
|
|
18
|
+
environment: z.ZodDefault<z.ZodEnum<{
|
|
19
|
+
staging: "staging";
|
|
20
|
+
production: "production";
|
|
21
|
+
}>>;
|
|
22
|
+
deploymentId: z.ZodOptional<z.ZodUUID>;
|
|
23
|
+
level: z.ZodOptional<z.ZodEnum<{
|
|
24
|
+
debug: "debug";
|
|
25
|
+
info: "info";
|
|
26
|
+
warn: "warn";
|
|
27
|
+
error: "error";
|
|
28
|
+
}>>;
|
|
29
|
+
source: z.ZodOptional<z.ZodEnum<{
|
|
30
|
+
request: "request";
|
|
31
|
+
console: "console";
|
|
32
|
+
exception: "exception";
|
|
33
|
+
}>>;
|
|
34
|
+
range: z.ZodDefault<z.ZodEnum<{
|
|
35
|
+
"1h": "1h";
|
|
36
|
+
"24h": "24h";
|
|
37
|
+
"7d": "7d";
|
|
38
|
+
}>>;
|
|
39
|
+
search: z.ZodDefault<z.ZodString>;
|
|
40
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
41
|
+
}, z.core.$strict>;
|
|
42
|
+
export declare const runtimeLogEntrySchema: z.ZodObject<{
|
|
43
|
+
id: z.ZodUUID;
|
|
44
|
+
requestId: z.ZodUUID;
|
|
45
|
+
occurredAt: z.ZodString;
|
|
46
|
+
deploymentId: z.ZodUUID;
|
|
47
|
+
artifactId: z.ZodUUID;
|
|
48
|
+
environment: z.ZodEnum<{
|
|
49
|
+
staging: "staging";
|
|
50
|
+
production: "production";
|
|
51
|
+
}>;
|
|
52
|
+
component: z.ZodEnum<{
|
|
53
|
+
api: "api";
|
|
54
|
+
web: "web";
|
|
55
|
+
}>;
|
|
56
|
+
kind: z.ZodEnum<{
|
|
57
|
+
request: "request";
|
|
58
|
+
console: "console";
|
|
59
|
+
exception: "exception";
|
|
60
|
+
}>;
|
|
61
|
+
level: z.ZodEnum<{
|
|
62
|
+
debug: "debug";
|
|
63
|
+
info: "info";
|
|
64
|
+
warn: "warn";
|
|
65
|
+
error: "error";
|
|
66
|
+
}>;
|
|
67
|
+
message: z.ZodString;
|
|
68
|
+
method: z.ZodNullable<z.ZodString>;
|
|
69
|
+
status: z.ZodNullable<z.ZodNumber>;
|
|
70
|
+
outcome: z.ZodNullable<z.ZodString>;
|
|
71
|
+
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
72
|
+
truncated: z.ZodBoolean;
|
|
73
|
+
}, z.core.$strict>;
|
|
74
|
+
export declare const runtimeLogPageSchema: z.ZodObject<{
|
|
75
|
+
state: z.ZodEnum<{
|
|
76
|
+
ready: "ready";
|
|
77
|
+
disabled: "disabled";
|
|
78
|
+
unavailable: "unavailable";
|
|
79
|
+
}>;
|
|
80
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
81
|
+
environment: z.ZodEnum<{
|
|
82
|
+
staging: "staging";
|
|
83
|
+
production: "production";
|
|
84
|
+
}>;
|
|
85
|
+
coverage: z.ZodLiteral<"dynamic-workers">;
|
|
86
|
+
retentionDays: z.ZodLiteral<7>;
|
|
87
|
+
from: z.ZodString;
|
|
88
|
+
to: z.ZodString;
|
|
89
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
90
|
+
id: z.ZodUUID;
|
|
91
|
+
requestId: z.ZodUUID;
|
|
92
|
+
occurredAt: z.ZodString;
|
|
93
|
+
deploymentId: z.ZodUUID;
|
|
94
|
+
artifactId: z.ZodUUID;
|
|
95
|
+
environment: z.ZodEnum<{
|
|
96
|
+
staging: "staging";
|
|
97
|
+
production: "production";
|
|
98
|
+
}>;
|
|
99
|
+
component: z.ZodEnum<{
|
|
100
|
+
api: "api";
|
|
101
|
+
web: "web";
|
|
102
|
+
}>;
|
|
103
|
+
kind: z.ZodEnum<{
|
|
104
|
+
request: "request";
|
|
105
|
+
console: "console";
|
|
106
|
+
exception: "exception";
|
|
107
|
+
}>;
|
|
108
|
+
level: z.ZodEnum<{
|
|
109
|
+
debug: "debug";
|
|
110
|
+
info: "info";
|
|
111
|
+
warn: "warn";
|
|
112
|
+
error: "error";
|
|
113
|
+
}>;
|
|
114
|
+
message: z.ZodString;
|
|
115
|
+
method: z.ZodNullable<z.ZodString>;
|
|
116
|
+
status: z.ZodNullable<z.ZodNumber>;
|
|
117
|
+
outcome: z.ZodNullable<z.ZodString>;
|
|
118
|
+
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
119
|
+
truncated: z.ZodBoolean;
|
|
120
|
+
}, z.core.$strict>>;
|
|
121
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
122
|
+
dropped: z.ZodNumber;
|
|
123
|
+
lastReceivedAt: z.ZodNullable<z.ZodString>;
|
|
124
|
+
}, z.core.$strict>;
|
|
125
|
+
export type RuntimeLogQuery = z.infer<typeof runtimeLogQuerySchema>;
|
|
126
|
+
export type RuntimeLogEntry = z.infer<typeof runtimeLogEntrySchema>;
|
|
127
|
+
export type RuntimeLogPage = z.infer<typeof runtimeLogPageSchema>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export const runtimeLogEnvironmentSchema = z.enum(["staging", "production"]);
|
|
4
|
+
export const runtimeLogLevelSchema = z.enum(["debug", "info", "warn", "error"]);
|
|
5
|
+
export const runtimeLogSourceSchema = z.enum(["request", "console", "exception"]);
|
|
6
|
+
export const runtimeLogQuerySchema = z
|
|
7
|
+
.object({
|
|
8
|
+
environment: runtimeLogEnvironmentSchema.default("production"),
|
|
9
|
+
deploymentId: z.uuid().optional(),
|
|
10
|
+
level: runtimeLogLevelSchema.optional(),
|
|
11
|
+
source: runtimeLogSourceSchema.optional(),
|
|
12
|
+
range: z.enum(["1h", "24h", "7d"]).default("24h"),
|
|
13
|
+
search: z.string().trim().max(200).default(""),
|
|
14
|
+
cursor: z.string().max(512).optional(),
|
|
15
|
+
})
|
|
16
|
+
.strict();
|
|
17
|
+
export const runtimeLogEntrySchema = z
|
|
18
|
+
.object({
|
|
19
|
+
id: z.uuid(),
|
|
20
|
+
requestId: z.uuid(),
|
|
21
|
+
occurredAt: z.string().datetime(),
|
|
22
|
+
deploymentId: z.uuid(),
|
|
23
|
+
artifactId: z.uuid(),
|
|
24
|
+
environment: runtimeLogEnvironmentSchema,
|
|
25
|
+
component: z.enum(["api", "web"]),
|
|
26
|
+
kind: runtimeLogSourceSchema,
|
|
27
|
+
level: runtimeLogLevelSchema,
|
|
28
|
+
message: z.string().max(2048),
|
|
29
|
+
method: z.string().max(16).nullable(),
|
|
30
|
+
status: z.number().int().min(100).max(599).nullable(),
|
|
31
|
+
outcome: z.string().max(80).nullable(),
|
|
32
|
+
durationMs: z.number().min(0).max(300000).nullable(),
|
|
33
|
+
truncated: z.boolean(),
|
|
34
|
+
})
|
|
35
|
+
.strict();
|
|
36
|
+
export const runtimeLogPageSchema = z
|
|
37
|
+
.object({
|
|
38
|
+
state: z.enum(["disabled", "unavailable", "ready"]),
|
|
39
|
+
reason: z.string().nullable(),
|
|
40
|
+
environment: runtimeLogEnvironmentSchema,
|
|
41
|
+
coverage: z.literal("dynamic-workers"),
|
|
42
|
+
retentionDays: z.literal(7),
|
|
43
|
+
from: z.string().datetime(),
|
|
44
|
+
to: z.string().datetime(),
|
|
45
|
+
entries: z.array(runtimeLogEntrySchema).max(100),
|
|
46
|
+
nextCursor: z.string().nullable(),
|
|
47
|
+
dropped: z.number().int().nonnegative(),
|
|
48
|
+
lastReceivedAt: z.string().datetime().nullable(),
|
|
49
|
+
})
|
|
50
|
+
.strict();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function readSourceBounded(body: ReadableStream<Uint8Array> | null, maximum: number): Promise<Uint8Array<ArrayBuffer>>;
|
|
2
|
+
export declare function sourceFileExcluded(path: string): boolean;
|
|
3
|
+
export declare function sourceExecutable(files: Map<string, Uint8Array>, path: string): boolean;
|
|
4
|
+
export declare function validateSourcePath(path: string): string;
|
|
5
|
+
export declare function sourceInventory(files: Map<string, Uint8Array>): Promise<{
|
|
6
|
+
manifest: string;
|
|
7
|
+
digest: string;
|
|
8
|
+
}>;
|
|
9
|
+
export declare function packSource(files: Map<string, Uint8Array>): Promise<Uint8Array<ArrayBuffer>>;
|
|
10
|
+
export declare function unpackSource(compressed: Uint8Array, strict?: boolean): Promise<Map<string, Uint8Array<ArrayBufferLike>>>;
|
|
11
|
+
export declare function setSourceExecutable(files: Map<string, Uint8Array>, path: string, executable: boolean): void;
|