mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
@@ -135,6 +135,7 @@ export class StartSdk<Manifest extends T.SDKManifest, Store> {
|
||||
}
|
||||
|
||||
return {
|
||||
manifest: this.manifest,
|
||||
...startSdkEffectWrapper,
|
||||
action: {
|
||||
run: actions.runAction,
|
||||
|
||||
@@ -59,7 +59,9 @@ export function buildManifest<
|
||||
(images, [k, v]) => {
|
||||
v.arch = v.arch || ["aarch64", "x86_64"]
|
||||
if (v.emulateMissingAs === undefined)
|
||||
v.emulateMissingAs = v.arch[0] || null
|
||||
v.emulateMissingAs = (v.arch as string[]).includes("aarch64")
|
||||
? "aarch64"
|
||||
: v.arch[0] || null
|
||||
images[k] = v as ImageConfig
|
||||
return images
|
||||
},
|
||||
|
||||
@@ -87,7 +87,7 @@ describe("values", () => {
|
||||
const rawIs = await value.build({} as any)
|
||||
validator.unsafeCast("test text")
|
||||
validator.unsafeCast(null)
|
||||
testOutput<typeof validator._TYPE, string | null | undefined>()(null)
|
||||
testOutput<typeof validator._TYPE, string | null>()(null)
|
||||
})
|
||||
test("color", async () => {
|
||||
const value = Value.color({
|
||||
@@ -99,7 +99,7 @@ describe("values", () => {
|
||||
})
|
||||
const validator = value.validator
|
||||
validator.unsafeCast("#000000")
|
||||
testOutput<typeof validator._TYPE, string | null | undefined>()(null)
|
||||
testOutput<typeof validator._TYPE, string | null>()(null)
|
||||
})
|
||||
test("datetime", async () => {
|
||||
const value = Value.datetime({
|
||||
@@ -129,7 +129,7 @@ describe("values", () => {
|
||||
})
|
||||
const validator = value.validator
|
||||
validator.unsafeCast("2021-01-01")
|
||||
testOutput<typeof validator._TYPE, string | null | undefined>()(null)
|
||||
testOutput<typeof validator._TYPE, string | null>()(null)
|
||||
})
|
||||
test("textarea", async () => {
|
||||
const value = Value.textarea({
|
||||
@@ -144,7 +144,7 @@ describe("values", () => {
|
||||
})
|
||||
const validator = value.validator
|
||||
validator.unsafeCast("test text")
|
||||
testOutput<typeof validator._TYPE, string | null | undefined>()(null)
|
||||
testOutput<typeof validator._TYPE, string | null>()(null)
|
||||
})
|
||||
test("number", async () => {
|
||||
const value = Value.number({
|
||||
@@ -180,7 +180,7 @@ describe("values", () => {
|
||||
})
|
||||
const validator = value.validator
|
||||
validator.unsafeCast(2)
|
||||
testOutput<typeof validator._TYPE, number | null | undefined>()(null)
|
||||
testOutput<typeof validator._TYPE, number | null>()(null)
|
||||
})
|
||||
test("select", async () => {
|
||||
const value = Value.select({
|
||||
@@ -319,33 +319,33 @@ describe("values", () => {
|
||||
test("text", async () => {
|
||||
const value = Value.dynamicText(async () => ({
|
||||
name: "Testing",
|
||||
required: true,
|
||||
required: false,
|
||||
default: null,
|
||||
}))
|
||||
const validator = value.validator
|
||||
const rawIs = await value.build({} as any)
|
||||
validator.unsafeCast("test text")
|
||||
validator.unsafeCast(null)
|
||||
testOutput<typeof validator._TYPE, string | null | undefined>()(null)
|
||||
testOutput<typeof validator._TYPE, string | null>()(null)
|
||||
expect(await value.build(fakeOptions)).toMatchObject({
|
||||
name: "Testing",
|
||||
required: true,
|
||||
required: false,
|
||||
default: null,
|
||||
})
|
||||
})
|
||||
test("text with default", async () => {
|
||||
const value = Value.dynamicText(async () => ({
|
||||
name: "Testing",
|
||||
required: true,
|
||||
required: false,
|
||||
default: "this is a default value",
|
||||
}))
|
||||
const validator = value.validator
|
||||
validator.unsafeCast("test text")
|
||||
validator.unsafeCast(null)
|
||||
testOutput<typeof validator._TYPE, string | null | undefined>()(null)
|
||||
testOutput<typeof validator._TYPE, string | null>()(null)
|
||||
expect(await value.build(fakeOptions)).toMatchObject({
|
||||
name: "Testing",
|
||||
required: true,
|
||||
required: false,
|
||||
default: "this is a default value",
|
||||
})
|
||||
})
|
||||
@@ -359,7 +359,7 @@ describe("values", () => {
|
||||
const rawIs = await value.build({} as any)
|
||||
validator.unsafeCast("test text")
|
||||
validator.unsafeCast(null)
|
||||
testOutput<typeof validator._TYPE, string | null | undefined>()(null)
|
||||
testOutput<typeof validator._TYPE, string | null>()(null)
|
||||
expect(await value.build(fakeOptions)).toMatchObject({
|
||||
name: "Testing",
|
||||
required: false,
|
||||
@@ -377,7 +377,7 @@ describe("values", () => {
|
||||
const validator = value.validator
|
||||
validator.unsafeCast("#000000")
|
||||
validator.unsafeCast(null)
|
||||
testOutput<typeof validator._TYPE, string | null | undefined>()(null)
|
||||
testOutput<typeof validator._TYPE, string | null>()(null)
|
||||
expect(await value.build(fakeOptions)).toMatchObject({
|
||||
name: "Testing",
|
||||
required: false,
|
||||
@@ -445,7 +445,7 @@ describe("values", () => {
|
||||
const validator = value.validator
|
||||
validator.unsafeCast("2021-01-01")
|
||||
validator.unsafeCast(null)
|
||||
testOutput<typeof validator._TYPE, string | null | undefined>()(null)
|
||||
testOutput<typeof validator._TYPE, string | null>()(null)
|
||||
expect(await value.build(fakeOptions)).toMatchObject({
|
||||
name: "Testing",
|
||||
required: true,
|
||||
@@ -468,7 +468,7 @@ describe("values", () => {
|
||||
}))
|
||||
const validator = value.validator
|
||||
validator.unsafeCast("test text")
|
||||
testOutput<typeof validator._TYPE, string | null | undefined>()(null)
|
||||
testOutput<typeof validator._TYPE, string | null>()(null)
|
||||
expect(await value.build(fakeOptions)).toMatchObject({
|
||||
name: "Testing",
|
||||
required: false,
|
||||
@@ -492,7 +492,7 @@ describe("values", () => {
|
||||
validator.unsafeCast(2)
|
||||
validator.unsafeCast(null)
|
||||
expect(() => validator.unsafeCast("null")).toThrowError()
|
||||
testOutput<typeof validator._TYPE, number | null | undefined>()(null)
|
||||
testOutput<typeof validator._TYPE, number | null>()(null)
|
||||
expect(await value.build(fakeOptions)).toMatchObject({
|
||||
name: "Testing",
|
||||
required: true,
|
||||
@@ -795,7 +795,7 @@ describe("Nested nullable values", () => {
|
||||
validator.unsafeCast({ a: null })
|
||||
validator.unsafeCast({ a: "test" })
|
||||
expect(() => validator.unsafeCast({ a: 4 })).toThrowError()
|
||||
testOutput<typeof validator._TYPE, { a: string | null | undefined }>()(null)
|
||||
testOutput<typeof validator._TYPE, { a: string | null }>()(null)
|
||||
})
|
||||
test("Testing number", async () => {
|
||||
const value = InputSpec.of({
|
||||
@@ -818,7 +818,7 @@ describe("Nested nullable values", () => {
|
||||
validator.unsafeCast({ a: null })
|
||||
validator.unsafeCast({ a: 5 })
|
||||
expect(() => validator.unsafeCast({ a: "4" })).toThrowError()
|
||||
testOutput<typeof validator._TYPE, { a: number | null | undefined }>()(null)
|
||||
testOutput<typeof validator._TYPE, { a: number | null }>()(null)
|
||||
})
|
||||
test("Testing color", async () => {
|
||||
const value = InputSpec.of({
|
||||
@@ -835,7 +835,7 @@ describe("Nested nullable values", () => {
|
||||
validator.unsafeCast({ a: null })
|
||||
validator.unsafeCast({ a: "5" })
|
||||
expect(() => validator.unsafeCast({ a: 4 })).toThrowError()
|
||||
testOutput<typeof validator._TYPE, { a: string | null | undefined }>()(null)
|
||||
testOutput<typeof validator._TYPE, { a: string | null }>()(null)
|
||||
})
|
||||
test("Testing select", async () => {
|
||||
const value = InputSpec.of({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CurrentDependenciesResult } from "../../../base/lib/dependencies/setupDependencies"
|
||||
import { StartSdk } from "../StartSdk"
|
||||
import { setupManifest } from "../manifest/setupManifest"
|
||||
import { VersionInfo } from "../version/VersionInfo"
|
||||
import { VersionGraph } from "../version/VersionGraph"
|
||||
|
||||
export type Manifest = any
|
||||
@@ -21,7 +21,15 @@ export const sdk = StartSdk.of()
|
||||
long: "",
|
||||
},
|
||||
containers: {},
|
||||
images: {},
|
||||
images: {
|
||||
main: {
|
||||
source: {
|
||||
dockerTag: "start9/hello-world",
|
||||
},
|
||||
arch: ["aarch64", "x86_64"],
|
||||
emulateMissingAs: "aarch64",
|
||||
},
|
||||
},
|
||||
volumes: [],
|
||||
assets: [],
|
||||
alerts: {
|
||||
|
||||
@@ -22,7 +22,7 @@ testOutput<
|
||||
testOutput<InputSpecSpec["rpc"]["advanced"]["servertimeout"], number>()(null)
|
||||
testOutput<
|
||||
InputSpecSpec["advanced"]["peers"]["addnode"][0]["hostname"],
|
||||
string | null | undefined
|
||||
string | null
|
||||
>()(null)
|
||||
testOutput<
|
||||
InputSpecSpec["testListUnion"][0]["union"]["value"]["name"],
|
||||
|
||||
12
sdk/package/package-lock.json
generated
12
sdk/package/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@start9labs/start-sdk",
|
||||
"version": "0.3.6-alpha.16",
|
||||
"version": "0.3.6-alpha.21",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@start9labs/start-sdk",
|
||||
"version": "0.3.6-alpha.16",
|
||||
"version": "0.3.6-alpha.21",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@iarna/toml": "^2.2.5",
|
||||
@@ -15,7 +15,7 @@
|
||||
"isomorphic-fetch": "^3.0.0",
|
||||
"lodash.merge": "^4.6.2",
|
||||
"mime-types": "^2.1.35",
|
||||
"ts-matches": "^6.0.0",
|
||||
"ts-matches": "^6.1.0",
|
||||
"yaml": "^2.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -3918,9 +3918,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/ts-matches": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ts-matches/-/ts-matches-6.0.0.tgz",
|
||||
"integrity": "sha512-vR4hhz9bYMW30qIJUuLaeAWlsR54vse6ZI2riVhVLMBE6/vss43jwrOvbHheiyU7e26ssT/yWx69aJHD2REJSA==",
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ts-matches/-/ts-matches-6.1.0.tgz",
|
||||
"integrity": "sha512-01qvbIpOiKdbzzXDH84JeHunvCwBGFdZw94jS6kOGLSN5ms+1nBZtfe8WSuYMIPb1xPA+qyAiVgznFi2VCQ6UQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/ts-morph": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@start9labs/start-sdk",
|
||||
"version": "0.3.6-alpha.17",
|
||||
"version": "0.3.6-alpha.21",
|
||||
"description": "Software development kit to facilitate packaging services for StartOS",
|
||||
"main": "./package/lib/index.js",
|
||||
"types": "./package/lib/index.d.ts",
|
||||
@@ -33,7 +33,7 @@
|
||||
"isomorphic-fetch": "^3.0.0",
|
||||
"lodash.merge": "^4.6.2",
|
||||
"mime-types": "^2.1.35",
|
||||
"ts-matches": "^6.0.0",
|
||||
"ts-matches": "^6.1.0",
|
||||
"yaml": "^2.2.2",
|
||||
"@iarna/toml": "^2.2.5",
|
||||
"@noble/curves": "^1.4.0",
|
||||
|
||||
Reference in New Issue
Block a user