mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-31 04:33:40 +00:00
49 lines
1.0 KiB
JavaScript
49 lines
1.0 KiB
JavaScript
import { IBuilder } from "./builder.js";
|
|
export class Value extends IBuilder {
|
|
static boolean(a) {
|
|
return new Value({
|
|
type: "boolean",
|
|
...a,
|
|
});
|
|
}
|
|
static string(a) {
|
|
return new Value({
|
|
type: "string",
|
|
...a,
|
|
});
|
|
}
|
|
static number(a) {
|
|
return new Value({
|
|
type: "number",
|
|
...a,
|
|
});
|
|
}
|
|
static enum(a) {
|
|
return new Value({
|
|
type: "enum",
|
|
...a,
|
|
});
|
|
}
|
|
static object(a) {
|
|
const { spec: previousSpec, ...rest } = a;
|
|
const spec = previousSpec.build();
|
|
return new Value({
|
|
type: "object",
|
|
...rest,
|
|
spec,
|
|
});
|
|
}
|
|
static union(a) {
|
|
const { variants: previousVariants, ...rest } = a;
|
|
const variants = previousVariants.build();
|
|
return new Value({
|
|
type: "union",
|
|
...rest,
|
|
variants,
|
|
});
|
|
}
|
|
static list(a) {
|
|
return new Value(a.build());
|
|
}
|
|
}
|