mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-30 12:21:57 +00:00
chore: Fix the tests and add new types for raw
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { InputSpec, ValueSpec } from "../config-types";
|
||||
import { InputSpec, ValueSpec } from "../configTypes";
|
||||
import { typeFromProps } from "../../util";
|
||||
import { BuilderExtract, IBuilder } from "./builder";
|
||||
import { Value } from "./value";
|
||||
@@ -63,16 +63,10 @@ export class Config<A extends InputSpec> extends IBuilder<A> {
|
||||
static empty() {
|
||||
return new Config({});
|
||||
}
|
||||
static withValue<K extends string, B extends ValueSpec>(
|
||||
key: K,
|
||||
value: Value<B>
|
||||
) {
|
||||
static withValue<K extends string, B extends ValueSpec>(key: K, value: Value<B>) {
|
||||
return Config.empty().withValue(key, value);
|
||||
}
|
||||
static addValue<K extends string, B extends ValueSpec>(
|
||||
key: K,
|
||||
value: Value<B>
|
||||
) {
|
||||
static addValue<K extends string, B extends ValueSpec>(key: K, value: Value<B>) {
|
||||
return Config.empty().withValue(key, value);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BuilderExtract, IBuilder } from "./builder";
|
||||
import { Config } from "./config";
|
||||
import { InputSpec, ListValueSpecNumber, ListValueSpecString, UniqueBy, ValueSpecList } from "../config-types";
|
||||
import { InputSpec, ListValueSpecNumber, ListValueSpecString, UniqueBy, ValueSpecList } from "../configTypes";
|
||||
import { guardAll } from "../../util";
|
||||
/**
|
||||
* Used as a subtype of Value.list
|
||||
|
||||
@@ -9,9 +9,9 @@ import {
|
||||
ValueSpecList,
|
||||
ValueSpecNumber,
|
||||
ValueSpecTextarea,
|
||||
} from "../config-types";
|
||||
} from "../configTypes";
|
||||
import { guardAll } from "../../util";
|
||||
import { DefaultString } from "../config-types";
|
||||
import { DefaultString } from "../configTypes";
|
||||
/**
|
||||
* A value is going to be part of the form in the FE of the OS.
|
||||
* Something like a boolean, a string, a number, etc.
|
||||
@@ -35,12 +35,7 @@ const username = Value.string({
|
||||
```
|
||||
*/
|
||||
export class Value<A extends ValueSpec> extends IBuilder<A> {
|
||||
static boolean(a: {
|
||||
name: string;
|
||||
description?: string | null;
|
||||
warning?: string | null;
|
||||
default?: boolean | null;
|
||||
}) {
|
||||
static boolean(a: { name: string; description?: string | null; warning?: string | null; default?: boolean | null }) {
|
||||
return new Value({
|
||||
description: null,
|
||||
warning: null,
|
||||
@@ -166,9 +161,7 @@ export class Value<A extends ValueSpec> extends IBuilder<A> {
|
||||
spec,
|
||||
});
|
||||
}
|
||||
static union<
|
||||
V extends Variants<{ [key: string]: { name: string; spec: InputSpec } }>
|
||||
>(
|
||||
static union<V extends Variants<{ [key: string]: { name: string; spec: InputSpec } }>>(
|
||||
a: {
|
||||
name: string;
|
||||
description?: string | null;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { InputSpec } from "../config-types";
|
||||
import { InputSpec } from "../configTypes";
|
||||
import { BuilderExtract, IBuilder } from "./builder";
|
||||
import { Config } from ".";
|
||||
|
||||
@@ -80,10 +80,7 @@ export class Variants<
|
||||
static empty() {
|
||||
return Variants.of({});
|
||||
}
|
||||
static withVariant<K extends string, B extends InputSpec>(
|
||||
key: K,
|
||||
value: Config<B>
|
||||
) {
|
||||
static withVariant<K extends string, B extends InputSpec>(key: K, value: Config<B>) {
|
||||
return Variants.empty().withVariant(key, value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user