@ebay-dt/bonfire-core 0.1.0-alpha.0 → 0.1.0-alpha.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 +54 -6
- package/dist/agent.d.ts +48 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +96 -0
- package/dist/agent.js.map +1 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +15 -1
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/lifecycle-input.d.ts +10 -5
- package/dist/lifecycle-input.d.ts.map +1 -1
- package/dist/lifecycle-input.js +49 -25
- package/dist/lifecycle-input.js.map +1 -1
- package/dist/lifecycle.d.ts +23 -1
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +13 -0
- package/dist/lifecycle.js.map +1 -1
- package/dist/prototype-catalog.d.ts +4 -0
- package/dist/prototype-catalog.d.ts.map +1 -1
- package/dist/prototype-catalog.js.map +1 -1
- package/dist/prototype-metadata.d.ts +6 -1
- package/dist/prototype-metadata.d.ts.map +1 -1
- package/dist/prototype-metadata.js +17 -1
- package/dist/prototype-metadata.js.map +1 -1
- package/dist/theme.d.ts +43 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +210 -0
- package/dist/theme.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,6 +28,39 @@ configuration is deeply frozen.
|
|
|
28
28
|
The package also exports the `BonfireIdentity` and
|
|
29
29
|
`GitHubCliLoginPageModel` types used by the Node, Next.js, and React packages.
|
|
30
30
|
|
|
31
|
+
## Generic theme contracts
|
|
32
|
+
|
|
33
|
+
Themes are optional instance configuration. A registry declares the themes an
|
|
34
|
+
application can render and the color schemes each theme supports:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import type { BonfireConfigInput } from "@ebay-dt/bonfire-core";
|
|
38
|
+
|
|
39
|
+
const config = {
|
|
40
|
+
appId: "my-app",
|
|
41
|
+
name: "My App",
|
|
42
|
+
themes: {
|
|
43
|
+
definitions: [
|
|
44
|
+
{
|
|
45
|
+
id: "alpha",
|
|
46
|
+
label: "Alpha",
|
|
47
|
+
allowedColorSchemes: ["system", "light", "dark"],
|
|
48
|
+
},
|
|
49
|
+
{ id: "beta", label: "Beta", allowedColorSchemes: ["dark"] },
|
|
50
|
+
],
|
|
51
|
+
defaultTheme: "alpha",
|
|
52
|
+
defaultColorScheme: "system",
|
|
53
|
+
},
|
|
54
|
+
} satisfies BonfireConfigInput;
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`ThemeDefinition`, `ThemeRegistry`, and `PrototypeTheme` are generic contracts;
|
|
58
|
+
Bonfire does not assign meaning to theme IDs or own their CSS. Prototype
|
|
59
|
+
metadata may narrow the registry to a default theme, allowed themes, a default
|
|
60
|
+
scheme, and allowed schemes. All registry and metadata values are normalized,
|
|
61
|
+
validated, and deeply frozen. `parsePrototypeThemeSelection` expands the
|
|
62
|
+
create/edit dialog's switching permissions into a validated `PrototypeTheme`.
|
|
63
|
+
|
|
31
64
|
## Prototype catalog contracts
|
|
32
65
|
|
|
33
66
|
Prototype references use a validated login and lowercase kebab-case slug:
|
|
@@ -93,18 +126,33 @@ if (!result.ok) {
|
|
|
93
126
|
```
|
|
94
127
|
|
|
95
128
|
Create and duplicate inputs normalize title/description and validate all
|
|
96
|
-
prototype references.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
129
|
+
prototype references. Edit normalizes the title/description together with the
|
|
130
|
+
owned prototype ref; delete uses the same normalized `PrototypeRef` command
|
|
131
|
+
input. Destination identity and slug are intentionally absent from browser
|
|
132
|
+
input; trusted services derive them from the authenticated identity and
|
|
133
|
+
normalized title. Create, duplicate, edit, and delete are development-only
|
|
100
134
|
mutation contracts; production adapters remain public and read-only.
|
|
101
135
|
|
|
102
136
|
Dirty observation is represented by the finite `clean` and `dirty` statuses. It
|
|
103
137
|
is an observation of the repository, not durable client state.
|
|
104
|
-
|
|
105
|
-
paths, Git output, or framework values.
|
|
138
|
+
Edit and delete return explicit success values and never expose filesystem
|
|
139
|
+
paths, Git output, or framework values. Edit preserves the existing ref and
|
|
140
|
+
URL; delete represents removal of the complete owned prototype directory,
|
|
141
|
+
including uncommitted files.
|
|
106
142
|
|
|
107
143
|
Lifecycle errors contain only stable codes, never filesystem paths, Git output,
|
|
108
144
|
GitHub CLI output, or secrets. Hosts own user-facing copy for codes such as
|
|
109
145
|
`invalid-input`, `already-exists`, `repository-busy`, `working-tree-conflict`,
|
|
110
146
|
`git-failure`, and `filesystem-failure`.
|
|
147
|
+
|
|
148
|
+
Deployment uses the same validated `PrototypeCommandInput` as other
|
|
149
|
+
reference-only lifecycle commands. A successful `DeploymentValue` contains the
|
|
150
|
+
owned prototype ref, canonical `previewUrl`, `deploymentId`, `readyState`, and
|
|
151
|
+
an optional warning. Ready states are finite: `BLOCKED`, `BUILDING`, `CANCELED`,
|
|
152
|
+
`ERROR`, `INITIALIZING`, `QUEUED`, and `READY`. A ready state is the provider's
|
|
153
|
+
reported state; Bonfire does not poll the deployment ID.
|
|
154
|
+
|
|
155
|
+
Deployment is optional and development-only. Core does not define a service
|
|
156
|
+
endpoint, credentials, deployment target, or `{ owner, branch }` input; trusted
|
|
157
|
+
Node/Next adapters derive the application ID and login from server configuration
|
|
158
|
+
and authenticated identity.
|
package/dist/agent.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type PrototypeRef } from "./prototype-ref.js";
|
|
2
|
+
export type Agent = "cursor" | "claude-code";
|
|
3
|
+
export type TerminalApp = "terminal" | "iterm" | "warp";
|
|
4
|
+
export type AgentCommand = "cursor" | "claude" | "osascript";
|
|
5
|
+
export type OpenInAgentInput = {
|
|
6
|
+
ref: PrototypeRef;
|
|
7
|
+
};
|
|
8
|
+
export type OpenInClaudeCodeInput = OpenInAgentInput & {
|
|
9
|
+
terminal?: TerminalApp;
|
|
10
|
+
};
|
|
11
|
+
export type UserPreferences = {
|
|
12
|
+
preferredTerminal?: TerminalApp;
|
|
13
|
+
};
|
|
14
|
+
export type AgentActionErrorCode = "unauthenticated" | "forbidden" | "not-found" | "invalid-input" | "needs-terminal" | "missing-command" | "unsupported-platform" | "launch-failed";
|
|
15
|
+
export type AgentActionError = {
|
|
16
|
+
code: AgentActionErrorCode;
|
|
17
|
+
agent?: Agent;
|
|
18
|
+
command?: AgentCommand;
|
|
19
|
+
terminal?: TerminalApp;
|
|
20
|
+
};
|
|
21
|
+
export type AgentLaunchValue = {
|
|
22
|
+
agent: Agent;
|
|
23
|
+
};
|
|
24
|
+
export type AgentActionResult<Value = AgentLaunchValue> = {
|
|
25
|
+
ok: true;
|
|
26
|
+
value: Value;
|
|
27
|
+
} | {
|
|
28
|
+
ok: false;
|
|
29
|
+
error: AgentActionError;
|
|
30
|
+
};
|
|
31
|
+
export declare class AgentInputError extends Error {
|
|
32
|
+
readonly code: "invalid-input";
|
|
33
|
+
readonly path: string;
|
|
34
|
+
constructor(path: string);
|
|
35
|
+
}
|
|
36
|
+
export declare function parseAgent(value: unknown): Agent;
|
|
37
|
+
export declare function parseTerminalApp(value: unknown): TerminalApp;
|
|
38
|
+
export declare function parseAgentCommand(value: unknown): AgentCommand;
|
|
39
|
+
export declare function parseOpenInAgentInput(value: unknown): {
|
|
40
|
+
ref: PrototypeRef;
|
|
41
|
+
};
|
|
42
|
+
export declare function parseOpenInClaudeCodeInput(value: unknown): OpenInClaudeCodeInput;
|
|
43
|
+
/**
|
|
44
|
+
* Preference documents are intentionally forward-compatible: unknown keys are
|
|
45
|
+
* ignored and an invalid terminal value means that no terminal is configured.
|
|
46
|
+
*/
|
|
47
|
+
export declare function parseUserPreferences(value: unknown): UserPreferences;
|
|
48
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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CAAU;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,YAAY,IAAI,EAAE,MAAM,EAIvB;CACF;AAcD,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,SAExC;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,eAE9C;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,gBAE/C;AAuBD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO;;EAOnD;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,yBAcxD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAgBpE"}
|
package/dist/agent.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { asRecord, deepFreeze, findUnknownKey } from "./internal/utils.js";
|
|
2
|
+
import { definePrototypeRef, PrototypeRefError, } from "./prototype-ref.js";
|
|
3
|
+
const AGENTS = ["cursor", "claude-code"];
|
|
4
|
+
const TERMINALS = ["terminal", "iterm", "warp"];
|
|
5
|
+
const AGENT_COMMANDS = [
|
|
6
|
+
"cursor",
|
|
7
|
+
"claude",
|
|
8
|
+
"osascript",
|
|
9
|
+
];
|
|
10
|
+
export class AgentInputError extends Error {
|
|
11
|
+
code = "invalid-input";
|
|
12
|
+
path;
|
|
13
|
+
constructor(path) {
|
|
14
|
+
super("Invalid agent input");
|
|
15
|
+
this.name = "AgentInputError";
|
|
16
|
+
this.path = path;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function parseEnum(value, values, path) {
|
|
20
|
+
if (typeof value === "string" && values.includes(value)) {
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
throw new AgentInputError(path);
|
|
24
|
+
}
|
|
25
|
+
export function parseAgent(value) {
|
|
26
|
+
return parseEnum(value, AGENTS, "agent");
|
|
27
|
+
}
|
|
28
|
+
export function parseTerminalApp(value) {
|
|
29
|
+
return parseEnum(value, TERMINALS, "terminal");
|
|
30
|
+
}
|
|
31
|
+
export function parseAgentCommand(value) {
|
|
32
|
+
return parseEnum(value, AGENT_COMMANDS, "command");
|
|
33
|
+
}
|
|
34
|
+
function parseInputRef(record) {
|
|
35
|
+
if (!Object.hasOwn(record, "ref")) {
|
|
36
|
+
throw new AgentInputError("ref");
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
return definePrototypeRef(record.ref);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (error instanceof PrototypeRefError) {
|
|
43
|
+
throw new AgentInputError("ref");
|
|
44
|
+
}
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function requireInputRecord(value) {
|
|
49
|
+
const record = asRecord(value);
|
|
50
|
+
if (record === null)
|
|
51
|
+
throw new AgentInputError("input");
|
|
52
|
+
return record;
|
|
53
|
+
}
|
|
54
|
+
export function parseOpenInAgentInput(value) {
|
|
55
|
+
const record = requireInputRecord(value);
|
|
56
|
+
if (findUnknownKey(record, ["ref"])) {
|
|
57
|
+
throw new AgentInputError("input");
|
|
58
|
+
}
|
|
59
|
+
return deepFreeze({ ref: parseInputRef(record) });
|
|
60
|
+
}
|
|
61
|
+
export function parseOpenInClaudeCodeInput(value) {
|
|
62
|
+
const record = requireInputRecord(value);
|
|
63
|
+
if (findUnknownKey(record, ["ref", "terminal"])) {
|
|
64
|
+
throw new AgentInputError("input");
|
|
65
|
+
}
|
|
66
|
+
const input = {
|
|
67
|
+
ref: parseInputRef(record),
|
|
68
|
+
};
|
|
69
|
+
if (record.terminal !== undefined) {
|
|
70
|
+
input.terminal = parseTerminalApp(record.terminal);
|
|
71
|
+
}
|
|
72
|
+
return deepFreeze(input);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Preference documents are intentionally forward-compatible: unknown keys are
|
|
76
|
+
* ignored and an invalid terminal value means that no terminal is configured.
|
|
77
|
+
*/
|
|
78
|
+
export function parseUserPreferences(value) {
|
|
79
|
+
const record = asRecord(value);
|
|
80
|
+
if (record === null || !Object.hasOwn(record, "preferredTerminal")) {
|
|
81
|
+
return Object.freeze({});
|
|
82
|
+
}
|
|
83
|
+
if (record.preferredTerminal === undefined)
|
|
84
|
+
return Object.freeze({});
|
|
85
|
+
try {
|
|
86
|
+
return Object.freeze({
|
|
87
|
+
preferredTerminal: parseTerminalApp(record.preferredTerminal),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
if (error instanceof AgentInputError)
|
|
92
|
+
return Object.freeze({});
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EACL,kBAAkB,EAClB,iBAAiB,GAElB,MAAM,oBAAoB,CAAC;AAM5B,MAAM,MAAM,GAAqB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AAC3D,MAAM,SAAS,GAA2B,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AACxE,MAAM,cAAc,GAA4B;IAC9C,QAAQ;IACR,QAAQ;IACR,WAAW;CACZ,CAAC;AAsCF,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC/B,IAAI,GAAG,eAAwB,CAAC;IAChC,IAAI,CAAS;IAEtB,YAAY,IAAY;QACtB,KAAK,CAAC,qBAAqB,CAAC,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,SAAS,SAAS,CAChB,KAAc,EACd,MAAwB,EACxB,IAAY;IAEZ,IAAI,OAAO,KAAK,K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iB,CAAC;SAC9D,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,eAAe;YAAE,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC/D,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ThemeRegistry } from "./theme.js";
|
|
1
2
|
import type { DeepReadonly } from "./internal/types.js";
|
|
2
3
|
export type BonfireConfigInput = {
|
|
3
4
|
appId: string;
|
|
@@ -7,6 +8,7 @@ export type BonfireConfigInput = {
|
|
|
7
8
|
hostname: string;
|
|
8
9
|
};
|
|
9
10
|
};
|
|
11
|
+
themes?: ThemeRegistry;
|
|
10
12
|
};
|
|
11
13
|
export type BonfireConfig = DeepReadonly<BonfireConfigInput>;
|
|
12
14
|
export declare class BonfireConfigError extends Error {
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAQxD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QACJ,MAAM,EAAE;YACN,QAAQ,EAAE,MAAM,CAAC;SAClB,CAAC;KACH,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAMA,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAQxD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QACJ,MAAM,EAAE;YACN,QAAQ,EAAE,MAAM,CAAC;SAClB,CAAC;KACH,CAAC;IACF,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC,kBAAkB,CAAC,CAAC;AAE7D,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,YAAY,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAIxC;CACF;AAsGD,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEpD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,kBAAkB,GAAG,aAAa,CA2CrE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,UAEjD"}
|
package/dist/config.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { asRecord, deepFreeze, findUnknownKey, readRequiredString, } from "./internal/utils.js";
|
|
2
|
+
import { parseThemeRegistry, ThemeValidationError, } from "./theme.js";
|
|
2
3
|
const APP_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
3
4
|
const HOSTNAME_LABEL_PATTERN = /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)$/;
|
|
4
5
|
const MAX_APP_ID_LENGTH = 63;
|
|
@@ -81,7 +82,7 @@ export function parseHostname(value) {
|
|
|
81
82
|
}
|
|
82
83
|
export function defineConfig(input) {
|
|
83
84
|
const root = configRecord(input, "config");
|
|
84
|
-
rejectConfigUnknownKeys(root, ["appId", "name", "auth"], "config");
|
|
85
|
+
rejectConfigUnknownKeys(root, ["appId", "name", "auth", "themes"], "config");
|
|
85
86
|
const appId = validateAppId(root.appId, "config.appId");
|
|
86
87
|
const name = validateName(configRequiredString(root, "name", "config"), "config.name");
|
|
87
88
|
const auth = configRecord(root.auth, "config.auth");
|
|
@@ -89,6 +90,18 @@ export function defineConfig(input) {
|
|
|
89
90
|
const github = configRecord(auth.github, "config.auth.github");
|
|
90
91
|
rejectConfigUnknownKeys(github, ["hostname"], "config.auth.github");
|
|
91
92
|
const hostname = validateHostname(configRequiredString(github, "hostname", "config.auth.github"), "config.auth.github.hostname");
|
|
93
|
+
let themes;
|
|
94
|
+
if (Object.hasOwn(root, "themes")) {
|
|
95
|
+
try {
|
|
96
|
+
themes = parseThemeRegistry(root.themes, "config.themes");
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
if (error instanceof ThemeValidationError) {
|
|
100
|
+
throw new BonfireConfigError(error.path, error.reason);
|
|
101
|
+
}
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
92
105
|
const normalized = {
|
|
93
106
|
appId,
|
|
94
107
|
name,
|
|
@@ -97,6 +110,7 @@ export function defineConfig(input) {
|
|
|
97
110
|
hostname,
|
|
98
111
|
},
|
|
99
112
|
},
|
|
113
|
+
...(themes === undefined ? {} : { themes }),
|
|
100
114
|
};
|
|
101
115
|
return deepFreeze(normalized);
|
|
102
116
|
}
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,UAAU,EACV,cAAc,EACd,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,UAAU,EACV,cAAc,EACd,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,oBAAoB,GAErB,MAAM,YAAY,CAAC;AAGpB,MAAM,cAAc,GAAG,4BAA4B,CAAC;AACpD,MAAM,sBAAsB,GAAG,4CAA4C,CAAC;AAC5E,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC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E,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export { defineConfig, getSessionCookieName, parseHostname, type BonfireConfig, type BonfireConfigInput, } from "./config.js";
|
|
2
|
+
export { COLOR_SCHEMES, createDefaultPrototypeTheme, parsePrototypeTheme, parsePrototypeThemeSelection, parseThemeRegistry, ThemeValidationError, type ColorScheme, type PrototypeTheme, type PrototypeThemeSelection, type ThemeDefinition, type ThemeRegistry, } from "./theme.js";
|
|
2
3
|
export { parseBonfireIdentity, BonfireIdentityError, type BonfireIdentity, } from "./identity.js";
|
|
4
|
+
export { AgentInputError, parseAgent, parseAgentCommand, parseOpenInAgentInput, parseOpenInClaudeCodeInput, parseTerminalApp, parseUserPreferences, type Agent, type AgentActionError, type AgentActionErrorCode, type AgentActionResult, type AgentCommand, type AgentLaunchValue, type OpenInAgentInput, type OpenInClaudeCodeInput, type TerminalApp, type UserPreferences, } from "./agent.js";
|
|
3
5
|
export type { GitHubCliLoginPageModel } from "./auth-model.js";
|
|
4
6
|
export { definePrototypeRef, getPrototypeUrl, parsePrototypePath, PrototypeRefError, slugifyPrototypeTitle, } from "./prototype-ref.js";
|
|
5
7
|
export type { PrototypeRef } from "./prototype-ref.js";
|
|
6
|
-
export { definePrototypeSummary, parsePrototypeMetadata, PrototypeMetadataError, type PrototypeMetadata, type PrototypeSummary, } from "./prototype-metadata.js";
|
|
8
|
+
export { definePrototypeSummary, parsePrototypeMetadata, PrototypeMetadataError, type PrototypeMetadata, type PrototypeSummary, type PrototypeMetadataParseOptions, } from "./prototype-metadata.js";
|
|
7
9
|
export { filterPrototypes, getPrototypeAuthorOptions, sortPrototypes, type PrototypeAuthorOption, type PrototypeAuthorSelection, type PrototypeCatalogQuery, type PrototypeDashboardModel, type PrototypeSort, } from "./prototype-catalog.js";
|
|
8
|
-
export { AutomaticBranchSwitchSettingError, isLifecycleFailure, isLifecycleSuccess, parseAutomaticBranchSwitchSetting, lifecycleFailure, lifecycleSuccess, type AutomaticBranchSwitchMode, type BranchPreparationStatus, type BranchPreparationValue, type CreatePrototypeValue, type DirtyObservationStatus, type DirtyObservationValue, type DiscardPrototypeValue, type DuplicatePrototypeValue, type LifecycleError, type LifecycleErrorCode, type LifecyclePrototypeValue, type LifecycleRemoteStatus, type LifecycleResult, type SavePrototypeValue, } from "./lifecycle.js";
|
|
9
|
-
export { LifecycleInputError, parseCreatePrototypeInput,
|
|
10
|
+
export { AutomaticBranchSwitchSettingError, DEPLOYMENT_READY_STATES, isDeploymentReadyState, isLifecycleFailure, isLifecycleSuccess, parseAutomaticBranchSwitchSetting, lifecycleFailure, lifecycleSuccess, type AutomaticBranchSwitchMode, type DeploymentReadyState, type DeploymentValue, type DeploymentWarningCode, type BranchPreparationStatus, type BranchPreparationValue, type CreatePrototypeValue, type DeletePrototypeValue, type DirtyObservationStatus, type DirtyObservationValue, type DiscardPrototypeValue, type DuplicatePrototypeValue, type EditPrototypeValue, type LifecycleError, type LifecycleErrorCode, type LifecyclePrototypeValue, type LifecycleRemoteStatus, type LifecycleResult, type SavePrototypeValue, } from "./lifecycle.js";
|
|
11
|
+
export { LifecycleInputError, parseCreatePrototypeInput, parseDuplicatePrototypeInput, parseEditPrototypeInput, parsePrototypeCommandInput, PROTOTYPE_DESCRIPTION_MAX_CODE_POINTS, PROTOTYPE_TITLE_MAX_CODE_POINTS, type CreatePrototypeInput, type DuplicatePrototypeInput, type EditPrototypeInput, type PrototypeCommandInput, } from "./lifecycle-input.js";
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,kBAAkB,GACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,kBAAkB,GACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,aAAa,EACb,2BAA2B,EAC3B,mBAAmB,EACnB,4BAA4B,EAC5B,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,aAAa,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,0BAA0B,EAC1B,gBAAgB,EAChB,oBAAoB,EACpB,KAAK,KAAK,EACV,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,eAAe,GACrB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EACL,kBAAkB,EAClB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ist/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { defineConfig, getSessionCookieName, parseHostname, } from "./config.js";
|
|
2
|
+
export { COLOR_SCHEMES, createDefaultPrototypeTheme, parsePrototypeTheme, parsePrototypeThemeSelection, parseThemeRegistry, ThemeValidationError, } from "./theme.js";
|
|
2
3
|
export { parseBonfireIdentity, BonfireIdentityError, } from "./identity.js";
|
|
4
|
+
export { AgentInputError, parseAgent, parseAgentCommand, parseOpenInAgentInput, parseOpenInClaudeCodeInput, parseTerminalApp, parseUserPreferences, } from "./agent.js";
|
|
3
5
|
export { definePrototypeRef, getPrototypeUrl, parsePrototypePath, PrototypeRefError, slugifyPrototypeTitle, } from "./prototype-ref.js";
|
|
4
6
|
export { definePrototypeSummary, parsePrototypeMetadata, PrototypeMetadataError, } from "./prototype-metadata.js";
|
|
5
7
|
export { filterPrototypes, getPrototypeAuthorOptions, sortPrototypes, } from "./prototype-catalog.js";
|
|
6
|
-
export { AutomaticBranchSwitchSettingError, isLifecycleFailure, isLifecycleSuccess, parseAutomaticBranchSwitchSetting, lifecycleFailure, lifecycleSuccess, } from "./lifecycle.js";
|
|
7
|
-
export { LifecycleInputError, parseCreatePrototypeInput,
|
|
8
|
+
export { AutomaticBranchSwitchSettingError, DEPLOYMENT_READY_STATES, isDeploymentReadyState, isLifecycleFailure, isLifecycleSuccess, parseAutomaticBranchSwitchSetting, lifecycleFailure, lifecycleSuccess, } from "./lifecycle.js";
|
|
9
|
+
export { LifecycleInputError, parseCreatePrototypeInput, parseDuplicatePrototypeInput, parseEditPrototypeInput, parsePrototypeCommandInput, PROTOTYPE_DESCRIPTION_MAX_CODE_POINTS, PROTOTYPE_TITLE_MAX_CODE_POINTS, } from "./lifecycle-input.js";
|
|
8
10
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,aAAa,GAGd,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GAErB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,aAAa,GAGd,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,aAAa,EACb,2BAA2B,EAC3B,mBAAmB,EACnB,4BAA4B,EAC5B,kBAAkB,EAClB,oBAAoB,GAMrB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GAErB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,0BAA0B,EAC1B,gBAAgB,EAChB,oBAAoB,GAWrB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,GAIvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,cAAc,GAMf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,iCAAiC,EACjC,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,iCAAiC,EACjC,gBAAgB,EAChB,gBAAgB,GAoBjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,4BAA4B,EAC5B,uBAAuB,EACvB,0BAA0B,EAC1B,qCAAqC,EACrC,+BAA+B,GAKhC,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
import { type PrototypeRef } from "./prototype-ref.js";
|
|
2
|
+
import { type PrototypeTheme, type ThemeRegistry } from "./theme.js";
|
|
2
3
|
export declare const PROTOTYPE_TITLE_MAX_CODE_POINTS = 200;
|
|
3
4
|
export declare const PROTOTYPE_DESCRIPTION_MAX_CODE_POINTS = 2000;
|
|
4
5
|
export type CreatePrototypeInput = {
|
|
5
6
|
title: string;
|
|
6
7
|
description: string | null;
|
|
8
|
+
theme?: PrototypeTheme;
|
|
7
9
|
};
|
|
8
10
|
export type DuplicatePrototypeInput = {
|
|
9
11
|
source: PrototypeRef;
|
|
10
12
|
title: string;
|
|
11
13
|
description: string | null;
|
|
12
14
|
};
|
|
15
|
+
export type EditPrototypeInput = {
|
|
16
|
+
ref: PrototypeRef;
|
|
17
|
+
title: string;
|
|
18
|
+
description: string | null;
|
|
19
|
+
theme?: PrototypeTheme;
|
|
20
|
+
};
|
|
13
21
|
export type PrototypeCommandInput = {
|
|
14
22
|
ref: PrototypeRef;
|
|
15
23
|
};
|
|
16
|
-
export type SavePrototypeInput = PrototypeCommandInput;
|
|
17
|
-
export type DiscardPrototypeInput = PrototypeCommandInput;
|
|
18
24
|
export declare class LifecycleInputError extends Error {
|
|
19
25
|
readonly code: "invalid-input";
|
|
20
26
|
readonly path: string;
|
|
21
27
|
constructor(path: string);
|
|
22
28
|
}
|
|
23
|
-
export declare function parseCreatePrototypeInput(value: unknown): CreatePrototypeInput;
|
|
29
|
+
export declare function parseCreatePrototypeInput(value: unknown, themeRegistry?: ThemeRegistry): CreatePrototypeInput;
|
|
24
30
|
export declare function parseDuplicatePrototypeInput(value: unknown): DuplicatePrototypeInput;
|
|
31
|
+
export declare function parseEditPrototypeInput(value: unknown, themeRegistry?: ThemeRegistry): EditPrototypeInput;
|
|
25
32
|
export declare function parsePrototypeCommandInput(value: unknown): PrototypeCommandInput;
|
|
26
|
-
export declare function parseSavePrototypeInput(value: unknown): SavePrototypeInput;
|
|
27
|
-
export declare function parseDiscardPrototypeInput(value: unknown): DiscardPrototypeInput;
|
|
28
33
|
//# sourceMappingURL=lifecycle-input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle-input.d.ts","sourceRoot":"","sources":["../src/lifecycle-input.ts"],"names":[],"mappings":"AAMA,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"lifecycle-input.d.ts","sourceRoot":"","sources":["../src/lifecycle-input.ts"],"names":[],"mappings":"AAMA,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,+BAA+B,MAAM,CAAC;AACnD,eAAO,MAAM,qCAAqC,OAAQ,CAAC;AAE3D,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,EAAE,YAAY,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,GAAG,EAAE,YAAY,CAAC;CACnB,CAAC;AAEF,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,IAAI,EAAG,eAAe,CAAU;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,YAAY,IAAI,EAAE,MAAM,EAIvB;CACF;AAwGD,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,OAAO,EACd,aAAa,CAAC,EAAE,aAAa,GAC5B,oBAAoB,CActB;AAED,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,OAAO,GACb,uBAAuB,CAazB;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,OAAO,EACd,aAAa,CAAC,EAAE,aAAa,GAC5B,kBAAkB,CAepB;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,GACb,qBAAqB,CAKvB"}
|
package/dist/lifecycle-input.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { asRecord, deepFreeze, findUnknownKey, readRequiredString, } from "./internal/utils.js";
|
|
2
2
|
import { definePrototypeRef, PrototypeRefError, slugifyPrototypeTitle, } from "./prototype-ref.js";
|
|
3
|
+
import { parsePrototypeTheme, ThemeValidationError, } from "./theme.js";
|
|
3
4
|
export const PROTOTYPE_TITLE_MAX_CODE_POINTS = 200;
|
|
4
5
|
export const PROTOTYPE_DESCRIPTION_MAX_CODE_POINTS = 2_000;
|
|
5
6
|
export class LifecycleInputError extends Error {
|
|
@@ -48,26 +49,55 @@ function parseDescription(record) {
|
|
|
48
49
|
}
|
|
49
50
|
return description.length === 0 ? null : description;
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
-
if (!Object.hasOwn(record,
|
|
53
|
-
throw new LifecycleInputError(
|
|
52
|
+
function parseRef(record, key) {
|
|
53
|
+
if (!Object.hasOwn(record, key)) {
|
|
54
|
+
throw new LifecycleInputError(key);
|
|
54
55
|
}
|
|
55
56
|
try {
|
|
56
|
-
return definePrototypeRef(record
|
|
57
|
+
return definePrototypeRef(record[key]);
|
|
57
58
|
}
|
|
58
59
|
catch (error) {
|
|
59
60
|
if (error instanceof PrototypeRefError) {
|
|
60
|
-
throw new LifecycleInputError(
|
|
61
|
+
throw new LifecycleInputError(key);
|
|
62
|
+
}
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function parseSource(record) {
|
|
67
|
+
return parseRef(record, "source");
|
|
68
|
+
}
|
|
69
|
+
function parseThemeField(record, themeRegistry) {
|
|
70
|
+
if (!Object.hasOwn(record, "theme") || record.theme === undefined) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
if (!themeRegistry) {
|
|
74
|
+
// Theme input has nothing to validate against when the instance has no
|
|
75
|
+
// configured registry; reject rather than silently ignoring it.
|
|
76
|
+
throw new LifecycleInputError("theme");
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
// `theme` is already the normalized `PrototypeTheme` shape (the same
|
|
80
|
+
// shape stored in prototype metadata). Callers that offer a simplified
|
|
81
|
+
// authoring UI expand a `PrototypeThemeSelection` into this shape with
|
|
82
|
+
// `parsePrototypeThemeSelection` before submitting it, keeping this
|
|
83
|
+
// parse idempotent for callers that re-validate already-parsed input.
|
|
84
|
+
return parsePrototypeTheme(record.theme, "theme", themeRegistry);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
if (error instanceof ThemeValidationError) {
|
|
88
|
+
throw new LifecycleInputError(error.path);
|
|
61
89
|
}
|
|
62
90
|
throw error;
|
|
63
91
|
}
|
|
64
92
|
}
|
|
65
|
-
export function parseCreatePrototypeInput(value) {
|
|
93
|
+
export function parseCreatePrototypeInput(value, themeRegistry) {
|
|
66
94
|
const record = requireRecord(value, "createPrototypeInput");
|
|
67
|
-
rejectUnknownKey(record, ["title", "description"], "createPrototypeInput");
|
|
95
|
+
rejectUnknownKey(record, ["title", "description", "theme"], "createPrototypeInput");
|
|
96
|
+
const theme = parseThemeField(record, themeRegistry);
|
|
68
97
|
return deepFreeze({
|
|
69
98
|
title: parseTitle(record),
|
|
70
99
|
description: parseDescription(record),
|
|
100
|
+
...(theme === undefined ? {} : { theme }),
|
|
71
101
|
});
|
|
72
102
|
}
|
|
73
103
|
export function parseDuplicatePrototypeInput(value) {
|
|
@@ -79,26 +109,20 @@ export function parseDuplicatePrototypeInput(value) {
|
|
|
79
109
|
description: parseDescription(record),
|
|
80
110
|
});
|
|
81
111
|
}
|
|
112
|
+
export function parseEditPrototypeInput(value, themeRegistry) {
|
|
113
|
+
const record = requireRecord(value, "editPrototypeInput");
|
|
114
|
+
rejectUnknownKey(record, ["ref", "title", "description", "theme"], "editPrototypeInput");
|
|
115
|
+
const theme = parseThemeField(record, themeRegistry);
|
|
116
|
+
return deepFreeze({
|
|
117
|
+
ref: parseRef(record, "ref"),
|
|
118
|
+
title: parseTitle(record),
|
|
119
|
+
description: parseDescription(record),
|
|
120
|
+
...(theme === undefined ? {} : { theme }),
|
|
121
|
+
});
|
|
122
|
+
}
|
|
82
123
|
export function parsePrototypeCommandInput(value) {
|
|
83
124
|
const record = requireRecord(value, "prototypeCommandInput");
|
|
84
125
|
rejectUnknownKey(record, ["ref"], "prototypeCommandInput");
|
|
85
|
-
|
|
86
|
-
throw new LifecycleInputError("ref");
|
|
87
|
-
}
|
|
88
|
-
try {
|
|
89
|
-
return deepFreeze({ ref: definePrototypeRef(record.ref) });
|
|
90
|
-
}
|
|
91
|
-
catch (error) {
|
|
92
|
-
if (error instanceof PrototypeRefError) {
|
|
93
|
-
throw new LifecycleInputError("ref");
|
|
94
|
-
}
|
|
95
|
-
throw error;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
export function parseSavePrototypeInput(value) {
|
|
99
|
-
return parsePrototypeCommandInput(value);
|
|
100
|
-
}
|
|
101
|
-
export function parseDiscardPrototypeInput(value) {
|
|
102
|
-
return parsePrototypeCommandInput(value);
|
|
126
|
+
return deepFreeze({ ref: parseRef(record, "ref") });
|
|
103
127
|
}
|
|
104
128
|
//# sourceMappingURL=lifecycle-input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle-input.js","sourceRoot":"","sources":["../src/lifecycle-input.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,UAAU,EACV,cAAc,EACd,kBAAkB,GACnB,MA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U,CAAC,MAAM,CAAC;QACzB,WAAW,EAAE,gBAAgB,CAAC,MAAM,CAAC;QACrC,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;KAC1C,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,KAAc;IAEd,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,EAAE,uBAAuB,CAAC,CAAC;IAC7D,gBAAgB,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,uBAAuB,CAAC,CAAC;IAE3D,OAAO,UAAU,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;AACtD,CAAC"}
|
package/dist/lifecycle.d.ts
CHANGED
|
@@ -5,7 +5,11 @@ export declare class AutomaticBranchSwitchSettingError extends Error {
|
|
|
5
5
|
constructor();
|
|
6
6
|
}
|
|
7
7
|
export declare function parseAutomaticBranchSwitchSetting(value: unknown): AutomaticBranchSwitchMode;
|
|
8
|
-
export
|
|
8
|
+
export declare const DEPLOYMENT_READY_STATES: readonly ["BLOCKED", "BUILDING", "CANCELED", "ERROR", "INITIALIZING", "QUEUED", "READY"];
|
|
9
|
+
export type DeploymentReadyState = (typeof DEPLOYMENT_READY_STATES)[number];
|
|
10
|
+
export declare function isDeploymentReadyState(value: unknown): value is DeploymentReadyState;
|
|
11
|
+
export type DeploymentWarningCode = "metadata-persistence-failed" | "primary-merge-failed";
|
|
12
|
+
export type LifecycleErrorCode = "unauthenticated" | "forbidden" | "invalid-input" | "not-found" | "already-exists" | "repository-busy" | "working-tree-conflict" | "filesystem-failure" | "git-failure" | "deployment-failure" | "deployment-unavailable" | "timeout" | "unexpected-failure";
|
|
9
13
|
export type LifecycleError = {
|
|
10
14
|
code: LifecycleErrorCode;
|
|
11
15
|
};
|
|
@@ -28,15 +32,33 @@ export type LifecyclePrototypeValue = {
|
|
|
28
32
|
};
|
|
29
33
|
export type CreatePrototypeValue = LifecyclePrototypeValue;
|
|
30
34
|
export type DuplicatePrototypeValue = LifecyclePrototypeValue;
|
|
35
|
+
export type EditPrototypeValue = {
|
|
36
|
+
edited: true;
|
|
37
|
+
ref: PrototypeRef;
|
|
38
|
+
};
|
|
39
|
+
export type DeletePrototypeValue = {
|
|
40
|
+
deleted: true;
|
|
41
|
+
ref: PrototypeRef;
|
|
42
|
+
};
|
|
31
43
|
export type SavePrototypeValue = {
|
|
32
44
|
saved: true;
|
|
33
45
|
};
|
|
34
46
|
export type DiscardPrototypeValue = {
|
|
35
47
|
discarded: true;
|
|
36
48
|
};
|
|
49
|
+
export type DeploymentValue = {
|
|
50
|
+
deployed: true;
|
|
51
|
+
ref: PrototypeRef;
|
|
52
|
+
previewUrl: string;
|
|
53
|
+
deploymentId: string;
|
|
54
|
+
readyState: DeploymentReadyState;
|
|
55
|
+
warning: DeploymentWarningCode | undefined;
|
|
56
|
+
};
|
|
37
57
|
export type DirtyObservationStatus = "clean" | "dirty";
|
|
38
58
|
export type DirtyObservationValue = {
|
|
39
59
|
status: DirtyObservationStatus;
|
|
60
|
+
/** Existing deployment preview, when one has been persisted. */
|
|
61
|
+
previewUrl?: string | null;
|
|
40
62
|
};
|
|
41
63
|
export declare function lifecycleSuccess<Value>(value: Value): LifecycleResult<Value>;
|
|
42
64
|
export declare function lifecycleFailure(code: LifecycleErrorCode): LifecycleResult<never>;
|
package/dist/lifecycle.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../src/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,MAAM,yBAAyB,GAAG,SAAS,GAAG,UAAU,CAAC;AAE/D,qBAAa,iCAAkC,SAAQ,KAAK;IAC1D,QAAQ,CAAC,IAAI,EAAG,eAAe,CAAU;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,GACvB,eAAe,CAAC,KAAK,CAAC,CAExB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EACtC,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,GAC7B,MAAM,IAAI;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAEtC;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EACtC,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,GAC7B,MAAM,IAAI;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,cAAc,CAAA;CAAE,CAEhD"}
|
package/dist/lifecycle.js
CHANGED
|
@@ -12,6 +12,19 @@ export function parseAutomaticBranchSwitchSetting(value) {
|
|
|
12
12
|
return "disabled";
|
|
13
13
|
throw new AutomaticBranchSwitchSettingError();
|
|
14
14
|
}
|
|
15
|
+
export const DEPLOYMENT_READY_STATES = Object.freeze([
|
|
16
|
+
"BLOCKED",
|
|
17
|
+
"BUILDING",
|
|
18
|
+
"CANCELED",
|
|
19
|
+
"ERROR",
|
|
20
|
+
"INITIALIZING",
|
|
21
|
+
"QUEUED",
|
|
22
|
+
"READY",
|
|
23
|
+
]);
|
|
24
|
+
export function isDeploymentReadyState(value) {
|
|
25
|
+
return (typeof value === "string" &&
|
|
26
|
+
DEPLOYMENT_READY_STATES.includes(value));
|
|
27
|
+
}
|
|
15
28
|
export function lifecycleSuccess(value) {
|
|
16
29
|
return { ok: true, value };
|
|
17
30
|
}
|
package/dist/lifecycle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../src/lifecycle.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,iCAAkC,SAAQ,KAAK;IACjD,IAAI,GAAG,eAAwB,CAAC;IAEzC;QACE,KAAK,CAAC,yCAAyC,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,GAAG,mCAAmC,CAAC;IAClD,CAAC;CACF;AAED,MAA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E,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,MAA8B;IAE9B,OAAO,MAAM,CAAC,EAAE,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,MAA8B;IAE9B,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;AACpB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PrototypeSummary } from "./prototype-metadata.js";
|
|
2
|
+
import type { ThemeRegistry } from "./theme.js";
|
|
2
3
|
export type PrototypeSort = "recent" | "alphabetical" | "deployed";
|
|
3
4
|
export type PrototypeAuthorSelection = "all" | "mine" | string;
|
|
4
5
|
export type PrototypeCatalogQuery = {
|
|
@@ -15,6 +16,9 @@ export type PrototypeDashboardModel = {
|
|
|
15
16
|
authorOptions: readonly PrototypeAuthorOption[];
|
|
16
17
|
showMine: boolean;
|
|
17
18
|
summaries: readonly PrototypeSummary[];
|
|
19
|
+
/** Present only when the instance has configured theme definitions; used
|
|
20
|
+
* to render theme-authoring controls in create/edit dialogs. */
|
|
21
|
+
themeRegistry?: ThemeRegistry;
|
|
18
22
|
};
|
|
19
23
|
export declare function filterPrototypes(summaries: readonly PrototypeSummary[], author: PrototypeAuthorSelection, currentLogin?: string | null): PrototypeSummary[];
|
|
20
24
|
export declare function sortPrototypes(summaries: readonly PrototypeSummary[], sort: PrototypeSort): PrototypeSummary[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prototype-catalog.d.ts","sourceRoot":"","sources":["../src/prototype-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"prototype-catalog.d.ts","sourceRoot":"","sources":["../src/prototype-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,cAAc,GAAG,UAAU,CAAC;AACnE,MAAM,MAAM,wBAAwB,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAE/D,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,wBAAwB,CAAC;IACjC,IAAI,EAAE,aAAa,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,qBAAqB,CAAC;IAC7B,aAAa,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAChD,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACvC;oEACgE;IAChE,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B,CAAC;AAgBF,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,SAAS,gBAAgB,EAAE,EACtC,MAAM,EAAE,wBAAwB,EAChC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAC3B,gBAAgB,EAAE,CAQpB;AAED,wBAAgB,cAAc,CAC5B,SAAS,EAAE,SAAS,gBAAgB,EAAE,EACtC,IAAI,EAAE,aAAa,GAClB,gBAAgB,EAAE,CAgCpB;AAED,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,SAAS,gBAAgB,EAAE,EACtC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAC3B,qBAAqB,EAAE,CAkBzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prototype-catalog.js","sourceRoot":"","sources":["../src/prototype-catalog.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prototype-catalog.js","sourceRoot":"","sources":["../src/prototype-catalog.ts"],"names":[],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AC;IAED,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;SACzB,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;SAC1E,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACjB,KAAK,EAAE,OAAO,CAAC,WAAW;QAC1B,IAAI,EAAE,OAAO,CAAC,UAAU;KACzB,CAAC,CAAC,CAAC;AACR,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type PrototypeRef } from "./prototype-ref.js";
|
|
2
|
+
import { type PrototypeTheme, type ThemeRegistry } from "./theme.js";
|
|
2
3
|
export type PrototypeMetadata = {
|
|
3
4
|
title: string;
|
|
4
5
|
description: string | null;
|
|
@@ -7,6 +8,7 @@ export type PrototypeMetadata = {
|
|
|
7
8
|
createdAt: string;
|
|
8
9
|
updatedAt: string;
|
|
9
10
|
previewUrl: string | null;
|
|
11
|
+
theme?: PrototypeTheme;
|
|
10
12
|
};
|
|
11
13
|
export type PrototypeSummary = PrototypeMetadata & {
|
|
12
14
|
ref: PrototypeRef;
|
|
@@ -16,6 +18,9 @@ export declare class PrototypeMetadataError extends Error {
|
|
|
16
18
|
readonly path: string;
|
|
17
19
|
constructor(path: string, message: string);
|
|
18
20
|
}
|
|
19
|
-
export
|
|
21
|
+
export type PrototypeMetadataParseOptions = {
|
|
22
|
+
themeRegistry?: ThemeRegistry;
|
|
23
|
+
};
|
|
24
|
+
export declare function parsePrototypeMetadata(value: unknown, options?: PrototypeMetadataParseOptions): PrototypeMetadata;
|
|
20
25
|
export declare function definePrototypeSummary(metadata: PrototypeMetadata, ref: PrototypeRef): PrototypeSummary;
|
|
21
26
|
//# sourceMappingURL=prototype-metadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prototype-metadata.d.ts","sourceRoot":"","sources":["../src/prototype-metadata.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"prototype-metadata.d.ts","sourceRoot":"","sources":["../src/prototype-metadata.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAK5B,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AAGpB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,GAAG;IACjD,GAAG,EAAE,YAAY,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,YAAY,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAIxC;CACF;AA6JD,MAAM,MAAM,6BAA6B,GAAG;IAC1C,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B,CAAC;AAsBF,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,6BAAkC,GAC1C,iBAAiB,CAuBnB;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,iBAAiB,EAC3B,GAAG,EAAE,YAAY,GAChB,gBAAgB,CAelB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { asRecord, deepFreeze, readRequiredString } from "./internal/utils.js";
|
|
2
2
|
import { definePrototypeRef, getPrototypeUrl, PrototypeRefError, } from "./prototype-ref.js";
|
|
3
3
|
import { PROTOTYPE_DESCRIPTION_MAX_CODE_POINTS, PROTOTYPE_TITLE_MAX_CODE_POINTS, } from "./lifecycle-input.js";
|
|
4
|
+
import { parsePrototypeTheme, ThemeValidationError, } from "./theme.js";
|
|
4
5
|
const VALIDATION_SLUG = "prototype";
|
|
5
6
|
export class PrototypeMetadataError extends Error {
|
|
6
7
|
path;
|
|
@@ -118,8 +119,22 @@ function parsePreviewUrl(record) {
|
|
|
118
119
|
}
|
|
119
120
|
return value;
|
|
120
121
|
}
|
|
121
|
-
|
|
122
|
+
function parseMetadataTheme(record, options) {
|
|
123
|
+
if (!Object.hasOwn(record, "theme"))
|
|
124
|
+
return undefined;
|
|
125
|
+
try {
|
|
126
|
+
return parsePrototypeTheme(record.theme, "metadata.theme", options.themeRegistry);
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
if (error instanceof ThemeValidationError) {
|
|
130
|
+
throw new PrototypeMetadataError(error.path, error.reason);
|
|
131
|
+
}
|
|
132
|
+
throw error;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
export function parsePrototypeMetadata(value, options = {}) {
|
|
122
136
|
const record = requiredMetadataRecord(value);
|
|
137
|
+
const theme = parseMetadataTheme(record, options);
|
|
123
138
|
const metadata = {
|
|
124
139
|
title: parseTitle(record),
|
|
125
140
|
description: parseNullableText(record, "description", PROTOTYPE_DESCRIPTION_MAX_CODE_POINTS),
|
|
@@ -128,6 +143,7 @@ export function parsePrototypeMetadata(value) {
|
|
|
128
143
|
createdAt: parseTimestamp(record, "createdAt"),
|
|
129
144
|
updatedAt: parseTimestamp(record, "updatedAt"),
|
|
130
145
|
previewUrl: parsePreviewUrl(record),
|
|
146
|
+
...(theme === undefined ? {} : { theme }),
|
|
131
147
|
};
|
|
132
148
|
return deepFreeze(metadata);
|
|
133
149
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prototype-metadata.js","sourceRoot":"","sources":["../src/prototype-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,iBAAiB,GAElB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,qCAAqC,EACrC,+BAA+B,GAChC,MAAM,sBAAsB,CAAC;AAC9B,MAAM,eAAe,GAAG,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"prototype-metadata.js","sourceRoot":"","sources":["../src/prototype-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,iBAAiB,GAElB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,qCAAqC,EACrC,+BAA+B,GAChC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GAGrB,MAAM,YAAY,CAAC;AACpB,MAAM,eAAe,GAAG,WAAW,CAAC;AAkBpC,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IACtC,IAAI,CAAS;IAEtB,YAAY,IAAY,EAAE,OAAe;QACvC,KAAK,CAAC,iCAAiC,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;QAC3D,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,SAAS,eAAe,CAAC,KAAa;IACpC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;AAClC,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAc;IAC5C,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;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AW,EAAE,gBAAgB,CAAC,MAAM,CAAC;QACrC,UAAU,EAAE,iBAAiB,CAC3B,MAAM,EACN,YAAY,EACZ,+BAA+B,CAChC;QACD,SAAS,EAAE,cAAc,CAAC,MAAM,EAAE,WAAW,CAAC;QAC9C,SAAS,EAAE,cAAc,CAAC,MAAM,EAAE,WAAW,CAAC;QAC9C,UAAU,EAAE,eAAe,CAAC,MAAM,CAAC;QACnC,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;KACd,CAAC;IAE9B,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,QAA2B,EAC3B,GAAiB;IAEjB,MAAM,kBAAkB,GAAG,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IAC5D,MAAM,aAAa,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAC9C,IAAI,kBAAkB,CAAC,WAAW,KAAK,aAAa,CAAC,KAAK,EAAE,CAAC;QAC3D,MAAM,IAAI,sBAAsB,CAC9B,sBAAsB,EACtB,sBAAsB,CACvB,CAAC;IACJ,CAAC;IAED,OAAO,UAAU,CAAC;QAChB,GAAG,kBAAkB;QACrB,GAAG,EAAE,aAAa;QAClB,GAAG,EAAE,eAAe,CAAC,aAAa,CAAC;KACpC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const COLOR_SCHEMES: readonly ["light", "dark", "system"];
|
|
2
|
+
export type ColorScheme = (typeof COLOR_SCHEMES)[number];
|
|
3
|
+
export type ThemeDefinition = {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
allowedColorSchemes: readonly ColorScheme[];
|
|
7
|
+
};
|
|
8
|
+
export type ThemeRegistry = {
|
|
9
|
+
definitions: readonly ThemeDefinition[];
|
|
10
|
+
defaultTheme: string;
|
|
11
|
+
defaultColorScheme: ColorScheme;
|
|
12
|
+
};
|
|
13
|
+
export type PrototypeTheme = {
|
|
14
|
+
defaultTheme: string;
|
|
15
|
+
allowedThemes: readonly string[];
|
|
16
|
+
defaultColorScheme: ColorScheme;
|
|
17
|
+
allowedColorSchemes: readonly ColorScheme[];
|
|
18
|
+
};
|
|
19
|
+
export declare class ThemeValidationError extends Error {
|
|
20
|
+
readonly path: string;
|
|
21
|
+
constructor(path: string, message: string);
|
|
22
|
+
readonly reason: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function parseThemeRegistry(value: unknown, path?: string): ThemeRegistry;
|
|
25
|
+
export declare function createDefaultPrototypeTheme(registry: ThemeRegistry): PrototypeTheme;
|
|
26
|
+
export type PrototypeThemeSelection = {
|
|
27
|
+
defaultTheme: string;
|
|
28
|
+
allowThemeSwitching: boolean;
|
|
29
|
+
defaultColorScheme: ColorScheme;
|
|
30
|
+
allowColorSchemeSwitching: boolean;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Expands an author-facing selection (a chosen default plus two
|
|
34
|
+
* switching-permission flags) into a fully validated `PrototypeTheme`
|
|
35
|
+
* policy. This is the shape a create/edit authoring UI submits; it is
|
|
36
|
+
* simpler than hand-authoring `allowedThemes`/`allowedColorSchemes` arrays
|
|
37
|
+
* directly, since "allow switching" always means every registered theme (or
|
|
38
|
+
* every color scheme supported by the allowed themes) rather than an
|
|
39
|
+
* arbitrary subset.
|
|
40
|
+
*/
|
|
41
|
+
export declare function parsePrototypeThemeSelection(value: unknown, registry: ThemeRegistry, path?: string): PrototypeTheme;
|
|
42
|
+
export declare function parsePrototypeTheme(value: unknown, path?: string, registry?: ThemeRegistry): PrototypeTheme;
|
|
43
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAA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AAI,SAAU,GACb,cAAc,CAqDhB;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,EACd,IAAI,SAAU,EACd,QAAQ,CAAC,EAAE,aAAa,GACvB,cAAc,CAsFhB"}
|
package/dist/theme.js
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { asRecord, deepFreeze, findUnknownKey } from "./internal/utils.js";
|
|
2
|
+
export const COLOR_SCHEMES = ["light", "dark", "system"];
|
|
3
|
+
const THEME_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
4
|
+
const MAX_THEME_ID_LENGTH = 63;
|
|
5
|
+
export class ThemeValidationError extends Error {
|
|
6
|
+
path;
|
|
7
|
+
constructor(path, message) {
|
|
8
|
+
super(`Invalid theme configuration at ${path}: ${message}`);
|
|
9
|
+
this.name = "ThemeValidationError";
|
|
10
|
+
this.path = path;
|
|
11
|
+
this.reason = message;
|
|
12
|
+
}
|
|
13
|
+
reason;
|
|
14
|
+
}
|
|
15
|
+
function themeRecord(value, path) {
|
|
16
|
+
const record = asRecord(value);
|
|
17
|
+
if (record === null) {
|
|
18
|
+
throw new ThemeValidationError(path, "must be an object");
|
|
19
|
+
}
|
|
20
|
+
return record;
|
|
21
|
+
}
|
|
22
|
+
function rejectUnknownKeys(record, allowedKeys, path) {
|
|
23
|
+
const unknownKey = findUnknownKey(record, allowedKeys);
|
|
24
|
+
if (unknownKey) {
|
|
25
|
+
throw new ThemeValidationError(`${path}.${unknownKey}`, "is not supported");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function parseThemeId(value, path) {
|
|
29
|
+
if (typeof value !== "string") {
|
|
30
|
+
throw new ThemeValidationError(path, "must be a string");
|
|
31
|
+
}
|
|
32
|
+
if (value.length === 0 ||
|
|
33
|
+
value.length > MAX_THEME_ID_LENGTH ||
|
|
34
|
+
!THEME_ID_PATTERN.test(value)) {
|
|
35
|
+
throw new ThemeValidationError(path, "must contain lowercase letters, numbers, and single hyphens between segments");
|
|
36
|
+
}
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
function parseLabel(value, path) {
|
|
40
|
+
if (typeof value !== "string") {
|
|
41
|
+
throw new ThemeValidationError(path, "must be a string");
|
|
42
|
+
}
|
|
43
|
+
const label = value.trim();
|
|
44
|
+
if (label.length === 0) {
|
|
45
|
+
throw new ThemeValidationError(path, "must not be empty");
|
|
46
|
+
}
|
|
47
|
+
return label;
|
|
48
|
+
}
|
|
49
|
+
function parseColorScheme(value, path) {
|
|
50
|
+
if (typeof value !== "string" ||
|
|
51
|
+
!COLOR_SCHEMES.includes(value)) {
|
|
52
|
+
throw new ThemeValidationError(path, `must be one of ${COLOR_SCHEMES.join(", ")}`);
|
|
53
|
+
}
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
function parseColorSchemes(value, path) {
|
|
57
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
58
|
+
throw new ThemeValidationError(path, "must be a non-empty array");
|
|
59
|
+
}
|
|
60
|
+
const schemes = value.map((scheme, index) => parseColorScheme(scheme, `${path}[${index}]`));
|
|
61
|
+
if (new Set(schemes).size !== schemes.length) {
|
|
62
|
+
throw new ThemeValidationError(path, "must not contain duplicate values");
|
|
63
|
+
}
|
|
64
|
+
return schemes;
|
|
65
|
+
}
|
|
66
|
+
function parseThemeDefinition(value, index, definitionsPath) {
|
|
67
|
+
const path = `${definitionsPath}[${index}]`;
|
|
68
|
+
const record = themeRecord(value, path);
|
|
69
|
+
rejectUnknownKeys(record, ["id", "label", "allowedColorSchemes"], path);
|
|
70
|
+
return {
|
|
71
|
+
id: parseThemeId(record.id, `${path}.id`),
|
|
72
|
+
label: parseLabel(record.label, `${path}.label`),
|
|
73
|
+
allowedColorSchemes: parseColorSchemes(record.allowedColorSchemes, `${path}.allowedColorSchemes`),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function findTheme(definitions, id) {
|
|
77
|
+
return definitions.find((definition) => definition.id === id);
|
|
78
|
+
}
|
|
79
|
+
export function parseThemeRegistry(value, path = "themes") {
|
|
80
|
+
const record = themeRecord(value, path);
|
|
81
|
+
rejectUnknownKeys(record, ["definitions", "defaultTheme", "defaultColorScheme"], path);
|
|
82
|
+
if (!Array.isArray(record.definitions) || record.definitions.length === 0) {
|
|
83
|
+
throw new ThemeValidationError(`${path}.definitions`, "must be a non-empty array");
|
|
84
|
+
}
|
|
85
|
+
const definitions = record.definitions.map((definition, index) => {
|
|
86
|
+
const parsed = parseThemeDefinition(definition, index, `${path}.definitions`);
|
|
87
|
+
return parsed;
|
|
88
|
+
});
|
|
89
|
+
if (new Set(definitions.map((definition) => definition.id)).size !==
|
|
90
|
+
definitions.length) {
|
|
91
|
+
throw new ThemeValidationError(`${path}.definitions`, "must not contain duplicate theme IDs");
|
|
92
|
+
}
|
|
93
|
+
const defaultTheme = parseThemeId(record.defaultTheme, `${path}.defaultTheme`);
|
|
94
|
+
const defaultDefinition = findTheme(definitions, defaultTheme);
|
|
95
|
+
if (!defaultDefinition) {
|
|
96
|
+
throw new ThemeValidationError(`${path}.defaultTheme`, "must reference a defined theme");
|
|
97
|
+
}
|
|
98
|
+
const defaultColorScheme = parseColorScheme(record.defaultColorScheme, `${path}.defaultColorScheme`);
|
|
99
|
+
if (!defaultDefinition.allowedColorSchemes.includes(defaultColorScheme)) {
|
|
100
|
+
throw new ThemeValidationError(`${path}.defaultColorScheme`, `must be allowed by the default theme (${defaultTheme})`);
|
|
101
|
+
}
|
|
102
|
+
return deepFreeze({
|
|
103
|
+
definitions,
|
|
104
|
+
defaultTheme,
|
|
105
|
+
defaultColorScheme,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function parseThemeIds(value, path) {
|
|
109
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
110
|
+
throw new ThemeValidationError(path, "must be a non-empty array");
|
|
111
|
+
}
|
|
112
|
+
const ids = value.map((id, index) => parseThemeId(id, `${path}[${index}]`));
|
|
113
|
+
if (new Set(ids).size !== ids.length) {
|
|
114
|
+
throw new ThemeValidationError(path, "must not contain duplicate values");
|
|
115
|
+
}
|
|
116
|
+
return ids;
|
|
117
|
+
}
|
|
118
|
+
export function createDefaultPrototypeTheme(registry) {
|
|
119
|
+
const allowedColorSchemes = [
|
|
120
|
+
...new Set(registry.definitions.flatMap((definition) => definition.allowedColorSchemes)),
|
|
121
|
+
];
|
|
122
|
+
return parsePrototypeTheme({
|
|
123
|
+
defaultTheme: registry.defaultTheme,
|
|
124
|
+
allowedThemes: registry.definitions.map((definition) => definition.id),
|
|
125
|
+
defaultColorScheme: registry.defaultColorScheme,
|
|
126
|
+
allowedColorSchemes,
|
|
127
|
+
}, "theme", registry);
|
|
128
|
+
}
|
|
129
|
+
function parseBoolean(value, path) {
|
|
130
|
+
if (typeof value !== "boolean") {
|
|
131
|
+
throw new ThemeValidationError(path, "must be a boolean");
|
|
132
|
+
}
|
|
133
|
+
return value;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Expands an author-facing selection (a chosen default plus two
|
|
137
|
+
* switching-permission flags) into a fully validated `PrototypeTheme`
|
|
138
|
+
* policy. This is the shape a create/edit authoring UI submits; it is
|
|
139
|
+
* simpler than hand-authoring `allowedThemes`/`allowedColorSchemes` arrays
|
|
140
|
+
* directly, since "allow switching" always means every registered theme (or
|
|
141
|
+
* every color scheme supported by the allowed themes) rather than an
|
|
142
|
+
* arbitrary subset.
|
|
143
|
+
*/
|
|
144
|
+
export function parsePrototypeThemeSelection(value, registry, path = "theme") {
|
|
145
|
+
const record = themeRecord(value, path);
|
|
146
|
+
rejectUnknownKeys(record, [
|
|
147
|
+
"defaultTheme",
|
|
148
|
+
"allowThemeSwitching",
|
|
149
|
+
"defaultColorScheme",
|
|
150
|
+
"allowColorSchemeSwitching",
|
|
151
|
+
], path);
|
|
152
|
+
const defaultTheme = parseThemeId(record.defaultTheme, `${path}.defaultTheme`);
|
|
153
|
+
const allowThemeSwitching = parseBoolean(record.allowThemeSwitching, `${path}.allowThemeSwitching`);
|
|
154
|
+
const defaultColorScheme = parseColorScheme(record.defaultColorScheme, `${path}.defaultColorScheme`);
|
|
155
|
+
const allowColorSchemeSwitching = parseBoolean(record.allowColorSchemeSwitching, `${path}.allowColorSchemeSwitching`);
|
|
156
|
+
const allowedThemes = allowThemeSwitching
|
|
157
|
+
? registry.definitions.map((definition) => definition.id)
|
|
158
|
+
: [defaultTheme];
|
|
159
|
+
const allowedDefinitions = registry.definitions.filter((definition) => allowedThemes.includes(definition.id));
|
|
160
|
+
const allowedColorSchemes = allowColorSchemeSwitching
|
|
161
|
+
? [
|
|
162
|
+
...new Set(allowedDefinitions.flatMap((definition) => definition.allowedColorSchemes)),
|
|
163
|
+
]
|
|
164
|
+
: [defaultColorScheme];
|
|
165
|
+
return parsePrototypeTheme({ defaultTheme, allowedThemes, defaultColorScheme, allowedColorSchemes }, path, registry);
|
|
166
|
+
}
|
|
167
|
+
export function parsePrototypeTheme(value, path = "theme", registry) {
|
|
168
|
+
const record = themeRecord(value, path);
|
|
169
|
+
rejectUnknownKeys(record, [
|
|
170
|
+
"defaultTheme",
|
|
171
|
+
"allowedThemes",
|
|
172
|
+
"defaultColorScheme",
|
|
173
|
+
"allowedColorSchemes",
|
|
174
|
+
], path);
|
|
175
|
+
const defaultTheme = parseThemeId(record.defaultTheme, `${path}.defaultTheme`);
|
|
176
|
+
const allowedThemes = parseThemeIds(record.allowedThemes, `${path}.allowedThemes`);
|
|
177
|
+
if (!allowedThemes.includes(defaultTheme)) {
|
|
178
|
+
throw new ThemeValidationError(`${path}.defaultTheme`, "must be included in allowedThemes");
|
|
179
|
+
}
|
|
180
|
+
const defaultColorScheme = parseColorScheme(record.defaultColorScheme, `${path}.defaultColorScheme`);
|
|
181
|
+
const allowedColorSchemes = parseColorSchemes(record.allowedColorSchemes, `${path}.allowedColorSchemes`);
|
|
182
|
+
if (!allowedColorSchemes.includes(defaultColorScheme)) {
|
|
183
|
+
throw new ThemeValidationError(`${path}.defaultColorScheme`, "must be included in allowedColorSchemes");
|
|
184
|
+
}
|
|
185
|
+
if (registry) {
|
|
186
|
+
for (const theme of allowedThemes) {
|
|
187
|
+
const definition = findTheme(registry.definitions, theme);
|
|
188
|
+
if (!definition) {
|
|
189
|
+
throw new ThemeValidationError(`${path}.allowedThemes`, `must reference defined theme IDs; ${theme} is not registered`);
|
|
190
|
+
}
|
|
191
|
+
if (!allowedColorSchemes.some((scheme) => definition.allowedColorSchemes.includes(scheme))) {
|
|
192
|
+
throw new ThemeValidationError(`${path}.allowedColorSchemes`, `must include a scheme supported by theme ${theme}`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
const defaultDefinition = findTheme(registry.definitions, defaultTheme);
|
|
196
|
+
if (!defaultDefinition) {
|
|
197
|
+
throw new ThemeValidationError(`${path}.defaultTheme`, "must reference a defined theme");
|
|
198
|
+
}
|
|
199
|
+
if (!defaultDefinition.allowedColorSchemes.includes(defaultColorScheme)) {
|
|
200
|
+
throw new ThemeValidationError(`${path}.defaultColorScheme`, `must be allowed by theme ${defaultTheme}`);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return deepFreeze({
|
|
204
|
+
defaultTheme,
|
|
205
|
+
allowedThemes,
|
|
206
|
+
defaultColorScheme,
|
|
207
|
+
allowedColorSchemes,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE3E,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAC;AAuBlE,MAAM,gBAAgB,GAAG,4BAA4B,CAAC;AACtD,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAE/B,MAAM,OAAO,oBA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