diff --git a/.github/workflows/startos-iso.yaml b/.github/workflows/startos-iso.yaml index 47e0266cd..184c2b0c7 100644 --- a/.github/workflows/startos-iso.yaml +++ b/.github/workflows/startos-iso.yaml @@ -79,9 +79,12 @@ jobs: with: node-version: ${{ env.NODEJS_VERSION }} - - name: Set up QEMU + - name: Set up docker QEMU uses: docker/setup-qemu-action@v2 + - name: Set up system QEMU + run: sudo apt-get update && sudo apt-get install -y qemu-user-static + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -169,6 +172,8 @@ jobs: - name: Prevent rebuild of compiled artifacts run: | mkdir -p web/dist/raw + touch core/startos/bindings + mkdir -p container-runtime/dist PLATFORM=${{ matrix.platform }} make -t compiled-${{ env.ARCH }}.tar - name: Run iso build diff --git a/Makefile b/Makefile index 232bd84af..30a9bb9bd 100644 --- a/Makefile +++ b/Makefile @@ -9,14 +9,14 @@ IMAGE_TYPE=$(shell if [ "$(PLATFORM)" = raspberrypi ]; then echo img; else echo BINS := core/target/$(ARCH)-unknown-linux-musl/release/startbox core/target/$(ARCH)-unknown-linux-musl/release/containerbox WEB_UIS := web/dist/raw/ui web/dist/raw/setup-wizard web/dist/raw/install-wizard FIRMWARE_ROMS := ./firmware/$(PLATFORM) $(shell jq --raw-output '.[] | select(.platform[] | contains("$(PLATFORM)")) | "./firmware/$(PLATFORM)/" + .id + ".rom.gz"' build/lib/firmware.json) -BUILD_SRC := $(shell git ls-files build) build/lib/depends build/lib/conflicts build/lib/container-runtime/rootfs.squashfs $(FIRMWARE_ROMS) +BUILD_SRC := $(shell git ls-files build) build/lib/depends build/lib/conflicts container-runtime/rootfs.$(ARCH).squashfs $(FIRMWARE_ROMS) DEBIAN_SRC := $(shell git ls-files debian/) IMAGE_RECIPE_SRC := $(shell git ls-files image-recipe/) STARTD_SRC := core/startos/startd.service $(BUILD_SRC) COMPAT_SRC := $(shell git ls-files system-images/compat/) UTILS_SRC := $(shell git ls-files system-images/utils/) BINFMT_SRC := $(shell git ls-files system-images/binfmt/) -CORE_SRC := $(shell git ls-files core) $(shell git ls-files --recurse-submodules patch-db) web/dist/static web/patchdb-ui-seed.json $(GIT_HASH_FILE) +CORE_SRC := $(shell git ls-files -- core ':!:core/startos/bindings/*') $(shell git ls-files --recurse-submodules patch-db) web/dist/static web/patchdb-ui-seed.json $(GIT_HASH_FILE) WEB_SHARED_SRC := $(shell git ls-files web/projects/shared) $(shell ls -p web/ | grep -v / | sed 's/^/web\//g') web/node_modules web/config.json patch-db/client/dist web/patchdb-ui-seed.json WEB_UI_SRC := $(shell git ls-files web/projects/ui) WEB_SETUP_WIZARD_SRC := $(shell git ls-files web/projects/setup-wizard) @@ -24,7 +24,7 @@ WEB_INSTALL_WIZARD_SRC := $(shell git ls-files web/projects/install-wizard) PATCH_DB_CLIENT_SRC := $(shell git ls-files --recurse-submodules patch-db/client) GZIP_BIN := $(shell which pigz || which gzip) TAR_BIN := $(shell which gtar || which tar) -COMPILED_TARGETS := $(BINS) system-images/compat/docker-images/$(ARCH).tar system-images/utils/docker-images/$(ARCH).tar system-images/binfmt/docker-images/$(ARCH).tar +COMPILED_TARGETS := $(BINS) system-images/compat/docker-images/$(ARCH).tar system-images/utils/docker-images/$(ARCH).tar system-images/binfmt/docker-images/$(ARCH).tar container-runtime/rootfs.$(ARCH).squashfs ALL_TARGETS := $(STARTD_SRC) $(ENVIRONMENT_FILE) $(GIT_HASH_FILE) $(VERSION_FILE) $(COMPILED_TARGETS) $(shell if [ "$(PLATFORM)" = "raspberrypi" ]; then echo cargo-deps/aarch64-unknown-linux-musl/release/pi-beep; fi) $(shell /bin/bash -c 'if [[ "${ENVIRONMENT}" =~ (^|-)unstable($$|-) ]]; then echo cargo-deps/$(ARCH)-unknown-linux-musl/release/tokio-console; fi') $(PLATFORM_FILE) sdk/lib/test ifeq ($(REMOTE),) @@ -52,6 +52,9 @@ endif all: $(ALL_TARGETS) +touch: + touch $(ALL_TARGETS) + metadata: $(VERSION_FILE) $(PLATFORM_FILE) $(ENVIRONMENT_FILE) $(GIT_HASH_FILE) sudo: @@ -75,7 +78,7 @@ clean: rm -rf build/lib/firmware rm -rf container-runtime/dist rm -rf container-runtime/node_modules - rm -f build/lib/container-runtime/rootfs.squashfs + rm -f container-runtime/*.squashfs rm -rf sdk/dist rm -rf sdk/node_modules rm -f ENVIRONMENT.txt @@ -87,7 +90,9 @@ format: cd core && cargo +nightly fmt test: $(CORE_SRC) $(ENVIRONMENT_FILE) - cd core && cargo build && cargo test + (cd core && cargo build && cargo test) + npm --prefix sdk exec -- prettier -w ./core/startos/bindings/*.ts + (cd sdk && make test) cli: cd core && ./install-cli.sh @@ -124,6 +129,8 @@ install: $(ALL_TARGETS) $(call mkdir,$(DESTDIR)/usr/lib) $(call rm,$(DESTDIR)/usr/lib/startos) $(call cp,build/lib,$(DESTDIR)/usr/lib/startos) + $(call mkdir,$(DESTDIR)/usr/lib/startos/container-runtime) + $(call cp,container-runtime/rootfs.$(ARCH).squashfs,$(DESTDIR)/usr/lib/startos/container-runtime/rootfs.squashfs) $(call cp,PLATFORM.txt,$(DESTDIR)/usr/lib/startos/PLATFORM.txt) $(call cp,ENVIRONMENT.txt,$(DESTDIR)/usr/lib/startos/ENVIRONMENT.txt) @@ -165,31 +172,30 @@ emulate-reflash: $(ALL_TARGETS) upload-ota: results/$(BASENAME).squashfs TARGET=$(TARGET) KEY=$(KEY) ./upload-ota.sh -container-runtime/alpine.squashfs: $(PLATFORM_FILE) +container-runtime/alpine.$(ARCH).squashfs: ARCH=$(ARCH) ./container-runtime/download-base-image.sh container-runtime/node_modules: container-runtime/package.json container-runtime/package-lock.json sdk/dist npm --prefix container-runtime ci touch container-runtime/node_modules -core/startos/bindings: $(shell git ls-files core) $(ENVIRONMENT_FILE) $(PLATFORM_FILE) - (cd core/ && cargo test) - touch core/startos/bindings +core/startos/bindings: $(shell git ls-files -- core ':!:core/startos/bindings/*') $(ENVIRONMENT_FILE) + rm -rf core/startos/bindings + (cd core/ && cargo test --features=test) + npm --prefix sdk exec -- prettier -w ./core/startos/bindings/*.ts -sdk/lib/test: $(shell git ls-files sdk) core/startos/bindings - (cd sdk && make test) - -sdk/dist: $(shell git ls-files sdk) +sdk/dist: $(shell git ls-files sdk) core/startos/bindings (cd sdk && make bundle) -container-runtime/dist: container-runtime/node_modules $(shell git ls-files container-runtime/src) container-runtime/package.json container-runtime/tsconfig.json +# TODO: make container-runtime its own makefile? +container-runtime/dist/index.js: container-runtime/node_modules $(shell git ls-files container-runtime/src) container-runtime/package.json container-runtime/tsconfig.json npm --prefix container-runtime run build container-runtime/dist/node_modules container-runtime/dist/package.json container-runtime/dist/package-lock.json: container-runtime/package.json container-runtime/package-lock.json sdk/dist container-runtime/install-dist-deps.sh ./container-runtime/install-dist-deps.sh touch container-runtime/dist/node_modules -build/lib/container-runtime/rootfs.squashfs: container-runtime/alpine.squashfs container-runtime/containerRuntime.rc container-runtime/update-image.sh container-runtime/dist container-runtime/dist/node_modules core/target/$(ARCH)-unknown-linux-musl/release/containerbox $(PLATFORM_FILE) | sudo +container-runtime/rootfs.$(ARCH).squashfs: container-runtime/alpine.$(ARCH).squashfs container-runtime/containerRuntime.rc container-runtime/update-image.sh container-runtime/dist/index.js container-runtime/dist/node_modules core/target/$(ARCH)-unknown-linux-musl/release/containerbox | sudo ARCH=$(ARCH) ./container-runtime/update-image.sh build/lib/depends build/lib/conflicts: build/dpkg-deps/* diff --git a/build-cargo-dep.sh b/build-cargo-dep.sh index 5c8f9ceed..9e20f0caf 100755 --- a/build-cargo-dep.sh +++ b/build-cargo-dep.sh @@ -18,7 +18,7 @@ if [ -z "$ARCH" ]; then fi mkdir -p cargo-deps -alias 'rust-musl-builder'='docker run $USE_TTY --rm -e "RUSTFLAGS=$RUSTFLAGS" -v "$HOME/.cargo/registry":/root/.cargo/registry -v "$(pwd)":/home/rust/src -w /home/rust/src -P messense/rust-musl-cross:$ARCH-musl' +alias 'rust-musl-builder'='docker run $USE_TTY --rm -e "RUSTFLAGS=$RUSTFLAGS" -v "$HOME/.cargo/registry":/root/.cargo/registry -v "$(pwd)"/cargo-deps:/home/rust/src -w /home/rust/src -P messense/rust-musl-cross:$ARCH-musl' rust-musl-builder cargo install "$1" --target-dir /home/rust/src --target=$ARCH-unknown-linux-musl sudo chown -R $USER cargo-deps diff --git a/build/.gitignore b/build/.gitignore index f24aa0255..497f4b913 100644 --- a/build/.gitignore +++ b/build/.gitignore @@ -1,3 +1,2 @@ /lib/depends -/lib/conflicts -/lib/container-runtime/rootfs.squashfs \ No newline at end of file +/lib/conflicts \ No newline at end of file diff --git a/container-runtime/.gitignore b/container-runtime/.gitignore index 1764c1d17..8aa4208b7 100644 --- a/container-runtime/.gitignore +++ b/container-runtime/.gitignore @@ -4,5 +4,5 @@ bundle.js startInit.js service/ service.js -alpine.squashfs +*.squashfs /tmp \ No newline at end of file diff --git a/container-runtime/download-base-image.sh b/container-runtime/download-base-image.sh index e708478e1..23a140ea5 100755 --- a/container-runtime/download-base-image.sh +++ b/container-runtime/download-base-image.sh @@ -9,10 +9,11 @@ VERSION=3.19 ARCH=${ARCH:-$(uname -m)} FLAVOR=default -if [ "$ARCH" = "x86_64" ]; then - ARCH=amd64 -elif [ "$ARCH" = "aarch64" ]; then - ARCH=arm64 +_ARCH=$ARCH +if [ "$_ARCH" = "x86_64" ]; then + _ARCH=amd64 +elif [ "$_ARCH" = "aarch64" ]; then + _ARCH=arm64 fi -curl https://images.linuxcontainers.org/$(curl --silent https://images.linuxcontainers.org/meta/1.0/index-system | grep "^$DISTRO;$VERSION;$ARCH;$FLAVOR;" | head -n1 | sed 's/^.*;//g')/rootfs.squashfs --output alpine.squashfs \ No newline at end of file +curl https://images.linuxcontainers.org/$(curl --silent https://images.linuxcontainers.org/meta/1.0/index-system | grep "^$DISTRO;$VERSION;$_ARCH;$FLAVOR;" | head -n1 | sed 's/^.*;//g')/rootfs.squashfs --output alpine.${ARCH}.squashfs \ No newline at end of file diff --git a/container-runtime/src/Adapters/Systems/SystemForEmbassy/MainLoop.ts b/container-runtime/src/Adapters/Systems/SystemForEmbassy/MainLoop.ts index 69e3e6615..17fd13468 100644 --- a/container-runtime/src/Adapters/Systems/SystemForEmbassy/MainLoop.ts +++ b/container-runtime/src/Adapters/Systems/SystemForEmbassy/MainLoop.ts @@ -112,8 +112,9 @@ export class MainLoop { ]) if (executed.exitCode === 59) { await effects.setHealth({ - name: healthId, - status: "disabled", + id: healthId, + name: value.name, + result: "disabled", message: executed.stderr.toString() || executed.stdout.toString(), }) @@ -121,8 +122,9 @@ export class MainLoop { } if (executed.exitCode === 60) { await effects.setHealth({ - name: healthId, - status: "starting", + id: healthId, + name: value.name, + result: "starting", message: executed.stderr.toString() || executed.stdout.toString(), }) @@ -130,8 +132,9 @@ export class MainLoop { } if (executed.exitCode === 61) { await effects.setHealth({ - name: healthId, - status: "warning", + id: healthId, + name: value.name, + result: "loading", message: executed.stderr.toString() || executed.stdout.toString(), }) @@ -141,15 +144,17 @@ export class MainLoop { const message = executed.stdout.toString() if (!!errorMessage) { await effects.setHealth({ - name: healthId, - status: "failure", + id: healthId, + name: value.name, + result: "failure", message: errorMessage, }) return } await effects.setHealth({ - name: healthId, - status: "passing", + id: healthId, + name: value.name, + result: "success", message, }) return @@ -159,9 +164,10 @@ export class MainLoop { const method = moduleCode.health?.[healthId] if (!method) { await effects.setHealth({ - name: healthId, - status: "failure", - message: `Expecting that thejs health check ${healthId} exists`, + id: healthId, + name: value.name, + result: "failure", + message: `Expecting that the js health check ${healthId} exists`, }) return } @@ -173,24 +179,27 @@ export class MainLoop { if ("result" in result) { await effects.setHealth({ + id: healthId, + name: value.name, + result: "success", message: null, - name: healthId, - status: "passing", }) return } if ("error" in result) { await effects.setHealth({ - name: healthId, - status: "failure", + id: healthId, + name: value.name, + result: "failure", message: result.error, }) return } if (!("error-code" in result)) { await effects.setHealth({ - name: healthId, - status: "failure", + id: healthId, + name: value.name, + result: "failure", message: `Unknown error type ${JSON.stringify(result)}`, }) return @@ -198,32 +207,36 @@ export class MainLoop { const [code, message] = result["error-code"] if (code === 59) { await effects.setHealth({ - name: healthId, - status: "disabled", + id: healthId, + name: value.name, + result: "disabled", message, }) return } if (code === 60) { await effects.setHealth({ - name: healthId, - status: "starting", + id: healthId, + name: value.name, + result: "starting", message, }) return } if (code === 61) { await effects.setHealth({ - name: healthId, - status: "warning", + id: healthId, + name: value.name, + result: "loading", message, }) return } await effects.setHealth({ - name: healthId, - status: "failure", + id: healthId, + name: value.name, + result: "failure", message: `${result["error-code"][0]}: ${result["error-code"][1]}`, }) return diff --git a/container-runtime/src/Adapters/Systems/SystemForEmbassy/index.ts b/container-runtime/src/Adapters/Systems/SystemForEmbassy/index.ts index 7ff875d91..a18539445 100644 --- a/container-runtime/src/Adapters/Systems/SystemForEmbassy/index.ts +++ b/container-runtime/src/Adapters/Systems/SystemForEmbassy/index.ts @@ -29,6 +29,7 @@ import { import { HostSystemStartOs } from "../../HostSystemStartOs" import { JsonPath, unNestPath } from "../../../Models/JsonPath" import { RpcResult, matchRpcResult } from "../../RpcListener" +import { InputSpec } from "@start9labs/start-sdk/cjs/sdk/lib/config/configTypes" type Optional = A | undefined | null function todo(): never { @@ -259,6 +260,35 @@ export class SystemForEmbassy implements System { ): Promise { if (previousVersion) await this.migration(effects, previousVersion) await effects.setMainStatus({ status: "stopped" }) + await this.exportActions(effects) + } + async exportActions(effects: HostSystemStartOs) { + const manifest = this.manifest + if (!manifest.actions) return + for (const [actionId, action] of Object.entries(manifest.actions)) { + const hasRunning = !!action["allowed-statuses"].find( + (x) => x === "running", + ) + const hasStopped = !!action["allowed-statuses"].find( + (x) => x === "stopped", + ) + // prettier-ignore + const allowedStatuses = hasRunning && hasStopped ? "any": + hasRunning ? "onlyRunning" : + "onlyStopped" + await effects.exportAction({ + id: actionId, + metadata: { + name: action.name, + description: action.description, + warning: action.warning || null, + input: action["input-spec"] as InputSpec, + disabled: false, + allowedStatuses, + group: null, + }, + }) + } } private async uninit( effects: HostSystemStartOs, diff --git a/container-runtime/src/Models/JsonPath.ts b/container-runtime/src/Models/JsonPath.ts index 773331b19..314019154 100644 --- a/container-runtime/src/Models/JsonPath.ts +++ b/container-runtime/src/Models/JsonPath.ts @@ -15,10 +15,10 @@ export function unNestPath(a: A): UnNestPaths { function isNestedPath(path: string): path is NestedPaths { const paths = path.split("/") if (paths.length !== 4) return false - if (paths[1] === "action" && (paths[3] === "run" || paths[3] === "get")) + if (paths[1] === "actions" && (paths[3] === "run" || paths[3] === "get")) return true if ( - paths[1] === "dependencyConfig" && + paths[1] === "dependencies" && (paths[3] === "query" || paths[3] === "update") ) return true diff --git a/container-runtime/update-image.sh b/container-runtime/update-image.sh index 64ca503cf..e0d5dc0c3 100755 --- a/container-runtime/update-image.sh +++ b/container-runtime/update-image.sh @@ -9,7 +9,7 @@ set -e if mountpoint tmp/combined; then sudo umount tmp/combined; fi if mountpoint tmp/lower; then sudo umount tmp/lower; fi mkdir -p tmp/lower tmp/upper tmp/work tmp/combined -sudo mount alpine.squashfs tmp/lower +sudo mount alpine.${ARCH}.squashfs tmp/lower sudo mount -t overlay -olowerdir=tmp/lower,upperdir=tmp/upper,workdir=tmp/work overlay tmp/combined QEMU= @@ -33,9 +33,9 @@ fi sudo truncate -s 0 tmp/combined/etc/resolv.conf sudo chown -R 0:0 tmp/combined -rm -f ../build/lib/container-runtime/rootfs.squashfs +rm -f rootfs.${ARCH}.squashfs mkdir -p ../build/lib/container-runtime -sudo mksquashfs tmp/combined ../build/lib/container-runtime/rootfs.squashfs +sudo mksquashfs tmp/combined rootfs.${ARCH}.squashfs sudo umount tmp/combined sudo umount tmp/lower sudo rm -rf tmp \ No newline at end of file diff --git a/core/Cargo.lock b/core/Cargo.lock index 24a641819..602c16ae3 100644 --- a/core/Cargo.lock +++ b/core/Cargo.lock @@ -62,9 +62,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -155,9 +155,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.80" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" +checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" [[package]] name = "arrayref" @@ -224,18 +224,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] name = "async-trait" -version = "0.1.77" +version = "0.1.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -247,16 +247,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "atomic-write-file" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8204db279bf648d64fe845bd8840f78b39c8132ed4d6a4194c3b10d4b4cfb0b" -dependencies = [ - "nix 0.28.0", - "rand 0.8.5", -] - [[package]] name = "atty" version = "0.2.14" @@ -270,9 +260,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "axum" @@ -296,7 +286,7 @@ dependencies = [ "pin-project-lite", "rustversion", "serde", - "sync_wrapper", + "sync_wrapper 0.1.2", "tower", "tower-layer", "tower-service", @@ -304,9 +294,9 @@ dependencies = [ [[package]] name = "axum" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1236b4b292f6c4d6dc34604bb5120d85c3fe1d1aa596bd5cc52ca054d13e7b9e" +checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" dependencies = [ "async-trait", "axum-core 0.4.3", @@ -330,7 +320,7 @@ dependencies = [ "serde_path_to_error", "serde_urlencoded", "sha1", - "sync_wrapper", + "sync_wrapper 1.0.0", "tokio", "tokio-tungstenite", "tower", @@ -371,7 +361,7 @@ dependencies = [ "mime", "pin-project-lite", "rustversion", - "sync_wrapper", + "sync_wrapper 0.1.2", "tower-layer", "tower-service", "tracing", @@ -398,9 +388,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", @@ -478,9 +468,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" dependencies = [ "serde", ] @@ -516,9 +506,9 @@ dependencies = [ [[package]] name = "blake3" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0231f06152bf547e9c2b5194f247cd97aacf6dcd8b15d8e5ec0663f64580da87" +checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52" dependencies = [ "arrayref", "arrayvec", @@ -547,9 +537,9 @@ dependencies = [ [[package]] name = "brotli" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516074a47ef4bce09577a3b379392300159ce5b1ba2e501ff1c819950066100f" +checksum = "d640d25bc63c50fb1f0b545ffd80207d2e10a4c965530809b40ba3386825c391" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -580,9 +570,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" @@ -596,17 +586,11 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" - [[package]] name = "chrono" -version = "0.4.35" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" +checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e" dependencies = [ "android-tzdata", "iana-time-zone", @@ -689,9 +673,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.2" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b230ab84b0ffdf890d5a10abdbc8b83ae1c4918275daea1ab8801f71536b2651" +checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" dependencies = [ "clap_builder", "clap_derive", @@ -711,14 +695,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.0" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" +checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -738,9 +722,9 @@ checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "color-eyre" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a667583cca8c4f8436db8de46ea8233c42a7d9ae424a82d338f2e4675229204" +checksum = "55146f5e46f237f7423d74111267d4597b59b0dad0ffaf7303bce9945d843ad5" dependencies = [ "backtrace", "color-spantrace", @@ -888,9 +872,9 @@ dependencies = [ [[package]] name = "cookie" -version = "0.18.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd91cf61412820176e137621345ee43b3f4423e589e7ae4e50d601d93e35ef8" +checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" dependencies = [ "time", "version_check", @@ -992,7 +976,7 @@ version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "crossterm_winapi", "futures-core", "libc", @@ -1114,7 +1098,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -1138,7 +1122,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.10.0", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -1149,7 +1133,7 @@ checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ "darling_core", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -1401,10 +1385,10 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -1452,9 +1436,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" [[package]] name = "fd-lock-rs" @@ -1477,9 +1461,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1676f435fc1dadde4d03e43f5d62b259e1ce5f40bd4ffb21db2b42ebe59c1382" +checksum = "c007b1ae3abe1cb6f85a16305acd418b7ca6343b953633fee2b76d8f108b830f" [[package]] name = "filetime" @@ -1638,7 +1622,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -1716,7 +1700,7 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8283e7331b8c93b9756e0cfdbcfb90312852f953c6faf9bf741e684cc3b6ad69" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "crc", "log", "uuid", @@ -1735,9 +1719,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "4fbd2820c5e49886948654ab546d0688ff24530286bdcf8fca3cefb16d4618eb" dependencies = [ "bytes", "fnv", @@ -1745,7 +1729,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.2.5", + "indexmap 2.2.6", "slab", "tokio", "tokio-util", @@ -1754,9 +1738,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31d030e59af851932b72ceebadf4a2b5986dba4c3b99dd2493f8273a0f151943" +checksum = "51ee2dd2e4f378392eeff5d51618cd9a63166a2513846bbc55f21cfacd9199d4" dependencies = [ "bytes", "fnv", @@ -1764,7 +1748,7 @@ dependencies = [ "futures-sink", "futures-util", "http 1.1.0", - "indexmap 2.2.5", + "indexmap 2.2.6", "slab", "tokio", "tokio-util", @@ -1843,6 +1827,12 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "helpers" version = "0.1.0" @@ -1883,9 +1873,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hifijson" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85ef6b41c333e6dd2a4aaa59125a19b633cd17e7aaf372b2260809777bcdef4a" +checksum = "18ae468bcb4dfecf0e4949ee28abbc99076b6a0077f51ddbc94dbfff8e6a870c" [[package]] name = "hkdf" @@ -1959,12 +1949,12 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" +checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" dependencies = [ "bytes", - "futures-util", + "futures-core", "http 1.1.0", "http-body 1.0.0", "pin-project-lite", @@ -1998,7 +1988,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.24", + "h2 0.3.25", "http 0.2.12", "http-body 0.4.6", "httparse", @@ -2021,7 +2011,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.2", + "h2 0.4.3", "http 1.1.0", "http-body 1.0.0", "httparse", @@ -2214,9 +2204,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.5" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -2343,9 +2333,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jaq-core" @@ -2387,9 +2377,9 @@ dependencies = [ [[package]] name = "josekit" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd20997283339a19226445db97d632c8dc7adb6b8172537fe0e9e540fb141df2" +checksum = "0953340cf63354cec4a385f1fbcb3f409a5823778cae236078892f6030ed4565" dependencies = [ "anyhow", "base64", @@ -2466,7 +2456,7 @@ dependencies = [ "petgraph", "pico-args", "regex", - "regex-syntax 0.8.2", + "regex-syntax 0.8.3", "string_cache", "term", "tiny-keccak", @@ -2526,7 +2516,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "libc", "redox_syscall 0.4.1", ] @@ -2685,7 +2675,7 @@ dependencies = [ "tokio", "torut", "tracing", - "ts-rs 7.1.1", + "ts-rs", "yasi", ] @@ -2709,9 +2699,9 @@ dependencies = [ [[package]] name = "new_debug_unreachable" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" [[package]] name = "new_mime_guess" @@ -2754,23 +2744,11 @@ version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cfg-if", "libc", ] -[[package]] -name = "nix" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" -dependencies = [ - "bitflags 2.4.2", - "cfg-if", - "cfg_aliases", - "libc", -] - [[package]] name = "nom" version = "7.1.3" @@ -2918,7 +2896,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -2967,7 +2945,7 @@ version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cfg-if", "foreign-types", "libc", @@ -2984,7 +2962,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -3135,7 +3113,7 @@ dependencies = [ name = "patch-db-macro-internals" version = "0.1.0" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "syn 1.0.109", @@ -3173,7 +3151,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.2.5", + "indexmap 2.2.6", ] [[package]] @@ -3208,7 +3186,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -3252,9 +3230,9 @@ checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "platforms" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" +checksum = "db23d408679286588f4d4644f965003d056e3dd5abcaaa938116871d7ce2fee7" [[package]] name = "portable-atomic" @@ -3314,9 +3292,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] @@ -3329,13 +3307,13 @@ checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.4.2", + "bitflags 2.5.0", "lazy_static", "num-traits", "rand 0.8.5", "rand_chacha 0.3.1", "rand_xorshift", - "regex-syntax 0.8.2", + "regex-syntax 0.8.3", "rusty-fork", "tempfile", "unarray", @@ -3372,7 +3350,7 @@ dependencies = [ "itertools 0.11.0", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -3547,14 +3525,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", "regex-automata 0.4.6", - "regex-syntax 0.8.2", + "regex-syntax 0.8.3", ] [[package]] @@ -3574,7 +3552,7 @@ checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax 0.8.3", ] [[package]] @@ -3585,15 +3563,15 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "reqwest" -version = "0.11.25" +version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eea5a9eb898d3783f17c6407670e3592fd174cb81a10e51d4c37f49450b9946" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ "base64", "bytes", @@ -3602,7 +3580,7 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2 0.3.24", + "h2 0.3.25", "http 0.2.12", "http-body 0.4.6", "hyper 0.14.28", @@ -3619,7 +3597,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 0.1.2", "system-configuration", "tokio", "tokio-native-tls", @@ -3711,8 +3689,8 @@ source = "git+https://github.com/Start9Labs/rpc-toolkit.git?branch=refactor/trai dependencies = [ "async-stream", "async-trait", - "axum 0.7.4", - "clap 4.5.2", + "axum 0.7.5", + "clap 4.5.4", "futures", "http 1.1.0", "http-body-util", @@ -3835,11 +3813,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.31" +version = "0.38.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys", @@ -3859,9 +3837,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.22.2" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" +checksum = "99008d7ad0bbbea527ec27bddbc0e432c5b87d8175178cee68d2eec9c4a1813c" dependencies = [ "log", "ring", @@ -3882,9 +3860,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.3.1" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ede67b28608b4c60685c7d54122d4400d90f62b40caee7700e700380a390fa8" +checksum = "ecd36cc4259e3e4514335c4a138c6b43171a8d61d8f5c9348f9fc7529416f247" [[package]] name = "rustls-webpki" @@ -4071,16 +4049,16 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" dependencies = [ - "indexmap 2.2.5", + "indexmap 2.2.6", "itoa", "ryu", "serde", @@ -4088,9 +4066,9 @@ dependencies = [ [[package]] name = "serde_path_to_error" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd154a240de39fdebcf5775d2675c204d7c13cf39a4c697be6493c8e734337c" +checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" dependencies = [ "itoa", "serde", @@ -4119,15 +4097,15 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.6.1" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15d167997bd841ec232f5b2b8e0e26606df2e7caa4c31b95ea9ca52b200bd270" +checksum = "ee80b0e361bbf88fd2f6e242ccd19cfda072cb0faa6ae694ecee08199938569a" dependencies = [ "base64", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.5", + "indexmap 2.2.6", "serde", "serde_derive", "serde_json", @@ -4137,23 +4115,23 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.6.1" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "865f9743393e638991566a8b7a479043c2c8da94a33e0a31f18214c9cae0a64d" +checksum = "6561dc161a9224638a31d876ccdfefbc1df91d3f3a8342eddb35f055d48c7655" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] name = "serde_yaml" -version = "0.9.32" +version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd075d994154d4a774f95b51fb96bdc2832b0ea48425c92546073816cda1f2f" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 2.2.5", + "indexmap 2.2.6", "itoa", "ryu", "serde", @@ -4294,9 +4272,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" @@ -4346,9 +4324,9 @@ dependencies = [ [[package]] name = "sqlx" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dba03c279da73694ef99763320dea58b51095dfe87d001b1d4b5fe78ba8763cf" +checksum = "c9a2ccff1a000a5a59cd33da541d9f2fdcd9e6e8229cc200565942bff36d0aaa" dependencies = [ "sqlx-core", "sqlx-macros", @@ -4359,9 +4337,9 @@ dependencies = [ [[package]] name = "sqlx-core" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d84b0a3c3739e220d94b3239fd69fb1f74bc36e16643423bd99de3b43c21bfbd" +checksum = "24ba59a9342a3d9bab6c56c118be528b27c9b60e490080e9711a04dccac83ef6" dependencies = [ "ahash 0.8.11", "atoi", @@ -4370,7 +4348,6 @@ dependencies = [ "chrono", "crc", "crossbeam-queue", - "dotenvy", "either", "event-listener", "futures-channel", @@ -4380,7 +4357,7 @@ dependencies = [ "futures-util", "hashlink", "hex", - "indexmap 2.2.5", + "indexmap 2.2.6", "log", "memchr", "once_cell", @@ -4403,9 +4380,9 @@ dependencies = [ [[package]] name = "sqlx-macros" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89961c00dc4d7dffb7aee214964b065072bff69e36ddb9e2c107541f75e4f2a5" +checksum = "4ea40e2345eb2faa9e1e5e326db8c34711317d2b5e08d0d5741619048a803127" dependencies = [ "proc-macro2", "quote", @@ -4416,14 +4393,13 @@ dependencies = [ [[package]] name = "sqlx-macros-core" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0bd4519486723648186a08785143599760f7cc81c52334a55d6a83ea1e20841" +checksum = "5833ef53aaa16d860e92123292f1f6a3d53c34ba8b1969f152ef1a7bb803f3c8" dependencies = [ - "atomic-write-file", "dotenvy", "either", - "heck", + "heck 0.4.1", "hex", "once_cell", "proc-macro2", @@ -4443,13 +4419,13 @@ dependencies = [ [[package]] name = "sqlx-mysql" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e37195395df71fd068f6e2082247891bc11e3289624bbc776a0cdfa1ca7f1ea4" +checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418" dependencies = [ "atoi", "base64", - "bitflags 2.4.2", + "bitflags 2.5.0", "byteorder", "bytes", "chrono", @@ -4486,13 +4462,13 @@ dependencies = [ [[package]] name = "sqlx-postgres" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6ac0ac3b7ccd10cc96c7ab29791a7dd236bd94021f31eec7ba3d46a74aa1c24" +checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" dependencies = [ "atoi", "base64", - "bitflags 2.4.2", + "bitflags 2.5.0", "byteorder", "chrono", "crc", @@ -4514,7 +4490,6 @@ dependencies = [ "rand 0.8.5", "serde", "serde_json", - "sha1", "sha2 0.10.8", "smallvec", "sqlx-core", @@ -4526,9 +4501,9 @@ dependencies = [ [[package]] name = "sqlx-sqlite" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "210976b7d948c7ba9fced8ca835b11cbb2d677c59c79de41ac0d397e14547490" +checksum = "b244ef0a8414da0bed4bb1910426e890b19e5e9bccc27ada6b797d05c55ae0aa" dependencies = [ "atoi", "chrono", @@ -4571,7 +4546,7 @@ dependencies = [ "quote", "regex-syntax 0.6.29", "strsim 0.10.0", - "syn 2.0.52", + "syn 2.0.55", "unicode-width", ] @@ -4598,9 +4573,9 @@ dependencies = [ [[package]] name = "ssh-key" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01f8f4ea73476c0aa5d5e6a75ce1e8634e2c3f82005ef3bbed21547ac57f2bf7" +checksum = "3b71299a724c8d84956caaf8fc3b3ea57c3587fe2d0b800cd0dc1f3599905d7e" dependencies = [ "ed25519-dalek 2.1.1", "p256", @@ -4625,7 +4600,7 @@ dependencies = [ "async-compression", "async-stream", "async-trait", - "axum 0.7.4", + "axum 0.7.5", "axum-server", "base32", "base64", @@ -4635,11 +4610,11 @@ dependencies = [ "bytes", "chrono", "ciborium", - "clap 4.5.2", + "clap 4.5.4", "color-eyre", "console", "console-subscriber", - "cookie 0.18.0", + "cookie 0.18.1", "cookie_store", "current_platform", "digest 0.10.7", @@ -4659,7 +4634,7 @@ dependencies = [ "imbl", "imbl-value", "include_dir", - "indexmap 2.2.5", + "indexmap 2.2.6", "indicatif", "integer-encoding", "ipnet", @@ -4722,7 +4697,7 @@ dependencies = [ "tokio-tar", "tokio-tungstenite", "tokio-util", - "toml 0.8.10", + "toml 0.8.12", "torut", "tracing", "tracing-error", @@ -4730,7 +4705,7 @@ dependencies = [ "tracing-journald", "tracing-subscriber", "trust-dns-server", - "ts-rs 8.1.0", + "ts-rs", "typed-builder", "url", "urlencoding", @@ -4806,9 +4781,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.52" +version = "2.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" +checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0" dependencies = [ "proc-macro2", "quote", @@ -4822,21 +4797,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] -name = "system-configuration" -version = "0.6.0" +name = "sync_wrapper" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658bc6ee10a9b4fcf576e9b0819d95ec16f4d2c02d39fd83ac1c8789785c4a42" +checksum = "384595c11a4e2969895cad5a8c4029115f5ab956a9e5ef4de79d11a426e5f20c" + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ - "bitflags 2.4.2", + "bitflags 1.3.2", "core-foundation", "system-configuration-sys", ] [[package]] name = "system-configuration-sys" -version = "0.6.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" dependencies = [ "core-foundation-sys", "libc", @@ -4909,22 +4890,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -5041,7 +5022,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -5060,7 +5041,7 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" dependencies = [ - "rustls 0.22.2", + "rustls 0.22.3", "rustls-pki-types", "tokio", ] @@ -5079,9 +5060,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" dependencies = [ "futures-core", "pin-project-lite", @@ -5145,14 +5126,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.10" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a9aad4a3066010876e8dcf5a8a06e70a558751117a145c6ce2b82c2e2054290" +checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.6", + "toml_edit 0.22.9", ] [[package]] @@ -5170,7 +5151,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.2.5", + "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", @@ -5183,18 +5164,18 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.2.5", + "indexmap 2.2.6", "toml_datetime", "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.22.6" +version = "0.22.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1b5fd4128cc8d3e0cb74d4ed9a9cc7c7284becd4df68f5f940e1ad123606f6" +checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4" dependencies = [ - "indexmap 2.2.5", + "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", @@ -5212,7 +5193,7 @@ dependencies = [ "axum 0.6.20", "base64", "bytes", - "h2 0.3.24", + "h2 0.3.25", "http 0.2.12", "http-body 0.4.6", "hyper 0.14.28", @@ -5299,7 +5280,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -5434,49 +5415,24 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" -[[package]] -name = "ts-rs" -version = "7.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc2cae1fc5d05d47aa24b64f9a4f7cba24cdc9187a2084dd97ac57bef5eccae6" -dependencies = [ - "thiserror", - "ts-rs-macros 7.1.1", -] - [[package]] name = "ts-rs" version = "8.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d3fa4606cdab1e9b668cc65ce2545941d01f52bc27536a195c66c55b91cb84" +source = "git+https://github.com/dr-bonez/ts-rs.git?branch=feature/top-level-type-override#f37e51abbf3b4afc6dc2fdea72100ed0ee463a06" dependencies = [ "thiserror", - "ts-rs-macros 8.1.0", -] - -[[package]] -name = "ts-rs-macros" -version = "7.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73f7f9b821696963053a89a7bd8b292dc34420aea8294d7b225274d488f3ec92" -dependencies = [ - "Inflector", - "proc-macro2", - "quote", - "syn 2.0.52", - "termcolor", + "ts-rs-macros", ] [[package]] name = "ts-rs-macros" version = "8.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f86ae36cbb2d58b86677ad413054feeb0712e382e822131cf9a4a1e580c419b5" +source = "git+https://github.com/dr-bonez/ts-rs.git?branch=feature/top-level-type-override#f37e51abbf3b4afc6dc2fdea72100ed0ee463a06" dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", "termcolor", ] @@ -5517,7 +5473,7 @@ checksum = "563b3b88238ec95680aef36bdece66896eaa7ce3c0f1b4f39d38fb2435261352" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -5588,9 +5544,9 @@ checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" [[package]] name = "unsafe-libyaml" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" [[package]] name = "untrusted" @@ -5630,9 +5586,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" dependencies = [ "getrandom 0.2.12", ] @@ -5722,7 +5678,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", "wasm-bindgen-shared", ] @@ -5756,7 +5712,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5798,9 +5754,9 @@ checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "whoami" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fec781d48b41f8163426ed18e8fc2864c12937df9ce54c88ede7bd47270893e" +checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9" dependencies = [ "redox_syscall 0.4.1", "wasite", @@ -6076,7 +6032,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -6096,5 +6052,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] diff --git a/core/models/Cargo.toml b/core/models/Cargo.toml index 9f6a53443..b6a506774 100644 --- a/core/models/Cargo.toml +++ b/core/models/Cargo.toml @@ -32,7 +32,7 @@ sqlx = { version = "0.7.2", features = [ "postgres", ] } ssh-key = "0.6.2" -ts-rs = "7" +ts-rs = { git = "https://github.com/dr-bonez/ts-rs.git", branch = "feature/top-level-type-override" } # "8" thiserror = "1.0" tokio = { version = "1", features = ["full"] } torut = { git = "https://github.com/Start9Labs/torut.git", branch = "update/dependencies" } diff --git a/core/startos/bindings/BindOptionsSecure.ts b/core/models/bindings/ServiceInterfaceId.ts similarity index 68% rename from core/startos/bindings/BindOptionsSecure.ts rename to core/models/bindings/ServiceInterfaceId.ts index c7b1b69af..87edd8694 100644 --- a/core/startos/bindings/BindOptionsSecure.ts +++ b/core/models/bindings/ServiceInterfaceId.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type BindOptionsSecure = { ssl: boolean, }; \ No newline at end of file +export type ServiceInterfaceId = string; \ No newline at end of file diff --git a/core/models/src/data_url.rs b/core/models/src/data_url.rs index e2141b15a..9757d7f6a 100644 --- a/core/models/src/data_url.rs +++ b/core/models/src/data_url.rs @@ -6,11 +6,13 @@ use color_eyre::eyre::eyre; use reqwest::header::CONTENT_TYPE; use serde::{Deserialize, Serialize}; use tokio::io::{AsyncRead, AsyncReadExt}; +use ts_rs::TS; use yasi::InternedString; use crate::{mime, Error, ErrorKind, ResultExt}; -#[derive(Clone)] +#[derive(Clone, TS)] +#[ts(type = "string")] pub struct DataUrl<'a> { mime: InternedString, data: Cow<'a, [u8]>, diff --git a/core/models/src/id/action.rs b/core/models/src/id/action.rs index 992c995f7..3f17048e2 100644 --- a/core/models/src/id/action.rs +++ b/core/models/src/id/action.rs @@ -2,10 +2,12 @@ use std::path::Path; use std::str::FromStr; use serde::{Deserialize, Serialize}; +use ts_rs::TS; use crate::{Id, InvalidId}; -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, ts_rs::TS)] +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, TS)] +#[ts(type = "string")] pub struct ActionId(Id); impl FromStr for ActionId { type Err = InvalidId; diff --git a/core/models/src/id/health_check.rs b/core/models/src/id/health_check.rs index c416ab1e6..937f31aa3 100644 --- a/core/models/src/id/health_check.rs +++ b/core/models/src/id/health_check.rs @@ -2,10 +2,12 @@ use std::path::Path; use std::str::FromStr; use serde::{Deserialize, Deserializer, Serialize}; +use ts_rs::TS; use crate::{Id, InvalidId}; -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, ts_rs::TS)] +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, TS)] +#[ts(type = "string")] pub struct HealthCheckId(Id); impl std::fmt::Display for HealthCheckId { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { diff --git a/core/models/src/id/host.rs b/core/models/src/id/host.rs index 6bca7d0ff..2a1595bd8 100644 --- a/core/models/src/id/host.rs +++ b/core/models/src/id/host.rs @@ -2,11 +2,13 @@ use std::path::Path; use std::str::FromStr; use serde::{Deserialize, Deserializer, Serialize}; +use ts_rs::TS; use yasi::InternedString; use crate::{Id, InvalidId}; -#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)] +#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, TS)] +#[ts(type = "string")] pub struct HostId(Id); impl FromStr for HostId { type Err = InvalidId; diff --git a/core/models/src/id/image.rs b/core/models/src/id/image.rs index 5fd91a5a1..bbb0a601e 100644 --- a/core/models/src/id/image.rs +++ b/core/models/src/id/image.rs @@ -3,10 +3,12 @@ use std::path::Path; use std::str::FromStr; use serde::{Deserialize, Deserializer, Serialize}; +use ts_rs::TS; use crate::{Id, InvalidId, PackageId, Version}; -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, ts_rs::TS)] +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, TS)] +#[ts(type = "string")] pub struct ImageId(Id); impl AsRef for ImageId { fn as_ref(&self) -> &Path { diff --git a/core/models/src/id/mod.rs b/core/models/src/id/mod.rs index 29825f628..11644c71d 100644 --- a/core/models/src/id/mod.rs +++ b/core/models/src/id/mod.rs @@ -6,21 +6,21 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; use yasi::InternedString; mod action; -mod address; mod health_check; mod host; mod image; mod invalid_id; mod package; +mod service_interface; mod volume; pub use action::ActionId; -pub use address::AddressId; pub use health_check::HealthCheckId; pub use host::HostId; pub use image::ImageId; pub use invalid_id::InvalidId; pub use package::{PackageId, SYSTEM_PACKAGE_ID}; +pub use service_interface::ServiceInterfaceId; pub use volume::VolumeId; lazy_static::lazy_static! { @@ -28,8 +28,8 @@ lazy_static::lazy_static! { pub static ref SYSTEM_ID: Id = Id(InternedString::intern("x_system")); } -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Default, ts_rs::TS)] -pub struct Id(#[ts(type = "string")] InternedString); +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] +pub struct Id(InternedString); impl TryFrom for Id { type Error = InvalidId; fn try_from(value: InternedString) -> Result { diff --git a/core/models/src/id/package.rs b/core/models/src/id/package.rs index 8f71285c6..d2665e59a 100644 --- a/core/models/src/id/package.rs +++ b/core/models/src/id/package.rs @@ -12,6 +12,7 @@ lazy_static::lazy_static! { pub static ref SYSTEM_PACKAGE_ID: PackageId = PackageId(SYSTEM_ID.clone()); } #[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, TS)] +#[ts(type = "string")] pub struct PackageId(Id); impl FromStr for PackageId { type Err = InvalidId; diff --git a/core/models/src/id/address.rs b/core/models/src/id/service_interface.rs similarity index 67% rename from core/models/src/id/address.rs rename to core/models/src/id/service_interface.rs index 1bd670525..25aec0aba 100644 --- a/core/models/src/id/address.rs +++ b/core/models/src/id/service_interface.rs @@ -1,46 +1,48 @@ use std::path::Path; use serde::{Deserialize, Deserializer, Serialize}; +use ts_rs::TS; use crate::Id; -#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)] -pub struct AddressId(Id); -impl From for AddressId { +#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, TS)] +#[ts(export, type = "string")] +pub struct ServiceInterfaceId(Id); +impl From for ServiceInterfaceId { fn from(id: Id) -> Self { Self(id) } } -impl std::fmt::Display for AddressId { +impl std::fmt::Display for ServiceInterfaceId { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", &self.0) } } -impl std::ops::Deref for AddressId { +impl std::ops::Deref for ServiceInterfaceId { type Target = str; fn deref(&self) -> &Self::Target { &*self.0 } } -impl AsRef for AddressId { +impl AsRef for ServiceInterfaceId { fn as_ref(&self) -> &str { self.0.as_ref() } } -impl<'de> Deserialize<'de> for AddressId { +impl<'de> Deserialize<'de> for ServiceInterfaceId { fn deserialize(deserializer: D) -> Result where D: Deserializer<'de>, { - Ok(AddressId(Deserialize::deserialize(deserializer)?)) + Ok(ServiceInterfaceId(Deserialize::deserialize(deserializer)?)) } } -impl AsRef for AddressId { +impl AsRef for ServiceInterfaceId { fn as_ref(&self) -> &Path { self.0.as_ref().as_ref() } } -impl<'q> sqlx::Encode<'q, sqlx::Postgres> for AddressId { +impl<'q> sqlx::Encode<'q, sqlx::Postgres> for ServiceInterfaceId { fn encode_by_ref( &self, buf: &mut >::ArgumentBuffer, @@ -48,7 +50,7 @@ impl<'q> sqlx::Encode<'q, sqlx::Postgres> for AddressId { <&str as sqlx::Encode<'q, sqlx::Postgres>>::encode_by_ref(&&**self, buf) } } -impl sqlx::Type for AddressId { +impl sqlx::Type for ServiceInterfaceId { fn type_info() -> sqlx::postgres::PgTypeInfo { <&str as sqlx::Type>::type_info() } diff --git a/core/models/src/id/volume.rs b/core/models/src/id/volume.rs index 16821a3cf..7425c79c6 100644 --- a/core/models/src/id/volume.rs +++ b/core/models/src/id/volume.rs @@ -2,10 +2,12 @@ use std::borrow::Borrow; use std::path::Path; use serde::{Deserialize, Deserializer, Serialize}; +use ts_rs::TS; use crate::Id; -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, TS)] +#[ts(type = "string")] pub enum VolumeId { Backup, Custom(Id), diff --git a/core/startos/Cargo.toml b/core/startos/Cargo.toml index 301602e2d..d1a333447 100644 --- a/core/startos/Cargo.toml +++ b/core/startos/Cargo.toml @@ -41,6 +41,7 @@ default = ["cli", "daemon"] dev = [] unstable = ["console-subscriber", "tokio/tracing"] docker = [] +test = [] [dependencies] aes = { version = "0.7.5", features = ["ctr"] } @@ -70,11 +71,12 @@ current_platform = "0.2.0" digest = "0.10.7" divrem = "1.0.0" ed25519 = { version = "2.2.3", features = ["pkcs8", "pem", "alloc"] } -ed25519-dalek = { version = "2.0.0", features = [ +ed25519-dalek = { version = "2.1.1", features = [ "serde", "zeroize", "rand_core", "digest", + "pkcs8", ] } ed25519-dalek-v1 = { package = "ed25519-dalek", version = "1" } emver = { version = "0.1.7", git = "https://github.com/Start9Labs/emver-rs.git", features = [ @@ -174,7 +176,7 @@ tracing-futures = "0.2.5" tracing-journald = "0.3.0" tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } trust-dns-server = "0.23.1" -ts-rs = "8.1.0" +ts-rs = { git = "https://github.com/dr-bonez/ts-rs.git", branch = "feature/top-level-type-override" } # "8.1.0" typed-builder = "0.18.0" url = { version = "2.4.1", features = ["serde"] } urlencoding = "2.1.3" diff --git a/core/startos/bindings/BindKind.ts b/core/startos/bindings/ActionId.ts similarity index 67% rename from core/startos/bindings/BindKind.ts rename to core/startos/bindings/ActionId.ts index e026fb081..9bb1f9990 100644 --- a/core/startos/bindings/BindKind.ts +++ b/core/startos/bindings/ActionId.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type BindKind = "static" | "single" | "multi"; \ No newline at end of file +export type ActionId = string; diff --git a/core/startos/bindings/ActionMetadata.ts b/core/startos/bindings/ActionMetadata.ts index 91af02b7b..c9373a5b8 100644 --- a/core/startos/bindings/ActionMetadata.ts +++ b/core/startos/bindings/ActionMetadata.ts @@ -1,4 +1,12 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { AllowedStatuses } from "./AllowedStatuses"; -export type ActionMetadata = { name: string, description: string, warning: string | null, disabled: boolean, input: {[key: string]: any}, allowedStatuses: AllowedStatuses, group: string | null, }; \ No newline at end of file +export type ActionMetadata = { + name: string; + description: string; + warning: string | null; + input: any; + disabled: boolean; + allowedStatuses: AllowedStatuses; + group: string | null; +}; diff --git a/core/startos/bindings/AddSslOptions.ts b/core/startos/bindings/AddSslOptions.ts index f0f74fe03..984a1a7c6 100644 --- a/core/startos/bindings/AddSslOptions.ts +++ b/core/startos/bindings/AddSslOptions.ts @@ -1,3 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { AlpnInfo } from "./AlpnInfo"; -export type AddSslOptions = { scheme: string | null, preferredExternalPort: number, addXForwardedHeaders: boolean | null, }; \ No newline at end of file +export type AddSslOptions = { + scheme: string | null; + preferredExternalPort: number; + alpn: AlpnInfo; +}; diff --git a/core/startos/bindings/AddressInfo.ts b/core/startos/bindings/AddressInfo.ts index b253ab823..1355f72a2 100644 --- a/core/startos/bindings/AddressInfo.ts +++ b/core/startos/bindings/AddressInfo.ts @@ -1,4 +1,10 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { BindOptions } from "./BindOptions"; +import type { HostId } from "./HostId"; -export type AddressInfo = { username: string | null, hostId: string, bindOptions: BindOptions, suffix: string, }; \ No newline at end of file +export type AddressInfo = { + username: string | null; + hostId: HostId; + bindOptions: BindOptions; + suffix: string; +}; diff --git a/core/startos/bindings/Alerts.ts b/core/startos/bindings/Alerts.ts new file mode 100644 index 000000000..c6a671e83 --- /dev/null +++ b/core/startos/bindings/Alerts.ts @@ -0,0 +1,9 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Alerts = { + install: string | null; + uninstall: string | null; + restore: string | null; + start: string | null; + stop: string | null; +}; diff --git a/core/startos/bindings/Algorithm.ts b/core/startos/bindings/Algorithm.ts index d12447f04..877325fdf 100644 --- a/core/startos/bindings/Algorithm.ts +++ b/core/startos/bindings/Algorithm.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type Algorithm = "ecdsa" | "ed25519"; \ No newline at end of file +export type Algorithm = "ecdsa" | "ed25519"; diff --git a/core/startos/bindings/AllPackageData.ts b/core/startos/bindings/AllPackageData.ts new file mode 100644 index 000000000..c7698d10d --- /dev/null +++ b/core/startos/bindings/AllPackageData.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { PackageDataEntry } from "./PackageDataEntry"; +import type { PackageId } from "./PackageId"; + +export type AllPackageData = { [key: PackageId]: PackageDataEntry }; diff --git a/core/startos/bindings/AlpnInfo.ts b/core/startos/bindings/AlpnInfo.ts new file mode 100644 index 000000000..eac072fc0 --- /dev/null +++ b/core/startos/bindings/AlpnInfo.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { MaybeUtf8String } from "./MaybeUtf8String"; + +export type AlpnInfo = "reflect" | { specified: Array }; diff --git a/core/startos/bindings/HealthCheckString.ts b/core/startos/bindings/BackupProgress.ts similarity index 54% rename from core/startos/bindings/HealthCheckString.ts rename to core/startos/bindings/BackupProgress.ts index efe9f42bd..42812a7b7 100644 --- a/core/startos/bindings/HealthCheckString.ts +++ b/core/startos/bindings/BackupProgress.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type HealthCheckString = "passing" | "disabled" | "starting" | "warning" | "failure"; \ No newline at end of file +export type BackupProgress = { complete: boolean }; diff --git a/core/startos/bindings/BindInfo.ts b/core/startos/bindings/BindInfo.ts new file mode 100644 index 000000000..8bda6d37e --- /dev/null +++ b/core/startos/bindings/BindInfo.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BindOptions } from "./BindOptions"; + +export type BindInfo = { options: BindOptions; assignedLanPort: number | null }; diff --git a/core/startos/bindings/BindOptions.ts b/core/startos/bindings/BindOptions.ts index 997f2bd8b..6b12139a7 100644 --- a/core/startos/bindings/BindOptions.ts +++ b/core/startos/bindings/BindOptions.ts @@ -1,5 +1,10 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { AddSslOptions } from "./AddSslOptions"; -import type { BindOptionsSecure } from "./BindOptionsSecure"; +import type { Security } from "./Security"; -export type BindOptions = { scheme: string | null, preferredExternalPort: number, addSsl: AddSslOptions | null, secure: BindOptionsSecure | null, }; \ No newline at end of file +export type BindOptions = { + scheme: string | null; + preferredExternalPort: number; + addSsl: AddSslOptions | null; + secure: Security | null; +}; diff --git a/core/startos/bindings/BindParams.ts b/core/startos/bindings/BindParams.ts index 319666538..4aa78e522 100644 --- a/core/startos/bindings/BindParams.ts +++ b/core/startos/bindings/BindParams.ts @@ -1,6 +1,15 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { AddSslOptions } from "./AddSslOptions"; -import type { BindKind } from "./BindKind"; -import type { BindOptionsSecure } from "./BindOptionsSecure"; +import type { HostId } from "./HostId"; +import type { HostKind } from "./HostKind"; +import type { Security } from "./Security"; -export type BindParams = { kind: BindKind, id: string, internalPort: number, scheme: string, preferredExternalPort: number, addSsl: AddSslOptions | null, secure: BindOptionsSecure | null, }; \ No newline at end of file +export type BindParams = { + kind: HostKind; + id: HostId; + internalPort: number; + scheme: string | null; + preferredExternalPort: number; + addSsl: AddSslOptions | null; + secure: Security | null; +}; diff --git a/core/startos/bindings/Callback.ts b/core/startos/bindings/Callback.ts index 9c4cacab0..e6c5b004f 100644 --- a/core/startos/bindings/Callback.ts +++ b/core/startos/bindings/Callback.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type Callback = () => void; \ No newline at end of file +export type Callback = () => void; diff --git a/core/startos/bindings/ChrootParams.ts b/core/startos/bindings/ChrootParams.ts index d8d1b1b46..9ee6e8959 100644 --- a/core/startos/bindings/ChrootParams.ts +++ b/core/startos/bindings/ChrootParams.ts @@ -1,3 +1,10 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ChrootParams = { env: string | null, workdir: string | null, user: string | null, path: string, command: string, args: string[], }; \ No newline at end of file +export type ChrootParams = { + env: string | null; + workdir: string | null; + user: string | null; + path: string; + command: string; + args: string[]; +}; diff --git a/core/startos/bindings/CreateOverlayedImageParams.ts b/core/startos/bindings/CreateOverlayedImageParams.ts index 65e7487b6..d17f2e8c1 100644 --- a/core/startos/bindings/CreateOverlayedImageParams.ts +++ b/core/startos/bindings/CreateOverlayedImageParams.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type CreateOverlayedImageParams = { imageId: string, }; \ No newline at end of file +export type CreateOverlayedImageParams = { imageId: string }; diff --git a/core/startos/bindings/CurrentDependencies.ts b/core/startos/bindings/CurrentDependencies.ts new file mode 100644 index 000000000..75645e200 --- /dev/null +++ b/core/startos/bindings/CurrentDependencies.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { CurrentDependencyInfo } from "./CurrentDependencyInfo"; +import type { PackageId } from "./PackageId"; + +export type CurrentDependencies = { [key: PackageId]: CurrentDependencyInfo }; diff --git a/core/startos/bindings/CurrentDependencyInfo.ts b/core/startos/bindings/CurrentDependencyInfo.ts new file mode 100644 index 000000000..10112e312 --- /dev/null +++ b/core/startos/bindings/CurrentDependencyInfo.ts @@ -0,0 +1,9 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { DataUrl } from "./DataUrl"; + +export type CurrentDependencyInfo = { + title: string; + icon: DataUrl; + registryUrl: string; + versionSpec: string; +} & ({ kind: "exists" } | { kind: "running"; healthChecks: string[] }); diff --git a/core/startos/bindings/DataUrl.ts b/core/startos/bindings/DataUrl.ts new file mode 100644 index 000000000..65fa15059 --- /dev/null +++ b/core/startos/bindings/DataUrl.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type DataUrl = string; diff --git a/core/startos/bindings/DepInfo.ts b/core/startos/bindings/DepInfo.ts new file mode 100644 index 000000000..3c01e0939 --- /dev/null +++ b/core/startos/bindings/DepInfo.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type DepInfo = { description: string | null; optional: boolean }; diff --git a/core/startos/bindings/Dependencies.ts b/core/startos/bindings/Dependencies.ts new file mode 100644 index 000000000..974495b7b --- /dev/null +++ b/core/startos/bindings/Dependencies.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { DepInfo } from "./DepInfo"; +import type { PackageId } from "./PackageId"; + +export type Dependencies = { [key: PackageId]: DepInfo }; diff --git a/core/startos/bindings/DependencyConfigErrors.ts b/core/startos/bindings/DependencyConfigErrors.ts new file mode 100644 index 000000000..5f2246fa9 --- /dev/null +++ b/core/startos/bindings/DependencyConfigErrors.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { PackageId } from "./PackageId"; + +export type DependencyConfigErrors = { [key: PackageId]: string }; diff --git a/core/startos/bindings/DependencyKind.ts b/core/startos/bindings/DependencyKind.ts index 018562971..71fd49762 100644 --- a/core/startos/bindings/DependencyKind.ts +++ b/core/startos/bindings/DependencyKind.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type DependencyKind = "exists" | "running"; \ No newline at end of file +export type DependencyKind = "exists" | "running"; diff --git a/core/startos/bindings/DependencyRequirement.ts b/core/startos/bindings/DependencyRequirement.ts index 29e0b07fa..e6224ce48 100644 --- a/core/startos/bindings/DependencyRequirement.ts +++ b/core/startos/bindings/DependencyRequirement.ts @@ -1,3 +1,11 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type DependencyRequirement = { "kind": "running", id: string, healthChecks: string[], versionSpec: string, url: string, } | { "kind": "exists", id: string, versionSpec: string, url: string, }; +export type DependencyRequirement = + | { + kind: "running"; + id: string; + healthChecks: string[]; + versionSpec: string; + registryUrl: string; + } + | { kind: "exists"; id: string; versionSpec: string; registryUrl: string }; diff --git a/core/startos/bindings/Description.ts b/core/startos/bindings/Description.ts new file mode 100644 index 000000000..918bd09c5 --- /dev/null +++ b/core/startos/bindings/Description.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Description = { short: string; long: string }; diff --git a/core/startos/bindings/DestroyOverlayedImageParams.ts b/core/startos/bindings/DestroyOverlayedImageParams.ts index 34d4085a1..47671604a 100644 --- a/core/startos/bindings/DestroyOverlayedImageParams.ts +++ b/core/startos/bindings/DestroyOverlayedImageParams.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type DestroyOverlayedImageParams = { guid: string, }; \ No newline at end of file +export type DestroyOverlayedImageParams = { guid: string }; diff --git a/core/startos/bindings/Duration.ts b/core/startos/bindings/Duration.ts new file mode 100644 index 000000000..889c729b8 --- /dev/null +++ b/core/startos/bindings/Duration.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Duration = string; diff --git a/core/startos/bindings/ExecuteAction.ts b/core/startos/bindings/ExecuteAction.ts index 52636bdbc..aaa340747 100644 --- a/core/startos/bindings/ExecuteAction.ts +++ b/core/startos/bindings/ExecuteAction.ts @@ -1,3 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ExecuteAction = { serviceId: string | null, actionId: string, input: any, }; \ No newline at end of file +export type ExecuteAction = { + serviceId: string | null; + actionId: string; + input: any; +}; diff --git a/core/startos/bindings/ExportServiceInterfaceParams.ts b/core/startos/bindings/ExportServiceInterfaceParams.ts index ad7885507..93deb0ce5 100644 --- a/core/startos/bindings/ExportServiceInterfaceParams.ts +++ b/core/startos/bindings/ExportServiceInterfaceParams.ts @@ -2,4 +2,13 @@ import type { AddressInfo } from "./AddressInfo"; import type { ServiceInterfaceType } from "./ServiceInterfaceType"; -export type ExportServiceInterfaceParams = { id: string, name: string, description: string, hasPrimary: boolean, disabled: boolean, masked: boolean, addressInfo: AddressInfo, type: ServiceInterfaceType, }; \ No newline at end of file +export type ExportServiceInterfaceParams = { + id: string; + name: string; + description: string; + hasPrimary: boolean; + disabled: boolean; + masked: boolean; + addressInfo: AddressInfo; + type: ServiceInterfaceType; +}; diff --git a/core/startos/bindings/ExportedHostInfo.ts b/core/startos/bindings/ExportedHostInfo.ts new file mode 100644 index 000000000..d8339a074 --- /dev/null +++ b/core/startos/bindings/ExportedHostInfo.ts @@ -0,0 +1,10 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ExportedHostnameInfo } from "./ExportedHostnameInfo"; +import type { HostId } from "./HostId"; +import type { HostKind } from "./HostKind"; + +export type ExportedHostInfo = { + id: HostId; + kind: HostKind; + hostnames: Array; +}; diff --git a/core/startos/bindings/ExportedHostnameInfo.ts b/core/startos/bindings/ExportedHostnameInfo.ts new file mode 100644 index 000000000..23cbdd487 --- /dev/null +++ b/core/startos/bindings/ExportedHostnameInfo.ts @@ -0,0 +1,12 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ExportedIpHostname } from "./ExportedIpHostname"; +import type { ExportedOnionHostname } from "./ExportedOnionHostname"; + +export type ExportedHostnameInfo = + | { + kind: "ip"; + networkInterfaceId: string; + public: boolean; + hostname: ExportedIpHostname; + } + | { kind: "onion"; hostname: ExportedOnionHostname }; diff --git a/core/startos/bindings/ExportedIpHostname.ts b/core/startos/bindings/ExportedIpHostname.ts new file mode 100644 index 000000000..1e02ab2be --- /dev/null +++ b/core/startos/bindings/ExportedIpHostname.ts @@ -0,0 +1,18 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ExportedIpHostname = + | { kind: "ipv4"; value: string; port: number | null; sslPort: number | null } + | { kind: "ipv6"; value: string; port: number | null; sslPort: number | null } + | { + kind: "local"; + value: string; + port: number | null; + sslPort: number | null; + } + | { + kind: "domain"; + domain: string; + subdomain: string | null; + port: number | null; + sslPort: number | null; + }; diff --git a/core/startos/bindings/ExportedOnionHostname.ts b/core/startos/bindings/ExportedOnionHostname.ts new file mode 100644 index 000000000..af072289f --- /dev/null +++ b/core/startos/bindings/ExportedOnionHostname.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ExportedOnionHostname = { + value: string; + port: number | null; + sslPort: number | null; +}; diff --git a/core/startos/bindings/ExposeForDependentsParams.ts b/core/startos/bindings/ExposeForDependentsParams.ts index 9626f4dcf..714771c1e 100644 --- a/core/startos/bindings/ExposeForDependentsParams.ts +++ b/core/startos/bindings/ExposeForDependentsParams.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ExposeForDependentsParams = { paths: string[], }; \ No newline at end of file +export type ExposeForDependentsParams = { paths: string[] }; diff --git a/core/startos/bindings/ExposeUiParams.ts b/core/startos/bindings/ExposeUiParams.ts deleted file mode 100644 index 3c2230060..000000000 --- a/core/startos/bindings/ExposeUiParams.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ExposeUiParams = { "type": "object", value: {[key: string]: ExposeUiParams}, } | { "type": "string", path: string, description: string | null, masked: boolean, copyable: boolean | null, qr: boolean | null, }; \ No newline at end of file diff --git a/core/startos/bindings/ExposedUI.ts b/core/startos/bindings/ExposedUI.ts deleted file mode 100644 index bef4c8214..000000000 --- a/core/startos/bindings/ExposedUI.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ExposedUI = { "type": "object", value: {[key: string]: ExposedUI}, description: string | null, } | { "type": "string", path: string, description: string | null, masked: boolean, copyable: boolean | null, qr: boolean | null, }; \ No newline at end of file diff --git a/core/startos/bindings/FullProgress.ts b/core/startos/bindings/FullProgress.ts new file mode 100644 index 000000000..56f6a1a15 --- /dev/null +++ b/core/startos/bindings/FullProgress.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { NamedProgress } from "./NamedProgress"; +import type { Progress } from "./Progress"; + +export type FullProgress = { overall: Progress; phases: Array }; diff --git a/core/startos/bindings/GetHostInfoParams.ts b/core/startos/bindings/GetHostInfoParams.ts index 69abeeb13..7c2b1b6b6 100644 --- a/core/startos/bindings/GetHostInfoParams.ts +++ b/core/startos/bindings/GetHostInfoParams.ts @@ -2,4 +2,9 @@ import type { Callback } from "./Callback"; import type { GetHostInfoParamsKind } from "./GetHostInfoParamsKind"; -export type GetHostInfoParams = { kind: GetHostInfoParamsKind | null, serviceInterfaceId: string, packageId: string | null, callback: Callback, }; \ No newline at end of file +export type GetHostInfoParams = { + kind: GetHostInfoParamsKind | null; + serviceInterfaceId: string; + packageId: string | null; + callback: Callback; +}; diff --git a/core/startos/bindings/GetHostInfoParamsKind.ts b/core/startos/bindings/GetHostInfoParamsKind.ts index 6d401f685..6353044ce 100644 --- a/core/startos/bindings/GetHostInfoParamsKind.ts +++ b/core/startos/bindings/GetHostInfoParamsKind.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type GetHostInfoParamsKind = "multi"; \ No newline at end of file +export type GetHostInfoParamsKind = "multi"; diff --git a/core/startos/bindings/GetPrimaryUrlParams.ts b/core/startos/bindings/GetPrimaryUrlParams.ts index 6296d4342..c5aaa0ebe 100644 --- a/core/startos/bindings/GetPrimaryUrlParams.ts +++ b/core/startos/bindings/GetPrimaryUrlParams.ts @@ -1,4 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { Callback } from "./Callback"; -export type GetPrimaryUrlParams = { packageId: string | null, serviceInterfaceId: string, callback: Callback, }; \ No newline at end of file +export type GetPrimaryUrlParams = { + packageId: string | null; + serviceInterfaceId: string; + callback: Callback; +}; diff --git a/core/startos/bindings/GetServiceInterfaceParams.ts b/core/startos/bindings/GetServiceInterfaceParams.ts index 1eb2b6f28..03990c10b 100644 --- a/core/startos/bindings/GetServiceInterfaceParams.ts +++ b/core/startos/bindings/GetServiceInterfaceParams.ts @@ -1,4 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { Callback } from "./Callback"; -export type GetServiceInterfaceParams = { packageId: string | null, serviceInterfaceId: string, callback: Callback, }; \ No newline at end of file +export type GetServiceInterfaceParams = { + packageId: string | null; + serviceInterfaceId: string; + callback: Callback; +}; diff --git a/core/startos/bindings/GetServicePortForwardParams.ts b/core/startos/bindings/GetServicePortForwardParams.ts index dd4eaf211..3de7e0219 100644 --- a/core/startos/bindings/GetServicePortForwardParams.ts +++ b/core/startos/bindings/GetServicePortForwardParams.ts @@ -1,3 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type GetServicePortForwardParams = { packageId: string | null, internalPort: number, }; \ No newline at end of file +export type GetServicePortForwardParams = { + packageId: string | null; + internalPort: number; +}; diff --git a/core/startos/bindings/GetSslCertificateParams.ts b/core/startos/bindings/GetSslCertificateParams.ts index a4a2447cd..a1fd17bdd 100644 --- a/core/startos/bindings/GetSslCertificateParams.ts +++ b/core/startos/bindings/GetSslCertificateParams.ts @@ -1,4 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { Algorithm } from "./Algorithm"; -export type GetSslCertificateParams = { packageId: string | null, hostId: string, algorithm: Algorithm | null, }; \ No newline at end of file +export type GetSslCertificateParams = { + packageId: string | null; + hostId: string; + algorithm: Algorithm | null; +}; diff --git a/core/startos/bindings/GetSslKeyParams.ts b/core/startos/bindings/GetSslKeyParams.ts index eb36cd2f5..8c5170c9c 100644 --- a/core/startos/bindings/GetSslKeyParams.ts +++ b/core/startos/bindings/GetSslKeyParams.ts @@ -1,4 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { Algorithm } from "./Algorithm"; -export type GetSslKeyParams = { packageId: string | null, hostId: string, algorithm: Algorithm | null, }; \ No newline at end of file +export type GetSslKeyParams = { + packageId: string | null; + hostId: string; + algorithm: Algorithm | null; +}; diff --git a/core/startos/bindings/GetStoreParams.ts b/core/startos/bindings/GetStoreParams.ts index 6b965e75f..bfd97377b 100644 --- a/core/startos/bindings/GetStoreParams.ts +++ b/core/startos/bindings/GetStoreParams.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type GetStoreParams = { packageId: string | null, path: string, }; \ No newline at end of file +export type GetStoreParams = { packageId: string | null; path: string }; diff --git a/core/startos/bindings/GetSystemSmtpParams.ts b/core/startos/bindings/GetSystemSmtpParams.ts index 25d30529f..b96b9f595 100644 --- a/core/startos/bindings/GetSystemSmtpParams.ts +++ b/core/startos/bindings/GetSystemSmtpParams.ts @@ -1,4 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { Callback } from "./Callback"; -export type GetSystemSmtpParams = { callback: Callback, }; \ No newline at end of file +export type GetSystemSmtpParams = { callback: Callback }; diff --git a/core/startos/bindings/Governor.ts b/core/startos/bindings/Governor.ts new file mode 100644 index 000000000..82c9e39f1 --- /dev/null +++ b/core/startos/bindings/Governor.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Governor = string; diff --git a/core/startos/bindings/HardwareRequirements.ts b/core/startos/bindings/HardwareRequirements.ts new file mode 100644 index 000000000..079483289 --- /dev/null +++ b/core/startos/bindings/HardwareRequirements.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HardwareRequirements = { + device: { [key: string]: string }; + ram: bigint | null; + arch: Array | null; +}; diff --git a/core/startos/bindings/HealthCheckId.ts b/core/startos/bindings/HealthCheckId.ts new file mode 100644 index 000000000..eeefafbb1 --- /dev/null +++ b/core/startos/bindings/HealthCheckId.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HealthCheckId = string; diff --git a/core/startos/bindings/HealthCheckResult.ts b/core/startos/bindings/HealthCheckResult.ts new file mode 100644 index 000000000..ae4d3c3c2 --- /dev/null +++ b/core/startos/bindings/HealthCheckResult.ts @@ -0,0 +1,9 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HealthCheckResult = { name: string } & ( + | { result: "success"; message: string | null } + | { result: "disabled"; message: string | null } + | { result: "starting"; message: string | null } + | { result: "loading"; message: string } + | { result: "failure"; message: string } +); diff --git a/core/startos/bindings/Host.ts b/core/startos/bindings/Host.ts new file mode 100644 index 000000000..4188cb404 --- /dev/null +++ b/core/startos/bindings/Host.ts @@ -0,0 +1,11 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BindInfo } from "./BindInfo"; +import type { HostAddress } from "./HostAddress"; +import type { HostKind } from "./HostKind"; + +export type Host = { + kind: HostKind; + bindings: { [key: number]: BindInfo }; + addresses: Array; + primary: HostAddress | null; +}; diff --git a/core/startos/bindings/HostAddress.ts b/core/startos/bindings/HostAddress.ts new file mode 100644 index 000000000..9cddf778b --- /dev/null +++ b/core/startos/bindings/HostAddress.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HostAddress = { kind: "onion"; address: string }; diff --git a/core/startos/bindings/HostId.ts b/core/startos/bindings/HostId.ts new file mode 100644 index 000000000..23049a51d --- /dev/null +++ b/core/startos/bindings/HostId.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HostId = string; diff --git a/core/startos/bindings/HostInfo.ts b/core/startos/bindings/HostInfo.ts new file mode 100644 index 000000000..b69dbf6b4 --- /dev/null +++ b/core/startos/bindings/HostInfo.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Host } from "./Host"; +import type { HostId } from "./HostId"; + +export type HostInfo = { [key: HostId]: Host }; diff --git a/core/startos/bindings/HostKind.ts b/core/startos/bindings/HostKind.ts new file mode 100644 index 000000000..09e61b91b --- /dev/null +++ b/core/startos/bindings/HostKind.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HostKind = "multi"; diff --git a/core/startos/bindings/ImageId.ts b/core/startos/bindings/ImageId.ts new file mode 100644 index 000000000..408331f72 --- /dev/null +++ b/core/startos/bindings/ImageId.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ImageId = string; diff --git a/core/startos/bindings/InstalledState.ts b/core/startos/bindings/InstalledState.ts new file mode 100644 index 000000000..053c3ae66 --- /dev/null +++ b/core/startos/bindings/InstalledState.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Manifest } from "./Manifest"; + +export type InstalledState = { manifest: Manifest }; diff --git a/core/startos/bindings/InstallingInfo.ts b/core/startos/bindings/InstallingInfo.ts new file mode 100644 index 000000000..7627f4502 --- /dev/null +++ b/core/startos/bindings/InstallingInfo.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { FullProgress } from "./FullProgress"; +import type { Manifest } from "./Manifest"; + +export type InstallingInfo = { newManifest: Manifest; progress: FullProgress }; diff --git a/core/startos/bindings/InstallingState.ts b/core/startos/bindings/InstallingState.ts new file mode 100644 index 000000000..3203cfd6b --- /dev/null +++ b/core/startos/bindings/InstallingState.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { InstallingInfo } from "./InstallingInfo"; + +export type InstallingState = { installingInfo: InstallingInfo }; diff --git a/core/startos/bindings/IpInfo.ts b/core/startos/bindings/IpInfo.ts new file mode 100644 index 000000000..1208fafb9 --- /dev/null +++ b/core/startos/bindings/IpInfo.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type IpInfo = { + ipv4Range: string | null; + ipv4: string | null; + ipv6Range: string | null; + ipv6: string | null; +}; diff --git a/core/startos/bindings/ListServiceInterfacesParams.ts b/core/startos/bindings/ListServiceInterfacesParams.ts index cd889b149..03d1cdfc8 100644 --- a/core/startos/bindings/ListServiceInterfacesParams.ts +++ b/core/startos/bindings/ListServiceInterfacesParams.ts @@ -1,4 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { Callback } from "./Callback"; -export type ListServiceInterfacesParams = { packageId: string | null, callback: Callback, }; \ No newline at end of file +export type ListServiceInterfacesParams = { + packageId: string | null; + callback: Callback; +}; diff --git a/core/startos/bindings/MainStatus.ts b/core/startos/bindings/MainStatus.ts new file mode 100644 index 000000000..878213087 --- /dev/null +++ b/core/startos/bindings/MainStatus.ts @@ -0,0 +1,20 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Duration } from "./Duration"; +import type { HealthCheckId } from "./HealthCheckId"; +import type { HealthCheckResult } from "./HealthCheckResult"; + +export type MainStatus = + | { status: "stopped" } + | { status: "restarting" } + | { status: "stopping"; timeout: Duration } + | { status: "starting" } + | { + status: "running"; + started: string; + health: { [key: HealthCheckId]: HealthCheckResult }; + } + | { + status: "backingUp"; + started: string | null; + health: { [key: HealthCheckId]: HealthCheckResult }; + }; diff --git a/core/startos/bindings/Manifest.ts b/core/startos/bindings/Manifest.ts new file mode 100644 index 000000000..688486a7d --- /dev/null +++ b/core/startos/bindings/Manifest.ts @@ -0,0 +1,32 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Alerts } from "./Alerts"; +import type { Dependencies } from "./Dependencies"; +import type { Description } from "./Description"; +import type { HardwareRequirements } from "./HardwareRequirements"; +import type { ImageId } from "./ImageId"; +import type { PackageId } from "./PackageId"; +import type { VolumeId } from "./VolumeId"; + +export type Manifest = { + id: PackageId; + title: string; + version: string; + releaseNotes: string; + license: string; + replaces: Array; + wrapperRepo: string; + upstreamRepo: string; + supportSite: string; + marketingSite: string; + donationUrl: string | null; + description: Description; + images: Array; + assets: Array; + volumes: Array; + alerts: Alerts; + dependencies: Dependencies; + hardwareRequirements: HardwareRequirements; + gitHash: string | null; + osVersion: string; + hasConfig: boolean; +}; diff --git a/core/startos/bindings/MaybeUtf8String.ts b/core/startos/bindings/MaybeUtf8String.ts new file mode 100644 index 000000000..a77f8ce4e --- /dev/null +++ b/core/startos/bindings/MaybeUtf8String.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type MaybeUtf8String = string | number[]; diff --git a/core/startos/bindings/MountParams.ts b/core/startos/bindings/MountParams.ts index 4f8615a25..daa4ddf32 100644 --- a/core/startos/bindings/MountParams.ts +++ b/core/startos/bindings/MountParams.ts @@ -1,4 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { MountTarget } from "./MountTarget"; -export type MountParams = { location: string, target: MountTarget, }; \ No newline at end of file +export type MountParams = { location: string; target: MountTarget }; diff --git a/core/startos/bindings/MountTarget.ts b/core/startos/bindings/MountTarget.ts index 6a28ec3ac..3009861fb 100644 --- a/core/startos/bindings/MountTarget.ts +++ b/core/startos/bindings/MountTarget.ts @@ -1,3 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type MountTarget = { packageId: string, volumeId: string, subpath: string | null, readonly: boolean, }; \ No newline at end of file +export type MountTarget = { + packageId: string; + volumeId: string; + subpath: string | null; + readonly: boolean; +}; diff --git a/core/startos/bindings/NamedProgress.ts b/core/startos/bindings/NamedProgress.ts new file mode 100644 index 000000000..42104c48b --- /dev/null +++ b/core/startos/bindings/NamedProgress.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Progress } from "./Progress"; + +export type NamedProgress = { name: string; progress: Progress }; diff --git a/core/startos/bindings/PackageDataEntry.ts b/core/startos/bindings/PackageDataEntry.ts new file mode 100644 index 000000000..8b906bb90 --- /dev/null +++ b/core/startos/bindings/PackageDataEntry.ts @@ -0,0 +1,26 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ActionId } from "./ActionId"; +import type { ActionMetadata } from "./ActionMetadata"; +import type { CurrentDependencies } from "./CurrentDependencies"; +import type { DataUrl } from "./DataUrl"; +import type { HostInfo } from "./HostInfo"; +import type { PackageState } from "./PackageState"; +import type { ServiceInterfaceId } from "./ServiceInterfaceId"; +import type { ServiceInterfaceWithHostInfo } from "./ServiceInterfaceWithHostInfo"; +import type { Status } from "./Status"; + +export type PackageDataEntry = { + stateInfo: PackageState; + status: Status; + marketplaceUrl: string | null; + developerKey: string; + icon: DataUrl; + lastBackup: string | null; + currentDependencies: CurrentDependencies; + actions: { [key: ActionId]: ActionMetadata }; + serviceInterfaces: { + [key: ServiceInterfaceId]: ServiceInterfaceWithHostInfo; + }; + hosts: HostInfo; + storeExposedDependents: string[]; +}; diff --git a/core/startos/bindings/PackageId.ts b/core/startos/bindings/PackageId.ts new file mode 100644 index 000000000..349bf44d7 --- /dev/null +++ b/core/startos/bindings/PackageId.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type PackageId = string; diff --git a/core/startos/bindings/PackageState.ts b/core/startos/bindings/PackageState.ts new file mode 100644 index 000000000..6c90bff09 --- /dev/null +++ b/core/startos/bindings/PackageState.ts @@ -0,0 +1,11 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { InstalledState } from "./InstalledState"; +import type { InstallingState } from "./InstallingState"; +import type { UpdatingState } from "./UpdatingState"; + +export type PackageState = + | ({ state: "installing" } & InstallingState) + | ({ state: "restoring" } & InstallingState) + | ({ state: "updating" } & UpdatingState) + | ({ state: "installed" } & InstalledState) + | ({ state: "removing" } & InstalledState); diff --git a/core/startos/bindings/ParamsMaybePackageId.ts b/core/startos/bindings/ParamsMaybePackageId.ts index 867eb2a51..e9f0f170c 100644 --- a/core/startos/bindings/ParamsMaybePackageId.ts +++ b/core/startos/bindings/ParamsMaybePackageId.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ParamsMaybePackageId = { packageId: string | null, }; \ No newline at end of file +export type ParamsMaybePackageId = { packageId: string | null }; diff --git a/core/startos/bindings/ParamsPackageId.ts b/core/startos/bindings/ParamsPackageId.ts index aa3caec92..7bc919843 100644 --- a/core/startos/bindings/ParamsPackageId.ts +++ b/core/startos/bindings/ParamsPackageId.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ParamsPackageId = { packageId: string, }; \ No newline at end of file +export type ParamsPackageId = { packageId: string }; diff --git a/core/startos/bindings/Progress.ts b/core/startos/bindings/Progress.ts new file mode 100644 index 000000000..c8e5e4431 --- /dev/null +++ b/core/startos/bindings/Progress.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Progress = boolean | { done: number; total: number | null }; diff --git a/core/startos/bindings/Public.ts b/core/startos/bindings/Public.ts new file mode 100644 index 000000000..442176303 --- /dev/null +++ b/core/startos/bindings/Public.ts @@ -0,0 +1,9 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { AllPackageData } from "./AllPackageData"; +import type { ServerInfo } from "./ServerInfo"; + +export type Public = { + serverInfo: ServerInfo; + packageData: AllPackageData; + ui: any; +}; diff --git a/core/startos/bindings/RemoveActionParams.ts b/core/startos/bindings/RemoveActionParams.ts index ae2faccbe..fcd567c3f 100644 --- a/core/startos/bindings/RemoveActionParams.ts +++ b/core/startos/bindings/RemoveActionParams.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type RemoveActionParams = { id: string, }; \ No newline at end of file +export type RemoveActionParams = { id: string }; diff --git a/core/startos/bindings/RemoveAddressParams.ts b/core/startos/bindings/RemoveAddressParams.ts index 2b9881ce1..578631d39 100644 --- a/core/startos/bindings/RemoveAddressParams.ts +++ b/core/startos/bindings/RemoveAddressParams.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type RemoveAddressParams = { id: string, }; \ No newline at end of file +export type RemoveAddressParams = { id: string }; diff --git a/core/startos/bindings/ReverseProxyBind.ts b/core/startos/bindings/ReverseProxyBind.ts index 6c2d5a586..c9d67b127 100644 --- a/core/startos/bindings/ReverseProxyBind.ts +++ b/core/startos/bindings/ReverseProxyBind.ts @@ -1,3 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ReverseProxyBind = { ip: string | null, port: number, ssl: boolean, }; \ No newline at end of file +export type ReverseProxyBind = { + ip: string | null; + port: number; + ssl: boolean; +}; diff --git a/core/startos/bindings/ReverseProxyDestination.ts b/core/startos/bindings/ReverseProxyDestination.ts index 8786f1008..216d1310f 100644 --- a/core/startos/bindings/ReverseProxyDestination.ts +++ b/core/startos/bindings/ReverseProxyDestination.ts @@ -1,3 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ReverseProxyDestination = { ip: string | null, port: number, ssl: boolean, }; \ No newline at end of file +export type ReverseProxyDestination = { + ip: string | null; + port: number; + ssl: boolean; +}; diff --git a/core/startos/bindings/ReverseProxyHttp.ts b/core/startos/bindings/ReverseProxyHttp.ts index f7b652e6a..07cf41862 100644 --- a/core/startos/bindings/ReverseProxyHttp.ts +++ b/core/startos/bindings/ReverseProxyHttp.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ReverseProxyHttp = { headers: null | {[key: string]: string}, }; \ No newline at end of file +export type ReverseProxyHttp = { headers: null | { [key: string]: string } }; diff --git a/core/startos/bindings/ReverseProxyParams.ts b/core/startos/bindings/ReverseProxyParams.ts index bc6d3016c..6f684b780 100644 --- a/core/startos/bindings/ReverseProxyParams.ts +++ b/core/startos/bindings/ReverseProxyParams.ts @@ -3,4 +3,8 @@ import type { ReverseProxyBind } from "./ReverseProxyBind"; import type { ReverseProxyDestination } from "./ReverseProxyDestination"; import type { ReverseProxyHttp } from "./ReverseProxyHttp"; -export type ReverseProxyParams = { bind: ReverseProxyBind, dst: ReverseProxyDestination, http: ReverseProxyHttp, }; \ No newline at end of file +export type ReverseProxyParams = { + bind: ReverseProxyBind; + dst: ReverseProxyDestination; + http: ReverseProxyHttp; +}; diff --git a/core/startos/bindings/Security.ts b/core/startos/bindings/Security.ts new file mode 100644 index 000000000..e722707df --- /dev/null +++ b/core/startos/bindings/Security.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Security = { ssl: boolean }; diff --git a/core/startos/bindings/ServerInfo.ts b/core/startos/bindings/ServerInfo.ts new file mode 100644 index 000000000..e505c84e7 --- /dev/null +++ b/core/startos/bindings/ServerInfo.ts @@ -0,0 +1,35 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Governor } from "./Governor"; +import type { IpInfo } from "./IpInfo"; +import type { ServerStatus } from "./ServerStatus"; +import type { WifiInfo } from "./WifiInfo"; + +export type ServerInfo = { + arch: string; + platform: string; + id: string; + hostname: string; + version: string; + lastBackup: string | null; + /** + * Used in the wifi to determine the region to set the system to + */ + lastWifiRegion: string | null; + eosVersionCompat: string; + lanAddress: string; + onionAddress: string; + /** + * for backwards compatibility + */ + torAddress: string; + ipInfo: { [key: string]: IpInfo }; + statusInfo: ServerStatus; + wifi: WifiInfo; + unreadNotificationCount: number; + passwordHash: string; + pubkey: string; + caFingerprint: string; + ntpSynced: boolean; + zram: boolean; + governor: Governor | null; +}; diff --git a/core/startos/bindings/ServerSpecs.ts b/core/startos/bindings/ServerSpecs.ts new file mode 100644 index 000000000..b2278873c --- /dev/null +++ b/core/startos/bindings/ServerSpecs.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ServerSpecs = { cpu: string; disk: string; memory: string }; diff --git a/core/startos/bindings/ServerStatus.ts b/core/startos/bindings/ServerStatus.ts new file mode 100644 index 000000000..e72d5d6de --- /dev/null +++ b/core/startos/bindings/ServerStatus.ts @@ -0,0 +1,12 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BackupProgress } from "./BackupProgress"; +import type { PackageId } from "./PackageId"; +import type { UpdateProgress } from "./UpdateProgress"; + +export type ServerStatus = { + backupProgress: { [key: PackageId]: BackupProgress } | null; + updated: boolean; + updateProgress: UpdateProgress | null; + shuttingDown: boolean; + restarting: boolean; +}; diff --git a/core/startos/bindings/ServiceInterface.ts b/core/startos/bindings/ServiceInterface.ts new file mode 100644 index 000000000..4167257bb --- /dev/null +++ b/core/startos/bindings/ServiceInterface.ts @@ -0,0 +1,15 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { AddressInfo } from "./AddressInfo"; +import type { ServiceInterfaceId } from "./ServiceInterfaceId"; +import type { ServiceInterfaceType } from "./ServiceInterfaceType"; + +export type ServiceInterface = { + id: ServiceInterfaceId; + name: string; + description: string; + hasPrimary: boolean; + disabled: boolean; + masked: boolean; + addressInfo: AddressInfo; + type: ServiceInterfaceType; +}; diff --git a/core/startos/bindings/ServiceInterfaceId.ts b/core/startos/bindings/ServiceInterfaceId.ts new file mode 100644 index 000000000..55315ab60 --- /dev/null +++ b/core/startos/bindings/ServiceInterfaceId.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ServiceInterfaceId = string; diff --git a/core/startos/bindings/ServiceInterfaceType.ts b/core/startos/bindings/ServiceInterfaceType.ts index 74372d4ad..fadd11f9d 100644 --- a/core/startos/bindings/ServiceInterfaceType.ts +++ b/core/startos/bindings/ServiceInterfaceType.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type ServiceInterfaceType = "ui" | "p2p" | "api"; \ No newline at end of file +export type ServiceInterfaceType = "ui" | "p2p" | "api"; diff --git a/core/startos/bindings/ServiceInterfaceWithHostInfo.ts b/core/startos/bindings/ServiceInterfaceWithHostInfo.ts new file mode 100644 index 000000000..bef83abe2 --- /dev/null +++ b/core/startos/bindings/ServiceInterfaceWithHostInfo.ts @@ -0,0 +1,17 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { AddressInfo } from "./AddressInfo"; +import type { ExportedHostInfo } from "./ExportedHostInfo"; +import type { ServiceInterfaceId } from "./ServiceInterfaceId"; +import type { ServiceInterfaceType } from "./ServiceInterfaceType"; + +export type ServiceInterfaceWithHostInfo = { + hostInfo: ExportedHostInfo; + id: ServiceInterfaceId; + name: string; + description: string; + hasPrimary: boolean; + disabled: boolean; + masked: boolean; + addressInfo: AddressInfo; + type: ServiceInterfaceType; +}; diff --git a/core/startos/bindings/SetConfigured.ts b/core/startos/bindings/SetConfigured.ts index 8f191b562..ff9eaf11d 100644 --- a/core/startos/bindings/SetConfigured.ts +++ b/core/startos/bindings/SetConfigured.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type SetConfigured = { configured: boolean, }; \ No newline at end of file +export type SetConfigured = { configured: boolean }; diff --git a/core/startos/bindings/SetDependenciesParams.ts b/core/startos/bindings/SetDependenciesParams.ts index b313b0718..d4d2d45cb 100644 --- a/core/startos/bindings/SetDependenciesParams.ts +++ b/core/startos/bindings/SetDependenciesParams.ts @@ -1,4 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { DependencyRequirement } from "./DependencyRequirement"; -export type SetDependenciesParams = { dependencies: Array, }; \ No newline at end of file +export type SetDependenciesParams = { + dependencies: Array; +}; diff --git a/core/startos/bindings/SetHealth.ts b/core/startos/bindings/SetHealth.ts index 321b5c97b..8a4a1bcff 100644 --- a/core/startos/bindings/SetHealth.ts +++ b/core/startos/bindings/SetHealth.ts @@ -1,4 +1,10 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { HealthCheckString } from "./HealthCheckString"; +import type { HealthCheckId } from "./HealthCheckId"; -export type SetHealth = { name: string, status: HealthCheckString, message: string | null, }; \ No newline at end of file +export type SetHealth = { id: HealthCheckId; name: string } & ( + | { result: "success"; message: string | null } + | { result: "disabled"; message: string | null } + | { result: "starting"; message: string | null } + | { result: "loading"; message: string } + | { result: "failure"; message: string } +); diff --git a/core/startos/bindings/SetMainStatus.ts b/core/startos/bindings/SetMainStatus.ts index 0476ff4ce..653342e5f 100644 --- a/core/startos/bindings/SetMainStatus.ts +++ b/core/startos/bindings/SetMainStatus.ts @@ -1,4 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { Status } from "./Status"; -export type SetMainStatus = { status: Status, }; \ No newline at end of file +export type SetMainStatus = { status: Status }; diff --git a/core/startos/bindings/SetStoreParams.ts b/core/startos/bindings/SetStoreParams.ts index e3496a171..8737295bd 100644 --- a/core/startos/bindings/SetStoreParams.ts +++ b/core/startos/bindings/SetStoreParams.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type SetStoreParams = { value: any, path: string, }; \ No newline at end of file +export type SetStoreParams = { value: any; path: string }; diff --git a/core/startos/bindings/Status.ts b/core/startos/bindings/Status.ts index fdfaea244..e23c5b4be 100644 --- a/core/startos/bindings/Status.ts +++ b/core/startos/bindings/Status.ts @@ -1,3 +1,9 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { DependencyConfigErrors } from "./DependencyConfigErrors"; +import type { MainStatus } from "./MainStatus"; -export type Status = "running" | "stopped"; \ No newline at end of file +export type Status = { + configured: boolean; + main: MainStatus; + dependencyConfigErrors: DependencyConfigErrors; +}; diff --git a/core/startos/bindings/UpdateProgress.ts b/core/startos/bindings/UpdateProgress.ts new file mode 100644 index 000000000..3d07c56b4 --- /dev/null +++ b/core/startos/bindings/UpdateProgress.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type UpdateProgress = { size: number | null; downloaded: number }; diff --git a/core/startos/bindings/UpdatingState.ts b/core/startos/bindings/UpdatingState.ts new file mode 100644 index 000000000..37a83f0df --- /dev/null +++ b/core/startos/bindings/UpdatingState.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { InstallingInfo } from "./InstallingInfo"; +import type { Manifest } from "./Manifest"; + +export type UpdatingState = { + manifest: Manifest; + installingInfo: InstallingInfo; +}; diff --git a/core/startos/bindings/VolumeId.ts b/core/startos/bindings/VolumeId.ts new file mode 100644 index 000000000..e5c63994e --- /dev/null +++ b/core/startos/bindings/VolumeId.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type VolumeId = string; diff --git a/core/startos/bindings/WifiInfo.ts b/core/startos/bindings/WifiInfo.ts new file mode 100644 index 000000000..c949b1e76 --- /dev/null +++ b/core/startos/bindings/WifiInfo.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type WifiInfo = { + ssids: Array; + selected: string | null; + connected: string | null; +}; diff --git a/core/startos/src/db/mod.rs b/core/startos/src/db/mod.rs index 874733ca6..99602ba5a 100644 --- a/core/startos/src/db/mod.rs +++ b/core/startos/src/db/mod.rs @@ -206,7 +206,7 @@ async fn cli_dump( from_value::( ctx.call_remote( "db.dump", - imbl_value::json!({ "include-private":include_private }), + imbl_value::json!({ "includePrivate":include_private }), ) .await?, )? diff --git a/core/startos/src/db/model/mod.rs b/core/startos/src/db/model/mod.rs index cae1bfe51..9be0f8b68 100644 --- a/core/startos/src/db/model/mod.rs +++ b/core/startos/src/db/model/mod.rs @@ -2,6 +2,7 @@ use std::collections::BTreeMap; use patch_db::HasModel; use serde::{Deserialize, Serialize}; +use ts_rs::TS; use crate::account::AccountInfo; use crate::auth::Sessions; diff --git a/core/startos/src/db/model/package.rs b/core/startos/src/db/model/package.rs index 05d6e73b7..83a35d086 100644 --- a/core/startos/src/db/model/package.rs +++ b/core/startos/src/db/model/package.rs @@ -3,7 +3,7 @@ use std::collections::{BTreeMap, BTreeSet}; use chrono::{DateTime, Utc}; use emver::VersionRange; use imbl_value::InternedString; -use models::{DataUrl, HealthCheckId, HostId, PackageId}; +use models::{ActionId, DataUrl, HealthCheckId, HostId, PackageId, ServiceInterfaceId}; use patch_db::json_ptr::JsonPointer; use patch_db::HasModel; use reqwest::Url; @@ -11,12 +11,15 @@ use serde::{Deserialize, Serialize}; use ts_rs::TS; use crate::net::host::HostInfo; +use crate::net::service_interface::ServiceInterfaceWithHostInfo; use crate::prelude::*; use crate::progress::FullProgress; use crate::s9pk::manifest::Manifest; use crate::status::Status; +use crate::util::serde::Pem; -#[derive(Debug, Default, Deserialize, Serialize)] +#[derive(Debug, Default, Deserialize, Serialize, TS)] +#[ts(export)] pub struct AllPackageData(pub BTreeMap); impl Map for AllPackageData { type Key = PackageId; @@ -35,10 +38,11 @@ pub enum ManifestPreference { New, } -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[serde(tag = "state")] #[model = "Model"] +#[ts(export)] pub enum PackageState { Installing(InstallingState), Restoring(InstallingState), @@ -257,53 +261,81 @@ impl Model { } } -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct InstallingState { pub installing_info: InstallingInfo, } -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct UpdatingState { pub manifest: Manifest, pub installing_info: InstallingInfo, } -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct InstalledState { pub manifest: Manifest, } -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct InstallingInfo { pub new_manifest: Manifest, pub progress: FullProgress, } +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] +#[ts(export)] +#[serde(rename_all = "camelCase")] +pub enum AllowedStatuses { + OnlyRunning, // onlyRunning + OnlyStopped, + Any, +} -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Clone, Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +pub struct ActionMetadata { + pub name: String, + pub description: String, + pub warning: Option, + #[ts(type = "any")] + pub input: Value, + pub disabled: bool, + pub allowed_statuses: AllowedStatuses, + pub group: Option, +} + +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] +#[serde(rename_all = "camelCase")] +#[model = "Model"] +#[ts(export)] pub struct PackageDataEntry { pub state_info: PackageState, pub status: Status, + #[ts(type = "string | null")] pub marketplace_url: Option, - #[serde(default)] - #[serde(with = "crate::util::serde::ed25519_pubkey")] - pub developer_key: ed25519_dalek::VerifyingKey, + #[ts(type = "string")] + pub developer_key: Pem, pub icon: DataUrl<'static>, + #[ts(type = "string | null")] pub last_backup: Option>, - pub dependency_info: BTreeMap, pub current_dependencies: CurrentDependencies, - pub interface_addresses: InterfaceAddressMap, + pub actions: BTreeMap, + pub service_interfaces: BTreeMap, pub hosts: HostInfo, - pub store_exposed_ui: StoreExposedUI, + #[ts(type = "string[]")] pub store_exposed_dependents: Vec, } impl AsRef for PackageDataEntry { @@ -312,52 +344,8 @@ impl AsRef for PackageDataEntry { } } -#[derive(Debug, Deserialize, Serialize, HasModel)] -#[model = "Model"] -pub struct ExposedDependent { - path: String, - title: String, - description: Option, - masked: Option, - copyable: Option, - qr: Option, -} -#[derive(Default, Debug, Clone, serde::Serialize, serde::Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct StoreExposedUI(pub BTreeMap); - -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] -#[serde(rename_all = "camelCase")] -#[serde(tag = "type")] +#[derive(Debug, Clone, Default, Deserialize, Serialize, TS)] #[ts(export)] -pub enum ExposedUI { - Object { - #[ts(type = "{[key: string]: ExposedUI}")] - value: BTreeMap, - #[serde(default)] - #[ts(type = "string | null")] - description: String, - }, - String { - #[ts(type = "string")] - path: JsonPointer, - description: Option, - masked: bool, - copyable: Option, - qr: Option, - }, -} - -impl Default for ExposedUI { - fn default() -> Self { - ExposedUI::Object { - value: BTreeMap::new(), - description: "".to_string(), - } - } -} - -#[derive(Debug, Clone, Default, Deserialize, Serialize)] pub struct CurrentDependencies(pub BTreeMap); impl CurrentDependencies { pub fn map( @@ -381,31 +369,26 @@ impl Map for CurrentDependencies { } } -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Clone, Debug, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] -#[model = "Model"] -pub struct StaticDependencyInfo { +pub struct CurrentDependencyInfo { + #[serde(flatten)] + pub kind: CurrentDependencyKind, pub title: String, pub icon: DataUrl<'static>, + #[ts(type = "string")] + pub registry_url: Url, + #[ts(type = "string")] + pub version_spec: VersionRange, } #[derive(Clone, Debug, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] #[serde(tag = "kind")] -pub enum CurrentDependencyInfo { - #[serde(rename_all = "camelCase")] - Exists { - #[ts(type = "string")] - url: Url, - #[ts(type = "string")] - version_spec: VersionRange, - }, +pub enum CurrentDependencyKind { + Exists, #[serde(rename_all = "camelCase")] Running { - #[ts(type = "string")] - url: Url, - #[ts(type = "string")] - version_spec: VersionRange, #[serde(default)] #[ts(type = "string[]")] health_checks: BTreeSet, diff --git a/core/startos/src/db/model/public.rs b/core/startos/src/db/model/public.rs index d618f8d33..d1eec5443 100644 --- a/core/startos/src/db/model/public.rs +++ b/core/startos/src/db/model/public.rs @@ -13,6 +13,7 @@ use patch_db::{HasModel, Value}; use reqwest::Url; use serde::{Deserialize, Serialize}; use torut::onion::OnionAddressV3; +use ts_rs::TS; use crate::account::AccountInfo; use crate::db::model::package::AllPackageData; @@ -23,13 +24,14 @@ use crate::util::Version; use crate::version::{Current, VersionT}; use crate::{ARCH, PLATFORM}; -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] -// #[macro_debug] +#[ts(export)] pub struct Public { pub server_info: ServerInfo, pub package_data: AllPackageData, + #[ts(type = "any")] pub ui: Value, } impl Public { @@ -64,10 +66,6 @@ impl Public { selected: None, }, unread_notification_count: 0, - connection_addresses: ConnectionAddresses { - tor: Vec::new(), - clearnet: Vec::new(), - }, password_hash: account.password.clone(), pubkey: ssh_key::PublicKey::from(&account.ssh_key) .to_openssh() @@ -101,31 +99,41 @@ fn get_platform() -> InternedString { (&*PLATFORM).into() } -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct ServerInfo { #[serde(default = "get_arch")] + #[ts(type = "string")] pub arch: InternedString, #[serde(default = "get_platform")] + #[ts(type = "string")] pub platform: InternedString, pub id: String, pub hostname: String, + #[ts(type = "string")] pub version: Version, + #[ts(type = "string | null")] pub last_backup: Option>, /// Used in the wifi to determine the region to set the system to + #[ts(type = "string | null")] pub last_wifi_region: Option, + #[ts(type = "string")] pub eos_version_compat: VersionRange, + #[ts(type = "string")] pub lan_address: Url, + #[ts(type = "string")] pub onion_address: OnionAddressV3, /// for backwards compatibility + #[ts(type = "string")] pub tor_address: Url, pub ip_info: BTreeMap, #[serde(default)] pub status_info: ServerStatus, pub wifi: WifiInfo, + #[ts(type = "number")] pub unread_notification_count: u64, - pub connection_addresses: ConnectionAddresses, pub password_hash: String, pub pubkey: String, pub ca_fingerprint: String, @@ -136,12 +144,15 @@ pub struct ServerInfo { pub governor: Option, } -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct IpInfo { + #[ts(type = "string | null")] pub ipv4_range: Option, pub ipv4: Option, + #[ts(type = "string | null")] pub ipv6_range: Option, pub ipv6: Option, } @@ -158,15 +169,17 @@ impl IpInfo { } } -#[derive(Debug, Default, Deserialize, Serialize, HasModel)] +#[derive(Debug, Default, Deserialize, Serialize, HasModel, TS)] #[model = "Model"] +#[ts(export)] pub struct BackupProgress { pub complete: bool, } -#[derive(Debug, Default, Deserialize, Serialize, HasModel)] +#[derive(Debug, Default, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct ServerStatus { pub backup_progress: Option>, pub updated: bool, @@ -177,34 +190,32 @@ pub struct ServerStatus { pub restarting: bool, } -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct UpdateProgress { + #[ts(type = "number | null")] pub size: Option, + #[ts(type = "number")] pub downloaded: u64, } -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct WifiInfo { pub ssids: Vec, pub selected: Option, pub connected: Option, } -#[derive(Debug, Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] +#[ts(export)] pub struct ServerSpecs { pub cpu: String, pub disk: String, pub memory: String, } - -#[derive(Debug, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct ConnectionAddresses { - pub tor: Vec, - pub clearnet: Vec, -} diff --git a/core/startos/src/dependencies.rs b/core/startos/src/dependencies.rs index ca40bf432..d973688e9 100644 --- a/core/startos/src/dependencies.rs +++ b/core/startos/src/dependencies.rs @@ -2,18 +2,16 @@ use std::collections::BTreeMap; use std::time::Duration; use clap::Parser; -use emver::VersionRange; -use models::{OptionExt, PackageId}; +use models::PackageId; use rpc_toolkit::{command, from_fn_async, Empty, HandlerExt, ParentHandler}; use serde::{Deserialize, Serialize}; use tracing::instrument; +use ts_rs::TS; use crate::config::{Config, ConfigSpec, ConfigureContext}; use crate::context::RpcContext; use crate::db::model::package::CurrentDependencies; -use crate::db::model::Database; use crate::prelude::*; -use crate::s9pk::manifest::Manifest; use crate::status::DependencyConfigErrors; use crate::Error; @@ -21,8 +19,9 @@ pub fn dependency() -> ParentHandler { ParentHandler::new().subcommand("configure", configure()) } -#[derive(Clone, Debug, Default, Deserialize, Serialize, HasModel)] +#[derive(Clone, Debug, Default, Deserialize, Serialize, HasModel, TS)] #[model = "Model"] +#[ts(export)] pub struct Dependencies(pub BTreeMap); impl Map for Dependencies { type Key = PackageId; @@ -35,27 +34,13 @@ impl Map for Dependencies { } } -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -#[serde(tag = "type")] -pub enum DependencyRequirement { - OptIn { how: String }, - OptOut { how: String }, - Required, -} -impl DependencyRequirement { - pub fn required(&self) -> bool { - matches!(self, &DependencyRequirement::Required) - } -} - -#[derive(Clone, Debug, Deserialize, Serialize, HasModel)] +#[derive(Clone, Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct DepInfo { - pub version: VersionRange, - pub requirement: DependencyRequirement, pub description: Option, + pub optional: bool, } #[derive(Deserialize, Serialize, Parser)] diff --git a/core/startos/src/net/host/address.rs b/core/startos/src/net/host/address.rs index 6f3ff6df2..cb3b485f6 100644 --- a/core/startos/src/net/host/address.rs +++ b/core/startos/src/net/host/address.rs @@ -1,9 +1,14 @@ use serde::{Deserialize, Serialize}; use torut::onion::OnionAddressV3; +use ts_rs::TS; -#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, PartialOrd, Ord, TS)] #[serde(rename_all = "camelCase")] #[serde(tag = "kind")] +#[ts(export)] pub enum HostAddress { - Onion { address: OnionAddressV3 }, + Onion { + #[ts(type = "string")] + address: OnionAddressV3, + }, } diff --git a/core/startos/src/net/host/binding.rs b/core/startos/src/net/host/binding.rs index 0584b517b..8301821f5 100644 --- a/core/startos/src/net/host/binding.rs +++ b/core/startos/src/net/host/binding.rs @@ -1,12 +1,14 @@ use imbl_value::InternedString; use serde::{Deserialize, Serialize}; +use ts_rs::TS; use crate::net::forward::AvailablePorts; use crate::net::vhost::AlpnInfo; use crate::prelude::*; -#[derive(Debug, Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] +#[ts(export)] pub struct BindInfo { pub options: BindOptions, pub assigned_lan_port: Option, @@ -14,7 +16,7 @@ pub struct BindInfo { impl BindInfo { pub fn new(available_ports: &mut AvailablePorts, options: BindOptions) -> Result { let mut assigned_lan_port = None; - if options.add_ssl.is_some() || options.secure { + if options.add_ssl.is_some() || options.secure.is_some() { assigned_lan_port = Some(available_ports.alloc()?); } Ok(Self { @@ -31,7 +33,7 @@ impl BindInfo { mut assigned_lan_port, .. } = self; - if options.add_ssl.is_some() || options.secure { + if options.add_ssl.is_some() || options.secure.is_some() { assigned_lan_port = if let Some(port) = assigned_lan_port.take() { Some(port) } else { @@ -49,20 +51,30 @@ impl BindInfo { } } -#[derive(Debug, Deserialize, Serialize)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] +#[ts(export)] #[serde(rename_all = "camelCase")] -pub struct BindOptions { - pub scheme: InternedString, - pub preferred_external_port: u16, - pub add_ssl: Option, - pub secure: bool, +pub struct Security { pub ssl: bool, } -#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)] +#[derive(Clone, Debug, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] +#[ts(export)] +pub struct BindOptions { + #[ts(type = "string | null")] + pub scheme: Option, + pub preferred_external_port: u16, + pub add_ssl: Option, + pub secure: Option, +} + +#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export)] pub struct AddSslOptions { - pub scheme: InternedString, + #[ts(type = "string | null")] + pub scheme: Option, pub preferred_external_port: u16, // #[serde(default)] // pub add_x_forwarded_headers: bool, // TODO diff --git a/core/startos/src/net/host/mod.rs b/core/startos/src/net/host/mod.rs index 18b86ba0e..2d50df15a 100644 --- a/core/startos/src/net/host/mod.rs +++ b/core/startos/src/net/host/mod.rs @@ -3,6 +3,7 @@ use std::collections::{BTreeMap, BTreeSet}; use imbl_value::InternedString; use models::HostId; use serde::{Deserialize, Serialize}; +use ts_rs::TS; use crate::net::forward::AvailablePorts; use crate::net::host::address::HostAddress; @@ -12,9 +13,10 @@ use crate::prelude::*; pub mod address; pub mod binding; -#[derive(Debug, Deserialize, Serialize, HasModel)] +#[derive(Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct Host { pub kind: HostKind, pub bindings: BTreeMap, @@ -37,16 +39,18 @@ impl Host { } } -#[derive(Debug, Deserialize, Serialize)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] +#[ts(export)] pub enum HostKind { Multi, // Single, // Static, } -#[derive(Debug, Default, Deserialize, Serialize, HasModel)] +#[derive(Debug, Default, Deserialize, Serialize, HasModel, TS)] #[model = "Model"] +#[ts(export)] pub struct HostInfo(BTreeMap); impl Map for HostInfo { diff --git a/core/startos/src/net/mod.rs b/core/startos/src/net/mod.rs index f6e5ddee5..aaf019e66 100644 --- a/core/startos/src/net/mod.rs +++ b/core/startos/src/net/mod.rs @@ -7,6 +7,7 @@ pub mod host; pub mod keys; pub mod mdns; pub mod net_controller; +pub mod service_interface; pub mod ssl; pub mod static_server; pub mod tor; diff --git a/core/startos/src/net/net_controller.rs b/core/startos/src/net/net_controller.rs index c9338cdff..a4c9ea507 100644 --- a/core/startos/src/net/net_controller.rs +++ b/core/startos/src/net/net_controller.rs @@ -247,7 +247,7 @@ impl NetService { None, external, (self.ip, *port).into(), - if bind.options.ssl { + if bind.options.secure.as_ref().map_or(false, |s| s.ssl) { Ok(()) } else { Err(ssl.alpn.clone()) diff --git a/core/startos/src/net/service_interface.rs b/core/startos/src/net/service_interface.rs new file mode 100644 index 000000000..9a4659cfd --- /dev/null +++ b/core/startos/src/net/service_interface.rs @@ -0,0 +1,115 @@ +use std::net::{Ipv4Addr, Ipv6Addr}; + +use models::{HostId, ServiceInterfaceId}; +use serde::{Deserialize, Serialize}; +use ts_rs::TS; + +use crate::net::host::binding::BindOptions; +use crate::net::host::HostKind; +use crate::prelude::*; + +#[derive(Clone, Debug, Deserialize, Serialize, TS)] +#[ts(export)] +#[serde(rename_all = "camelCase")] +pub struct ServiceInterfaceWithHostInfo { + #[serde(flatten)] + pub service_interface: ServiceInterface, + pub host_info: ExportedHostInfo, +} + +#[derive(Clone, Debug, Deserialize, Serialize, TS)] +#[ts(export)] +#[serde(rename_all = "camelCase")] +pub struct ExportedHostInfo { + pub id: HostId, + pub kind: HostKind, + pub hostnames: Vec, +} + +#[derive(Clone, Debug, Deserialize, Serialize, TS)] +#[ts(export)] +#[serde(rename_all = "camelCase")] +#[serde(rename_all_fields = "camelCase")] +#[serde(tag = "kind")] +pub enum ExportedHostnameInfo { + Ip { + network_interface_id: String, + public: bool, + hostname: ExportedIpHostname, + }, + Onion { + hostname: ExportedOnionHostname, + }, +} + +#[derive(Clone, Debug, Deserialize, Serialize, TS)] +#[ts(export)] +#[serde(rename_all = "camelCase")] +pub struct ExportedOnionHostname { + pub value: String, + pub port: Option, + pub ssl_port: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize, TS)] +#[ts(export)] +#[serde(rename_all = "camelCase")] +#[serde(rename_all_fields = "camelCase")] +#[serde(tag = "kind")] +pub enum ExportedIpHostname { + Ipv4 { + value: Ipv4Addr, + port: Option, + ssl_port: Option, + }, + Ipv6 { + value: Ipv6Addr, + port: Option, + ssl_port: Option, + }, + Local { + value: String, + port: Option, + ssl_port: Option, + }, + Domain { + domain: String, + subdomain: Option, + port: Option, + ssl_port: Option, + }, +} + +#[derive(Clone, Debug, Deserialize, Serialize, TS)] +#[ts(export)] +#[serde(rename_all = "camelCase")] +pub struct ServiceInterface { + pub id: ServiceInterfaceId, + pub name: String, + pub description: String, + pub has_primary: bool, + pub disabled: bool, + pub masked: bool, + pub address_info: AddressInfo, + #[serde(rename = "type")] + pub interface_type: ServiceInterfaceType, +} + +#[derive(Clone, Debug, Deserialize, Serialize, TS)] +#[ts(export)] +#[serde(rename_all = "camelCase")] +pub enum ServiceInterfaceType { + Ui, + P2p, + Api, +} + +#[derive(Clone, Debug, Deserialize, Serialize, TS)] +#[ts(export)] +#[serde(rename_all = "camelCase")] +pub struct AddressInfo { + pub username: Option, + pub host_id: HostId, + pub bind_options: BindOptions, + pub suffix: String, +} diff --git a/core/startos/src/net/static_server.rs b/core/startos/src/net/static_server.rs index e8207e3bf..fa71672b3 100644 --- a/core/startos/src/net/static_server.rs +++ b/core/startos/src/net/static_server.rs @@ -14,7 +14,7 @@ use futures::future::ready; use http::header::ACCEPT_ENCODING; use http::request::Parts as RequestParts; use http::{HeaderMap, Method, StatusCode}; -use include_dir::{include_dir, Dir}; +use include_dir::Dir; use new_mime_guess::MimeGuess; use openssl::hash::MessageDigest; use openssl::x509::X509; @@ -33,11 +33,15 @@ use crate::middleware::db::SyncDb; use crate::middleware::diagnostic::DiagnosticMode; use crate::{diagnostic_api, install_api, main_api, setup_api, Error, ErrorKind, ResultExt}; -static NOT_FOUND: &[u8] = b"Not Found"; -static METHOD_NOT_ALLOWED: &[u8] = b"Method Not Allowed"; -static NOT_AUTHORIZED: &[u8] = b"Not Authorized"; +const NOT_FOUND: &[u8] = b"Not Found"; +const METHOD_NOT_ALLOWED: &[u8] = b"Method Not Allowed"; +const NOT_AUTHORIZED: &[u8] = b"Not Authorized"; -static EMBEDDED_UIS: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/../../web/dist/static"); +#[cfg(all(feature = "daemon", not(feature = "test")))] +const EMBEDDED_UIS: Dir<'_> = + include_dir::include_dir!("$CARGO_MANIFEST_DIR/../../web/dist/static"); +#[cfg(not(all(feature = "daemon", not(feature = "test"))))] +const EMBEDDED_UIS: Dir<'_> = Dir::new("", &[]); const PROXY_STRIP_HEADERS: &[&str] = &["cookie", "host", "origin", "referer", "user-agent"]; diff --git a/core/startos/src/net/vhost.rs b/core/startos/src/net/vhost.rs index 88cb759a0..46838ed51 100644 --- a/core/startos/src/net/vhost.rs +++ b/core/startos/src/net/vhost.rs @@ -17,6 +17,7 @@ use tokio_rustls::rustls::server::Acceptor; use tokio_rustls::rustls::{RootCertStore, ServerConfig}; use tokio_rustls::{LazyConfigAcceptor, TlsConnector}; use tracing::instrument; +use ts_rs::TS; use crate::prelude::*; use crate::util::io::{BackTrackingReader, TimeoutStream}; @@ -80,8 +81,9 @@ struct TargetInfo { connect_ssl: Result<(), AlpnInfo>, } -#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize)] +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] +#[ts(export)] pub enum AlpnInfo { Reflect, Specified(Vec), diff --git a/core/startos/src/progress.rs b/core/startos/src/progress.rs index 38e66a419..eec637575 100644 --- a/core/startos/src/progress.rs +++ b/core/startos/src/progress.rs @@ -9,6 +9,7 @@ use itertools::Itertools; use serde::{Deserialize, Serialize}; use tokio::io::{AsyncSeek, AsyncWrite}; use tokio::sync::{mpsc, watch}; +use ts_rs::TS; use crate::db::model::DatabaseModel; use crate::prelude::*; @@ -19,11 +20,16 @@ lazy_static::lazy_static! { static ref BYTES: ProgressStyle = ProgressStyle::with_template("{spinner} {wide_msg} [{bytes}/?] [{binary_bytes_per_sec} {elapsed}]").unwrap(); } -#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, PartialOrd, Ord, TS)] #[serde(untagged)] pub enum Progress { Complete(bool), - Progress { done: u64, total: Option }, + Progress { + #[ts(type = "number")] + done: u64, + #[ts(type = "number | null")] + total: Option, + }, } impl Progress { pub fn new() -> Self { @@ -126,13 +132,16 @@ impl std::ops::AddAssign for Progress { } } -#[derive(Debug, Clone, Deserialize, Serialize)] +#[derive(Debug, Clone, Deserialize, Serialize, TS)] +#[ts(export)] pub struct NamedProgress { + #[ts(type = "string")] pub name: InternedString, pub progress: Progress, } -#[derive(Debug, Clone, Deserialize, Serialize)] +#[derive(Debug, Clone, Deserialize, Serialize, TS)] +#[ts(export)] pub struct FullProgress { pub overall: Progress, pub phases: Vec, diff --git a/core/startos/src/properties.rs b/core/startos/src/properties.rs index 5482bdb58..5aa8a01d4 100644 --- a/core/startos/src/properties.rs +++ b/core/startos/src/properties.rs @@ -1,13 +1,10 @@ -use std::{borrow::Borrow, collections::BTreeMap}; - use clap::Parser; -use imbl_value::{json, InOMap, InternedString, Value}; +use imbl_value::Value; use models::PackageId; use rpc_toolkit::command; use serde::{Deserialize, Serialize}; use crate::context::RpcContext; -use crate::db::model::package::{ExposedUI, StoreExposedUI}; use crate::prelude::*; use crate::Error; diff --git a/core/startos/src/s9pk/v1/manifest.rs b/core/startos/src/s9pk/v1/manifest.rs index 813ad11a6..ef346ad2b 100644 --- a/core/startos/src/s9pk/v1/manifest.rs +++ b/core/startos/src/s9pk/v1/manifest.rs @@ -1,6 +1,7 @@ use std::collections::BTreeMap; use std::path::{Path, PathBuf}; +use emver::VersionRange; use imbl_value::InOMap; pub use models::PackageId; use models::VolumeId; @@ -8,7 +9,6 @@ use serde::{Deserialize, Serialize}; use url::Url; use super::git_hash::GitHash; -use crate::dependencies::Dependencies; use crate::prelude::*; use crate::s9pk::manifest::{Alerts, Description, HardwareRequirements}; use crate::util::Version; @@ -43,7 +43,7 @@ pub struct Manifest { pub alerts: Alerts, pub volumes: BTreeMap, #[serde(default)] - pub dependencies: Dependencies, + pub dependencies: BTreeMap, pub config: Option>, #[serde(default)] @@ -53,6 +53,29 @@ pub struct Manifest { pub hardware_requirements: HardwareRequirements, } +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +#[serde(tag = "type")] +pub enum DependencyRequirement { + OptIn { how: String }, + OptOut { how: String }, + Required, +} +impl DependencyRequirement { + pub fn required(&self) -> bool { + matches!(self, &DependencyRequirement::Required) + } +} + +#[derive(Clone, Debug, Deserialize, Serialize, HasModel)] +#[serde(rename_all = "camelCase")] +#[model = "Model"] +pub struct DepInfo { + pub version: VersionRange, + pub requirement: DependencyRequirement, + pub description: Option, +} + #[derive(Clone, Debug, Default, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Assets { diff --git a/core/startos/src/s9pk/v2/compat.rs b/core/startos/src/s9pk/v2/compat.rs index 423491e7a..5a98538dc 100644 --- a/core/startos/src/s9pk/v2/compat.rs +++ b/core/startos/src/s9pk/v2/compat.rs @@ -7,6 +7,7 @@ use tokio::fs::File; use tokio::io::{AsyncRead, AsyncSeek, AsyncWriteExt}; use tokio::process::Command; +use crate::dependencies::{DepInfo, Dependencies}; use crate::prelude::*; use crate::s9pk::manifest::Manifest; use crate::s9pk::merkle_archive::directory_contents::DirectoryContents; @@ -347,7 +348,21 @@ impl From for Manifest { .map(|(id, _)| id.clone()) .collect(), alerts: value.alerts, - dependencies: value.dependencies, + dependencies: Dependencies( + value + .dependencies + .into_iter() + .map(|(id, value)| { + ( + id, + DepInfo { + description: value.description, + optional: !value.requirement.required(), + }, + ) + }) + .collect(), + ), hardware_requirements: value.hardware_requirements, git_hash: value.git_hash, os_version: value.eos_version, diff --git a/core/startos/src/s9pk/v2/manifest.rs b/core/startos/src/s9pk/v2/manifest.rs index 119bbb466..ea4524400 100644 --- a/core/startos/src/s9pk/v2/manifest.rs +++ b/core/startos/src/s9pk/v2/manifest.rs @@ -5,6 +5,7 @@ use helpers::const_true; pub use models::PackageId; use models::{ImageId, VolumeId}; use serde::{Deserialize, Serialize}; +use ts_rs::TS; use url::Url; use crate::dependencies::Dependencies; @@ -18,21 +19,28 @@ fn current_version() -> Version { Current::new().semver().into() } -#[derive(Clone, Debug, Deserialize, Serialize, HasModel)] +#[derive(Clone, Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct Manifest { pub id: PackageId, pub title: String, + #[ts(type = "string")] pub version: Version, pub release_notes: String, pub license: String, // type of license #[serde(default)] pub replaces: Vec, + #[ts(type = "string")] pub wrapper_repo: Url, + #[ts(type = "string")] pub upstream_repo: Url, + #[ts(type = "string")] pub support_site: Url, + #[ts(type = "string")] pub marketing_site: Url, + #[ts(type = "string | null")] pub donation_url: Option, pub description: Description, pub images: Vec, @@ -45,23 +53,28 @@ pub struct Manifest { #[serde(default)] pub hardware_requirements: HardwareRequirements, #[serde(default)] + #[ts(type = "string | null")] pub git_hash: Option, #[serde(default = "current_version")] + #[ts(type = "string")] pub os_version: Version, #[serde(default = "const_true")] pub has_config: bool, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] +#[ts(export)] pub struct HardwareRequirements { #[serde(default)] + #[ts(type = "{ [key: string]: string }")] device: BTreeMap, ram: Option, pub arch: Option>, } -#[derive(Clone, Debug, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, Serialize, TS)] +#[ts(export)] pub struct Description { pub short: String, pub long: String, @@ -84,8 +97,9 @@ impl Description { } } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, Serialize, TS)] #[serde(rename_all = "camelCase")] +#[ts(export)] pub struct Alerts { pub install: Option, pub uninstall: Option, diff --git a/core/startos/src/service/mod.rs b/core/startos/src/service/mod.rs index 2feb4ca34..a10857c5a 100644 --- a/core/startos/src/service/mod.rs +++ b/core/startos/src/service/mod.rs @@ -12,7 +12,6 @@ use serde::{Deserialize, Serialize}; use start_stop::StartStop; use tokio::sync::Notify; -use crate::action::ActionResult; use crate::config::action::ConfigRes; use crate::context::{CliContext, RpcContext}; use crate::core::rpc_continuations::RequestGuid; @@ -30,6 +29,7 @@ use crate::status::health_check::HealthCheckResult; use crate::status::MainStatus; use crate::util::actor::{Actor, BackgroundJobs, SimpleActor}; use crate::volume::data_dir; +use crate::{action::ActionResult, util::serde::Pem}; pub mod cli; mod config; @@ -280,7 +280,7 @@ impl Service { entry .as_state_info_mut() .ser(&PackageState::Installed(InstalledState { manifest }))?; - entry.as_developer_key_mut().ser(&developer_key)?; + entry.as_developer_key_mut().ser(&Pem::new(developer_key))?; entry.as_icon_mut().ser(&icon)?; // TODO: marketplace url // TODO: dependency info diff --git a/core/startos/src/service/persistent_container.rs b/core/startos/src/service/persistent_container.rs index a3756b37a..038661ace 100644 --- a/core/startos/src/service/persistent_container.rs +++ b/core/startos/src/service/persistent_container.rs @@ -116,6 +116,16 @@ impl PersistentContainer { .await?; let mut volumes = BTreeMap::new(); for volume in &s9pk.as_manifest().volumes { + let mountpoint = lxc_container + .rootfs_dir() + .join("media/startos/volumes") + .join(volume); + tokio::fs::create_dir_all(&mountpoint).await?; + Command::new("chown") + .arg("100000:100000") + .arg(&mountpoint) + .invoke(crate::ErrorKind::Filesystem) + .await?; let mount = MountGuard::mount( &IdMapped::new( Bind::new(data_dir(&ctx.datadir, &s9pk.as_manifest().id, volume)), @@ -123,10 +133,7 @@ impl PersistentContainer { 100000, 65536, ), - lxc_container - .rootfs_dir() - .join("media/startos/volumes") - .join(volume), + mountpoint, MountType::ReadWrite, ) .await?; @@ -134,6 +141,16 @@ impl PersistentContainer { } let mut assets = BTreeMap::new(); for asset in &s9pk.as_manifest().assets { + let mountpoint = lxc_container + .rootfs_dir() + .join("media/startos/assets") + .join(asset); + tokio::fs::create_dir_all(&mountpoint).await?; + Command::new("chown") + .arg("100000:100000") + .arg(&mountpoint) + .invoke(crate::ErrorKind::Filesystem) + .await?; assets.insert( asset.clone(), MountGuard::mount( @@ -145,10 +162,7 @@ impl PersistentContainer { ) .join(asset), ), - lxc_container - .rootfs_dir() - .join("media/startos/assets") - .join(asset), + mountpoint, MountType::ReadWrite, ) .await?, diff --git a/core/startos/src/service/service_effect_handler.rs b/core/startos/src/service/service_effect_handler.rs index b3eaf365c..4041cbb98 100644 --- a/core/startos/src/service/service_effect_handler.rs +++ b/core/startos/src/service/service_effect_handler.rs @@ -11,7 +11,7 @@ use clap::Parser; use emver::VersionRange; use imbl::OrdMap; use imbl_value::{json, InternedString}; -use models::{ActionId, HealthCheckId, ImageId, PackageId, VolumeId}; +use models::{ActionId, HealthCheckId, HostId, ImageId, PackageId, VolumeId}; use patch_db::json_ptr::JsonPointer; use rpc_toolkit::{from_fn, from_fn_async, AnyContext, Context, Empty, HandlerExt, ParentHandler}; use serde::{Deserialize, Serialize}; @@ -20,16 +20,18 @@ use ts_rs::TS; use url::Url; use crate::db::model::package::{ - CurrentDependencies, CurrentDependencyInfo, ExposedUI, StoreExposedUI, + ActionMetadata, CurrentDependencies, CurrentDependencyInfo, CurrentDependencyKind, }; use crate::disk::mount::filesystem::idmapped::IdMapped; use crate::disk::mount::filesystem::loop_dev::LoopDev; use crate::disk::mount::filesystem::overlayfs::OverlayGuard; +use crate::net::host::binding::BindOptions; +use crate::net::host::HostKind; use crate::prelude::*; use crate::s9pk::rpc::SKIP_ENV; use crate::service::cli::ContainerCliContext; use crate::service::ServiceActorSeed; -use crate::status::health_check::{HealthCheckResult, HealthCheckString}; +use crate::status::health_check::HealthCheckResult; use crate::status::MainStatus; use crate::util::clap::FromStrParser; use crate::util::{new_guid, Invoke}; @@ -114,7 +116,6 @@ pub fn service_effect_handler() -> ParentHandler { "exposeForDependents", from_fn_async(expose_for_dependents).no_cli(), ) - .subcommand("exposeUi", from_fn_async(expose_ui).no_cli()) .subcommand( "createOverlayedImage", from_fn_async(create_overlayed_image) @@ -186,21 +187,7 @@ struct GetServicePortForwardParams { package_id: Option, internal_port: u32, } -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] -#[ts(export)] -#[serde(rename_all = "camelCase")] -struct BindOptionsSecure { - ssl: bool, -} -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] -#[ts(export)] -#[serde(rename_all = "camelCase")] -struct BindOptions { - scheme: Option, - preferred_external_port: u32, - add_ssl: Option, - secure: Option, -} + #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] #[ts(export)] #[serde(rename_all = "camelCase")] @@ -255,14 +242,6 @@ struct ListServiceInterfacesParams { struct RemoveAddressParams { id: String, } -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] -#[ts(export)] -#[serde(rename_all = "camelCase")] -enum AllowedStatuses { - OnlyRunning, // onlyRunning - OnlyStopped, - Any, -} #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] #[ts(export)] @@ -275,21 +254,9 @@ struct ExportActionParams { #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] #[ts(export)] #[serde(rename_all = "camelCase")] -struct ActionMetadata { - name: String, - description: String, - warning: Option, - disabled: bool, - #[ts(type = "{[key: string]: any}")] - input: Value, - allowed_statuses: AllowedStatuses, - group: Option, -} -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] -#[ts(export)] -#[serde(rename_all = "camelCase")] struct RemoveActionParams { - id: String, + #[ts(type = "string")] + id: ActionId, } #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] #[ts(export)] @@ -388,11 +355,48 @@ async fn list_service_interfaces( async fn remove_address(context: EffectContext, data: RemoveAddressParams) -> Result { todo!() } -async fn export_action(context: EffectContext, data: ExportActionParams) -> Result { - todo!() +async fn export_action(context: EffectContext, data: ExportActionParams) -> Result<(), Error> { + let context = context.deref()?; + let package_id = context.id.clone(); + context + .ctx + .db + .mutate(|db| { + let model = db + .as_public_mut() + .as_package_data_mut() + .as_idx_mut(&package_id) + .or_not_found(&package_id)? + .as_actions_mut(); + let mut value = model.de()?; + value + .insert(data.id, data.metadata) + .map(|_| ()) + .unwrap_or_default(); + model.ser(&value) + }) + .await?; + Ok(()) } -async fn remove_action(context: EffectContext, data: RemoveActionParams) -> Result { - todo!() +async fn remove_action(context: EffectContext, data: RemoveActionParams) -> Result<(), Error> { + let context = context.deref()?; + let package_id = context.id.clone(); + context + .ctx + .db + .mutate(|db| { + let model = db + .as_public_mut() + .as_package_data_mut() + .as_idx_mut(&package_id) + .or_not_found(&package_id)? + .as_actions_mut(); + let mut value = model.de()?; + value.remove(&data.id).map(|_| ()).unwrap_or_default(); + model.ser(&value) + }) + .await?; + Ok(()) } async fn reverse_proxy(context: EffectContext, data: ReverseProxyParams) -> Result { todo!() @@ -431,35 +435,16 @@ async fn get_host_info( async fn clear_bindings(context: EffectContext, _: Empty) -> Result { todo!() } -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] -#[serde(rename_all = "camelCase")] -#[ts(export)] -enum BindKind { - Static, - Single, - Multi, -} -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] -#[serde(rename_all = "camelCase")] -#[ts(export)] - -struct AddSslOptions { - scheme: Option, - preferred_external_port: u32, - add_x_forwarded_headers: Option, -} #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, TS)] #[serde(rename_all = "camelCase")] #[ts(export)] struct BindParams { - kind: BindKind, - id: String, - internal_port: u32, - scheme: String, - preferred_external_port: u32, - add_ssl: Option, - secure: Option, + kind: HostKind, + id: HostId, + internal_port: u16, + #[serde(flatten)] + options: BindOptions, } async fn bind(_: AnyContext, BindParams { .. }: BindParams) -> Result { todo!() @@ -699,23 +684,6 @@ async fn expose_for_dependents( Ok(()) } -async fn expose_ui(context: EffectContext, params: StoreExposedUI) -> Result<(), Error> { - let context = context.deref()?; - let package_id = context.id.clone(); - context - .ctx - .db - .mutate(|db| { - db.as_public_mut() - .as_package_data_mut() - .as_idx_mut(&package_id) - .or_not_found(&package_id)? - .as_store_exposed_ui_mut() - .ser(¶ms) - }) - .await?; - Ok(()) -} #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Parser, TS)] #[ts(export)] #[serde(rename_all = "camelCase")] @@ -919,19 +887,14 @@ async fn set_main_status(context: EffectContext, params: SetMainStatus) -> Resul #[serde(rename_all = "camelCase")] #[ts(export)] struct SetHealth { - #[ts(type = "string")] - name: HealthCheckId, - status: HealthCheckString, - message: Option, + id: HealthCheckId, + #[serde(flatten)] + result: HealthCheckResult, } async fn set_health( context: EffectContext, - SetHealth { - name, - status, - message, - }: SetHealth, + SetHealth { id, result }: SetHealth, ) -> Result { let context = context.deref()?; @@ -940,43 +903,22 @@ async fn set_health( .ctx .db .mutate(move |db| { - let mut main = db - .as_public() - .as_package_data() - .as_idx(package_id) - .or_not_found(package_id)? - .as_status() - .as_main() - .de()?; - match &mut main { - &mut MainStatus::Running { ref mut health, .. } - | &mut MainStatus::BackingUp { ref mut health, .. } => { - health.remove(&name); - - health.insert( - name, - match status { - HealthCheckString::Disabled => HealthCheckResult::Disabled, - HealthCheckString::Passing => HealthCheckResult::Success, - HealthCheckString::Starting => HealthCheckResult::Starting, - HealthCheckString::Warning => HealthCheckResult::Loading { - message: message.unwrap_or_default(), - }, - HealthCheckString::Failure => HealthCheckResult::Failure { - error: message.unwrap_or_default(), - }, - }, - ); - } - _ => return Ok(()), - }; db.as_public_mut() .as_package_data_mut() .as_idx_mut(package_id) .or_not_found(package_id)? .as_status_mut() .as_main_mut() - .ser(&main) + .mutate(|main| { + match main { + &mut MainStatus::Running { ref mut health, .. } + | &mut MainStatus::BackingUp { ref mut health, .. } => { + health.insert(id, result); + } + _ => (), + } + Ok(()) + }) }) .await?; Ok(json!(())) @@ -1101,7 +1043,7 @@ enum DependencyRequirement { #[ts(type = "string")] version_spec: VersionRange, #[ts(type = "string")] - url: Url, + registry_url: Url, }, #[serde(rename_all = "camelCase")] Exists { @@ -1110,7 +1052,7 @@ enum DependencyRequirement { #[ts(type = "string")] version_spec: VersionRange, #[ts(type = "string")] - url: Url, + registry_url: Url, }, } // filebrowser:exists,bitcoind:running:foo+bar+baz @@ -1120,7 +1062,7 @@ impl FromStr for DependencyRequirement { match s.split_once(':') { Some((id, "e")) | Some((id, "exists")) => Ok(Self::Exists { id: id.parse()?, - url: "".parse()?, // TODO + registry_url: "".parse()?, // TODO version_spec: "*".parse()?, // TODO }), Some((id, rest)) => { @@ -1144,14 +1086,14 @@ impl FromStr for DependencyRequirement { Ok(Self::Running { id: id.parse()?, health_checks, - url: "".parse()?, // TODO + registry_url: "".parse()?, // TODO version_spec: "*".parse()?, // TODO }) } None => Ok(Self::Running { id: s.parse()?, health_checks: BTreeSet::new(), - url: "".parse()?, // TODO + registry_url: "".parse()?, // TODO version_spec: "*".parse()?, // TODO }), } @@ -1187,20 +1129,31 @@ async fn set_dependencies( .map(|dependency| match dependency { DependencyRequirement::Exists { id, - url, - version_spec, - } => (id, CurrentDependencyInfo::Exists { url, version_spec }), - DependencyRequirement::Running { - id, - health_checks, - url, + registry_url, version_spec, } => ( id, - CurrentDependencyInfo::Running { - url, + CurrentDependencyInfo { + kind: CurrentDependencyKind::Exists, + registry_url, version_spec, - health_checks, + icon: todo!(), + title: todo!(), + }, + ), + DependencyRequirement::Running { + id, + health_checks, + registry_url, + version_spec, + } => ( + id, + CurrentDependencyInfo { + kind: CurrentDependencyKind::Running { health_checks }, + registry_url, + version_spec, + icon: todo!(), + title: todo!(), }, ), }) diff --git a/core/startos/src/service/service_map.rs b/core/startos/src/service/service_map.rs index 1a9d2342c..934497eb9 100644 --- a/core/startos/src/service/service_map.rs +++ b/core/startos/src/service/service_map.rs @@ -27,6 +27,7 @@ use crate::s9pk::merkle_archive::source::FileSource; use crate::s9pk::S9pk; use crate::service::{LoadDisposition, Service}; use crate::status::{MainStatus, Status}; +use crate::util::serde::Pem; pub type DownloadInstallFuture = BoxFuture<'static, Result>; pub type InstallFuture = BoxFuture<'static, Result<(), Error>>; @@ -167,14 +168,13 @@ impl ServiceMap { dependency_config_errors: Default::default(), }, marketplace_url: None, - developer_key, + developer_key: Pem::new(developer_key), icon, last_backup: None, - dependency_info: Default::default(), current_dependencies: Default::default(), - interface_addresses: Default::default(), + actions: Default::default(), + service_interfaces: Default::default(), hosts: Default::default(), - store_exposed_ui: Default::default(), store_exposed_dependents: Default::default(), }, )?; diff --git a/core/startos/src/status/health_check.rs b/core/startos/src/status/health_check.rs index 7a6cb0430..cd5616527 100644 --- a/core/startos/src/status/health_check.rs +++ b/core/startos/src/status/health_check.rs @@ -1,35 +1,52 @@ pub use models::HealthCheckId; use serde::{Deserialize, Serialize}; +use ts_rs::TS; -#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, TS)] +#[serde(rename_all = "camelCase")] +pub struct HealthCheckResult { + pub name: String, + #[serde(flatten)] + pub kind: HealthCheckResultKind, +} + +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, TS)] #[serde(rename_all = "camelCase")] #[serde(tag = "result")] -pub enum HealthCheckResult { - Success, - Disabled, - Starting, +pub enum HealthCheckResultKind { + Success { message: Option }, + Disabled { message: Option }, + Starting { message: Option }, Loading { message: String }, - Failure { error: String }, + Failure { message: String }, } impl std::fmt::Display for HealthCheckResult { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - HealthCheckResult::Success => write!(f, "Succeeded"), - HealthCheckResult::Disabled => write!(f, "Disabled"), - HealthCheckResult::Starting => write!(f, "Starting"), - HealthCheckResult::Loading { message } => write!(f, "Loading ({})", message), - HealthCheckResult::Failure { error } => write!(f, "Failed ({})", error), + let name = &self.name; + match &self.kind { + HealthCheckResultKind::Success { message } => { + if let Some(message) = message { + write!(f, "{name}: Succeeded ({message})") + } else { + write!(f, "{name}: Succeeded") + } + } + HealthCheckResultKind::Disabled { message } => { + if let Some(message) = message { + write!(f, "{name}: Disabled ({message})") + } else { + write!(f, "{name}: Disabled") + } + } + HealthCheckResultKind::Starting { message } => { + if let Some(message) = message { + write!(f, "{name}: Starting ({message})") + } else { + write!(f, "{name}: Starting") + } + } + HealthCheckResultKind::Loading { message } => write!(f, "{name}: Loading ({message})"), + HealthCheckResultKind::Failure { message } => write!(f, "{name}: Failed ({message})"), } } } - -#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, ts_rs::TS)] -#[serde(rename_all = "camelCase")] -#[ts(export)] -pub enum HealthCheckString { - Passing, - Disabled, - Starting, - Warning, - Failure, -} diff --git a/core/startos/src/status/mod.rs b/core/startos/src/status/mod.rs index 13b0568e2..2faa90e79 100644 --- a/core/startos/src/status/mod.rs +++ b/core/startos/src/status/mod.rs @@ -4,15 +4,17 @@ use chrono::{DateTime, Utc}; use imbl::OrdMap; use models::PackageId; use serde::{Deserialize, Serialize}; +use ts_rs::TS; use self::health_check::HealthCheckId; use crate::prelude::*; use crate::status::health_check::HealthCheckResult; pub mod health_check; -#[derive(Clone, Debug, Deserialize, Serialize, HasModel)] +#[derive(Clone, Debug, Deserialize, Serialize, HasModel, TS)] #[serde(rename_all = "camelCase")] #[model = "Model"] +#[ts(export)] pub struct Status { pub configured: bool, pub main: MainStatus, @@ -20,9 +22,9 @@ pub struct Status { pub dependency_config_errors: DependencyConfigErrors, } -#[derive(Clone, Debug, Deserialize, Serialize, HasModel, Default)] -#[serde(rename_all = "camelCase")] +#[derive(Clone, Debug, Deserialize, Serialize, HasModel, Default, TS)] #[model = "Model"] +#[ts(export)] pub struct DependencyConfigErrors(pub BTreeMap); impl Map for DependencyConfigErrors { type Key = PackageId; @@ -35,22 +37,29 @@ impl Map for DependencyConfigErrors { } } -#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)] +#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, TS)] #[serde(tag = "status")] #[serde(rename_all = "camelCase")] pub enum MainStatus { Stopped, Restarting, + #[serde(rename_all = "camelCase")] Stopping { timeout: crate::util::serde::Duration, }, Starting, + #[serde(rename_all = "camelCase")] Running { + #[ts(type = "string")] started: DateTime, + #[ts(as = "BTreeMap")] health: OrdMap, }, + #[serde(rename_all = "camelCase")] BackingUp { + #[ts(type = "string | null")] started: Option>, + #[ts(as = "BTreeMap")] health: OrdMap, }, } diff --git a/core/startos/src/util/cpupower.rs b/core/startos/src/util/cpupower.rs index cc4ac5ef4..db625f90e 100644 --- a/core/startos/src/util/cpupower.rs +++ b/core/startos/src/util/cpupower.rs @@ -3,6 +3,7 @@ use std::collections::BTreeSet; use imbl::OrdMap; use tokio::process::Command; +use ts_rs::TS; use crate::prelude::*; use crate::util::Invoke; @@ -13,7 +14,10 @@ pub const GOVERNOR_HEIRARCHY: &[Governor] = &[ Governor(Cow::Borrowed("conservative")), ]; -#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, serde::Serialize, serde::Deserialize)] +#[derive( + Debug, Clone, PartialEq, Eq, PartialOrd, Ord, serde::Serialize, serde::Deserialize, TS, +)] +#[ts(export, type = "string")] pub struct Governor(Cow<'static, str>); impl std::str::FromStr for Governor { type Err = std::convert::Infallible; diff --git a/core/startos/src/util/serde.rs b/core/startos/src/util/serde.rs index de25e0505..2fa992abd 100644 --- a/core/startos/src/util/serde.rs +++ b/core/startos/src/util/serde.rs @@ -15,6 +15,7 @@ use serde::de::DeserializeOwned; use serde::ser::{SerializeMap, SerializeSeq}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde_json::Value; +use ts_rs::TS; use super::IntoDoubleEndedIterator; use crate::util::clap::FromStrParser; @@ -633,7 +634,8 @@ where } } -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, TS)] +#[ts(export, type = "string")] pub struct Duration(std::time::Duration); impl Deref for Duration { type Target = std::time::Duration; @@ -1128,6 +1130,18 @@ impl PemEncoding for ssh_key::PrivateKey { } } +impl PemEncoding for ed25519_dalek::VerifyingKey { + fn from_pem(pem: &str) -> Result { + use ed25519_dalek::pkcs8::DecodePublicKey; + ed25519_dalek::VerifyingKey::from_public_key_pem(pem).map_err(E::custom) + } + fn to_pem(&self) -> Result { + use ed25519_dalek::pkcs8::EncodePublicKey; + self.to_public_key_pem(pkcs8::LineEnding::LF) + .map_err(E::custom) + } +} + pub mod pem { use serde::{Deserialize, Deserializer, Serializer}; @@ -1163,7 +1177,8 @@ impl Pem { } } -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, TS)] +#[ts(export, type = "string | number[]")] pub struct MaybeUtf8String(pub Vec); impl std::fmt::Debug for MaybeUtf8String { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { diff --git a/image-recipe/build.sh b/image-recipe/build.sh index 28aa574ae..7aae39c7f 100755 --- a/image-recipe/build.sh +++ b/image-recipe/build.sh @@ -217,7 +217,7 @@ if [ "${IB_TARGET_PLATFORM}" = "raspberrypi" ]; then ln -sf /usr/bin/pi-beep /usr/local/bin/beep wget https://archive.raspberrypi.org/debian/pool/main/w/wireless-regdb/wireless-regdb_2018.05.09-0~rpt1_all.deb echo 1b7b1076257726609535b71d146a5721622d19a0843061ee7568188e836dd10f wireless-regdb_2018.05.09-0~rpt1_all.deb | sha256sum -c - apt-get install ./wireless-regdb_2018.05.09-0~rpt1_all.deb + apt-get install -y --allow-downgrades ./wireless-regdb_2018.05.09-0~rpt1_all.deb rm wireless-regdb_2018.05.09-0~rpt1_all.deb fi diff --git a/sdk/lib/Dependency.ts b/sdk/lib/Dependency.ts index 71cc05890..1e70629da 100644 --- a/sdk/lib/Dependency.ts +++ b/sdk/lib/Dependency.ts @@ -6,13 +6,13 @@ export class Dependency { | { type: "running" versionSpec: Checker - url: string + registryUrl: string healthChecks: string[] } | { type: "exists" versionSpec: Checker - url: string + registryUrl: string }, ) {} } diff --git a/sdk/lib/emverLite/mod.ts b/sdk/lib/emverLite/mod.ts index dd68360ac..f69d4f35d 100644 --- a/sdk/lib/emverLite/mod.ts +++ b/sdk/lib/emverLite/mod.ts @@ -179,7 +179,6 @@ export class Checker { * @returns */ static parse(range: string | Checker): Checker { - console.log(`Parser (${range})`) if (range instanceof Checker) { return range } diff --git a/sdk/lib/health/HealthCheck.ts b/sdk/lib/health/HealthCheck.ts index 488ecdcf5..e1fbee97b 100644 --- a/sdk/lib/health/HealthCheck.ts +++ b/sdk/lib/health/HealthCheck.ts @@ -40,19 +40,21 @@ export function healthCheck(o: { const { status, message } = await o.fn(overlay) await o.effects.setHealth({ name: o.name, - status, - message, + id: o.name, + result: status, + message: message || "", }) currentValue.hadSuccess = true - currentValue.lastResult = "passing" + currentValue.lastResult = "success" await triggerFirstSuccess().catch((err) => { console.error(err) }) } catch (e) { await o.effects.setHealth({ name: o.name, - status: "failure", - message: asMessage(e), + id: o.name, + result: "failure", + message: asMessage(e) || "", }) currentValue.lastResult = "failure" } diff --git a/sdk/lib/health/checkFns/checkPortListening.ts b/sdk/lib/health/checkFns/checkPortListening.ts index 89dcf89b3..4cc0738da 100644 --- a/sdk/lib/health/checkFns/checkPortListening.ts +++ b/sdk/lib/health/checkFns/checkPortListening.ts @@ -45,7 +45,7 @@ export async function checkPortListening( port, ) if (hasAddress) { - return { status: "passing", message: options.successMessage } + return { status: "success", message: options.successMessage } } return { status: "failure", diff --git a/sdk/lib/health/checkFns/checkWebUrl.ts b/sdk/lib/health/checkFns/checkWebUrl.ts index d18509ee3..8f61ae2ef 100644 --- a/sdk/lib/health/checkFns/checkWebUrl.ts +++ b/sdk/lib/health/checkFns/checkWebUrl.ts @@ -22,7 +22,7 @@ export const checkWebUrl = async ( .then( (x) => ({ - status: "passing", + status: "success", message: successMessage, }) as const, ) diff --git a/sdk/lib/health/checkFns/runHealthScript.ts b/sdk/lib/health/checkFns/runHealthScript.ts index 5d69f5e17..f0f41ee91 100644 --- a/sdk/lib/health/checkFns/runHealthScript.ts +++ b/sdk/lib/health/checkFns/runHealthScript.ts @@ -32,7 +32,7 @@ export const runHealthScript = async ( throw { status: "failure", message: errorMessage } as CheckResult }) return { - status: "passing", + status: "success", message: message(res.stdout.toString()), } as CheckResult } diff --git a/sdk/lib/interfaces/Host.ts b/sdk/lib/interfaces/Host.ts index 250f42075..de54f7dc0 100644 --- a/sdk/lib/interfaces/Host.ts +++ b/sdk/lib/interfaces/Host.ts @@ -1,71 +1,58 @@ import { object, string } from "ts-matches" import { Effects } from "../types" import { Origin } from "./Origin" +import { AddSslOptions } from "../../../core/startos/bindings/AddSslOptions" +import { Security } from "../../../core/startos/bindings/Security" +import { BindOptions } from "../../../core/startos/bindings/BindOptions" +import { AlpnInfo } from "../../../core/startos/bindings/AlpnInfo" + +export { AddSslOptions, Security, BindOptions } const knownProtocols = { http: { - secure: false, - ssl: false, + secure: null, defaultPort: 80, withSsl: "https", + alpn: { specified: ["http/1.1"] } as AlpnInfo, }, https: { - secure: true, - ssl: true, + secure: { ssl: true }, defaultPort: 443, }, ws: { - secure: false, - ssl: false, + secure: null, defaultPort: 80, withSsl: "wss", + alpn: { specified: ["http/1.1"] } as AlpnInfo, }, wss: { - secure: true, - ssl: true, + secure: { ssl: true }, defaultPort: 443, }, ssh: { - secure: true, - ssl: false, + secure: { ssl: false }, defaultPort: 22, }, bitcoin: { - secure: true, - ssl: false, + secure: { ssl: false }, defaultPort: 8333, }, lightning: { - secure: true, - ssl: true, + secure: { ssl: true }, defaultPort: 9735, }, grpc: { - secure: true, - ssl: true, + secure: { ssl: true }, defaultPort: 50051, }, dns: { - secure: true, - ssl: false, + secure: { ssl: false }, defaultPort: 53, }, } as const export type Scheme = string | null -type AddSslOptions = { - scheme: Scheme - preferredExternalPort: number - addXForwardedHeaders: boolean | null /** default: false */ -} -type Security = { ssl: boolean } -export type BindOptions = { - scheme: Scheme - preferredExternalPort: number - addSsl: AddSslOptions | null - secure: Security | null -} type KnownProtocols = typeof knownProtocols type ProtocolsWithSslVariants = { [K in keyof KnownProtocols]: KnownProtocols[K] extends { @@ -177,9 +164,10 @@ export class Host { if ("noAddSsl" in options && options.noAddSsl) return null if ("withSsl" in protoInfo && protoInfo.withSsl) return { - addXForwardedHeaders: null, + // addXForwardedHeaders: null, preferredExternalPort: knownProtocols[protoInfo.withSsl].defaultPort, scheme: protoInfo.withSsl, + alpn: protoInfo.alpn, ...("addSsl" in options ? options.addSsl : null), } return null diff --git a/sdk/lib/mainFn/Daemons.ts b/sdk/lib/mainFn/Daemons.ts index 540ca3d37..640ab8c4b 100644 --- a/sdk/lib/mainFn/Daemons.ts +++ b/sdk/lib/mainFn/Daemons.ts @@ -227,7 +227,7 @@ export class Daemons { }) as CheckResult, ) currentInput.lastResult = response.status || null - if (!currentInput.hadSuccess && response.status === "passing") { + if (!currentInput.hadSuccess && response.status === "success") { currentInput.hadSuccess = true resolve(child) } diff --git a/sdk/lib/test/startosTypeValidation.test.ts b/sdk/lib/test/startosTypeValidation.test.ts index f2e86de74..5fa3f74b3 100644 --- a/sdk/lib/test/startosTypeValidation.test.ts +++ b/sdk/lib/test/startosTypeValidation.test.ts @@ -9,7 +9,6 @@ import { ParamsMaybePackageId } from "../../../core/startos/bindings/ParamsMaybe import { SetConfigured } from "../../../core/startos/bindings/SetConfigured" import { SetHealth } from "../../../core/startos/bindings/SetHealth" import { ExposeForDependentsParams } from "../../../core/startos/bindings/ExposeForDependentsParams" -import { ExposeUiParams } from "../../../core/startos/bindings/ExposeUiParams" import { GetSslCertificateParams } from "../../../core/startos/bindings/GetSslCertificateParams" import { GetSslKeyParams } from "../../../core/startos/bindings/GetSslKeyParams" import { GetServiceInterfaceParams } from "../../../core/startos/bindings/GetServiceInterfaceParams" @@ -24,7 +23,6 @@ import { ExportActionParams } from "../../../core/startos/bindings/ExportActionP import { RemoveActionParams } from "../../../core/startos/bindings/RemoveActionParams" import { ReverseProxyParams } from "../../../core/startos/bindings/ReverseProxyParams" import { MountParams } from "../../../core/startos/bindings/MountParams" -import { ExposedUI } from "../../../core/startos/bindings/ExposedUI" function typeEquality(_a: ExpectedType) {} describe("startosTypeValidation ", () => { test(`checking the params match`, () => { diff --git a/sdk/lib/trigger/changeOnFirstSuccess.ts b/sdk/lib/trigger/changeOnFirstSuccess.ts index 28129e3e5..4c45afe31 100644 --- a/sdk/lib/trigger/changeOnFirstSuccess.ts +++ b/sdk/lib/trigger/changeOnFirstSuccess.ts @@ -11,7 +11,7 @@ export function changeOnFirstSuccess(o: { beforeFirstSuccess.next() for ( let res = await beforeFirstSuccess.next(); - currentValue?.lastResult !== "passing" && !res.done; + currentValue?.lastResult !== "success" && !res.done; res = await beforeFirstSuccess.next() ) { yield diff --git a/sdk/lib/trigger/successFailure.ts b/sdk/lib/trigger/successFailure.ts index 1886402c4..1bab27289 100644 --- a/sdk/lib/trigger/successFailure.ts +++ b/sdk/lib/trigger/successFailure.ts @@ -12,7 +12,7 @@ export function successFailure(o: { beforeSuccess.next() for ( let res = await beforeSuccess.next(); - currentValue?.lastResult !== "passing" && !res.done; + currentValue?.lastResult !== "success" && !res.done; res = await beforeSuccess.next() ) { yield @@ -21,7 +21,7 @@ export function successFailure(o: { const duringError = o.duringError(getInput) for ( let res = await duringError.next(); - currentValue?.lastResult === "passing" && !res.done; + currentValue?.lastResult === "success" && !res.done; res = await duringError.next() ) { yield diff --git a/sdk/lib/types.ts b/sdk/lib/types.ts index fa77d2c02..3ddf79a36 100644 --- a/sdk/lib/types.ts +++ b/sdk/lib/types.ts @@ -1,5 +1,6 @@ export * as configTypes from "./config/configTypes" -import { AddSslOptions } from "../../core/startos/bindings/AddSslOptions" +import { HealthCheckId } from "../../core/startos/bindings/HealthCheckId" +import { HealthCheckResult } from "../../core/startos/bindings/HealthCheckResult" import { MainEffects, ServiceInterfaceType, Signals } from "./StartSdk" import { InputSpec } from "./config/configTypes" import { DependenciesReceipt } from "./config/setupConfig" @@ -142,13 +143,7 @@ export type Daemon = { [DaemonProof]: never } -export type HealthStatus = - | `passing` - | `disabled` - | `starting` - | `warning` - | `failure` - +export type HealthStatus = HealthCheckResult["result"] export type SmtpValue = { server: string port: number @@ -324,16 +319,13 @@ export type Effects = { /** Removes all network bindings */ clearBindings(): Promise /** Creates a host connected to the specified port with the provided options */ - bind(options: { - kind: "static" | "single" | "multi" - id: string - internalPort: number - - scheme: Scheme - preferredExternalPort: number - addSsl: AddSslOptions | null - secure: { ssl: boolean } | null - }): Promise + bind( + options: { + kind: "static" | "single" | "multi" + id: string + internalPort: number + } & BindOptions, + ): Promise /** Retrieves the current hostname(s) associated with a host id */ // getHostInfo(options: { // kind: "static" | "single" @@ -479,11 +471,11 @@ export type Effects = { algorithm: "ecdsa" | "ed25519" | null }) => Promise - setHealth(o: { - name: string - status: HealthStatus - message: string | null - }): Promise + setHealth( + o: HealthCheckResult & { + id: HealthCheckId + }, + ): Promise /** Set the dependencies of what the service needs, usually ran during the set config as a best practice */ setDependencies(options: { @@ -590,7 +582,7 @@ export type KnownError = export type Dependency = { id: PackageId versionSpec: string - url: string + registryUrl: string } & ({ kind: "exists" } | { kind: "running"; healthChecks: string[] }) export type Dependencies = Array diff --git a/web/projects/marketplace/src/types.ts b/web/projects/marketplace/src/types.ts index 15b1f4ccf..f086a18c6 100644 --- a/web/projects/marketplace/src/types.ts +++ b/web/projects/marketplace/src/types.ts @@ -1,4 +1,5 @@ import { Url } from '@start9labs/shared' +import { Manifest } from '../../../../core/startos/bindings/Manifest' export type StoreURL = string export type StoreName = string @@ -42,35 +43,6 @@ export interface DependencyMetadata { hidden: boolean } -export interface Manifest { - id: string - title: string - version: string - gitHash?: string - description: { - short: string - long: string - } - replaces?: string[] - releaseNotes: string - license: string // name of license - wrapperRepo: Url - upstreamRepo: Url - supportSite: Url - marketingSite: Url - donationUrl: Url | null - alerts: { - install: string | null - uninstall: string | null - restore: string | null - start: string | null - stop: string | null - } - dependencies: Record - osVersion: string - hasConfig: boolean -} - export interface Dependency { description: string | null optional: boolean diff --git a/web/projects/ui/src/app/apps/portal/pipes/to-manifest.ts b/web/projects/ui/src/app/apps/portal/pipes/to-manifest.ts index 404c1bbd3..0376f882f 100644 --- a/web/projects/ui/src/app/apps/portal/pipes/to-manifest.ts +++ b/web/projects/ui/src/app/apps/portal/pipes/to-manifest.ts @@ -1,7 +1,7 @@ import { Pipe, PipeTransform } from '@angular/core' import { PackageDataEntry } from 'src/app/services/patch-db/data-model' -import { Manifest } from '@start9labs/marketplace' import { getManifest } from 'src/app/util/get-package-data' +import { Manifest } from '../../../../../../../../core/startos/bindings/Manifest' @Pipe({ name: 'toManifest', @@ -11,4 +11,4 @@ export class ToManifestPipe implements PipeTransform { transform(pkg: PackageDataEntry): Manifest { return getManifest(pkg) } -} \ No newline at end of file +} diff --git a/web/projects/ui/src/app/apps/portal/routes/dashboard/controls.component.ts b/web/projects/ui/src/app/apps/portal/routes/dashboard/controls.component.ts index bb7f81f19..063e706a0 100644 --- a/web/projects/ui/src/app/apps/portal/routes/dashboard/controls.component.ts +++ b/web/projects/ui/src/app/apps/portal/routes/dashboard/controls.component.ts @@ -5,20 +5,18 @@ import { computed, inject, input, - Input, } from '@angular/core' -import { TuiLetModule, tuiPure } from '@taiga-ui/cdk' +import { TuiLetModule } from '@taiga-ui/cdk' import { TuiButtonModule, tuiButtonOptionsProvider, } from '@taiga-ui/experimental' -import { map, Observable } from 'rxjs' +import { map } from 'rxjs' import { UILaunchComponent } from 'src/app/apps/portal/routes/dashboard/ui.component' import { ActionsService } from 'src/app/apps/portal/services/actions.service' import { DepErrorService } from 'src/app/services/dep-error.service' import { PackageDataEntry } from 'src/app/services/patch-db/data-model' import { getManifest } from 'src/app/util/get-package-data' -import { Manifest } from '@start9labs/marketplace' @Component({ standalone: true, diff --git a/web/projects/ui/src/app/apps/portal/routes/dashboard/status.component.ts b/web/projects/ui/src/app/apps/portal/routes/dashboard/status.component.ts index 0c076aef0..c201f91a8 100644 --- a/web/projects/ui/src/app/apps/portal/routes/dashboard/status.component.ts +++ b/web/projects/ui/src/app/apps/portal/routes/dashboard/status.component.ts @@ -8,11 +8,7 @@ import { tuiPure } from '@taiga-ui/cdk' import { TuiLoaderModule } from '@taiga-ui/core' import { TuiIconModule } from '@taiga-ui/experimental' import { PackageDataEntry } from 'src/app/services/patch-db/data-model' -import { - HealthStatus, - PrimaryStatus, - renderPkgStatus, -} from 'src/app/services/pkg-status-rendering.service' +import { renderPkgStatus } from 'src/app/services/pkg-status-rendering.service' import { InstallingProgressDisplayPipe } from '../service/pipes/install-progress.pipe' @Component({ @@ -68,7 +64,7 @@ export class StatusComponent { return ( !this.hasDepErrors && // no deps error !!this.pkg.status.configured && // no config needed - status.health !== HealthStatus.Failure // no health issues + status.health !== 'failure' // no health issues ) } @@ -83,29 +79,29 @@ export class StatusComponent { get status(): string { if (this.pkg.stateInfo.installingInfo) { - return `Installing... ${this.pipe.transform(this.pkg.stateInfo.installingInfo.progress.overall)}` + return `Installing...${this.pipe.transform(this.pkg.stateInfo.installingInfo.progress.overall)}` } switch (this.getStatus(this.pkg).primary) { - case PrimaryStatus.Running: + case 'running': return 'Running' - case PrimaryStatus.Stopped: + case 'stopped': return 'Stopped' - case PrimaryStatus.NeedsConfig: + case 'needsConfig': return 'Needs Config' - case PrimaryStatus.Updating: + case 'updating': return 'Updating...' - case PrimaryStatus.Stopping: + case 'stopping': return 'Stopping...' - case PrimaryStatus.Starting: + case 'starting': return 'Starting...' - case PrimaryStatus.BackingUp: + case 'backingUp': return 'Backing Up...' - case PrimaryStatus.Restarting: + case 'restarting': return 'Restarting...' - case PrimaryStatus.Removing: + case 'removing': return 'Removing...' - case PrimaryStatus.Restoring: + case 'restoring': return 'Restoring...' default: return 'Unknown' @@ -114,18 +110,20 @@ export class StatusComponent { get color(): string { switch (this.getStatus(this.pkg).primary) { - case PrimaryStatus.Running: + case 'running': return 'var(--tui-success-fill)' - case PrimaryStatus.NeedsConfig: + case 'needsConfig': return 'var(--tui-warning-fill)' - case PrimaryStatus.Updating: - case PrimaryStatus.Stopping: - case PrimaryStatus.Starting: - case PrimaryStatus.BackingUp: - case PrimaryStatus.Restarting: - case PrimaryStatus.Removing: - case PrimaryStatus.Restoring: + case 'installing': + case 'updating': + case 'stopping': + case 'starting': + case 'backingUp': + case 'restarting': + case 'removing': + case 'restoring': return 'var(--tui-info-fill)' + // stopped default: return 'var(--tui-text-02)' } diff --git a/web/projects/ui/src/app/apps/portal/routes/dashboard/ui.component.ts b/web/projects/ui/src/app/apps/portal/routes/dashboard/ui.component.ts index 0d85273fa..0bdd31da2 100644 --- a/web/projects/ui/src/app/apps/portal/routes/dashboard/ui.component.ts +++ b/web/projects/ui/src/app/apps/portal/routes/dashboard/ui.component.ts @@ -9,10 +9,7 @@ import { tuiPure } from '@taiga-ui/cdk' import { TuiDataListModule, TuiHostedDropdownModule } from '@taiga-ui/core' import { TuiButtonModule } from '@taiga-ui/experimental' import { ConfigService } from 'src/app/services/config.service' -import { - PackageDataEntry, - PackageMainStatus, -} from 'src/app/services/patch-db/data-model' +import { PackageDataEntry } from 'src/app/services/patch-db/data-model' @Component({ standalone: true, @@ -73,7 +70,7 @@ export class UILaunchComponent { } get isRunning(): boolean { - return this.pkg.status.main.status === PackageMainStatus.Running + return this.pkg.status.main.status === 'running' } @tuiPure diff --git a/web/projects/ui/src/app/apps/portal/routes/service/components/actions.component.ts b/web/projects/ui/src/app/apps/portal/routes/service/components/actions.component.ts index be3f11dcf..7c3238229 100644 --- a/web/projects/ui/src/app/apps/portal/routes/service/components/actions.component.ts +++ b/web/projects/ui/src/app/apps/portal/routes/service/components/actions.component.ts @@ -9,8 +9,8 @@ import { TuiButtonModule } from '@taiga-ui/experimental' import { DependencyInfo } from 'src/app/apps/portal/routes/service/types/dependency-info' import { ActionsService } from 'src/app/apps/portal/services/actions.service' import { PackageDataEntry } from 'src/app/services/patch-db/data-model' -import { Manifest } from '@start9labs/marketplace' import { getManifest } from 'src/app/util/get-package-data' +import { Manifest } from '../../../../../../../../../../core/startos/bindings/Manifest' @Component({ selector: 'service-actions', diff --git a/web/projects/ui/src/app/apps/portal/routes/service/components/health-check.component.ts b/web/projects/ui/src/app/apps/portal/routes/service/components/health-check.component.ts index d56389354..8281301ba 100644 --- a/web/projects/ui/src/app/apps/portal/routes/service/components/health-check.component.ts +++ b/web/projects/ui/src/app/apps/portal/routes/service/components/health-check.component.ts @@ -1,10 +1,7 @@ import { CommonModule } from '@angular/common' import { ChangeDetectionStrategy, Component, Input } from '@angular/core' import { TuiLoaderModule, TuiSvgModule } from '@taiga-ui/core' -import { - HealthCheckResult, - HealthResult, -} from 'src/app/services/patch-db/data-model' +import { HealthCheckResult } from '../../../../../../../../../../core/startos/bindings/HealthCheckResult' @Component({ selector: 'service-health-check', @@ -54,18 +51,14 @@ export class ServiceHealthCheckComponent { get loading(): boolean { const { result } = this.check - return ( - !result || - result === HealthResult.Starting || - result === HealthResult.Loading - ) + return !result || result === 'starting' || result === 'loading' } get icon(): string { switch (this.check.result) { - case HealthResult.Success: + case 'success': return 'tuiIconCheckLarge' - case HealthResult.Failure: + case 'failure': return 'tuiIconAlertTriangleLarge' default: return 'tuiIconMinusLarge' @@ -74,13 +67,14 @@ export class ServiceHealthCheckComponent { get color(): string { switch (this.check.result) { - case HealthResult.Success: + case 'success': return 'var(--tui-success-fill)' - case HealthResult.Failure: + case 'failure': return 'var(--tui-warning-fill)' - case HealthResult.Starting: - case HealthResult.Loading: + case 'starting': + case 'loading': return 'var(--tui-primary)' + // disabled default: return 'var(--tui-text-02)' } @@ -92,13 +86,14 @@ export class ServiceHealthCheckComponent { } switch (this.check.result) { - case HealthResult.Starting: + case 'starting': return 'Starting...' - case HealthResult.Success: + case 'success': return `Success: ${this.check.message}` - case HealthResult.Loading: - case HealthResult.Failure: + case 'loading': + case 'failure': return this.check.message + // disabled default: return this.check.result } diff --git a/web/projects/ui/src/app/apps/portal/routes/service/components/health-checks.component.ts b/web/projects/ui/src/app/apps/portal/routes/service/components/health-checks.component.ts index 54928a408..25cb8b769 100644 --- a/web/projects/ui/src/app/apps/portal/routes/service/components/health-checks.component.ts +++ b/web/projects/ui/src/app/apps/portal/routes/service/components/health-checks.component.ts @@ -5,9 +5,9 @@ import { inject, Input, } from '@angular/core' -import { HealthCheckResult } from 'src/app/services/patch-db/data-model' import { ConnectionService } from 'src/app/services/connection.service' import { ServiceHealthCheckComponent } from './health-check.component' +import { HealthCheckResult } from '../../../../../../../../../../core/startos/bindings/HealthCheckResult' @Component({ selector: 'service-health-checks', diff --git a/web/projects/ui/src/app/apps/portal/routes/service/components/progress.component.ts b/web/projects/ui/src/app/apps/portal/routes/service/components/progress.component.ts index 2e15f4f02..4af375ce0 100644 --- a/web/projects/ui/src/app/apps/portal/routes/service/components/progress.component.ts +++ b/web/projects/ui/src/app/apps/portal/routes/service/components/progress.component.ts @@ -1,7 +1,7 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core' import { TuiProgressModule } from '@taiga-ui/kit' -import { Progress } from 'src/app/services/patch-db/data-model' import { InstallingProgressPipe } from '../pipes/install-progress.pipe' +import { Progress } from '../../../../../../../../../../core/startos/bindings/Progress' @Component({ selector: '[progress]', diff --git a/web/projects/ui/src/app/apps/portal/routes/service/pipes/install-progress.pipe.ts b/web/projects/ui/src/app/apps/portal/routes/service/pipes/install-progress.pipe.ts index bcb20cfdd..172243fd5 100644 --- a/web/projects/ui/src/app/apps/portal/routes/service/pipes/install-progress.pipe.ts +++ b/web/projects/ui/src/app/apps/portal/routes/service/pipes/install-progress.pipe.ts @@ -1,5 +1,5 @@ import { Pipe, PipeTransform } from '@angular/core' -import { Progress } from '../../../../../services/patch-db/data-model' +import { Progress } from '../../../../../../../../../../core/startos/bindings/Progress' @Pipe({ standalone: true, diff --git a/web/projects/ui/src/app/apps/portal/routes/service/pipes/to-additional.pipe.ts b/web/projects/ui/src/app/apps/portal/routes/service/pipes/to-additional.pipe.ts index b7bae96b7..cd525ad95 100644 --- a/web/projects/ui/src/app/apps/portal/routes/service/pipes/to-additional.pipe.ts +++ b/web/projects/ui/src/app/apps/portal/routes/service/pipes/to-additional.pipe.ts @@ -1,12 +1,12 @@ import { inject, Pipe, PipeTransform } from '@angular/core' import { TuiDialogService } from '@taiga-ui/core' import { PolymorpheusComponent } from '@tinkoff/ng-polymorpheus' -import { Manifest } from '@start9labs/marketplace' import { CopyService, MarkdownComponent } from '@start9labs/shared' import { from } from 'rxjs' import { PackageDataEntry } from 'src/app/services/patch-db/data-model' import { ApiService } from 'src/app/services/api/embassy-api.service' import { getManifest } from 'src/app/util/get-package-data' +import { Manifest } from '../../../../../../../../../../core/startos/bindings/Manifest' export const FALLBACK_URL = 'Not provided' diff --git a/web/projects/ui/src/app/apps/portal/routes/service/pipes/to-menu.pipe.ts b/web/projects/ui/src/app/apps/portal/routes/service/pipes/to-menu.pipe.ts index 9f1ccb4e7..c08be87a6 100644 --- a/web/projects/ui/src/app/apps/portal/routes/service/pipes/to-menu.pipe.ts +++ b/web/projects/ui/src/app/apps/portal/routes/service/pipes/to-menu.pipe.ts @@ -1,6 +1,5 @@ import { inject, Pipe, PipeTransform } from '@angular/core' import { Params } from '@angular/router' -import { Manifest } from '@start9labs/marketplace' import { MarkdownComponent } from '@start9labs/shared' import { TuiDialogService } from '@taiga-ui/core' import { PolymorpheusComponent } from '@tinkoff/ng-polymorpheus' @@ -15,6 +14,7 @@ import { PackageDataEntry } from 'src/app/services/patch-db/data-model' import { ProxyService } from 'src/app/services/proxy.service' import { ServicePropertiesModal } from '../modals/properties.component' import { getManifest } from 'src/app/util/get-package-data' +import { Manifest } from '../../../../../../../../../../core/startos/bindings/Manifest' export interface ServiceMenu { icon: string diff --git a/web/projects/ui/src/app/apps/portal/routes/service/routes/actions.component.ts b/web/projects/ui/src/app/apps/portal/routes/service/routes/actions.component.ts index b20e48f0d..9b8d66365 100644 --- a/web/projects/ui/src/app/apps/portal/routes/service/routes/actions.component.ts +++ b/web/projects/ui/src/app/apps/portal/routes/service/routes/actions.component.ts @@ -18,7 +18,6 @@ import { ApiService } from 'src/app/services/api/embassy-api.service' import { DataModel, PackageDataEntry, - PackageState, } from 'src/app/services/patch-db/data-model' import { hasCurrentDeps } from 'src/app/util/has-deps' import { FormDialogService } from 'src/app/services/form-dialog.service' @@ -73,7 +72,7 @@ export class ServiceActionsRoute { readonly pkg$ = this.patch .watch$('packageData', this.id) - .pipe(filter(pkg => pkg.stateInfo.state === PackageState.Installed)) + .pipe(filter(pkg => pkg.stateInfo.state === 'installed')) readonly action = { icon: 'tuiIconTrash2Large', diff --git a/web/projects/ui/src/app/apps/portal/routes/service/routes/service.component.ts b/web/projects/ui/src/app/apps/portal/routes/service/routes/service.component.ts index c4954c420..f0eefb616 100644 --- a/web/projects/ui/src/app/apps/portal/routes/service/routes/service.component.ts +++ b/web/projects/ui/src/app/apps/portal/routes/service/routes/service.component.ts @@ -1,21 +1,17 @@ import { CommonModule } from '@angular/common' import { ChangeDetectionStrategy, Component, inject } from '@angular/core' import { ActivatedRoute, NavigationExtras, Router } from '@angular/router' -import { Manifest } from '@start9labs/marketplace' import { isEmptyObject } from '@start9labs/shared' import { PatchDB } from 'patch-db-client' import { combineLatest, map, switchMap } from 'rxjs' import { ConnectionService } from 'src/app/services/connection.service' import { - DependencyErrorType, DepErrorService, PkgDependencyErrors, } from 'src/app/services/dep-error.service' import { FormDialogService } from 'src/app/services/form-dialog.service' import { DataModel, - HealthCheckResult, - MainStatus, PackageDataEntry, } from 'src/app/services/patch-db/data-model' import { @@ -40,6 +36,9 @@ import { import { DependencyInfo } from '../types/dependency-info' import { getManifest } from 'src/app/util/get-package-data' import { InstallingProgressPipe } from 'src/app/apps/portal/routes/service/pipes/install-progress.pipe' +import { Manifest } from '../../../../../../../../../../core/startos/bindings/Manifest' +import { HealthCheckResult } from '../../../../../../../../../../core/startos/bindings/HealthCheckResult' +import { MainStatus } from '../../../../../../../../../../core/startos/bindings/MainStatus' @Component({ template: ` @@ -72,7 +71,7 @@ import { InstallingProgressPipe } from 'src/app/apps/portal/routes/service/pipes } @else { @if ( service.pkg.stateInfo.state === 'installed' && - service.status.primary !== 'backing-up' + service.status.primary !== 'backingUp' ) { @if (connected$ | async) { any) | null = null if (depError) { - if (depError.type === DependencyErrorType.NotInstalled) { + if (depError.type === 'notInstalled') { errorText = 'Not installed' fixText = 'Install' fixAction = () => this.fixDep(pkg, pkgManifest, 'install', depId) - } else if (depError.type === DependencyErrorType.IncorrectVersion) { + } else if (depError.type === 'incorrectVersion') { errorText = 'Incorrect version' fixText = 'Update' fixAction = () => this.fixDep(pkg, pkgManifest, 'update', depId) - } else if (depError.type === DependencyErrorType.ConfigUnsatisfied) { + } else if (depError.type === 'configUnsatisfied') { errorText = 'Config not satisfied' fixText = 'Auto config' fixAction = () => this.fixDep(pkg, pkgManifest, 'configure', depId) - } else if (depError.type === DependencyErrorType.NotRunning) { + } else if (depError.type === 'notRunning') { errorText = 'Not running' fixText = 'Start' - } else if (depError.type === DependencyErrorType.HealthChecksFailed) { + } else if (depError.type === 'healthChecksFailed') { errorText = 'Required health check not passing' - } else if (depError.type === DependencyErrorType.Transitive) { + } else if (depError.type === 'transitive') { errorText = 'Dependency has a dependency issue' } } diff --git a/web/projects/ui/src/app/apps/portal/routes/system/backups/modals/backup.component.ts b/web/projects/ui/src/app/apps/portal/routes/system/backups/modals/backup.component.ts index 833fedf48..11470bd63 100644 --- a/web/projects/ui/src/app/apps/portal/routes/system/backups/modals/backup.component.ts +++ b/web/projects/ui/src/app/apps/portal/routes/system/backups/modals/backup.component.ts @@ -16,7 +16,7 @@ import { } from '@tinkoff/ng-polymorpheus' import { PatchDB } from 'patch-db-client' import { firstValueFrom, map } from 'rxjs' -import { DataModel, PackageState } from 'src/app/services/patch-db/data-model' +import { DataModel } from 'src/app/services/patch-db/data-model' import { getManifest } from 'src/app/util/get-package-data' interface Package { @@ -100,7 +100,7 @@ export class BackupsBackupModal { id, title, icon: pkg.icon, - disabled: pkg.stateInfo.state !== PackageState.Installed, + disabled: pkg.stateInfo.state !== 'installed', checked: false, } }) diff --git a/web/projects/ui/src/app/apps/portal/routes/system/marketplace/components/controls.component.ts b/web/projects/ui/src/app/apps/portal/routes/system/marketplace/components/controls.component.ts index 2fe65d0b6..bdba855d7 100644 --- a/web/projects/ui/src/app/apps/portal/routes/system/marketplace/components/controls.component.ts +++ b/web/projects/ui/src/app/apps/portal/routes/system/marketplace/components/controls.component.ts @@ -24,7 +24,6 @@ import { firstValueFrom } from 'rxjs' import { DataModel, PackageDataEntry, - PackageState, } from 'src/app/services/patch-db/data-model' import { ClientStorageService } from 'src/app/services/client-storage.service' import { MarketplaceService } from 'src/app/services/marketplace.service' diff --git a/web/projects/ui/src/app/apps/portal/routes/system/notifications/item.component.ts b/web/projects/ui/src/app/apps/portal/routes/system/notifications/item.component.ts index cc902f4ea..bdef89d45 100644 --- a/web/projects/ui/src/app/apps/portal/routes/system/notifications/item.component.ts +++ b/web/projects/ui/src/app/apps/portal/routes/system/notifications/item.component.ts @@ -6,7 +6,6 @@ import { inject, } from '@angular/core' import { RouterLink } from '@angular/router' -import { Manifest } from '@start9labs/marketplace' import { tuiPure } from '@taiga-ui/cdk' import { TuiSvgModule } from '@taiga-ui/core' import { TuiLineClampModule } from '@taiga-ui/kit' @@ -16,6 +15,7 @@ import { ServerNotification } from 'src/app/services/api/api.types' import { DataModel } from 'src/app/services/patch-db/data-model' import { NotificationService } from '../../../services/notification.service' import { toRouterLink } from '../../../utils/to-router-link' +import { Manifest } from '../../../../../../../../../../core/startos/bindings/Manifest' @Component({ selector: '[notificationItem]', diff --git a/web/projects/ui/src/app/apps/portal/routes/system/settings/routes/interfaces/ui.component.ts b/web/projects/ui/src/app/apps/portal/routes/system/settings/routes/interfaces/ui.component.ts index 84271ac19..b98c2cba7 100644 --- a/web/projects/ui/src/app/apps/portal/routes/system/settings/routes/interfaces/ui.component.ts +++ b/web/projects/ui/src/app/apps/portal/routes/system/settings/routes/interfaces/ui.component.ts @@ -47,7 +47,8 @@ export class StartOsUiComponent { addSsl: { scheme: 'https', preferredExternalPort: 443, - addXForwardedHeaders: null, + // @TODO is this alpn correct? + alpn: { specified: ['http/1.1', 'h2'] }, }, secure: { ssl: false, diff --git a/web/projects/ui/src/app/apps/portal/routes/system/sideload/sideload.utils.ts b/web/projects/ui/src/app/apps/portal/routes/system/sideload/sideload.utils.ts index 3ebbc33e8..027cb52fd 100644 --- a/web/projects/ui/src/app/apps/portal/routes/system/sideload/sideload.utils.ts +++ b/web/projects/ui/src/app/apps/portal/routes/system/sideload/sideload.utils.ts @@ -1,4 +1,4 @@ -import { Manifest, MarketplacePkg } from '@start9labs/marketplace' +import { MarketplacePkg } from '@start9labs/marketplace' import cbor from 'cbor' interface Positions { diff --git a/web/projects/ui/src/app/apps/portal/services/actions.service.ts b/web/projects/ui/src/app/apps/portal/services/actions.service.ts index bfacc59d4..3c563808c 100644 --- a/web/projects/ui/src/app/apps/portal/services/actions.service.ts +++ b/web/projects/ui/src/app/apps/portal/services/actions.service.ts @@ -11,9 +11,9 @@ import { ApiService } from 'src/app/services/api/embassy-api.service' import { FormDialogService } from 'src/app/services/form-dialog.service' import { DataModel } from 'src/app/services/patch-db/data-model' import { hasCurrentDeps } from 'src/app/util/has-deps' -import { Manifest } from '@start9labs/marketplace' import { getAllPackages } from 'src/app/util/get-package-data' import { PatchDB } from 'patch-db-client' +import { Manifest } from '../../../../../../../../core/startos/bindings/Manifest' @Injectable({ providedIn: 'root', diff --git a/web/projects/ui/src/app/services/api/api.fixures.ts b/web/projects/ui/src/app/services/api/api.fixures.ts index 35c860be6..16f5b9e5c 100644 --- a/web/projects/ui/src/app/services/api/api.fixures.ts +++ b/web/projects/ui/src/app/services/api/api.fixures.ts @@ -1,8 +1,6 @@ import { InstalledState, PackageDataEntry, - PackageMainStatus, - PackageState, ServerStatusInfo, } from 'src/app/services/patch-db/data-model' import { @@ -12,15 +10,12 @@ import { ServerNotifications, } from './api.types' import { BTC_ICON, LND_ICON, PROXY_ICON } from './api-icons' -import { - DependencyMetadata, - Manifest, - MarketplacePkg, -} from '@start9labs/marketplace' +import { DependencyMetadata, MarketplacePkg } from '@start9labs/marketplace' import { Log } from '@start9labs/shared' import { configBuilderToSpec } from 'src/app/util/configBuilderToSpec' import { CT } from '@start9labs/start-sdk' import { CB } from '@start9labs/start-sdk' +import { Manifest } from '../../../../../../../core/startos/bindings/Manifest' export module Mock { export const ServerUpdated: ServerStatusInfo = { @@ -83,16 +78,26 @@ export module Mock { osVersion: '0.2.12', dependencies: {}, hasConfig: true, + images: ['main'], + assets: [], + volumes: ['main'], + hardwareRequirements: { + device: {}, + arch: null, + ram: null, + }, } export const MockManifestLnd: Manifest = { id: 'lnd', title: 'Lightning Network Daemon', version: '0.11.1', + gitHash: 'abcdefgh', description: { short: 'A bolt spec compliant client.', long: 'More info about LND. More info about LND. More info about LND.', }, + replaces: ['banks', 'governments'], releaseNotes: 'Dual funded channels!', license: 'MIT', wrapperRepo: 'https://github.com/start9labs/lnd-wrapper', @@ -121,6 +126,14 @@ export module Mock { }, }, hasConfig: true, + images: ['main'], + assets: [], + volumes: ['main'], + hardwareRequirements: { + device: {}, + arch: null, + ram: null, + }, } export const MockManifestBitcoinProxy: Manifest = { @@ -153,7 +166,16 @@ export module Mock { optional: false, }, }, + replaces: [], hasConfig: false, + images: ['main'], + assets: [], + volumes: ['main'], + hardwareRequirements: { + device: {}, + arch: null, + ram: null, + }, } export const BitcoinDep: DependencyMetadata = { @@ -1260,7 +1282,7 @@ export module Mock { export const bitcoind: PackageDataEntry = { stateInfo: { - state: PackageState.Installed, + state: 'installed', manifest: MockManifestBitcoind, }, icon: '/assets/img/service-icons/bitcoind.svg', @@ -1269,7 +1291,7 @@ export module Mock { status: { configured: true, main: { - status: PackageMainStatus.Running, + status: 'running', started: new Date().toISOString(), health: {}, }, @@ -1293,9 +1315,10 @@ export module Mock { scheme: 'http', preferredExternalPort: 80, addSsl: { - addXForwardedHeaders: false, + // addXForwardedHeaders: false, preferredExternalPort: 443, scheme: 'https', + alpn: { specified: ['http/1.1', 'h2'] }, }, secure: null, }, @@ -1365,9 +1388,10 @@ export module Mock { scheme: 'http', preferredExternalPort: 80, addSsl: { - addXForwardedHeaders: false, + // addXForwardedHeaders: false, preferredExternalPort: 443, scheme: 'https', + alpn: { specified: ['http/1.1'] }, }, secure: null, }, @@ -1493,6 +1517,8 @@ export module Mock { }, }, currentDependencies: {}, + hosts: {}, + storeExposedDependents: [], marketplaceUrl: 'https://registry.start9.com/', developerKey: 'developer-key', outboundProxy: null, @@ -1500,7 +1526,7 @@ export module Mock { export const bitcoinProxy: PackageDataEntry = { stateInfo: { - state: PackageState.Installed, + state: 'installed', manifest: MockManifestBitcoinProxy, }, icon: '/assets/img/service-icons/btc-rpc-proxy.png', @@ -1509,7 +1535,7 @@ export module Mock { status: { configured: false, main: { - status: PackageMainStatus.Stopped, + status: 'stopped', }, dependencyConfigErrors: {}, }, @@ -1530,9 +1556,10 @@ export module Mock { scheme: 'http', preferredExternalPort: 80, addSsl: { - addXForwardedHeaders: false, + // addXForwardedHeaders: false, preferredExternalPort: 443, scheme: 'https', + alpn: { specified: ['http/1.1', 'h2'] }, }, secure: { ssl: true, @@ -1632,6 +1659,8 @@ export module Mock { healthChecks: [], }, }, + hosts: {}, + storeExposedDependents: [], marketplaceUrl: 'https://registry.start9.com/', developerKey: 'developer-key', outboundProxy: null, @@ -1639,7 +1668,7 @@ export module Mock { export const lnd: PackageDataEntry = { stateInfo: { - state: PackageState.Installed, + state: 'installed', manifest: MockManifestLnd, }, icon: '/assets/img/service-icons/lnd.png', @@ -1648,7 +1677,7 @@ export module Mock { status: { configured: true, main: { - status: PackageMainStatus.Stopped, + status: 'stopped', }, dependencyConfigErrors: { 'btc-rpc-proxy': 'Username not found', @@ -1882,9 +1911,10 @@ export module Mock { kind: 'exists', registryUrl: 'https://community-registry.start9.com', versionSpec: '>2.0.0', // @TODO - healthChecks: [], }, }, + hosts: {}, + storeExposedDependents: [], marketplaceUrl: 'https://registry.start9.com/', developerKey: 'developer-key', outboundProxy: null, diff --git a/web/projects/ui/src/app/services/api/api.types.ts b/web/projects/ui/src/app/services/api/api.types.ts index 1f2352ba7..ef0c5accb 100644 --- a/web/projects/ui/src/app/services/api/api.types.ts +++ b/web/projects/ui/src/app/services/api/api.types.ts @@ -1,10 +1,9 @@ import { Dump, Revision } from 'patch-db-client' -import { MarketplacePkg, StoreInfo, Manifest } from '@start9labs/marketplace' +import { MarketplacePkg, StoreInfo } from '@start9labs/marketplace' import { DataModel, DomainInfo, NetworkStrategy, - HealthCheckResult, } from 'src/app/services/patch-db/data-model' import { StartOSDiskInfo, @@ -15,6 +14,8 @@ import { } from '@start9labs/shared' import { CT } from '@start9labs/start-sdk' import { config } from '@start9labs/start-sdk' +import { HealthCheckResult } from '../../../../../../../core/startos/bindings/HealthCheckResult' +import { Manifest } from '../../../../../../../core/startos/bindings/Manifest' export module RR { // DB @@ -644,40 +645,29 @@ export type DependencyError = | DependencyErrorHealthChecksFailed | DependencyErrorTransitive -export enum DependencyErrorType { - NotInstalled = 'not-installed', - NotRunning = 'not-running', - IncorrectVersion = 'incorrect-version', - ConfigUnsatisfied = 'config-unsatisfied', - HealthChecksFailed = 'health-checks-failed', - InterfaceHealthChecksFailed = 'interface-health-checks-failed', - Transitive = 'transitive', -} - export interface DependencyErrorNotInstalled { - type: DependencyErrorType.NotInstalled + type: 'notInstalled' } export interface DependencyErrorNotRunning { - type: DependencyErrorType.NotRunning + type: 'notRunning' } export interface DependencyErrorIncorrectVersion { - type: DependencyErrorType.IncorrectVersion + type: 'incorrectVersion' expected: string // version range received: string // version } export interface DependencyErrorConfigUnsatisfied { - type: DependencyErrorType.ConfigUnsatisfied - error: string + type: 'configUnsatisfied' } export interface DependencyErrorHealthChecksFailed { - type: DependencyErrorType.HealthChecksFailed + type: 'healthChecksFailed' check: HealthCheckResult } export interface DependencyErrorTransitive { - type: DependencyErrorType.Transitive + type: 'transitive' } diff --git a/web/projects/ui/src/app/services/api/embassy-mock-api.service.ts b/web/projects/ui/src/app/services/api/embassy-mock-api.service.ts index 96aa518aa..b7017a203 100644 --- a/web/projects/ui/src/app/services/api/embassy-mock-api.service.ts +++ b/web/projects/ui/src/app/services/api/embassy-mock-api.service.ts @@ -10,11 +10,8 @@ import { } from 'patch-db-client' import { DataModel, - FullProgress, InstallingState, PackageDataEntry, - PackageMainStatus, - PackageState, Proxy, StateInfo, UpdatingState, @@ -39,6 +36,7 @@ import { WebSocketSubjectConfig } from 'rxjs/webSocket' import { AuthService } from '../auth.service' import { ConnectionService } from '../connection.service' import { StoreInfo } from '@start9labs/marketplace' +import { FullProgress } from '../../../../../../../core/startos/bindings/FullProgress' const PROGRESS: FullProgress = { overall: { @@ -864,7 +862,7 @@ export class MockApiService extends ApiService { { op: PatchOp.REPLACE, path: appPath, - value: PackageMainStatus.BackingUp, + value: 'backingUp', }, ] this.mockRevision(appPatch) @@ -874,7 +872,7 @@ export class MockApiService extends ApiService { this.mockRevision([ { ...appPatch[0], - value: PackageMainStatus.Stopped, + value: 'stopped', }, ]) this.mockRevision([ @@ -979,10 +977,10 @@ export class MockApiService extends ApiService { ...Mock.LocalPkgs[params.id], stateInfo: { // if installing - // state: PackageState.Installing, + // state: 'installing', // if updating - state: PackageState.Updating, + state: 'updating', manifest: mockPatchData.packageData[params.id].stateInfo.manifest!, // both @@ -1047,7 +1045,7 @@ export class MockApiService extends ApiService { value: { ...Mock.LocalPkgs[id], stateInfo: { - state: PackageState.Restoring, + state: 'restoring', installingInfo: { newManifest: Mock.LocalPkgs[id].stateInfo.manifest!, progress: PROGRESS, @@ -1090,7 +1088,7 @@ export class MockApiService extends ApiService { { op: PatchOp.REPLACE, path: path + '/status', - value: PackageMainStatus.Running, + value: 'running', }, { op: PatchOp.REPLACE, @@ -1105,7 +1103,7 @@ export class MockApiService extends ApiService { { op: PatchOp.REPLACE, path: path + '/status', - value: PackageMainStatus.Starting, + value: 'starting', }, ] @@ -1126,7 +1124,7 @@ export class MockApiService extends ApiService { { op: PatchOp.REPLACE, path: path + '/status', - value: PackageMainStatus.Starting, + value: 'starting', }, { op: PatchOp.ADD, @@ -1142,7 +1140,7 @@ export class MockApiService extends ApiService { { op: PatchOp.REPLACE, path: path + '/status', - value: PackageMainStatus.Running, + value: 'running', }, { op: PatchOp.REMOVE, @@ -1179,7 +1177,7 @@ export class MockApiService extends ApiService { { op: PatchOp.REPLACE, path: path + '/status', - value: PackageMainStatus.Restarting, + value: 'restarting', }, { op: PatchOp.REPLACE, @@ -1203,7 +1201,7 @@ export class MockApiService extends ApiService { op: PatchOp.REPLACE, path: path, value: { - status: PackageMainStatus.Stopped, + status: 'stopped', }, }, ] @@ -1215,7 +1213,7 @@ export class MockApiService extends ApiService { op: PatchOp.REPLACE, path: path, value: { - status: PackageMainStatus.Stopping, + status: 'stopping', timeout: '35s', }, }, @@ -1245,7 +1243,7 @@ export class MockApiService extends ApiService { { op: PatchOp.REPLACE, path: `/packageData/${params.id}/stateInfo/state`, - value: PackageState.Removing, + value: 'removing', }, ] @@ -1397,7 +1395,7 @@ export class MockApiService extends ApiService { op: PatchOp.REPLACE, path: `/packageData/${id}/stateInfo`, value: { - state: PackageState.Installed, + state: 'installed', manifest: Mock.LocalPkgs[id].stateInfo.manifest, }, }, diff --git a/web/projects/ui/src/app/services/api/mock-patch.ts b/web/projects/ui/src/app/services/api/mock-patch.ts index bb9c84d85..8cb16e8fa 100644 --- a/web/projects/ui/src/app/services/api/mock-patch.ts +++ b/web/projects/ui/src/app/services/api/mock-patch.ts @@ -1,9 +1,4 @@ -import { - DataModel, - HealthResult, - PackageMainStatus, - PackageState, -} from 'src/app/services/patch-db/data-model' +import { DataModel } from 'src/app/services/patch-db/data-model' import { Mock } from './api.fixures' export const mockPatchData: DataModel = { @@ -12,7 +7,6 @@ export const mockPatchData: DataModel = { ackWelcome: '1.0.0', theme: 'Dark', desktop: ['lnd'], - widgets: [], marketplace: { selectedUrl: 'https://registry.start9.com/', knownHosts: { @@ -138,11 +132,13 @@ export const mockPatchData: DataModel = { passwordHash: '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ', platform: 'x86_64-nonfree', + arch: 'x86_64', + governor: 'performance', }, packageData: { bitcoind: { stateInfo: { - state: PackageState.Installed, + state: 'installed', manifest: { ...Mock.MockManifestBitcoind, version: '0.20.0', @@ -154,31 +150,33 @@ export const mockPatchData: DataModel = { status: { configured: true, main: { - status: PackageMainStatus.Running, + status: 'running', started: '2021-06-14T20:49:17.774Z', health: { 'ephemeral-health-check': { name: 'Ephemeral Health Check', - result: HealthResult.Starting, + result: 'starting', + message: null, }, 'chain-state': { name: 'Chain State', - result: HealthResult.Loading, + result: 'loading', message: 'Bitcoin is syncing from genesis', }, 'p2p-interface': { name: 'P2P', - result: HealthResult.Success, + result: 'success', message: 'Health check successful', }, 'rpc-interface': { name: 'RPC', - result: HealthResult.Failure, + result: 'failure', message: 'RPC interface unreachable.', }, 'unnecessary-health-check': { name: 'Unnecessary Health Check', - result: HealthResult.Disabled, + result: 'disabled', + message: null, }, }, }, @@ -202,9 +200,10 @@ export const mockPatchData: DataModel = { scheme: 'http', preferredExternalPort: 80, addSsl: { - addXForwardedHeaders: false, + // addXForwardedHeaders: false, preferredExternalPort: 443, scheme: 'https', + alpn: { specified: ['http/1.1', 'h2'] }, }, secure: null, }, @@ -274,9 +273,10 @@ export const mockPatchData: DataModel = { scheme: 'http', preferredExternalPort: 80, addSsl: { - addXForwardedHeaders: false, + // addXForwardedHeaders: false, preferredExternalPort: 443, scheme: 'https', + alpn: { specified: ['http/1.1'] }, }, secure: null, }, @@ -402,13 +402,15 @@ export const mockPatchData: DataModel = { }, }, currentDependencies: {}, + hosts: {}, + storeExposedDependents: [], marketplaceUrl: 'https://registry.start9.com/', developerKey: 'developer-key', outboundProxy: null, }, lnd: { stateInfo: { - state: PackageState.Installed, + state: 'installed', manifest: { ...Mock.MockManifestLnd, version: '0.11.0', @@ -420,7 +422,7 @@ export const mockPatchData: DataModel = { status: { configured: true, main: { - status: PackageMainStatus.Stopped, + status: 'stopped', }, dependencyConfigErrors: { 'btc-rpc-proxy': 'This is a config unsatisfied error', @@ -655,6 +657,8 @@ export const mockPatchData: DataModel = { healthChecks: [], }, }, + hosts: {}, + storeExposedDependents: [], marketplaceUrl: 'https://registry.start9.com/', developerKey: 'developer-key', outboundProxy: null, diff --git a/web/projects/ui/src/app/services/config.service.ts b/web/projects/ui/src/app/services/config.service.ts index e8cd12003..f47690130 100644 --- a/web/projects/ui/src/app/services/config.service.ts +++ b/web/projects/ui/src/app/services/config.service.ts @@ -2,11 +2,12 @@ import { DOCUMENT } from '@angular/common' import { Inject, Injectable } from '@angular/core' import { WorkspaceConfig } from '@start9labs/shared' import { T } from '@start9labs/start-sdk' -import { - PackageDataEntry, - PackageMainStatus, - PackageState, -} from 'src/app/services/patch-db/data-model' +import { PackageDataEntry } from 'src/app/services/patch-db/data-model' +import { PackageState } from '../../../../../../core/startos/bindings/PackageState' +import { MainStatus } from '../../../../../../core/startos/bindings/MainStatus' +import { ExportedOnionHostname } from '../../../../../../core/startos/bindings/ExportedOnionHostname' +import { ExportedIpHostname } from '../../../../../../core/startos/bindings/ExportedIpHostname' +import { ExportedHostnameInfo } from '../../../../../../core/startos/bindings/ExportedHostnameInfo' const { gitHash, @@ -77,10 +78,11 @@ export class ConfigService { return window.isSecureContext || this.isTor() } - isLaunchable(state: PackageState, status: PackageMainStatus): boolean { - return ( - state === PackageState.Installed && status === PackageMainStatus.Running - ) + isLaunchable( + state: PackageState['state'], + status: MainStatus['status'], + ): boolean { + return state === 'installed' && status === 'running' } /** ${scheme}://${username}@${host}:${externalPort}${suffix} */ @@ -95,31 +97,28 @@ export class ConfigService { const url = new URL(`${scheme}://${username}placeholder${suffix}`) if (host.kind === 'multi') { - const onionHostname = host.hostnames.find( - (h: any) => h.kind === 'onion', - ) as T.HostnameInfoOnion + const onionHostname = host.hostnames.find(h => h.kind === 'onion') + ?.hostname as ExportedOnionHostname if (this.isTor() && onionHostname) { - url.hostname = onionHostname.hostname.value + url.hostname = onionHostname.value } else { - const ipHostname = host.hostnames.find( - (h: any) => h.kind === 'ip', - ) as T.HostnameInfoIp + const ipHostname = host.hostnames.find(h => h.kind === 'ip') + ?.hostname as ExportedIpHostname if (!ipHostname) return '' url.hostname = this.hostname - url.port = String( - ipHostname.hostname.sslPort || ipHostname.hostname.port, - ) + url.port = String(ipHostname.sslPort || ipHostname.port) } } else { - const hostname = host.hostname + throw new Error('unimplemented') + const hostname = {} as ExportedHostnameInfo // host.hostname if (!hostname) return '' if (this.isTor() && hostname.kind === 'onion') { - url.hostname = hostname.hostname.value + url.hostname = (hostname.hostname as ExportedOnionHostname).value } else { url.hostname = this.hostname url.port = String(hostname.hostname.sslPort || hostname.hostname.port) diff --git a/web/projects/ui/src/app/services/dep-error.service.ts b/web/projects/ui/src/app/services/dep-error.service.ts index c48726c85..7fb0076e7 100644 --- a/web/projects/ui/src/app/services/dep-error.service.ts +++ b/web/projects/ui/src/app/services/dep-error.service.ts @@ -4,15 +4,13 @@ import { distinctUntilChanged, map, shareReplay } from 'rxjs/operators' import { PatchDB } from 'patch-db-client' import { DataModel, - HealthResult, InstalledState, PackageDataEntry, - PackageMainStatus, - PackageState, } from './patch-db/data-model' import * as deepEqual from 'fast-deep-equal' import { Observable } from 'rxjs' import { isInstalled } from '../util/get-package-data' +import { DependencyError } from './api/api.types' export type AllDependencyErrors = Record export type PkgDependencyErrors = Record @@ -82,9 +80,9 @@ export class DepErrorService { const dep = pkgs[depId] // not installed - if (!dep || dep.stateInfo.state !== PackageState.Installed) { + if (!dep || dep.stateInfo.state !== 'installed') { return { - type: DependencyErrorType.NotInstalled, + type: 'notInstalled', } } @@ -94,7 +92,7 @@ export class DepErrorService { // incorrect version if (!this.emver.satisfies(depManifest.version, versionSpec)) { return { - type: DependencyErrorType.IncorrectVersion, + type: 'incorrectVersion', expected: versionSpec, received: depManifest.version, } @@ -103,28 +101,29 @@ export class DepErrorService { // invalid config if (Object.values(pkg.status.dependencyConfigErrors).some(err => !!err)) { return { - type: DependencyErrorType.ConfigUnsatisfied, + type: 'configUnsatisfied', } } const depStatus = dep.status.main.status // not running - if ( - depStatus !== PackageMainStatus.Running && - depStatus !== PackageMainStatus.Starting - ) { + if (depStatus !== 'running' && depStatus !== 'starting') { return { - type: DependencyErrorType.NotRunning, + type: 'notRunning', } } + const currentDep = pkg.currentDependencies[depId] + // health check failure - if (depStatus === PackageMainStatus.Running) { - for (let id of pkg.currentDependencies[depId].healthChecks) { - if (dep.status.main.health[id]?.result !== HealthResult.Success) { + if (depStatus === 'running' && currentDep.kind === 'running') { + for (let id of currentDep.healthChecks) { + const check = dep.status.main.health[id] + if (check?.result !== 'success') { return { - type: DependencyErrorType.HealthChecksFailed, + type: 'healthChecksFailed', + check, } } } @@ -137,7 +136,7 @@ export class DepErrorService { if (transitiveError) { return { - type: DependencyErrorType.Transitive, + type: 'transitive', } } @@ -161,46 +160,3 @@ function dependencyDepth( depth, ) } - -export type DependencyError = - | DependencyErrorNotInstalled - | DependencyErrorNotRunning - | DependencyErrorIncorrectVersion - | DependencyErrorConfigUnsatisfied - | DependencyErrorHealthChecksFailed - | DependencyErrorTransitive - -export enum DependencyErrorType { - NotInstalled = 'notInstalled', - NotRunning = 'notRunning', - IncorrectVersion = 'incorrectVersion', - ConfigUnsatisfied = 'configUnsatisfied', - HealthChecksFailed = 'healthChecksFailed', - Transitive = 'transitive', -} - -export interface DependencyErrorNotInstalled { - type: DependencyErrorType.NotInstalled -} - -export interface DependencyErrorNotRunning { - type: DependencyErrorType.NotRunning -} - -export interface DependencyErrorIncorrectVersion { - type: DependencyErrorType.IncorrectVersion - expected: string // version range - received: string // version -} - -export interface DependencyErrorConfigUnsatisfied { - type: DependencyErrorType.ConfigUnsatisfied -} - -export interface DependencyErrorHealthChecksFailed { - type: DependencyErrorType.HealthChecksFailed -} - -export interface DependencyErrorTransitive { - type: DependencyErrorType.Transitive -} diff --git a/web/projects/ui/src/app/services/marketplace.service.ts b/web/projects/ui/src/app/services/marketplace.service.ts index 3281bfab9..e95294b91 100644 --- a/web/projects/ui/src/app/services/marketplace.service.ts +++ b/web/projects/ui/src/app/services/marketplace.service.ts @@ -6,7 +6,6 @@ import { MarketplacePkg, StoreData, StoreIdentity, - StoreIdentityWithData, StoreInfo, } from '@start9labs/marketplace' import { PatchDB } from 'patch-db-client' diff --git a/web/projects/ui/src/app/services/patch-db/data-model.ts b/web/projects/ui/src/app/services/patch-db/data-model.ts index 9012e9142..50dda578b 100644 --- a/web/projects/ui/src/app/services/patch-db/data-model.ts +++ b/web/projects/ui/src/app/services/patch-db/data-model.ts @@ -1,16 +1,17 @@ import { BackupJob, ServerNotifications } from '../api/api.types' -import { Url } from '@start9labs/shared' -import { Manifest } from '@start9labs/marketplace' import { T } from '@start9labs/start-sdk' import { config } from '@start9labs/start-sdk' +import { PackageDataEntry as PDE } from '../../../../../../../core/startos/bindings/PackageDataEntry' +import { FullProgress } from '../../../../../../../core/startos/bindings/FullProgress' +import { Manifest } from '../../../../../../../core/startos/bindings/Manifest' -export interface DataModel { - serverInfo: ServerInfo - packageData: { [id: string]: PackageDataEntry } +export type DataModel = { ui: UIData + serverInfo: ServerInfo + packageData: Record } -export interface UIData { +export type UIData = { name: string | null ackWelcome: string // emver marketplace: UIMarketplaceData @@ -21,24 +22,10 @@ export interface UIData { } ackInstructions: Record theme: string - widgets: readonly Widget[] desktop: readonly string[] } -export interface Widget { - id: string - meta: { - name: string - width: number - height: number - mobileWidth: number - mobileHeight: number - } - url?: string - settings?: string -} - -export interface UIMarketplaceData { +export type UIMarketplaceData = { selectedUrl: string knownHosts: { 'https://registry.start9.com/': UIStore @@ -47,11 +34,11 @@ export interface UIMarketplaceData { } } -export interface UIStore { +export type UIStore = { name?: string } -export interface ServerInfo { +export type ServerInfo = { id: string version: string country: string @@ -70,6 +57,8 @@ export interface ServerInfo { smtp: typeof config.constants.customSmtp.validator._TYPE passwordHash: string platform: string + arch: string + governor: string | null } export type NetworkInfo = { @@ -129,14 +118,6 @@ export type Proxy = { } } -export interface IpInfo { - [iface: string]: { - wireless: boolean - ipv4: string | null - ipv6: string | null - } -} - export interface ServerStatusInfo { currentBackup: null | { job: BackupJob @@ -148,16 +129,8 @@ export interface ServerStatusInfo { shuttingDown: boolean } -export type PackageDataEntry = { +export type PackageDataEntry = PDE & { stateInfo: T - icon: Url - status: Status - actions: Record - lastBackup: string | null - currentDependencies: Record - serviceInterfaces: Record - marketplaceUrl: string | null - developerKey: string installedAt: string outboundProxy: string | null } @@ -165,142 +138,24 @@ export type PackageDataEntry = { export type StateInfo = InstalledState | InstallingState | UpdatingState export type InstalledState = { - state: PackageState.Installed | PackageState.Removing + state: 'installed' | 'removing' manifest: Manifest installingInfo?: undefined } export type InstallingState = { - state: PackageState.Installing | PackageState.Restoring + state: 'installing' | 'restoring' installingInfo: InstallingInfo manifest?: undefined } export type UpdatingState = { - state: PackageState.Updating + state: 'updating' installingInfo: InstallingInfo manifest: Manifest } -export enum PackageState { - Installing = 'installing', - Installed = 'installed', - Updating = 'updating', - Removing = 'removing', - Restoring = 'restoring', -} - -export interface CurrentDependencyInfo { - title: string - icon: string - kind: 'exists' | 'running' - registryUrl: string - versionSpec: string - healthChecks: string[] // array of health check IDs -} - -export interface Status { - configured: boolean - main: MainStatus - dependencyConfigErrors: { [id: string]: string | null } -} - -export type MainStatus = - | MainStatusStopped - | MainStatusStopping - | MainStatusStarting - | MainStatusRunning - | MainStatusBackingUp - | MainStatusRestarting - | MainStatusConfiguring - -export interface MainStatusStopped { - status: PackageMainStatus.Stopped -} - -export interface MainStatusStopping { - status: PackageMainStatus.Stopping - timeout: string -} - -export interface MainStatusStarting { - status: PackageMainStatus.Starting -} - -export interface MainStatusRunning { - status: PackageMainStatus.Running - started: string // UTC date string - health: Record -} - -export interface MainStatusBackingUp { - status: PackageMainStatus.BackingUp -} - -export interface MainStatusRestarting { - status: PackageMainStatus.Restarting -} - -export interface MainStatusConfiguring { - status: PackageMainStatus.Configuring -} - -export enum PackageMainStatus { - Starting = 'starting', - Running = 'running', - Stopping = 'stopping', - Stopped = 'stopped', - BackingUp = 'backing-up', - Restarting = 'restarting', - Configuring = 'configuring', -} - -export type HealthCheckResult = { name: string } & ( - | HealthCheckResultStarting - | HealthCheckResultLoading - | HealthCheckResultDisabled - | HealthCheckResultSuccess - | HealthCheckResultFailure -) - -export enum HealthResult { - Starting = 'starting', - Loading = 'loading', - Disabled = 'disabled', - Success = 'success', - Failure = 'failure', -} - -export interface HealthCheckResultStarting { - result: HealthResult.Starting -} - -export interface HealthCheckResultDisabled { - result: HealthResult.Disabled -} - -export interface HealthCheckResultSuccess { - result: HealthResult.Success - message: string -} - -export interface HealthCheckResultLoading { - result: HealthResult.Loading - message: string -} - -export interface HealthCheckResultFailure { - result: HealthResult.Failure - message: string -} - export type InstallingInfo = { progress: FullProgress newManifest: Manifest } - -export type FullProgress = { - overall: Progress - phases: { name: string; progress: Progress }[] -} -export type Progress = boolean | { done: number; total: number | null } // false means indeterminate. true means complete diff --git a/web/projects/ui/src/app/services/pkg-status-rendering.service.ts b/web/projects/ui/src/app/services/pkg-status-rendering.service.ts index ea10ca51a..15a8eb823 100644 --- a/web/projects/ui/src/app/services/pkg-status-rendering.service.ts +++ b/web/projects/ui/src/app/services/pkg-status-rendering.service.ts @@ -1,70 +1,65 @@ -import { - PackageDataEntry, - PackageMainStatus, - PackageState, - Status, -} from 'src/app/services/patch-db/data-model' +import { PackageDataEntry } from 'src/app/services/patch-db/data-model' import { PkgDependencyErrors } from './dep-error.service' +import { Status } from '../../../../../../core/startos/bindings/Status' +import { T } from '@start9labs/start-sdk' export interface PackageStatus { - primary: PrimaryStatus | PackageState | PackageMainStatus + primary: PrimaryStatus dependency: DependencyStatus | null - health: HealthStatus | null + health: T.HealthStatus | null } export function renderPkgStatus( pkg: PackageDataEntry, depErrors: PkgDependencyErrors, ): PackageStatus { - let primary: PrimaryStatus | PackageState | PackageMainStatus + let primary: PrimaryStatus let dependency: DependencyStatus | null = null - let health: HealthStatus | null = null + let health: T.HealthStatus | null = null - if (pkg.stateInfo.state === PackageState.Installed) { - primary = getPrimaryStatus(pkg.status) + if (pkg.stateInfo.state === 'installed') { + primary = getInstalledPrimaryStatus(pkg.status) dependency = getDependencyStatus(depErrors) health = getHealthStatus(pkg.status) } else { - primary = pkg.stateInfo.state as string as PrimaryStatus + primary = pkg.stateInfo.state } return { primary, dependency, health } } -function getPrimaryStatus(status: Status): PrimaryStatus | PackageMainStatus { +function getInstalledPrimaryStatus(status: Status): PrimaryStatus { if (!status.configured) { - return PrimaryStatus.NeedsConfig + return 'needsConfig' } else { return status.main.status } } function getDependencyStatus(depErrors: PkgDependencyErrors): DependencyStatus { - return Object.values(depErrors).some(err => !!err) - ? DependencyStatus.Warning - : DependencyStatus.Satisfied + return Object.values(depErrors).some(err => !!err) ? 'warning' : 'satisfied' } -function getHealthStatus(status: Status): HealthStatus | null { - if (status.main.status !== PackageMainStatus.Running || !status.main.health) { +function getHealthStatus(status: Status): T.HealthStatus | null { + if (status.main.status !== 'running' || !status.main.health) { return null } const values = Object.values(status.main.health) if (values.some(h => h.result === 'failure')) { - return HealthStatus.Failure + return 'failure' } if (values.some(h => h.result === 'loading')) { - return HealthStatus.Loading + return 'loading' } if (values.some(h => h.result === 'starting')) { - return HealthStatus.Starting + return 'starting' } - return HealthStatus.Healthy + return 'success' } export interface StatusRendering { @@ -73,101 +68,88 @@ export interface StatusRendering { showDots?: boolean } -export enum PrimaryStatus { - // state - Installing = 'installing', - Updating = 'updating', - Removing = 'removing', - Restoring = 'restoring', - // status - Starting = 'starting', - Running = 'running', - Stopping = 'stopping', - Restarting = 'restarting', - Stopped = 'stopped', - BackingUp = 'backing-up', - // config - NeedsConfig = 'needs-config', -} +export type PrimaryStatus = + | 'installing' + | 'updating' + | 'removing' + | 'restoring' + | 'starting' + | 'running' + | 'stopping' + | 'restarting' + | 'stopped' + | 'backingUp' + | 'needsConfig' -export enum DependencyStatus { - Warning = 'warning', - Satisfied = 'satisfied', -} +export type DependencyStatus = 'warning' | 'satisfied' -export enum HealthStatus { - Failure = 'failure', - Starting = 'starting', - Loading = 'loading', - Healthy = 'healthy', -} - -export const PrimaryRendering: Record = { - [PrimaryStatus.Installing]: { +export const PrimaryRendering: Record = { + installing: { display: 'Installing', color: 'primary', showDots: true, }, - [PrimaryStatus.Updating]: { + updating: { display: 'Updating', color: 'primary', showDots: true, }, - [PrimaryStatus.Removing]: { + removing: { display: 'Removing', color: 'danger', showDots: true, }, - [PrimaryStatus.Restoring]: { + restoring: { display: 'Restoring', color: 'primary', showDots: true, }, - [PrimaryStatus.Stopping]: { + stopping: { display: 'Stopping', color: 'dark-shade', showDots: true, }, - [PrimaryStatus.Restarting]: { + restarting: { display: 'Restarting', color: 'tertiary', showDots: true, }, - [PrimaryStatus.Stopped]: { + stopped: { display: 'Stopped', color: 'dark-shade', showDots: false, }, - [PrimaryStatus.BackingUp]: { + backingUp: { display: 'Backing Up', color: 'primary', showDots: true, }, - [PrimaryStatus.Starting]: { + starting: { display: 'Starting', color: 'primary', showDots: true, }, - [PrimaryStatus.Running]: { + running: { display: 'Running', color: 'success', showDots: false, }, - [PrimaryStatus.NeedsConfig]: { + needsConfig: { display: 'Needs Config', color: 'warning', showDots: false, }, } -export const DependencyRendering: Record = { - [DependencyStatus.Warning]: { display: 'Issue', color: 'warning' }, - [DependencyStatus.Satisfied]: { display: 'Satisfied', color: 'success' }, +export const DependencyRendering: Record = { + warning: { display: 'Issue', color: 'warning' }, + satisfied: { display: 'Satisfied', color: 'success' }, } -export const HealthRendering: Record = { - [HealthStatus.Failure]: { display: 'Failure', color: 'danger' }, - [HealthStatus.Starting]: { display: 'Starting', color: 'primary' }, - [HealthStatus.Loading]: { display: 'Loading', color: 'primary' }, - [HealthStatus.Healthy]: { display: 'Healthy', color: 'success' }, +export const HealthRendering: Record = { + failure: { display: 'Failure', color: 'danger' }, + starting: { display: 'Starting', color: 'primary' }, + loading: { display: 'Loading', color: 'primary' }, + success: { display: 'Healthy', color: 'success' }, + disabled: { display: 'Disabled', color: 'dark' }, } diff --git a/web/projects/ui/src/app/types/pkg-info.ts b/web/projects/ui/src/app/types/pkg-info.ts index ae9e87f02..3761ae0c9 100644 --- a/web/projects/ui/src/app/types/pkg-info.ts +++ b/web/projects/ui/src/app/types/pkg-info.ts @@ -1,9 +1,5 @@ import { Subscription } from 'rxjs' -import { - PackageDataEntry, - PackageMainStatus, - PackageState, -} from '../services/patch-db/data-model' +import { PackageDataEntry } from '../services/patch-db/data-model' import { PrimaryStatus, StatusRendering, @@ -12,7 +8,7 @@ import { export interface PkgInfo { entry: PackageDataEntry primaryRendering: StatusRendering - primaryStatus: PrimaryStatus | PackageState | PackageMainStatus + primaryStatus: PrimaryStatus error: boolean warning: boolean transitioning: boolean diff --git a/web/projects/ui/src/app/util/get-package-data.ts b/web/projects/ui/src/app/util/get-package-data.ts index e986bbf43..e831a1117 100644 --- a/web/projects/ui/src/app/util/get-package-data.ts +++ b/web/projects/ui/src/app/util/get-package-data.ts @@ -4,11 +4,10 @@ import { InstalledState, InstallingState, PackageDataEntry, - PackageState, UpdatingState, } from 'src/app/services/patch-db/data-model' import { firstValueFrom } from 'rxjs' -import { Manifest } from '@start9labs/marketplace' +import { Manifest } from '../../../../../../core/startos/bindings/Manifest' export async function getPackage( patch: PatchDB, @@ -32,29 +31,29 @@ export function getManifest(pkg: PackageDataEntry): Manifest { export function isInstalled( pkg: PackageDataEntry, ): pkg is PackageDataEntry { - return pkg.stateInfo.state === PackageState.Installed + return pkg.stateInfo.state === 'installed' } export function isRemoving( pkg: PackageDataEntry, ): pkg is PackageDataEntry { - return pkg.stateInfo.state === PackageState.Removing + return pkg.stateInfo.state === 'removing' } export function isInstalling( pkg: PackageDataEntry, ): pkg is PackageDataEntry { - return pkg.stateInfo.state === PackageState.Installing + return pkg.stateInfo.state === 'installing' } export function isRestoring( pkg: PackageDataEntry, ): pkg is PackageDataEntry { - return pkg.stateInfo.state === PackageState.Restoring + return pkg.stateInfo.state === 'restoring' } export function isUpdating( pkg: PackageDataEntry, ): pkg is PackageDataEntry { - return pkg.stateInfo.state === PackageState.Updating + return pkg.stateInfo.state === 'updating' } diff --git a/web/projects/ui/src/app/util/get-package-info.ts b/web/projects/ui/src/app/util/get-package-info.ts index 03a6ed305..f28dd17f4 100644 --- a/web/projects/ui/src/app/util/get-package-info.ts +++ b/web/projects/ui/src/app/util/get-package-info.ts @@ -1,9 +1,6 @@ import { PackageDataEntry } from '../services/patch-db/data-model' import { - DependencyStatus, - HealthStatus, PrimaryRendering, - PrimaryStatus, renderPkgStatus, } from '../services/pkg-status-rendering.service' import { PkgInfo } from '../types/pkg-info' @@ -20,13 +17,11 @@ export function getPackageInfo( entry, primaryRendering, primaryStatus: statuses.primary, - error: - statuses.health === HealthStatus.Failure || - statuses.dependency === DependencyStatus.Warning, - warning: statuses.primary === PrimaryStatus.NeedsConfig, + error: statuses.health === 'failure' || statuses.dependency === 'warning', + warning: statuses.primary === 'needsConfig', transitioning: primaryRendering.showDots || - statuses.health === HealthStatus.Loading || - statuses.health === HealthStatus.Starting, + statuses.health === 'loading' || + statuses.health === 'starting', } }