diff --git a/cli.sh b/cli.sh index 7315aa4..114b2e9 100755 --- a/cli.sh +++ b/cli.sh @@ -6,8 +6,7 @@ ENTRY_FILE="./src/helmet.ts" MOD_FILE="./src/mod.ts" update_deps() { - # shellcheck disable=SC2046 - deno add $(jq -r '.imports | keys[]' < deno.json) + deno run -A jsr:@wok/deup@1.0.3 } code_quality() { diff --git a/deno.json b/deno.json index 895fa2a..9ec12c6 100644 --- a/deno.json +++ b/deno.json @@ -38,6 +38,7 @@ "@std/semver": "jsr:@std/semver@^0.224.3", "@std/yaml": "jsr:@std/yaml@^1.0.0", "@wok/case": "jsr:@wok/case@^1.0.1", - "@wok/utils": "jsr:@wok/utils@^1.3.6" + "@wok/typebox": "jsr:@wok/typebox@^0.32.36", + "@wok/utils": "jsr:@wok/utils@^1.4.0" } } diff --git a/deno.lock b/deno.lock index 753240f..7e62b2c 100644 --- a/deno.lock +++ b/deno.lock @@ -20,8 +20,8 @@ "jsr:@wok/case@^1.0.1": "jsr:@wok/case@1.0.1", "jsr:@wok/k8s@^1.30.3": "jsr:@wok/k8s@1.30.3", "jsr:@wok/openapi-client@^1.0.1": "jsr:@wok/openapi-client@1.0.1", - "jsr:@wok/typebox@^0.32.35": "jsr:@wok/typebox@0.32.35", - "jsr:@wok/utils@^1.3.6": "jsr:@wok/utils@1.3.6" + "jsr:@wok/typebox@^0.32.36": "jsr:@wok/typebox@0.32.36", + "jsr:@wok/utils@^1.4.0": "jsr:@wok/utils@1.4.0" }, "jsr": { "@std/assert@1.0.1": { @@ -92,11 +92,11 @@ "@wok/openapi-client@1.0.1": { "integrity": "267fb8a139d1b6719b1ad0ffbefbd190df8e95d32d53bd010d78694d81a777ba" }, - "@wok/typebox@0.32.35": { - "integrity": "39697de76b4a599dd9a8fcc69b4aef662a7c8f28a52eca1d5429d40748880a89" + "@wok/typebox@0.32.36": { + "integrity": "4c751fb09bfa5149a82e40be2f2b8fcd120763407fe1be5b3afea4db7106b219" }, - "@wok/utils@1.3.6": { - "integrity": "a1e3394f8b52a6d1036ca73ffcc3b564083ee5e4126791af5ee94964fbe37c9d", + "@wok/utils@1.4.0": { + "integrity": "f2b00ea832685b39ae079373db468fcede76e533cc51d01adc6fa6ad8aaecca3", "dependencies": [ "jsr:@std/async@^1.0.1", "jsr:@std/cli@^1.0.1", @@ -104,7 +104,7 @@ "jsr:@std/streams@^1.0.0", "jsr:@wok/case@^1.0.1", "jsr:@wok/k8s@^1.30.3", - "jsr:@wok/typebox@^0.32.35" + "jsr:@wok/typebox@^0.32.36" ] } } @@ -120,7 +120,8 @@ "jsr:@std/semver@^0.224.3", "jsr:@std/yaml@^1.0.0", "jsr:@wok/case@^1.0.1", - "jsr:@wok/utils@^1.3.6" + "jsr:@wok/typebox@^0.32.36", + "jsr:@wok/utils@^1.4.0" ] } } diff --git a/flake.lock b/flake.lock index 96275bc..4807fe9 100644 --- a/flake.lock +++ b/flake.lock @@ -83,11 +83,11 @@ "npmlock2nixPkg": "npmlock2nixPkg" }, "locked": { - "lastModified": 1722098811, - "narHash": "sha256-jUHx9fNoz2SRzLaW5bqSPRSzHrRcOg4YCt5wUoIix7w=", + "lastModified": 1722551417, + "narHash": "sha256-IoV4MvyeQOgOkd6ErBS7iG+goqbZNN8x0PqbcdLPpi0=", "owner": "shopstic", "repo": "nix-hot-pot", - "rev": "80f2fdd4536571d4d67615616d3e39aa81079f23", + "rev": "f68683949b0742dd7f21b425980df98422df39d8", "type": "github" }, "original": { diff --git a/src/actions/blacklist_instance.ts b/src/actions/blacklist_instance.ts index 556b91a..4685914 100644 --- a/src/actions/blacklist_instance.ts +++ b/src/actions/blacklist_instance.ts @@ -1,4 +1,4 @@ -import { Type } from "@wok/utils/typebox"; +import { Type } from "@wok/typebox"; import { createCliAction, ExitCode } from "@wok/utils/cli"; import { fetchCurrentWhitelist, updateWhitelist } from "./whitelist_instance.ts"; import { resolve as resolvePath } from "@std/path"; diff --git a/src/actions/compile.ts b/src/actions/compile.ts index 6f6ee7b..b70fc43 100644 --- a/src/actions/compile.ts +++ b/src/actions/compile.ts @@ -2,7 +2,7 @@ import { stringifyYamlRelaxed } from "../libs/yaml_utils.ts"; import type { HelmetChartInstance } from "../libs/types.ts"; import { join as joinPath, resolve as resolvePath } from "@std/path"; import { createCliAction, ExitCode } from "@wok/utils/cli"; -import { Type } from "@wok/utils/typebox"; +import { Type } from "@wok/typebox"; import { cyan } from "@std/fmt/colors"; import { importBundleModule } from "../libs/iac_utils.ts"; import { K8sKind } from "@wok/utils/k8s"; diff --git a/src/actions/ensure_instance_whitelisted.ts b/src/actions/ensure_instance_whitelisted.ts index 6d6256f..e209ad6 100644 --- a/src/actions/ensure_instance_whitelisted.ts +++ b/src/actions/ensure_instance_whitelisted.ts @@ -2,7 +2,7 @@ import { createCliAction, ExitCode } from "@wok/utils/cli"; import { captureExec } from "@wok/utils/exec"; import { bold, cyan, red } from "@std/fmt/colors"; import { resolve as resolvePath } from "@std/path"; -import { Type } from "@wok/utils/typebox"; +import { Type } from "@wok/typebox"; import { importBundleModule } from "../libs/iac_utils.ts"; import { fetchCurrentWhitelist } from "./whitelist_instance.ts"; diff --git a/src/actions/install.ts b/src/actions/install.ts index 5a3cf67..a6e9b89 100644 --- a/src/actions/install.ts +++ b/src/actions/install.ts @@ -1,6 +1,6 @@ import { captureExec, inheritExec, printErrLines, printOutLines } from "@wok/utils/exec"; import { validate } from "@wok/utils/validation"; -import { type Static, type TObject, Type } from "@wok/utils/typebox"; +import { type Static, type TObject, Type } from "@wok/typebox"; import { join as joinPath, resolve as resolvePath } from "@std/path"; import { expandGlobSync } from "@std/fs"; import { createCliAction, ExitCode } from "@wok/utils/cli"; diff --git a/src/actions/typeify.ts b/src/actions/typeify.ts index cf873e7..20c926f 100644 --- a/src/actions/typeify.ts +++ b/src/actions/typeify.ts @@ -8,7 +8,7 @@ import { pascalCase } from "@wok/case"; import { captureExec, inheritExec, printErrLines } from "@wok/utils/exec"; import { K8sCrdApiVersionV1beta1 } from "@wok/utils/k8s"; import { createCliAction, ExitCode } from "@wok/utils/cli"; -import { Type } from "@wok/utils/typebox"; +import { Type } from "@wok/typebox"; import { cyan, gray } from "@std/fmt/colors"; export type ClassifiedType = diff --git a/src/actions/uninstall.ts b/src/actions/uninstall.ts index f3102ed..5d4b685 100644 --- a/src/actions/uninstall.ts +++ b/src/actions/uninstall.ts @@ -1,6 +1,6 @@ import { createCliAction, ExitCode } from "@wok/utils/cli"; import { inheritExec } from "@wok/utils/exec"; -import { Type } from "@wok/utils/typebox"; +import { Type } from "@wok/typebox"; export default createCliAction( { diff --git a/src/actions/update.ts b/src/actions/update.ts index 5472ce4..c9942f5 100644 --- a/src/actions/update.ts +++ b/src/actions/update.ts @@ -2,7 +2,7 @@ import { inheritExec } from "@wok/utils/exec"; import { exists as fsExists, expandGlobSync } from "@std/fs"; import { dirname, join as joinPath, resolve as resolvePath } from "@std/path"; import { parse as parseYaml } from "@std/yaml"; -import { Type } from "@wok/utils/typebox"; +import { Type } from "@wok/typebox"; import { validate } from "@wok/utils/validation"; import { format as semverFormat, diff --git a/src/actions/whitelist_instance.ts b/src/actions/whitelist_instance.ts index 62dadb2..9e0142d 100644 --- a/src/actions/whitelist_instance.ts +++ b/src/actions/whitelist_instance.ts @@ -1,7 +1,7 @@ import { inheritExec, printErrLines, printOutLines } from "@wok/utils/exec"; import { createK8sConfigMap } from "@wok/utils/k8s"; import { createCliAction, ExitCode } from "@wok/utils/cli"; -import { Type } from "@wok/utils/typebox"; +import { Type } from "@wok/typebox"; import { resolve as resolvePath } from "@std/path"; import { gray } from "@std/fmt/colors"; import { importBundleModule } from "../libs/iac_utils.ts"; diff --git a/src/deps/typebox.ts b/src/deps/typebox.ts index 5cbb666..3bf7de4 100644 --- a/src/deps/typebox.ts +++ b/src/deps/typebox.ts @@ -1 +1 @@ -export * from "@wok/utils/typebox"; +export * from "@wok/typebox"; diff --git a/src/libs/iac_utils.ts b/src/libs/iac_utils.ts index d4447af..9b73346 100644 --- a/src/libs/iac_utils.ts +++ b/src/libs/iac_utils.ts @@ -3,7 +3,7 @@ import { type K8sCrd, K8sCrdKind, K8sCrdSchema, type K8sResource, K8sResourceSch import { exists as fsExists, expandGlob } from "@std/fs"; import { basename, dirname, fromFileUrl, join as joinPath } from "@std/path"; import { parse as parseYaml } from "@std/yaml"; -import { type Static, type TObject, type TProperties, Type } from "@wok/utils/typebox"; +import { type Static, type TObject, type TProperties, Type } from "@wok/typebox"; import { createValidator, validate, type ValidationResult } from "@wok/utils/validation"; import { type ChartInstanceConfig, diff --git a/src/libs/types.ts b/src/libs/types.ts index 612cbac..c0e1a75 100644 --- a/src/libs/types.ts +++ b/src/libs/types.ts @@ -1,22 +1,26 @@ import type { K8sCrd, K8sResource } from "@wok/utils/k8s"; import type { Range as SemverRange } from "@std/semver"; -import { FlexObject, type Static, Type } from "@wok/utils/typebox"; +import { type Static, Type } from "@wok/typebox"; -export const ChartRepoReleaseSchema = FlexObject({ +export const ChartRepoReleaseSchema = Type.Object({ apiVersion: Type.Optional(Type.String()), version: Type.String(), name: Type.String(), urls: Type.Array(Type.String()), +}, { + additionalProperties: true, }); export type ChartRepoRelease = Static; -export const ChartRepoIndexSchema = FlexObject({ +export const ChartRepoIndexSchema = Type.Object({ apiVersion: Type.String(), entries: Type.Record( Type.String(), Type.Array(ChartRepoReleaseSchema), ), +}, { + additionalProperties: true, }); export type ChartRepoIndex = Static; @@ -68,7 +72,7 @@ export type RemoteChartConfigMap = { [name: string]: RemoteChartConfig; }; -export const ChartMetadataSchema = FlexObject({ +export const ChartMetadataSchema = Type.Object({ apiVersion: Type.String(), name: Type.String(), version: Type.String(), @@ -84,6 +88,8 @@ export const ChartMetadataSchema = FlexObject({ appVersion: Type.Optional(Type.String()), // The version of the app that this contains (optional). This needn't be SemVer. deprecated: Type.Optional(Type.Boolean()), // Whether this chart is deprecated (optional, boolean) annotations: Type.Optional(Type.Any()), +}, { + additionalProperties: true, }); export type ChartMetadata = Static; @@ -110,14 +116,22 @@ export interface HelmetBundle { create: () => Promise; } -export const KubectlClientVersionCmdOutputSchema = FlexObject({ - clientVersion: FlexObject({ +export const KubectlClientVersionCmdOutputSchema = Type.Object({ + clientVersion: Type.Object({ gitVersion: Type.String({ minLength: 1 }), + }, { + additionalProperties: true, }), +}, { + additionalProperties: true, }); -export const KubectlServerVersionCmdOutputSchema = FlexObject({ - serverVersion: FlexObject({ +export const KubectlServerVersionCmdOutputSchema = Type.Object({ + serverVersion: Type.Object({ gitVersion: Type.String({ minLength: 1 }), + }, { + additionalProperties: true, }), +}, { + additionalProperties: true, });