mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-26 02:11:56 +00:00
chore: Update to use validator
This commit is contained in:
@@ -1,4 +1,13 @@
|
|||||||
export { Config } from "./config.ts";
|
import { Config } from "./config.ts";
|
||||||
export { List } from "./list.ts";
|
import { List } from "./list.ts";
|
||||||
export { Value } from "./value.ts";
|
import { Value } from "./value.ts";
|
||||||
export { Variants } from "./variants.ts";
|
import { Variants } from "./variants.ts";
|
||||||
|
|
||||||
|
export {
|
||||||
|
/** @typedef { import("./config.ts").Config } Pet
|
||||||
|
*/
|
||||||
|
Config,
|
||||||
|
List,
|
||||||
|
Value,
|
||||||
|
Variants,
|
||||||
|
};
|
||||||
|
|||||||
@@ -17,17 +17,16 @@ const previousPath = /(.+?)\/([^/]*)$/;
|
|||||||
})
|
})
|
||||||
const jsonFile = ConfigFile.json({
|
const jsonFile = ConfigFile.json({
|
||||||
path: 'data.json',
|
path: 'data.json',
|
||||||
data: someValidator,
|
validator: someValidator,
|
||||||
volume: 'main'
|
volume: 'main'
|
||||||
})
|
})
|
||||||
const tomlFile = ConfigFile.toml({
|
const tomlFile = ConfigFile.toml({
|
||||||
path: 'data.toml',
|
path: 'data.toml',
|
||||||
data: someValidator,
|
validator: someValidator,
|
||||||
volume: 'main'
|
volume: 'main'
|
||||||
})
|
})
|
||||||
const rawFile = ConfigFile.raw({
|
const rawFile = ConfigFile.raw({
|
||||||
path: 'data.amazingSettings',
|
path: 'data.amazingSettings',
|
||||||
data: someValidator,
|
|
||||||
volume: 'main'
|
volume: 'main'
|
||||||
fromData(dataIn: Data): string {
|
fromData(dataIn: Data): string {
|
||||||
return `myDatais ///- ${dataIn.data}`
|
return `myDatais ///- ${dataIn.data}`
|
||||||
@@ -39,7 +38,7 @@ const previousPath = /(.+?)\/([^/]*)$/;
|
|||||||
})
|
})
|
||||||
|
|
||||||
export const setConfig : T.ExpectedExports.setConfig= async (effects, config) => {
|
export const setConfig : T.ExpectedExports.setConfig= async (effects, config) => {
|
||||||
await jsonFile.write({ data: 'here lies data'}, effects)
|
await jsonFile.write({ data: 'here lies data'}, effects)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getConfig: T.ExpectedExports.getConfig = async (effects, config) => ({
|
export const getConfig: T.ExpectedExports.getConfig = async (effects, config) => ({
|
||||||
@@ -56,12 +55,16 @@ export class ConfigFile<A> {
|
|||||||
volume: string;
|
volume: string;
|
||||||
writeData(dataIn: A): string;
|
writeData(dataIn: A): string;
|
||||||
readData(stringValue: string): A;
|
readData(stringValue: string): A;
|
||||||
}
|
},
|
||||||
) {}
|
) {}
|
||||||
async write(data: A, effects: T.Effects) {
|
async write(data: A, effects: T.Effects) {
|
||||||
let matched;
|
let matched;
|
||||||
if ((matched = previousPath.exec(this.options.path)))
|
if ((matched = previousPath.exec(this.options.path))) {
|
||||||
await effects.createDir({ volumeId: this.options.volume, path: matched[1] });
|
await effects.createDir({
|
||||||
|
volumeId: this.options.volume,
|
||||||
|
path: matched[1],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
await effects.writeFile({
|
await effects.writeFile({
|
||||||
path: this.options.path,
|
path: this.options.path,
|
||||||
@@ -74,10 +77,17 @@ export class ConfigFile<A> {
|
|||||||
await effects.readFile({
|
await effects.readFile({
|
||||||
path: this.options.path,
|
path: this.options.path,
|
||||||
volumeId: this.options.volume,
|
volumeId: this.options.volume,
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
static raw<A>(options: { path: string; volume: string; fromData(dataIn: A): string; toData(rawData: string): A }) {
|
static raw<A>(
|
||||||
|
options: {
|
||||||
|
path: string;
|
||||||
|
volume: string;
|
||||||
|
fromData(dataIn: A): string;
|
||||||
|
toData(rawData: string): A;
|
||||||
|
},
|
||||||
|
) {
|
||||||
return new ConfigFile<A>({
|
return new ConfigFile<A>({
|
||||||
path: options.path,
|
path: options.path,
|
||||||
volume: options.volume,
|
volume: options.volume,
|
||||||
@@ -85,7 +95,13 @@ export class ConfigFile<A> {
|
|||||||
readData: options.toData,
|
readData: options.toData,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static json<A>(options: { path: string; volume: string; data: matches.Validator<unknown, A> }) {
|
static json<A>(
|
||||||
|
options: {
|
||||||
|
path: string;
|
||||||
|
volume: string;
|
||||||
|
validator: matches.Validator<unknown, A>;
|
||||||
|
},
|
||||||
|
) {
|
||||||
return new ConfigFile<A>({
|
return new ConfigFile<A>({
|
||||||
path: options.path,
|
path: options.path,
|
||||||
volume: options.volume,
|
volume: options.volume,
|
||||||
@@ -93,14 +109,14 @@ export class ConfigFile<A> {
|
|||||||
return JSON.stringify(inData, null, 2);
|
return JSON.stringify(inData, null, 2);
|
||||||
},
|
},
|
||||||
readData(inString) {
|
readData(inString) {
|
||||||
return options.data.unsafeCast(JSON.parse(inString));
|
return options.validator.unsafeCast(JSON.parse(inString));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static toml<A extends Record<string, unknown>>(options: {
|
static toml<A extends Record<string, unknown>>(options: {
|
||||||
path: string;
|
path: string;
|
||||||
volume: string;
|
volume: string;
|
||||||
data: matches.Validator<unknown, A>;
|
validator: matches.Validator<unknown, A>;
|
||||||
}) {
|
}) {
|
||||||
return new ConfigFile<A>({
|
return new ConfigFile<A>({
|
||||||
path: options.path,
|
path: options.path,
|
||||||
@@ -109,14 +125,14 @@ export class ConfigFile<A> {
|
|||||||
return TOML.stringify(inData);
|
return TOML.stringify(inData);
|
||||||
},
|
},
|
||||||
readData(inString) {
|
readData(inString) {
|
||||||
return options.data.unsafeCast(TOML.parse(inString));
|
return options.validator.unsafeCast(TOML.parse(inString));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static yaml<A extends Record<string, unknown>>(options: {
|
static yaml<A extends Record<string, unknown>>(options: {
|
||||||
path: string;
|
path: string;
|
||||||
volume: string;
|
volume: string;
|
||||||
data: matches.Validator<unknown, A>;
|
validator: matches.Validator<unknown, A>;
|
||||||
}) {
|
}) {
|
||||||
return new ConfigFile<A>({
|
return new ConfigFile<A>({
|
||||||
path: options.path,
|
path: options.path,
|
||||||
@@ -125,7 +141,7 @@ export class ConfigFile<A> {
|
|||||||
return YAML.stringify(inData);
|
return YAML.stringify(inData);
|
||||||
},
|
},
|
||||||
readData(inString) {
|
readData(inString) {
|
||||||
return options.data.unsafeCast(YAML.parse(inString));
|
return options.validator.unsafeCast(YAML.parse(inString));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,9 +16,12 @@ console.log(`
|
|||||||
const data = JSON.parse(list.join("\n"));
|
const data = JSON.parse(list.join("\n"));
|
||||||
|
|
||||||
const namedConsts = new Set(["Config", "Value", "List"]);
|
const namedConsts = new Set(["Config", "Value", "List"]);
|
||||||
const configName = newConst("config", convertConfigSpec(data));
|
const configName = newConst("configSpec", convertConfigSpec(data));
|
||||||
const configMatcherName = newConst("matchConfig", `${configName}.validator()`);
|
const configMatcherName = newConst(
|
||||||
console.log(`export type Config = typeof ${configMatcherName}._TYPE;`);
|
"matchConfigSpec",
|
||||||
|
`${configName}.validator()`,
|
||||||
|
);
|
||||||
|
console.log(`export type ConfigSpec = typeof ${configMatcherName}._TYPE;`);
|
||||||
|
|
||||||
function newConst(key: string, data: string) {
|
function newConst(key: string, data: string) {
|
||||||
const variableName = getNextConstName(camelCase(key));
|
const variableName = getNextConstName(camelCase(key));
|
||||||
@@ -37,68 +40,79 @@ function convertConfigSpec(data: any) {
|
|||||||
function convertValueSpec(value: any): string {
|
function convertValueSpec(value: any): string {
|
||||||
switch (value.type) {
|
switch (value.type) {
|
||||||
case "string": {
|
case "string": {
|
||||||
return `Value.string(${JSON.stringify(
|
return `Value.string(${
|
||||||
{
|
JSON.stringify(
|
||||||
name: value.name || null,
|
{
|
||||||
default: value.default || null,
|
name: value.name || null,
|
||||||
description: value.description || null,
|
default: value.default || null,
|
||||||
warning: value.warning || null,
|
description: value.description || null,
|
||||||
nullable: value.nullable || false,
|
warning: value.warning || null,
|
||||||
masked: value.masked || null,
|
nullable: value.nullable || false,
|
||||||
placeholder: value.placeholder || null,
|
masked: value.masked || null,
|
||||||
pattern: value.pattern || null,
|
placeholder: value.placeholder || null,
|
||||||
"pattern-description": value["pattern-description"] || null,
|
pattern: value.pattern || null,
|
||||||
textarea: value.textarea || null,
|
"pattern-description": value["pattern-description"] || null,
|
||||||
},
|
textarea: value.textarea || null,
|
||||||
null,
|
},
|
||||||
2
|
null,
|
||||||
)})`;
|
2,
|
||||||
|
)
|
||||||
|
})`;
|
||||||
}
|
}
|
||||||
case "number": {
|
case "number": {
|
||||||
return `Value.number(${JSON.stringify(
|
return `Value.number(${
|
||||||
{
|
JSON.stringify(
|
||||||
name: value.name || null,
|
{
|
||||||
default: value.default || null,
|
name: value.name || null,
|
||||||
description: value.description || null,
|
default: value.default || null,
|
||||||
warning: value.warning || null,
|
description: value.description || null,
|
||||||
nullable: value.nullable || false,
|
warning: value.warning || null,
|
||||||
range: value.range || null,
|
nullable: value.nullable || false,
|
||||||
integral: value.integral || false,
|
range: value.range || null,
|
||||||
units: value.units || null,
|
integral: value.integral || false,
|
||||||
placeholder: value.placeholder || null,
|
units: value.units || null,
|
||||||
},
|
placeholder: value.placeholder || null,
|
||||||
null,
|
},
|
||||||
2
|
null,
|
||||||
)})`;
|
2,
|
||||||
|
)
|
||||||
|
})`;
|
||||||
}
|
}
|
||||||
case "boolean": {
|
case "boolean": {
|
||||||
return `Value.boolean(${JSON.stringify(
|
return `Value.boolean(${
|
||||||
{
|
JSON.stringify(
|
||||||
name: value.name || null,
|
{
|
||||||
default: value.default || false,
|
name: value.name || null,
|
||||||
description: value.description || null,
|
default: value.default || false,
|
||||||
warning: value.warning || null,
|
description: value.description || null,
|
||||||
},
|
warning: value.warning || null,
|
||||||
null,
|
},
|
||||||
2
|
null,
|
||||||
)})`;
|
2,
|
||||||
|
)
|
||||||
|
})`;
|
||||||
}
|
}
|
||||||
case "enum": {
|
case "enum": {
|
||||||
return `Value.enum(${JSON.stringify(
|
return `Value.enum(${
|
||||||
{
|
JSON.stringify(
|
||||||
name: value.name || null,
|
{
|
||||||
description: value.description || null,
|
name: value.name || null,
|
||||||
warning: value.warning || null,
|
description: value.description || null,
|
||||||
default: value.default || null,
|
warning: value.warning || null,
|
||||||
values: value.values || null,
|
default: value.default || null,
|
||||||
"value-names": value["value-names"] || null,
|
values: value.values || null,
|
||||||
},
|
"value-names": value["value-names"] || null,
|
||||||
null,
|
},
|
||||||
2
|
null,
|
||||||
)})`;
|
2,
|
||||||
|
)
|
||||||
|
})`;
|
||||||
}
|
}
|
||||||
case "object": {
|
case "object": {
|
||||||
const specName = newConst(value.name + "_spec", convertConfigSpec(value.spec));
|
const specName = newConst(
|
||||||
|
value.name + "_spec",
|
||||||
|
convertConfigSpec(value.spec),
|
||||||
|
);
|
||||||
return `Value.object({
|
return `Value.object({
|
||||||
name: ${JSON.stringify(value.name || null)},
|
name: ${JSON.stringify(value.name || null)},
|
||||||
description: ${JSON.stringify(value.description || null)},
|
description: ${JSON.stringify(value.description || null)},
|
||||||
@@ -111,23 +125,30 @@ function convertValueSpec(value: any): string {
|
|||||||
})`;
|
})`;
|
||||||
}
|
}
|
||||||
case "union": {
|
case "union": {
|
||||||
const variants = newConst(value.name + "_variants", convertVariants(value.variants));
|
const variants = newConst(
|
||||||
|
value.name + "_variants",
|
||||||
|
convertVariants(value.variants),
|
||||||
|
);
|
||||||
return `Value.union({
|
return `Value.union({
|
||||||
name: ${JSON.stringify(value.name || null)},
|
name: ${JSON.stringify(value.name || null)},
|
||||||
description: ${JSON.stringify(value.description || null)},
|
description: ${JSON.stringify(value.description || null)},
|
||||||
warning: ${JSON.stringify(value.warning || null)},
|
warning: ${JSON.stringify(value.warning || null)},
|
||||||
default: ${JSON.stringify(value.default || null)},
|
default: ${JSON.stringify(value.default || null)},
|
||||||
variants: ${variants},
|
variants: ${variants},
|
||||||
tag: ${JSON.stringify({
|
tag: ${
|
||||||
|
JSON.stringify({
|
||||||
id: value?.tag?.["id"] || null,
|
id: value?.tag?.["id"] || null,
|
||||||
name: value?.tag?.["name"] || null,
|
name: value?.tag?.["name"] || null,
|
||||||
description: value?.tag?.["description"] || null,
|
description: value?.tag?.["description"] || null,
|
||||||
warning: value?.tag?.["warning"] || null,
|
warning: value?.tag?.["warning"] || null,
|
||||||
"variant-names": value?.tag?.["variant-names"] || {},
|
"variant-names": value?.tag?.["variant-names"] || {},
|
||||||
})},
|
})
|
||||||
|
},
|
||||||
"display-as": ${JSON.stringify(value["display-as"] || null)},
|
"display-as": ${JSON.stringify(value["display-as"] || null)},
|
||||||
"unique-by": ${JSON.stringify(value["unique-by"] || null)},
|
"unique-by": ${JSON.stringify(value["unique-by"] || null)},
|
||||||
"variant-names": ${JSON.stringify((value["variant-names"] as any) || null)},
|
"variant-names": ${
|
||||||
|
JSON.stringify((value["variant-names"] as any) || null)
|
||||||
|
},
|
||||||
})`;
|
})`;
|
||||||
}
|
}
|
||||||
case "list": {
|
case "list": {
|
||||||
@@ -144,69 +165,81 @@ function convertValueSpec(value: any): string {
|
|||||||
function convertList(value: any) {
|
function convertList(value: any) {
|
||||||
switch (value.subtype) {
|
switch (value.subtype) {
|
||||||
case "string": {
|
case "string": {
|
||||||
return `List.string(${JSON.stringify(
|
return `List.string(${
|
||||||
{
|
JSON.stringify(
|
||||||
name: value.name || null,
|
{
|
||||||
range: value.range || null,
|
name: value.name || null,
|
||||||
spec: {
|
range: value.range || null,
|
||||||
masked: value?.spec?.["masked"] || null,
|
spec: {
|
||||||
placeholder: value?.spec?.["placeholder"] || null,
|
masked: value?.spec?.["masked"] || null,
|
||||||
pattern: value?.spec?.["pattern"] || null,
|
placeholder: value?.spec?.["placeholder"] || null,
|
||||||
"pattern-description": value?.spec?.["pattern-description"] || null,
|
pattern: value?.spec?.["pattern"] || null,
|
||||||
textarea: value?.spec?.["textarea"] || false,
|
"pattern-description": value?.spec?.["pattern-description"] ||
|
||||||
|
null,
|
||||||
|
textarea: value?.spec?.["textarea"] || false,
|
||||||
|
},
|
||||||
|
default: value.default || null,
|
||||||
|
description: value.description || null,
|
||||||
|
warning: value.warning || null,
|
||||||
},
|
},
|
||||||
default: value.default || null,
|
null,
|
||||||
description: value.description || null,
|
2,
|
||||||
warning: value.warning || null,
|
)
|
||||||
},
|
})`;
|
||||||
null,
|
|
||||||
2
|
|
||||||
)})`;
|
|
||||||
}
|
}
|
||||||
case "number": {
|
case "number": {
|
||||||
return `List.number(${JSON.stringify(
|
return `List.number(${
|
||||||
{
|
JSON.stringify(
|
||||||
name: value.name || null,
|
{
|
||||||
range: value.range || null,
|
name: value.name || null,
|
||||||
spec: {
|
range: value.range || null,
|
||||||
range: value?.spec?.range || null,
|
spec: {
|
||||||
integral: value?.spec?.integral || false,
|
range: value?.spec?.range || null,
|
||||||
units: value?.spec?.units || null,
|
integral: value?.spec?.integral || false,
|
||||||
placeholder: value?.spec?.placeholder || null,
|
units: value?.spec?.units || null,
|
||||||
|
placeholder: value?.spec?.placeholder || null,
|
||||||
|
},
|
||||||
|
default: value.default || null,
|
||||||
|
description: value.description || null,
|
||||||
|
warning: value.warning || null,
|
||||||
},
|
},
|
||||||
default: value.default || null,
|
null,
|
||||||
description: value.description || null,
|
2,
|
||||||
warning: value.warning || null,
|
)
|
||||||
},
|
})`;
|
||||||
null,
|
|
||||||
2
|
|
||||||
)})`;
|
|
||||||
}
|
}
|
||||||
case "enum": {
|
case "enum": {
|
||||||
return `List.enum(${JSON.stringify(
|
return `List.enum(${
|
||||||
{
|
JSON.stringify(
|
||||||
name: value.name || null,
|
{
|
||||||
range: value.range || null,
|
name: value.name || null,
|
||||||
spec: {
|
range: value.range || null,
|
||||||
values: value?.spec?.["values"] || null,
|
spec: {
|
||||||
"value-names": value?.spec?.["value-names"] || {},
|
values: value?.spec?.["values"] || null,
|
||||||
|
"value-names": value?.spec?.["value-names"] || {},
|
||||||
|
},
|
||||||
|
default: value.default || null,
|
||||||
|
description: value.description || null,
|
||||||
|
warning: value.warning || null,
|
||||||
},
|
},
|
||||||
default: value.default || null,
|
null,
|
||||||
description: value.description || null,
|
2,
|
||||||
warning: value.warning || null,
|
)
|
||||||
},
|
})`;
|
||||||
null,
|
|
||||||
2
|
|
||||||
)})`;
|
|
||||||
}
|
}
|
||||||
case "object": {
|
case "object": {
|
||||||
const specName = newConst(value.name + "_spec", convertConfigSpec(value.spec.spec));
|
const specName = newConst(
|
||||||
|
value.name + "_spec",
|
||||||
|
convertConfigSpec(value.spec.spec),
|
||||||
|
);
|
||||||
return `List.obj({
|
return `List.obj({
|
||||||
name: ${JSON.stringify(value.name || null)},
|
name: ${JSON.stringify(value.name || null)},
|
||||||
range: ${JSON.stringify(value.range || null)},
|
range: ${JSON.stringify(value.range || null)},
|
||||||
spec: {
|
spec: {
|
||||||
spec: ${specName},
|
spec: ${specName},
|
||||||
"display-as": ${JSON.stringify(value?.spec?.["display-as"] || null)},
|
"display-as": ${
|
||||||
|
JSON.stringify(value?.spec?.["display-as"] || null)
|
||||||
|
},
|
||||||
"unique-by": ${JSON.stringify(value?.spec?.["unique-by"] || null)},
|
"unique-by": ${JSON.stringify(value?.spec?.["unique-by"] || null)},
|
||||||
},
|
},
|
||||||
default: ${JSON.stringify(value.default || null)},
|
default: ${JSON.stringify(value.default || null)},
|
||||||
@@ -215,7 +248,10 @@ function convertList(value: any) {
|
|||||||
})`;
|
})`;
|
||||||
}
|
}
|
||||||
case "union": {
|
case "union": {
|
||||||
const variants = newConst(value.name + "_variants", convertConfigSpec(value.spec.variants));
|
const variants = newConst(
|
||||||
|
value.name + "_variants",
|
||||||
|
convertConfigSpec(value.spec.variants),
|
||||||
|
);
|
||||||
return `List.union(
|
return `List.union(
|
||||||
{
|
{
|
||||||
name:${JSON.stringify(value.name || null)},
|
name:${JSON.stringify(value.name || null)},
|
||||||
@@ -223,14 +259,26 @@ function convertList(value: any) {
|
|||||||
spec: {
|
spec: {
|
||||||
tag: {
|
tag: {
|
||||||
"id":${JSON.stringify(value?.spec?.tag?.["id"] || null)},
|
"id":${JSON.stringify(value?.spec?.tag?.["id"] || null)},
|
||||||
"name": ${JSON.stringify(value?.spec?.tag?.["name"] || null)},
|
"name": ${
|
||||||
"description": ${JSON.stringify(value?.spec?.tag?.["description"] || null)},
|
JSON.stringify(value?.spec?.tag?.["name"] || null)
|
||||||
"warning": ${JSON.stringify(value?.spec?.tag?.["warning"] || null)},
|
},
|
||||||
"variant-names": ${JSON.stringify(value?.spec?.tag?.["variant-names"] || {})},
|
"description": ${
|
||||||
|
JSON.stringify(value?.spec?.tag?.["description"] || null)
|
||||||
|
},
|
||||||
|
"warning": ${
|
||||||
|
JSON.stringify(value?.spec?.tag?.["warning"] || null)
|
||||||
|
},
|
||||||
|
"variant-names": ${
|
||||||
|
JSON.stringify(value?.spec?.tag?.["variant-names"] || {})
|
||||||
|
},
|
||||||
},
|
},
|
||||||
variants: ${variants},
|
variants: ${variants},
|
||||||
"display-as": ${JSON.stringify(value?.spec?.["display-as"] || null)},
|
"display-as": ${
|
||||||
"unique-by": ${JSON.stringify(value?.spec?.["unique-by"] || null)},
|
JSON.stringify(value?.spec?.["display-as"] || null)
|
||||||
|
},
|
||||||
|
"unique-by": ${
|
||||||
|
JSON.stringify(value?.spec?.["unique-by"] || null)
|
||||||
|
},
|
||||||
default: ${JSON.stringify(value?.spec?.["default"] || null)},
|
default: ${JSON.stringify(value?.spec?.["default"] || null)},
|
||||||
},
|
},
|
||||||
default: ${JSON.stringify(value.default || null)},
|
default: ${JSON.stringify(value.default || null)},
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as PM from "./propertiesMatcher.ts";
|
import * as PM from "./propertiesMatcher.ts";
|
||||||
import { expect } from "https://deno.land/x/expect@v0.2.9/mod.ts";
|
import { expect } from "https://deno.land/x/expect@v0.2.9/mod.ts";
|
||||||
import { matches } from "../dependencies.ts";
|
import { matches } from "../dependencies.ts";
|
||||||
import { config as bitcoinPropertiesConfig } from "./test/output.ts";
|
import { configSpec as bitcoinPropertiesConfig } from "./test/output.ts";
|
||||||
|
|
||||||
const randWithSeed = (seed = 1) => {
|
const randWithSeed = (seed = 1) => {
|
||||||
return function random() {
|
return function random() {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { configBuilder } from "../../mod.ts";
|
import { configBuilder } from "../../mod.ts";
|
||||||
const { Config, Value, List, Variants } = configBuilder;
|
const { Config, Value, List, Variants } = configBuilder;
|
||||||
|
|
||||||
export const enable = Value.boolean({
|
export const enable = configBuilder.Value.boolean({
|
||||||
"name": "Enable",
|
"name": "Enable",
|
||||||
"default": true,
|
"default": true,
|
||||||
"description": "Allow remote RPC requests.",
|
"description": "Allow remote RPC requests.",
|
||||||
@@ -443,12 +443,12 @@ export const advanced1 = Value.object({
|
|||||||
spec: advancedSpec1,
|
spec: advancedSpec1,
|
||||||
"value-names": {},
|
"value-names": {},
|
||||||
});
|
});
|
||||||
export const config = Config.of({
|
export const configSpec = configBuilder.Config.of({
|
||||||
"rpc": rpc,
|
"rpc": rpc,
|
||||||
"zmq-enabled": zmqEnabled,
|
"zmq-enabled": zmqEnabled,
|
||||||
"txindex": txindex,
|
"txindex": txindex,
|
||||||
"wallet": wallet,
|
"wallet": wallet,
|
||||||
"advanced": advanced1,
|
"advanced": advanced1,
|
||||||
});
|
});
|
||||||
export const matchConfig = config.validator();
|
export const matchConfigSpec = configSpec.validator();
|
||||||
export type Config = typeof matchConfig._TYPE;
|
export type ConfigSpec = typeof matchConfigSpec._TYPE;
|
||||||
|
|||||||
Reference in New Issue
Block a user