Files
start-sdk/lib/script/config/list.js
2023-02-27 10:38:56 -07:00

73 lines
1.8 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.List = void 0;
const builder_js_1 = require("./builder.js");
class List extends builder_js_1.IBuilder {
// // deno-lint-ignore ban-types
// static boolean<A extends Description & Default<boolean[]> & { range: string; spec: {}; default: boolean }>(a: A) {
// return new List({
// type: "list" as const,
// subtype: "boolean" as const,
// ...a,
// });
// }
static string(a) {
return new List({
type: "list",
subtype: "string",
...a,
});
}
static number(a) {
return new List({
type: "list",
subtype: "number",
...a,
});
}
static enum(a) {
return new List({
type: "list",
subtype: "enum",
...a,
});
}
static obj(a) {
const { spec: previousSpec, ...rest } = a;
const { spec: previousSpecSpec, ...restSpec } = previousSpec;
const specSpec = previousSpecSpec.build();
const spec = {
...restSpec,
spec: specSpec,
};
const value = {
spec,
...rest,
};
return new List({
type: "list",
subtype: "object",
...value,
});
}
static union(a) {
const { spec: previousSpec, ...rest } = a;
const { variants: previousVariants, ...restSpec } = previousSpec;
const variants = previousVariants.build();
const spec = {
...restSpec,
variants,
};
const value = {
spec,
...rest,
};
return new List({
type: "list",
subtype: "union",
...value,
});
}
}
exports.List = List;