From 3052bbe85dd12049a5eec82f55e7773e144d37be Mon Sep 17 00:00:00 2001 From: BluJ Date: Fri, 14 Apr 2023 11:44:00 -0600 Subject: [PATCH] chore: charlie 20 --- lib/config/builder/list.ts | 2 +- lib/config/configTypes.ts | 50 ++++++++++++++++++++----------------- lib/properties/index.ts | 4 ++- package-lock.json | 4 +-- package.json | 2 +- scripts/oldSpecToBuilder.ts | 5 +++- 6 files changed, 38 insertions(+), 29 deletions(-) diff --git a/lib/config/builder/list.ts b/lib/config/builder/list.ts index d3686ce..b59c398 100644 --- a/lib/config/builder/list.ts +++ b/lib/config/builder/list.ts @@ -103,7 +103,7 @@ export class List extends IBuilder { description?: string | null; warning?: string | null; /** Default [] */ - default?: Record[]; + default?: []; /** Default = "(\*,\*)" */ range?: string; }, diff --git a/lib/config/configTypes.ts b/lib/config/configTypes.ts index c089cec..b64df92 100644 --- a/lib/config/configTypes.ts +++ b/lib/config/configTypes.ts @@ -2,34 +2,38 @@ import * as C from "./configTypesRaw"; export type ValueType = C.ValueType; -export type InputSpec = Record>; +export type RequiredDeep = A extends {} + ? { [K in keyof A]-?: RequiredDeep } + : Required; -export type ValueSpec = Required; +export type InputSpec = Record>; + +export type ValueSpec = RequiredDeep; /** core spec types. These types provide the metadata for performing validations */ -export type ValueSpecOf = Required>; +export type ValueSpecOf = RequiredDeep>; -export type ValueSpecString = Required; -export type ValueSpecTextarea = Required; -export type ValueSpecNumber = Required; -export type ValueSpecSelect = Required; -export type ValueSpecMultiselect = Required; -export type ValueSpecBoolean = Required; -export type ValueSpecUnion = Required; -export type ValueSpecFile = Required; -export type ValueSpecObject = Required; -export type WithStandalone = Required; -export type SelectBase = Required; -export type ListValueSpecType = Required; +export type ValueSpecString = RequiredDeep; +export type ValueSpecTextarea = RequiredDeep; +export type ValueSpecNumber = RequiredDeep; +export type ValueSpecSelect = RequiredDeep; +export type ValueSpecMultiselect = RequiredDeep; +export type ValueSpecBoolean = RequiredDeep; +export type ValueSpecUnion = RequiredDeep; +export type ValueSpecFile = RequiredDeep; +export type ValueSpecObject = RequiredDeep; +export type WithStandalone = RequiredDeep; +export type SelectBase = RequiredDeep; +export type ListValueSpecType = RequiredDeep; /** represents a spec for the values of a list */ -export type ListValueSpecOf = Required< +export type ListValueSpecOf = RequiredDeep< C.ListValueSpecOf >; /** represents a spec for a list */ -export type ValueSpecList = Required; -export type ValueSpecListOf = Required< +export type ValueSpecList = RequiredDeep; +export type ValueSpecListOf = RequiredDeep< C.ValueSpecListOf >; @@ -40,11 +44,11 @@ export function isValueSpecListOf( ): t is ValueSpecListOf & { spec: ListValueSpecOf } { return t.spec.type === s; } -export type ListValueSpecString = Required; -export type ListValueSpecNumber = Required; -export type ListValueSpecObject = Required; -export type UniqueBy = Required; -export type DefaultString = Required; +export type ListValueSpecString = RequiredDeep; +export type ListValueSpecNumber = RequiredDeep; +export type ListValueSpecObject = RequiredDeep; +export type UniqueBy = RequiredDeep; +export type DefaultString = RequiredDeep; export const unionSelectKey = "unionSelectKey" as const; export type UnionSelectKey = typeof unionSelectKey; diff --git a/lib/properties/index.ts b/lib/properties/index.ts index 27e19e5..33ad3af 100644 --- a/lib/properties/index.ts +++ b/lib/properties/index.ts @@ -6,7 +6,9 @@ export { PropertyObject } from "./PropertyObject"; export { PropertyString } from "./PropertyString"; export const test = ""; -export type UnionToIntersection = ((x: T) => any) extends (x: infer R) => any ? R : never; +export type UnionToIntersection = ((x: T) => any) extends (x: infer R) => any + ? R + : never; /** * This is used during creating the type of properties fn in the service package. diff --git a/package-lock.json b/package-lock.json index 983cdb6..0b15c12 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "start-sdk", - "version": "0.4.0-lib0.charlie19", + "version": "0.4.0-lib0.charlie20", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "start-sdk", - "version": "0.4.0-lib0.charlie19", + "version": "0.4.0-lib0.charlie20", "license": "MIT", "dependencies": { "@iarna/toml": "^2.2.5", diff --git a/package.json b/package.json index 5810700..14aa15d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "start-sdk", - "version": "0.4.0-lib0.charlie19", + "version": "0.4.0-lib0.charlie20", "description": "For making the patterns that are wanted in making services for the startOS.", "main": "./lib/index.js", "types": "./lib/index.d.ts", diff --git a/scripts/oldSpecToBuilder.ts b/scripts/oldSpecToBuilder.ts index 072d564..91c32fa 100644 --- a/scripts/oldSpecToBuilder.ts +++ b/scripts/oldSpecToBuilder.ts @@ -217,7 +217,10 @@ export default async function makeFileContent( const values = Object.fromEntries( Array.from(allValueNames) .filter(string.test) - .map((key) => [key, value?.spec?.["value-names"]?.[key] || key]) + .map((key: string) => [ + key, + value?.spec?.["value-names"]?.[key] || key, + ]) ); return `Value.multiselect(${JSON.stringify( {