diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 000000000..ce5d2734a --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,5 @@ +{ + "attribution": { + "commit": "" + } +} diff --git a/.gitignore b/.gitignore index 227782023..4207eb792 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,6 @@ secrets.db /compiled.tar /compiled-*.tar /build/lib/firmware -tmp \ No newline at end of file +tmp +web/.i18n-checked +agents/USER.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 000000000..22d94db31 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,146 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +StartOS is an open-source Linux distribution for running personal servers. It manages discovery, installation, network configuration, backups, and health monitoring of self-hosted services. + +**Tech Stack:** +- Backend: Rust (async/Tokio, Axum web framework) +- Frontend: Angular 20 + TypeScript + TaigaUI +- Container runtime: Node.js/TypeScript with LXC +- Database/State: Patch-DB (git submodule) - storage layer with reactive frontend sync +- API: JSON-RPC via rpc-toolkit (see `agents/rpc-toolkit.md`) +- Auth: Password + session cookie, public/private key signatures, local authcookie (see `core/src/middleware/auth/`) + +## Build & Development + +See [CONTRIBUTING.md](CONTRIBUTING.md) for: +- Environment setup and requirements +- Build commands and make targets +- Testing and formatting commands +- Environment variables + +**Quick reference:** +```bash +. ./devmode.sh # Enable dev mode +make update-startbox REMOTE=start9@ # Fastest iteration (binary + UI) +make test-core # Run Rust tests +``` + +## Architecture + +### Core (`/core`) +The Rust backend daemon. Main binaries: +- `startbox` - Main daemon (runs as `startd`) +- `start-cli` - CLI interface +- `start-container` - Runs inside LXC containers; communicates with host and manages subcontainers +- `registrybox` - Registry daemon +- `tunnelbox` - VPN/tunnel daemon + +**Key modules:** +- `src/context/` - Context types (RpcContext, CliContext, InitContext, DiagnosticContext) +- `src/service/` - Service lifecycle management with actor pattern (`service_actor.rs`) +- `src/db/model/` - Patch-DB models (`public.rs` synced to frontend, `private.rs` backend-only) +- `src/net/` - Networking (DNS, ACME, WiFi, Tor via Arti, WireGuard) +- `src/s9pk/` - S9PK package format (merkle archive) +- `src/registry/` - Package registry management + +**RPC Pattern:** See `agents/rpc-toolkit.md` + +### Web (`/web`) +Angular projects sharing common code: +- `projects/ui/` - Main admin interface +- `projects/setup-wizard/` - Initial setup +- `projects/start-tunnel/` - VPN management UI +- `projects/shared/` - Common library (API clients, components) +- `projects/marketplace/` - Service discovery + +**Development:** +```bash +cd web +npm ci +npm run start:ui # Dev server with mocks +npm run build:ui # Production build +npm run check # Type check all projects +``` + +### Container Runtime (`/container-runtime`) +Node.js runtime that manages service containers via RPC. See `RPCSpec.md` for protocol. + +**Container Architecture:** +``` +LXC Container (uniform base for all services) +└── systemd + └── container-runtime.service + └── Loads /usr/lib/startos/package/index.js (from s9pk javascript.squashfs) + └── Package JS launches subcontainers (from images in s9pk) +``` + +The container runtime communicates with the host via JSON-RPC over Unix socket. Package JavaScript must export functions conforming to the `ABI` type defined in `sdk/base/lib/types.ts`. + +**`/media/startos/` directory (mounted by host into container):** + +| Path | Description | +|------|-------------| +| `volumes//` | Package data volumes (id-mapped, persistent) | +| `assets/` | Read-only assets from s9pk `assets.squashfs` | +| `images//` | Container images (squashfs, used for subcontainers) | +| `images/.env` | Environment variables for image | +| `images/.json` | Image metadata | +| `backup/` | Backup mount point (mounted during backup operations) | +| `rpc/service.sock` | RPC socket (container runtime listens here) | +| `rpc/host.sock` | Host RPC socket (for effects callbacks to host) | + +**S9PK Structure:** See `agents/s9pk-structure.md` + +### SDK (`/sdk`) +TypeScript SDK for packaging services (`@start9labs/start-sdk`). + +- `base/` - Core types, ABI definitions, effects interface (`@start9labs/start-sdk-base`) +- `package/` - Full SDK for package developers, re-exports base + +### Patch-DB (`/patch-db`) +Git submodule providing diff-based state synchronization. Changes to `db/model/public.rs` automatically sync to the frontend. + +**Key patterns:** +- `db.peek().await` - Get a read-only snapshot of the database state +- `db.mutate(|db| { ... }).await` - Apply mutations atomically, returns `MutateResult` +- `#[derive(HasModel)]` - Derive macro for types stored in the database, generates typed accessors + +**Generated accessor types** (from `HasModel` derive): +- `as_field()` - Immutable reference: `&Model` +- `as_field_mut()` - Mutable reference: `&mut Model` +- `into_field()` - Owned value: `Model` + +**`Model` APIs** (from `db/prelude.rs`): +- `.de()` - Deserialize to `T` +- `.ser(&value)` - Serialize from `T` +- `.mutate(|v| ...)` - Deserialize, mutate, reserialize +- For maps: `.keys()`, `.as_idx(&key)`, `.as_idx_mut(&key)`, `.insert()`, `.remove()`, `.contains_key()` + +## Supplementary Documentation + +The `agents/` directory contains detailed documentation for AI assistants: + +- `TODO.md` - Pending tasks for AI agents (check this first, remove items when completed) +- `USER.md` - Current user identifier (gitignored, see below) +- `rpc-toolkit.md` - JSON-RPC patterns and handler configuration +- `core-rust-patterns.md` - Common utilities and patterns for Rust code in `/core` (guard pattern, mount guards, etc.) +- `s9pk-structure.md` - S9PK package format structure +- `i18n-patterns.md` - Internationalization key conventions and usage in `/core` + +### Session Startup + +On startup: + +1. **Check for `agents/USER.md`** - If it doesn't exist, prompt the user for their name/identifier and create it. This file is gitignored since it varies per developer. + +2. **Check `agents/TODO.md` for relevant tasks** - Show TODOs that either: + - Have no `@username` tag (relevant to everyone) + - Are tagged with the current user's identifier + + Skip TODOs tagged with a different user. + +3. **Ask "What would you like to do today?"** - Offer options for each relevant TODO item, plus "Something else" for other requests. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b81e9ce82..f8bafdff4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,123 +11,190 @@ This guide is for contributing to the StartOS. If you are interested in packagin ```bash / -├── assets/ -├── container-runtime/ -├── core/ -├── build/ -├── debian/ -├── web/ -├── image-recipe/ -├── patch-db -└── sdk/ +├── assets/ # Screenshots for README +├── build/ # Auxiliary files and scripts for deployed images +├── container-runtime/ # Node.js program managing package containers +├── core/ # Rust backend: API, daemon (startd), CLI (start-cli) +├── debian/ # Debian package maintainer scripts +├── image-recipe/ # Scripts for building StartOS images +├── patch-db/ # (submodule) Diff-based data store for frontend sync +├── sdk/ # TypeScript SDK for building StartOS packages +└── web/ # Web UIs (Angular) ``` -#### assets - -screenshots for the StartOS README - -#### container-runtime - -A NodeJS program that dynamically loads maintainer scripts and communicates with the OS to manage packages - -#### core - -An API, daemon (startd), and CLI (start-cli) that together provide the core functionality of StartOS. - -#### build - -Auxiliary files and scripts to include in deployed StartOS images - -#### debian - -Maintainer scripts for the StartOS Debian package - -#### web - -Web UIs served under various conditions and used to interact with StartOS APIs. - -#### image-recipe - -Scripts for building StartOS images - -#### patch-db (submodule) - -A diff based data store used to synchronize data between the web interfaces and server. - -#### sdk - -A typescript sdk for building start-os packages +See component READMEs for details: +- [`core`](core/README.md) +- [`web`](web/README.md) +- [`build`](build/README.md) +- [`patch-db`](https://github.com/Start9Labs/patch-db) ## Environment Setup -#### Clone the StartOS repository - ```sh git clone https://github.com/Start9Labs/start-os.git --recurse-submodules cd start-os ``` -#### Continue to your project of interest for additional instructions: +### Development Mode -- [`core`](core/README.md) -- [`web-interfaces`](web-interfaces/README.md) -- [`build`](build/README.md) -- [`patch-db`](https://github.com/Start9Labs/patch-db) +For faster iteration during development: + +```sh +. ./devmode.sh +``` + +This sets `ENVIRONMENT=dev` and `GIT_BRANCH_AS_HASH=1` to prevent rebuilds on every commit. ## Building -This project uses [GNU Make](https://www.gnu.org/software/make/) to build its components. To build any specific component, simply run `make ` replacing `` with the name of the target you'd like to build +All builds can be performed on any operating system that can run Docker. + +This project uses [GNU Make](https://www.gnu.org/software/make/) to build its components. ### Requirements - [GNU Make](https://www.gnu.org/software/make/) -- [Docker](https://docs.docker.com/get-docker/) +- [Docker](https://docs.docker.com/get-docker/) or [Podman](https://podman.io/) - [NodeJS v20.16.0](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) -- [sed](https://www.gnu.org/software/sed/) -- [grep](https://www.gnu.org/software/grep/) -- [awk](https://www.gnu.org/software/gawk/) +- [Rust](https://rustup.rs/) (nightly for formatting) +- [sed](https://www.gnu.org/software/sed/), [grep](https://www.gnu.org/software/grep/), [awk](https://www.gnu.org/software/gawk/) - [jq](https://jqlang.github.io/jq/) -- [gzip](https://www.gnu.org/software/gzip/) -- [brotli](https://github.com/google/brotli) +- [gzip](https://www.gnu.org/software/gzip/), [brotli](https://github.com/google/brotli) -### Environment variables +### Environment Variables -- `PLATFORM`: which platform you would like to build for. Must be one of `x86_64`, `x86_64-nonfree`, `aarch64`, `aarch64-nonfree`, `raspberrypi` - - NOTE: `nonfree` images are for including `nonfree` firmware packages in the built ISO -- `ENVIRONMENT`: a hyphen separated set of feature flags to enable - - `dev`: enables password ssh (INSECURE!) and does not compress frontends - - `unstable`: enables assertions that will cause errors on unexpected inconsistencies that are undesirable in production use either for performance or reliability reasons - - `docker`: use `docker` instead of `podman` -- `GIT_BRANCH_AS_HASH`: set to `1` to use the current git branch name as the git hash so that the project does not need to be rebuilt on each commit +| Variable | Description | +|----------|-------------| +| `PLATFORM` | Target platform: `x86_64`, `x86_64-nonfree`, `aarch64`, `aarch64-nonfree`, `riscv64`, `raspberrypi` | +| `ENVIRONMENT` | Hyphen-separated feature flags (see below) | +| `PROFILE` | Build profile: `release` (default) or `dev` | +| `GIT_BRANCH_AS_HASH` | Set to `1` to use git branch name as version hash (avoids rebuilds) | -### Useful Make Targets +**ENVIRONMENT flags:** +- `dev` - Enables password SSH before setup, skips frontend compression +- `unstable` - Enables assertions and debugging with performance penalty +- `console` - Enables tokio-console for async debugging + +**Platform notes:** +- `-nonfree` variants include proprietary firmware and drivers +- `raspberrypi` includes non-free components by necessity +- Platform is remembered between builds if not specified + +### Make Targets + +#### Building + +| Target | Description | +|--------|-------------| +| `iso` | Create full `.iso` image (not for raspberrypi) | +| `img` | Create full `.img` image (raspberrypi only) | +| `deb` | Build Debian package | +| `all` | Build all Rust binaries | +| `uis` | Build all web UIs | +| `ui` | Build main UI only | +| `ts-bindings` | Generate TypeScript bindings from Rust types | + +#### Deploying to Device + +For devices on the same network: + +| Target | Description | +|--------|-------------| +| `update-startbox REMOTE=start9@` | Deploy binary + UI only (fastest) | +| `update-deb REMOTE=start9@` | Deploy full Debian package | +| `update REMOTE=start9@` | OTA-style update | +| `reflash REMOTE=start9@` | Reflash as if using live ISO | +| `update-overlay REMOTE=start9@` | Deploy to in-memory overlay (reverts on reboot) | + +For devices on different networks (uses [magic-wormhole](https://github.com/magic-wormhole/magic-wormhole)): + +| Target | Description | +|--------|-------------| +| `wormhole` | Send startbox binary | +| `wormhole-deb` | Send Debian package | +| `wormhole-squashfs` | Send squashfs image | + +#### Other + +| Target | Description | +|--------|-------------| +| `format` | Run code formatting (Rust nightly required) | +| `test` | Run all automated tests | +| `test-core` | Run Rust tests | +| `test-sdk` | Run SDK tests | +| `test-container-runtime` | Run container runtime tests | +| `clean` | Delete all compiled artifacts | + +## Testing + +```bash +make test # All tests +make test-core # Rust tests (via ./core/run-tests.sh) +make test-sdk # SDK tests +make test-container-runtime # Container runtime tests + +# Run specific Rust test +cd core && cargo test --features=test +``` + +## Code Formatting + +```bash +# Rust (requires nightly) +make format + +# TypeScript/HTML/SCSS (web) +cd web && npm run format +``` + +## Code Style Guidelines + +### Formatting + +Run the formatters before committing. Configuration is handled by `rustfmt.toml` (Rust) and prettier configs (TypeScript). + +### Documentation & Comments + +**Rust:** +- Add doc comments (`///`) to public APIs, structs, and non-obvious functions +- Use `//` comments sparingly for complex logic that isn't self-evident +- Prefer self-documenting code (clear naming, small functions) over comments + +**TypeScript:** +- Document exported functions and complex types with JSDoc +- Keep comments focused on "why" rather than "what" + +**General:** +- Don't add comments that just restate the code +- Update or remove comments when code changes +- TODOs should include context: `// TODO(username): reason` + +### Commit Messages + +Use [Conventional Commits](https://www.conventionalcommits.org/): + +``` +(): + +[optional body] + +[optional footer] +``` + +**Types:** +- `feat` - New feature +- `fix` - Bug fix +- `docs` - Documentation only +- `style` - Formatting, no code change +- `refactor` - Code change that neither fixes a bug nor adds a feature +- `test` - Adding or updating tests +- `chore` - Build process, dependencies, etc. + +**Examples:** +``` +feat(web): add dark mode toggle +fix(core): resolve race condition in service startup +docs: update CONTRIBUTING.md with style guidelines +refactor(sdk): simplify package validation logic +``` -- `iso`: Create a full `.iso` image - - Only possible from Debian - - Not available for `PLATFORM=raspberrypi` - - Additional Requirements: - - [debspawn](https://github.com/lkhq/debspawn) -- `img`: Create a full `.img` image - - Only possible from Debian - - Only available for `PLATFORM=raspberrypi` - - Additional Requirements: - - [debspawn](https://github.com/lkhq/debspawn) -- `format`: Run automatic code formatting for the project - - Additional Requirements: - - [rust](https://rustup.rs/) -- `test`: Run automated tests for the project - - Additional Requirements: - - [rust](https://rustup.rs/) -- `update`: Deploy the current working project to a device over ssh as if through an over-the-air update - - Requires an argument `REMOTE` which is the ssh address of the device, i.e. `start9@192.168.122.2` -- `reflash`: Deploy the current working project to a device over ssh as if using a live `iso` image to reflash it - - Requires an argument `REMOTE` which is the ssh address of the device, i.e. `start9@192.168.122.2` -- `update-overlay`: Deploy the current working project to a device over ssh to the in-memory overlay without restarting it - - WARNING: changes will be reverted after the device is rebooted - - WARNING: changes to `init` will not take effect as the device is already initialized - - Requires an argument `REMOTE` which is the ssh address of the device, i.e. `start9@192.168.122.2` -- `wormhole`: Deploy the `startbox` to a device using [magic-wormhole](https://github.com/magic-wormhole/magic-wormhole) - - When the build it complete will emit a command to paste into the shell of the device to upgrade it - - Additional Requirements: - - [magic-wormhole](https://github.com/magic-wormhole/magic-wormhole) -- `clean`: Delete all compiled artifacts diff --git a/agents/TODO.md b/agents/TODO.md new file mode 100644 index 000000000..70124aa74 --- /dev/null +++ b/agents/TODO.md @@ -0,0 +1,9 @@ +# AI Agent TODOs + +Pending tasks for AI agents. Remove items when completed. + +## Unreviewed CLAUDE.md Sections + +- [ ] Architecture - Web (`/web`) - @MattDHill + + diff --git a/agents/core-rust-patterns.md b/agents/core-rust-patterns.md new file mode 100644 index 000000000..fc7058255 --- /dev/null +++ b/agents/core-rust-patterns.md @@ -0,0 +1,249 @@ +# Utilities & Patterns + +This document covers common utilities and patterns used throughout the StartOS codebase. + +## Util Module (`core/src/util/`) + +The `util` module contains reusable utilities. Key submodules: + +| Module | Purpose | +|--------|---------| +| `actor/` | Actor pattern implementation for concurrent state management | +| `collections/` | Custom collection types | +| `crypto.rs` | Cryptographic utilities (encryption, hashing) | +| `future.rs` | Future/async utilities | +| `io.rs` | File I/O helpers (create_file, canonicalize, etc.) | +| `iter.rs` | Iterator extensions | +| `net.rs` | Network utilities | +| `rpc.rs` | RPC helpers | +| `rpc_client.rs` | RPC client utilities | +| `serde.rs` | Serialization helpers (Base64, display/fromstr, etc.) | +| `sync.rs` | Synchronization primitives (SyncMutex, etc.) | + +## Command Invocation (`Invoke` trait) + +The `Invoke` trait provides a clean way to run external commands with error handling: + +```rust +use crate::util::Invoke; + +// Simple invocation +tokio::process::Command::new("ls") + .arg("-la") + .invoke(ErrorKind::Filesystem) + .await?; + +// With timeout +tokio::process::Command::new("slow-command") + .timeout(Some(Duration::from_secs(30))) + .invoke(ErrorKind::Timeout) + .await?; + +// With input +let mut input = Cursor::new(b"input data"); +tokio::process::Command::new("cat") + .input(Some(&mut input)) + .invoke(ErrorKind::Filesystem) + .await?; + +// Piped commands +tokio::process::Command::new("cat") + .arg("file.txt") + .pipe(&mut tokio::process::Command::new("grep").arg("pattern")) + .invoke(ErrorKind::Filesystem) + .await?; +``` + +## Guard Pattern + +Guards ensure cleanup happens when they go out of scope. + +### `GeneralGuard` / `GeneralBoxedGuard` + +For arbitrary cleanup actions: + +```rust +use crate::util::GeneralGuard; + +let guard = GeneralGuard::new(|| { + println!("Cleanup runs on drop"); +}); + +// Do work... + +// Explicit drop with action +guard.drop(); + +// Or skip the action +// guard.drop_without_action(); +``` + +### `FileLock` + +File-based locking with automatic unlock: + +```rust +use crate::util::FileLock; + +let lock = FileLock::new("/path/to/lockfile", true).await?; // blocking=true +// Lock held until dropped or explicitly unlocked +lock.unlock().await?; +``` + +## Mount Guard Pattern (`core/src/disk/mount/guard.rs`) + +RAII guards for filesystem mounts. Ensures filesystems are unmounted when guards are dropped. + +### `MountGuard` + +Basic mount guard: + +```rust +use crate::disk::mount::guard::MountGuard; +use crate::disk::mount::filesystem::{MountType, ReadOnly}; + +let guard = MountGuard::mount(&filesystem, "/mnt/target", ReadOnly).await?; + +// Use the mounted filesystem at guard.path() +do_something(guard.path()).await?; + +// Explicit unmount (or auto-unmounts on drop) +guard.unmount(false).await?; // false = don't delete mountpoint +``` + +### `TmpMountGuard` + +Reference-counted temporary mount (mounts to `/media/startos/tmp/`): + +```rust +use crate::disk::mount::guard::TmpMountGuard; +use crate::disk::mount::filesystem::ReadOnly; + +// Multiple clones share the same mount +let guard1 = TmpMountGuard::mount(&filesystem, ReadOnly).await?; +let guard2 = guard1.clone(); + +// Mount stays alive while any guard exists +// Auto-unmounts when last guard is dropped +``` + +### `GenericMountGuard` trait + +All mount guards implement this trait: + +```rust +pub trait GenericMountGuard: std::fmt::Debug + Send + Sync + 'static { + fn path(&self) -> &Path; + fn unmount(self) -> impl Future> + Send; +} +``` + +### `SubPath` + +Wraps a mount guard to point to a subdirectory: + +```rust +use crate::disk::mount::guard::SubPath; + +let mount = TmpMountGuard::mount(&filesystem, ReadOnly).await?; +let subdir = SubPath::new(mount, "data/subdir"); + +// subdir.path() returns the full path including subdirectory +``` + +## FileSystem Implementations (`core/src/disk/mount/filesystem/`) + +Various filesystem types that can be mounted: + +| Type | Description | +|------|-------------| +| `bind.rs` | Bind mounts | +| `block_dev.rs` | Block device mounts | +| `cifs.rs` | CIFS/SMB network shares | +| `ecryptfs.rs` | Encrypted filesystem | +| `efivarfs.rs` | EFI variables | +| `httpdirfs.rs` | HTTP directory as filesystem | +| `idmapped.rs` | ID-mapped mounts | +| `label.rs` | Mount by label | +| `loop_dev.rs` | Loop device mounts | +| `overlayfs.rs` | Overlay filesystem | + +## Other Useful Utilities + +### `Apply` / `ApplyRef` traits + +Fluent method chaining: + +```rust +use crate::util::Apply; + +let result = some_value + .apply(|v| transform(v)) + .apply(|v| another_transform(v)); +``` + +### `Container` + +Async-safe optional container: + +```rust +use crate::util::Container; + +let container = Container::new(None); +container.set(value).await; +let taken = container.take().await; +``` + +### `HashWriter` + +Write data while computing hash: + +```rust +use crate::util::HashWriter; +use sha2::Sha256; + +let writer = HashWriter::new(Sha256::new(), file); +// Write data... +let (hasher, file) = writer.finish(); +let hash = hasher.finalize(); +``` + +### `Never` type + +Uninhabited type for impossible cases: + +```rust +use crate::util::Never; + +fn impossible() -> Never { + // This function can never return +} + +let never: Never = impossible(); +never.absurd::() // Can convert to any type +``` + +### `MaybeOwned<'a, T>` + +Either borrowed or owned data: + +```rust +use crate::util::MaybeOwned; + +fn accept_either(data: MaybeOwned<'_, String>) { + // Use &*data to access the value +} + +accept_either(MaybeOwned::from(&existing_string)); +accept_either(MaybeOwned::from(owned_string)); +``` + +### `new_guid()` + +Generate a random GUID: + +```rust +use crate::util::new_guid; + +let guid = new_guid(); // Returns InternedString +``` diff --git a/agents/i18n-patterns.md b/agents/i18n-patterns.md new file mode 100644 index 000000000..ad729d0f0 --- /dev/null +++ b/agents/i18n-patterns.md @@ -0,0 +1,100 @@ +# i18n Patterns in `core/` + +## Library & Setup + +**Crate:** [`rust-i18n`](https://crates.io/crates/rust-i18n) v3.1.5 (`core/Cargo.toml`) + +**Initialization** (`core/src/lib.rs:3`): +```rust +rust_i18n::i18n!("locales", fallback = ["en_US"]); +``` +This macro scans `core/locales/` at compile time and embeds all translations as constants. + +**Prelude re-export** (`core/src/prelude.rs:4`): +```rust +pub use rust_i18n::t; +``` +Most modules import `t!` via the prelude. + +## Translation File + +**Location:** `core/locales/i18n.yaml` +**Format:** YAML v2 (~755 keys) + +**Supported languages:** `en_US`, `de_DE`, `es_ES`, `fr_FR`, `pl_PL` + +**Entry structure:** +```yaml +namespace.sub.key-name: + en_US: "English text with %{param}" + de_DE: "German text with %{param}" + # ... +``` + +## Using `t!()` + +```rust +// Simple key +t!("error.unknown") + +// With parameter interpolation (%{name} in YAML) +t!("bins.deprecated.renamed", old = old_name, new = new_name) +``` + +## Key Naming Conventions + +Keys use **dot-separated hierarchical namespaces** with **kebab-case** for multi-word segments: + +``` +.. +``` + +Examples: +- `error.incorrect-password` — error kind label +- `bins.start-init.updating-firmware` — startup phase message +- `backup.bulk.complete-title` — backup notification title +- `help.arg.acme-contact` — CLI help text for an argument +- `context.diagnostic.starting-diagnostic-ui` — diagnostic context status + +### Top-Level Namespaces + +| Namespace | Purpose | +|-----------|---------| +| `error.*` | `ErrorKind` display strings (see `src/error.rs`) | +| `bins.*` | CLI binary messages (deprecated, start-init, startd, etc.) | +| `init.*` | Initialization phase labels | +| `setup.*` | First-run setup messages | +| `context.*` | Context startup messages (diagnostic, setup, CLI) | +| `service.*` | Service lifecycle messages | +| `backup.*` | Backup/restore operation messages | +| `registry.*` | Package registry messages | +| `net.*` | Network-related messages | +| `middleware.*` | Request middleware messages (auth, etc.) | +| `disk.*` | Disk operation messages | +| `lxc.*` | Container management messages | +| `system.*` | System monitoring/metrics messages | +| `notifications.*` | User-facing notification messages | +| `update.*` | OS update messages | +| `util.*` | Utility messages (TUI, RPC) | +| `ssh.*` | SSH operation messages | +| `shutdown.*` | Shutdown-related messages | +| `logs.*` | Log-related messages | +| `auth.*` | Authentication messages | +| `help.*` | CLI help text (`help.arg.`) | +| `about.*` | CLI command descriptions | + +## Locale Selection + +`core/src/bins/mod.rs:15-36` — `set_locale_from_env()`: + +1. Reads `LANG` environment variable +2. Strips `.UTF-8` suffix +3. Exact-matches against available locales, falls back to language-prefix match (e.g. `en_GB` matches `en_US`) + +## Adding New Keys + +1. Add the key to `core/locales/i18n.yaml` with all 5 language translations +2. Use the `t!("your.key.name")` macro in Rust code +3. Follow existing namespace conventions — match the module path where the key is used +4. Use kebab-case for multi-word segments +5. Translations are validated at compile time diff --git a/agents/rpc-toolkit.md b/agents/rpc-toolkit.md new file mode 100644 index 000000000..933c345b6 --- /dev/null +++ b/agents/rpc-toolkit.md @@ -0,0 +1,226 @@ +# rpc-toolkit + +StartOS uses [rpc-toolkit](https://github.com/Start9Labs/rpc-toolkit) for its JSON-RPC API. This document covers the patterns used in this codebase. + +## Overview + +The API is JSON-RPC (not REST). All endpoints are RPC methods organized in a hierarchical command structure. + +## Handler Functions + +There are four types of handler functions, chosen based on the function's characteristics: + +### `from_fn_async` - Async handlers +For standard async functions. Most handlers use this. + +```rust +pub async fn my_handler(ctx: RpcContext, params: MyParams) -> Result { + // Can use .await +} + +from_fn_async(my_handler) +``` + +### `from_fn_async_local` - Non-thread-safe async handlers +For async functions that are not `Send` (cannot be safely moved between threads). Use when working with non-thread-safe types. + +```rust +pub async fn cli_download(ctx: CliContext, params: Params) -> Result<(), Error> { + // Non-Send async operations +} + +from_fn_async_local(cli_download) +``` + +### `from_fn_blocking` - Sync blocking handlers +For synchronous functions that perform blocking I/O or long computations. + +```rust +pub fn query_dns(ctx: RpcContext, params: DnsParams) -> Result { + // Blocking operations (file I/O, DNS lookup, etc.) +} + +from_fn_blocking(query_dns) +``` + +### `from_fn` - Sync non-blocking handlers +For pure functions or quick synchronous operations with no I/O. + +```rust +pub fn echo(ctx: RpcContext, params: EchoParams) -> Result { + Ok(params.message) +} + +from_fn(echo) +``` + +## ParentHandler + +Groups related RPC methods into a hierarchy: + +```rust +use rpc_toolkit::{Context, HandlerExt, ParentHandler, from_fn_async}; + +pub fn my_api() -> ParentHandler { + ParentHandler::new() + .subcommand("list", from_fn_async(list_handler).with_call_remote::()) + .subcommand("create", from_fn_async(create_handler).with_call_remote::()) +} +``` + +## Handler Extensions + +Chain methods to configure handler behavior. + +**Ordering rules:** +1. `with_about()` must come AFTER other CLI modifiers (`no_display()`, `with_custom_display_fn()`, etc.) +2. `with_call_remote()` must be the LAST adapter in the chain + +| Method | Purpose | +|--------|---------| +| `.with_metadata("key", Value)` | Attach metadata for middleware | +| `.no_cli()` | RPC-only, not available via CLI | +| `.no_display()` | No CLI output | +| `.with_display_serializable()` | Default JSON/YAML output for CLI | +| `.with_custom_display_fn(\|_, res\| ...)` | Custom CLI output formatting | +| `.with_about("about.description")` | Add help text (i18n key) - **after CLI modifiers** | +| `.with_call_remote::()` | Enable CLI to call remotely - **must be last** | + +### Correct ordering example: +```rust +from_fn_async(my_handler) + .with_metadata("sync_db", Value::Bool(true)) // metadata early + .no_display() // CLI modifier + .with_about("about.my-handler") // after CLI modifiers + .with_call_remote::() // always last +``` + +## Metadata by Middleware + +Metadata tags are processed by different middleware. Group them logically: + +### Auth Middleware (`middleware/auth/mod.rs`) + +| Metadata | Default | Description | +|----------|---------|-------------| +| `authenticated` | `true` | Whether endpoint requires authentication. Set to `false` for public endpoints. | + +### Session Auth Middleware (`middleware/auth/session.rs`) + +| Metadata | Default | Description | +|----------|---------|-------------| +| `login` | `false` | Special handling for login endpoints (rate limiting, cookie setting) | +| `get_session` | `false` | Inject session ID into params as `__Auth_session` | + +### Signature Auth Middleware (`middleware/auth/signature.rs`) + +| Metadata | Default | Description | +|----------|---------|-------------| +| `get_signer` | `false` | Inject signer public key into params as `__Auth_signer` | + +### Registry Auth (extends Signature Auth) + +| Metadata | Default | Description | +|----------|---------|-------------| +| `admin` | `false` | Require admin privileges (signer must be in admin list) | +| `get_device_info` | `false` | Inject device info header for hardware filtering | + +### Database Middleware (`middleware/db.rs`) + +| Metadata | Default | Description | +|----------|---------|-------------| +| `sync_db` | `false` | Sync database after mutation, add `X-Patch-Sequence` header | + +## Context Types + +Different contexts for different execution environments: + +- `RpcContext` - Web/RPC requests with full service access +- `CliContext` - CLI operations, calls remote RPC +- `InitContext` - During system initialization +- `DiagnosticContext` - Diagnostic/recovery mode +- `RegistryContext` - Registry daemon context +- `EffectContext` - Service effects context (container-to-host calls) + +## Parameter Structs + +Parameters use derive macros for JSON-RPC, CLI parsing, and TypeScript generation: + +```rust +#[derive(Deserialize, Serialize, Parser, TS)] +#[serde(rename_all = "camelCase")] // JSON-RPC uses camelCase +#[command(rename_all = "kebab-case")] // CLI uses kebab-case +#[ts(export)] // Generate TypeScript types +pub struct MyParams { + pub package_id: PackageId, +} +``` + +### Middleware Injection + +Auth middleware can inject values into params using special field names: + +```rust +#[derive(Deserialize, Serialize, Parser, TS)] +pub struct MyParams { + #[ts(skip)] + #[serde(rename = "__Auth_session")] // Injected by session auth + session: InternedString, + + #[ts(skip)] + #[serde(rename = "__Auth_signer")] // Injected by signature auth + signer: AnyVerifyingKey, + + #[ts(skip)] + #[serde(rename = "__Auth_userAgent")] // Injected during login + user_agent: Option, +} +``` + +## Common Patterns + +### Adding a New RPC Endpoint + +1. Define params struct with `Deserialize, Serialize, Parser, TS` +2. Choose handler type based on sync/async and thread-safety +3. Write handler function taking `(Context, Params) -> Result` +4. Add to parent handler with appropriate extensions (display modifiers before `with_about`) +5. TypeScript types auto-generated via `make ts-bindings` + +### Public (Unauthenticated) Endpoint + +```rust +from_fn_async(get_info) + .with_metadata("authenticated", Value::Bool(false)) + .with_display_serializable() + .with_about("about.get-info") + .with_call_remote::() // last +``` + +### Mutating Endpoint with DB Sync + +```rust +from_fn_async(update_config) + .with_metadata("sync_db", Value::Bool(true)) + .no_display() + .with_about("about.update-config") + .with_call_remote::() // last +``` + +### Session-Aware Endpoint + +```rust +from_fn_async(logout) + .with_metadata("get_session", Value::Bool(true)) + .no_display() + .with_about("about.logout") + .with_call_remote::() // last +``` + +## File Locations + +- Handler definitions: Throughout `core/src/` modules +- Main API tree: `core/src/lib.rs` (`main_api()`, `server()`, `package()`) +- Auth middleware: `core/src/middleware/auth/` +- DB middleware: `core/src/middleware/db.rs` +- Context types: `core/src/context/` diff --git a/agents/s9pk-structure.md b/agents/s9pk-structure.md new file mode 100644 index 000000000..81499336a --- /dev/null +++ b/agents/s9pk-structure.md @@ -0,0 +1,122 @@ +# S9PK Package Format + +S9PK is the package format for StartOS services. Version 2 uses a merkle archive structure for efficient downloading and cryptographic verification. + +## File Format + +S9PK files begin with a 3-byte header: `0x3b 0x3b 0x02` (magic bytes + version 2). + +The archive is cryptographically signed using Ed25519 with prehashed content (SHA-512 over blake3 merkle root hash). + +## Archive Structure + +``` +/ +├── manifest.json # Package metadata (required) +├── icon. # Package icon - any image/* format (required) +├── LICENSE.md # License text (required) +├── dependencies/ # Dependency metadata (optional) +│ └── / +│ ├── metadata.json # DependencyMetadata +│ └── icon. # Dependency icon +├── javascript.squashfs # Package JavaScript code (required) +├── assets.squashfs # Static assets (optional, legacy: assets/ directory) +└── images/ # Container images by architecture + └── / # e.g., x86_64, aarch64, riscv64 + ├── .squashfs # Container filesystem + ├── .json # Image metadata + └── .env # Environment variables +``` + +## Components + +### manifest.json + +The package manifest contains all metadata: + +| Field | Type | Description | +|-------|------|-------------| +| `id` | string | Package identifier (e.g., `bitcoind`) | +| `title` | string | Display name | +| `version` | string | Extended version string | +| `satisfies` | string[] | Version ranges this version satisfies | +| `releaseNotes` | string/object | Release notes (localized) | +| `canMigrateTo` | string | Version range for forward migration | +| `canMigrateFrom` | string | Version range for backward migration | +| `license` | string | License type | +| `wrapperRepo` | string | StartOS wrapper repository URL | +| `upstreamRepo` | string | Upstream project URL | +| `supportSite` | string | Support site URL | +| `marketingSite` | string | Marketing site URL | +| `donationUrl` | string? | Optional donation URL | +| `docsUrl` | string? | Optional documentation URL | +| `description` | object | Short and long descriptions (localized) | +| `images` | object | Image configurations by image ID | +| `volumes` | string[] | Volume IDs for persistent data | +| `alerts` | object | User alerts for lifecycle events | +| `dependencies` | object | Package dependencies | +| `hardwareRequirements` | object | Hardware requirements (arch, RAM, devices) | +| `hardwareAcceleration` | boolean | Whether package uses hardware acceleration | +| `gitHash` | string? | Git commit hash | +| `osVersion` | string | Minimum StartOS version | +| `sdkVersion` | string? | SDK version used to build | + +### javascript.squashfs + +Contains the package JavaScript that implements the `ABI` interface from `@start9labs/start-sdk-base`. This code runs in the container runtime and manages the package lifecycle. + +The squashfs is mounted at `/usr/lib/startos/package/` and the runtime loads `index.js`. + +### images/ + +Container images organized by architecture: + +- **`.squashfs`** - Container root filesystem +- **`.json`** - Image metadata (entrypoint, user, workdir, etc.) +- **`.env`** - Environment variables for the container + +Images are built from Docker/Podman and converted to squashfs. The `ImageConfig` in manifest specifies: +- `arch` - Supported architectures +- `emulateMissingAs` - Fallback architecture for emulation +- `nvidiaContainer` - Whether to enable NVIDIA container support + +### assets.squashfs + +Static assets accessible to the package, mounted read-only at `/media/startos/assets/` in the container. + +### dependencies/ + +Metadata for dependencies displayed in the UI: +- `metadata.json` - Just title for now +- `icon.` - Icon for the dependency + +## Merkle Archive + +The S9PK uses a merkle tree structure where each file and directory has a blake3 hash. This enables: + +1. **Partial downloads** - Download and verify individual files +2. **Integrity verification** - Verify any subset of the archive +3. **Efficient updates** - Only download changed portions +4. **DOS protection** - Size limits enforced before downloading content + +Files are sorted by priority for streaming (manifest first, then icon, license, dependencies, javascript, assets, images). + +## Building S9PK + +Use `start-cli s9pk pack` to build packages: + +```bash +start-cli s9pk pack -o +``` + +Images can be sourced from: +- Docker/Podman build (`--docker-build`) +- Existing Docker tag (`--docker-tag`) +- Pre-built squashfs files + +## Related Code + +- `core/src/s9pk/v2/mod.rs` - S9pk struct and serialization +- `core/src/s9pk/v2/manifest.rs` - Manifest types +- `core/src/s9pk/v2/pack.rs` - Packing logic +- `core/src/s9pk/merkle_archive/` - Merkle archive implementation diff --git a/build/lib/scripts/chroot-and-upgrade b/build/lib/scripts/chroot-and-upgrade index 792b7836d..c8e16acaf 100755 --- a/build/lib/scripts/chroot-and-upgrade +++ b/build/lib/scripts/chroot-and-upgrade @@ -111,6 +111,6 @@ if [ "$CHROOT_RES" -eq 0 ]; then reboot fi -umount -R /media/startos/next +umount /media/startos/next umount /media/startos/upper rm -rf /media/startos/upper /media/startos/next \ No newline at end of file diff --git a/container-runtime/RPCSpec.md b/container-runtime/RPCSpec.md index fd1014add..7c43467ba 100644 --- a/container-runtime/RPCSpec.md +++ b/container-runtime/RPCSpec.md @@ -1,16 +1,21 @@ -# Container RPC SERVER Specification +# Container RPC Server Specification + +The container runtime exposes a JSON-RPC server over a Unix socket at `/media/startos/rpc/service.sock`. ## Methods ### init -initialize runtime (mount `/proc`, `/sys`, `/dev`, and `/run` to each image in `/media/images`) +Initialize the runtime and system. -called after os has mounted js and images to the container +#### params -#### args - -`[]` +```ts +{ + id: string, + kind: "install" | "update" | "restore" | null, +} +``` #### response @@ -18,11 +23,16 @@ called after os has mounted js and images to the container ### exit -shutdown runtime +Shutdown runtime and optionally run exit hooks for a target version. -#### args +#### params -`[]` +```ts +{ + id: string, + target: string | null, // ExtendedVersion or VersionRange +} +``` #### response @@ -30,11 +40,11 @@ shutdown runtime ### start -run main method if not already running +Run main method if not already running. -#### args +#### params -`[]` +None #### response @@ -42,11 +52,11 @@ run main method if not already running ### stop -stop main method by sending SIGTERM to child processes, and SIGKILL after timeout +Stop main method by sending SIGTERM to child processes, and SIGKILL after timeout. -#### args +#### params -`{ timeout: millis }` +None #### response @@ -54,15 +64,16 @@ stop main method by sending SIGTERM to child processes, and SIGKILL after timeou ### execute -run a specific package procedure +Run a specific package procedure. -#### args +#### params ```ts { - procedure: JsonPath, - input: any, - timeout: millis, + id: string, // event ID + procedure: string, // JSON path (e.g., "/backup/create", "/actions/{name}/run") + input: any, + timeout: number | null, } ``` @@ -72,18 +83,64 @@ run a specific package procedure ### sandbox -run a specific package procedure in sandbox mode +Run a specific package procedure in sandbox mode. Same interface as `execute`. -#### args +UNIMPLEMENTED: this feature is planned but does not exist + +#### params ```ts { - procedure: JsonPath, - input: any, - timeout: millis, + id: string, + procedure: string, + input: any, + timeout: number | null, } ``` #### response `any` + +### callback + +Handle a callback from an effect. + +#### params + +```ts +{ + id: number, + args: any[], +} +``` + +#### response + +`null` (no response sent) + +### eval + +Evaluate a script in the runtime context. Used for debugging. + +#### params + +```ts +{ + script: string, +} +``` + +#### response + +`any` + +## Procedures + +The `execute` and `sandbox` methods route to procedures based on the `procedure` path: + +| Procedure | Description | +|-----------|-------------| +| `/backup/create` | Create a backup | +| `/actions/{name}/getInput` | Get input spec for an action | +| `/actions/{name}/run` | Run an action with input | diff --git a/sdk/base/lib/Effects.ts b/sdk/base/lib/Effects.ts index db543f7bc..b27c14728 100644 --- a/sdk/base/lib/Effects.ts +++ b/sdk/base/lib/Effects.ts @@ -16,14 +16,14 @@ import { MountParams, StatusInfo, Manifest, -} from "./osBindings" +} from './osBindings' import { PackageId, Dependencies, ServiceInterfaceId, SmtpValue, ActionResult, -} from "./types" +} from './types' /** Used to reach out from the pure js runtime */ @@ -155,13 +155,13 @@ export type Effects = { /** Returns a PEM encoded fullchain for the hostnames specified */ getSslCertificate: (options: { hostnames: string[] - algorithm?: "ecdsa" | "ed25519" + algorithm?: 'ecdsa' | 'ed25519' callback?: () => void }) => Promise<[string, string, string]> /** Returns a PEM encoded private key corresponding to the certificate for the hostnames specified */ getSslKey: (options: { hostnames: string[] - algorithm?: "ecdsa" | "ed25519" + algorithm?: 'ecdsa' | 'ed25519' }) => Promise /** sets the version that this service's data has been migrated to */ diff --git a/sdk/base/lib/actions/index.ts b/sdk/base/lib/actions/index.ts index e3204917b..c4568ab1c 100644 --- a/sdk/base/lib/actions/index.ts +++ b/sdk/base/lib/actions/index.ts @@ -1,7 +1,7 @@ -import * as T from "../types" -import * as IST from "../actions/input/inputSpecTypes" -import { Action, ActionInfo } from "./setupActions" -import { ExtractInputSpecType } from "./input/builder/inputSpec" +import * as T from '../types' +import * as IST from '../actions/input/inputSpecTypes' +import { Action, ActionInfo } from './setupActions' +import { ExtractInputSpecType } from './input/builder/inputSpec' export type RunActionInput = | Input @@ -53,17 +53,17 @@ type TaskBase = { replayId?: string } type TaskInput> = { - kind: "partial" + kind: 'partial' value: T.DeepPartial> } export type TaskOptions> = TaskBase & ( | { - when?: Exclude + when?: Exclude input?: TaskInput } | { - when: T.TaskTrigger & { condition: "input-not-matches" } + when: T.TaskTrigger & { condition: 'input-not-matches' } input: TaskInput } ) diff --git a/sdk/base/lib/actions/input/builder/index.ts b/sdk/base/lib/actions/input/builder/index.ts index 618c4856f..d5ab6ec3f 100644 --- a/sdk/base/lib/actions/input/builder/index.ts +++ b/sdk/base/lib/actions/input/builder/index.ts @@ -1,6 +1,6 @@ -import { InputSpec } from "./inputSpec" -import { List } from "./list" -import { Value } from "./value" -import { Variants } from "./variants" +import { InputSpec } from './inputSpec' +import { List } from './list' +import { Value } from './value' +import { Variants } from './variants' export { InputSpec as InputSpec, List, Value, Variants } diff --git a/sdk/base/lib/actions/input/builder/inputSpec.ts b/sdk/base/lib/actions/input/builder/inputSpec.ts index 8df1ebe50..986d898f1 100644 --- a/sdk/base/lib/actions/input/builder/inputSpec.ts +++ b/sdk/base/lib/actions/input/builder/inputSpec.ts @@ -1,9 +1,9 @@ -import { ValueSpec } from "../inputSpecTypes" -import { Value } from "./value" -import { _ } from "../../../util" -import { Effects } from "../../../Effects" -import { Parser, object } from "ts-matches" -import { DeepPartial } from "../../../types" +import { ValueSpec } from '../inputSpecTypes' +import { Value } from './value' +import { _ } from '../../../util' +import { Effects } from '../../../Effects' +import { Parser, object } from 'ts-matches' +import { DeepPartial } from '../../../types' export type LazyBuildOptions = { effects: Effects diff --git a/sdk/base/lib/actions/input/builder/list.ts b/sdk/base/lib/actions/input/builder/list.ts index 02c16ae7c..765775086 100644 --- a/sdk/base/lib/actions/input/builder/list.ts +++ b/sdk/base/lib/actions/input/builder/list.ts @@ -1,4 +1,4 @@ -import { InputSpec, LazyBuild } from "./inputSpec" +import { InputSpec, LazyBuild } from './inputSpec' import { ListValueSpecText, Pattern, @@ -6,8 +6,8 @@ import { UniqueBy, ValueSpecList, ValueSpecListOf, -} from "../inputSpecTypes" -import { Parser, arrayOf, string } from "ts-matches" +} from '../inputSpecTypes' +import { Parser, arrayOf, string } from 'ts-matches' export class List { private constructor( @@ -55,7 +55,7 @@ export class List { * @description Informs the browser how to behave and which keyboard to display on mobile * @default "text" */ - inputmode?: ListValueSpecText["inputmode"] + inputmode?: ListValueSpecText['inputmode'] /** * @description Displays a button that will generate a random string according to the provided charset and len attributes. */ @@ -65,21 +65,21 @@ export class List { const validator = arrayOf(string) return new List(() => { const spec = { - type: "text" as const, + type: 'text' as const, placeholder: null, minLength: null, maxLength: null, masked: false, - inputmode: "text" as const, + inputmode: 'text' as const, generate: null, patterns: aSpec.patterns || [], ...aSpec, } - const built: ValueSpecListOf<"text"> = { + const built: ValueSpecListOf<'text'> = { description: null, warning: null, default: [], - type: "list" as const, + type: 'list' as const, minLength: null, maxLength: null, disabled: false, @@ -106,7 +106,7 @@ export class List { minLength?: number | null maxLength?: number | null patterns?: Pattern[] - inputmode?: ListValueSpecText["inputmode"] + inputmode?: ListValueSpecText['inputmode'] } }>, ) { @@ -114,21 +114,21 @@ export class List { return new List(async (options) => { const { spec: aSpec, ...a } = await getA(options) const spec = { - type: "text" as const, + type: 'text' as const, placeholder: null, minLength: null, maxLength: null, masked: false, - inputmode: "text" as const, + inputmode: 'text' as const, generate: null, patterns: aSpec.patterns || [], ...aSpec, } - const built: ValueSpecListOf<"text"> = { + const built: ValueSpecListOf<'text'> = { description: null, warning: null, default: [], - type: "list" as const, + type: 'list' as const, minLength: null, maxLength: null, disabled: false, @@ -162,7 +162,7 @@ export class List { const { spec: previousSpecSpec, ...restSpec } = aSpec const built = await previousSpecSpec.build(options) const spec = { - type: "object" as const, + type: 'object' as const, displayAs: null, uniqueBy: null, ...restSpec, @@ -179,7 +179,7 @@ export class List { warning: null, minLength: null, maxLength: null, - type: "list" as const, + type: 'list' as const, disabled: false, ...value, }, diff --git a/sdk/base/lib/actions/input/builder/value.ts b/sdk/base/lib/actions/input/builder/value.ts index 23dd3ee73..b211376cc 100644 --- a/sdk/base/lib/actions/input/builder/value.ts +++ b/sdk/base/lib/actions/input/builder/value.ts @@ -1,6 +1,6 @@ -import { InputSpec, LazyBuild } from "./inputSpec" -import { List } from "./list" -import { UnionRes, UnionResStaticValidatedAs, Variants } from "./variants" +import { InputSpec, LazyBuild } from './inputSpec' +import { List } from './list' +import { UnionRes, UnionResStaticValidatedAs, Variants } from './variants' import { Pattern, RandomString, @@ -9,9 +9,9 @@ import { ValueSpecHidden, ValueSpecText, ValueSpecTextarea, -} from "../inputSpecTypes" -import { DefaultString } from "../inputSpecTypes" -import { _, once } from "../../../util" +} from '../inputSpecTypes' +import { DefaultString } from '../inputSpecTypes' +import { _, once } from '../../../util' import { Parser, any, @@ -23,8 +23,8 @@ import { number, object, string, -} from "ts-matches" -import { DeepPartial } from "../../../types" +} from 'ts-matches' +import { DeepPartial } from '../../../types' export const fileInfoParser = object({ path: string, @@ -42,7 +42,7 @@ const testForAsRequiredParser = once( function asRequiredParser( parser: Parser, input: Input, -): Parser> { +): Parser> { if (testForAsRequiredParser()(input)) return parser as any return parser.nullable() as any } @@ -92,7 +92,7 @@ export class Value { spec: { description: null, warning: null, - type: "toggle" as const, + type: 'toggle' as const, disabled: false, immutable: a.immutable ?? false, ...a, @@ -117,7 +117,7 @@ export class Value { spec: { description: null, warning: null, - type: "toggle" as const, + type: 'toggle' as const, disabled: false, immutable: false, ...(await a(options)), @@ -191,7 +191,7 @@ export class Value { * @description Informs the browser how to behave and which keyboard to display on mobile * @default "text" */ - inputmode?: ValueSpecText["inputmode"] + inputmode?: ValueSpecText['inputmode'] /** * @description Once set, the value can never be changed. * @default false @@ -206,7 +206,7 @@ export class Value { return new Value>( async () => ({ spec: { - type: "text" as const, + type: 'text' as const, description: null, warning: null, masked: false, @@ -214,7 +214,7 @@ export class Value { minLength: null, maxLength: null, patterns: [], - inputmode: "text", + inputmode: 'text', disabled: false, immutable: a.immutable ?? false, generate: a.generate ?? null, @@ -237,7 +237,7 @@ export class Value { minLength?: number | null maxLength?: number | null patterns?: Pattern[] - inputmode?: ValueSpecText["inputmode"] + inputmode?: ValueSpecText['inputmode'] disabled?: string | false generate?: null | RandomString }>, @@ -247,7 +247,7 @@ export class Value { const a = await getA(options) return { spec: { - type: "text" as const, + type: 'text' as const, description: null, warning: null, masked: false, @@ -255,7 +255,7 @@ export class Value { minLength: null, maxLength: null, patterns: [], - inputmode: "text", + inputmode: 'text', disabled: false, immutable: false, generate: a.generate ?? null, @@ -334,7 +334,7 @@ export class Value { minRows: 3, maxRows: 6, placeholder: null, - type: "textarea" as const, + type: 'textarea' as const, disabled: false, immutable: a.immutable ?? false, ...a, @@ -371,7 +371,7 @@ export class Value { minRows: 3, maxRows: 6, placeholder: null, - type: "textarea" as const, + type: 'textarea' as const, disabled: false, immutable: false, ...a, @@ -444,7 +444,7 @@ export class Value { return new Value>( () => ({ spec: { - type: "number" as const, + type: 'number' as const, description: null, warning: null, min: null, @@ -482,7 +482,7 @@ export class Value { const a = await getA(options) return { spec: { - type: "number" as const, + type: 'number' as const, description: null, warning: null, min: null, @@ -540,7 +540,7 @@ export class Value { return new Value>( () => ({ spec: { - type: "color" as const, + type: 'color' as const, description: null, warning: null, disabled: false, @@ -568,7 +568,7 @@ export class Value { const a = await getA(options) return { spec: { - type: "color" as const, + type: 'color' as const, description: null, warning: null, disabled: false, @@ -618,7 +618,7 @@ export class Value { * @description Informs the browser how to behave and which date/time component to display. * @default "datetime-local" */ - inputmode?: ValueSpecDatetime["inputmode"] + inputmode?: ValueSpecDatetime['inputmode'] min?: string | null max?: string | null /** @@ -631,10 +631,10 @@ export class Value { return new Value>( () => ({ spec: { - type: "datetime" as const, + type: 'datetime' as const, description: null, warning: null, - inputmode: "datetime-local", + inputmode: 'datetime-local', min: null, max: null, step: null, @@ -654,7 +654,7 @@ export class Value { warning?: string | null default: string | null required: Required - inputmode?: ValueSpecDatetime["inputmode"] + inputmode?: ValueSpecDatetime['inputmode'] min?: string | null max?: string | null disabled?: false | string @@ -665,10 +665,10 @@ export class Value { const a = await getA(options) return { spec: { - type: "datetime" as const, + type: 'datetime' as const, description: null, warning: null, - inputmode: "datetime-local", + inputmode: 'datetime-local', min: null, max: null, disabled: false, @@ -740,7 +740,7 @@ export class Value { spec: { description: null, warning: null, - type: "select" as const, + type: 'select' as const, disabled: false, immutable: a.immutable ?? false, ...a, @@ -766,7 +766,7 @@ export class Value { spec: { description: null, warning: null, - type: "select" as const, + type: 'select' as const, disabled: false, immutable: false, ...a, @@ -837,7 +837,7 @@ export class Value { return new Value<(keyof Values & string)[]>( () => ({ spec: { - type: "multiselect" as const, + type: 'multiselect' as const, minLength: null, maxLength: null, warning: null, @@ -867,7 +867,7 @@ export class Value { const a = await getA(options) return { spec: { - type: "multiselect" as const, + type: 'multiselect' as const, minLength: null, maxLength: null, warning: null, @@ -915,7 +915,7 @@ export class Value { const built = await spec.build(options as any) return { spec: { - type: "object" as const, + type: 'object' as const, description: null, warning: null, ...a, @@ -933,7 +933,7 @@ export class Value { required: Required }) { const buildValue = { - type: "file" as const, + type: 'file' as const, description: null, warning: null, ...a, @@ -960,7 +960,7 @@ export class Value { return new Value, FileInfo | null>( async (options) => { const spec = { - type: "file" as const, + type: 'file' as const, description: null, warning: null, ...(await a(options)), @@ -1034,7 +1034,7 @@ export class Value { const built = await a.variants.build(options as any) return { spec: { - type: "union" as const, + type: 'union' as const, description: null, warning: null, disabled: false, @@ -1109,7 +1109,7 @@ export class Value { const built = await newValues.variants.build(options as any) return { spec: { - type: "union" as const, + type: 'union' as const, description: null, warning: null, ...newValues, @@ -1202,7 +1202,7 @@ export class Value { return new Value(async () => { return { spec: { - type: "hidden" as const, + type: 'hidden' as const, } as ValueSpecHidden, validator: parser, } @@ -1221,7 +1221,7 @@ export class Value { const validator = await getParser(options) return { spec: { - type: "hidden" as const, + type: 'hidden' as const, } as ValueSpecHidden, validator, } diff --git a/sdk/base/lib/actions/input/builder/variants.ts b/sdk/base/lib/actions/input/builder/variants.ts index 66298067c..46818d893 100644 --- a/sdk/base/lib/actions/input/builder/variants.ts +++ b/sdk/base/lib/actions/input/builder/variants.ts @@ -1,12 +1,12 @@ -import { DeepPartial } from "../../../types" -import { ValueSpec, ValueSpecUnion } from "../inputSpecTypes" +import { DeepPartial } from '../../../types' +import { ValueSpec, ValueSpecUnion } from '../inputSpecTypes' import { LazyBuild, InputSpec, ExtractInputSpecType, ExtractInputSpecStaticValidatedAs, -} from "./inputSpec" -import { Parser, any, anyOf, literal, object } from "ts-matches" +} from './inputSpec' +import { Parser, any, anyOf, literal, object } from 'ts-matches' export type UnionRes< VariantValues extends { @@ -19,10 +19,10 @@ export type UnionRes< > = { [key in keyof VariantValues]: { selection: key - value: ExtractInputSpecType + value: ExtractInputSpecType other?: { [key2 in Exclude]?: DeepPartial< - ExtractInputSpecType + ExtractInputSpecType > } } @@ -39,10 +39,10 @@ export type UnionResStaticValidatedAs< > = { [key in keyof VariantValues]: { selection: key - value: ExtractInputSpecStaticValidatedAs + value: ExtractInputSpecStaticValidatedAs other?: { [key2 in Exclude]?: DeepPartial< - ExtractInputSpecStaticValidatedAs + ExtractInputSpecStaticValidatedAs > } } @@ -106,7 +106,7 @@ export class Variants< > { private constructor( public build: LazyBuild<{ - spec: ValueSpecUnion["variants"] + spec: ValueSpecUnion['variants'] validator: Parser> }>, public readonly validator: Parser< @@ -126,7 +126,7 @@ export class Variants< const staticValidators = {} as { [K in keyof VariantValues]: Parser< unknown, - ExtractInputSpecStaticValidatedAs + ExtractInputSpecStaticValidatedAs > } for (const key in a) { @@ -143,7 +143,7 @@ export class Variants< const validators = {} as { [K in keyof VariantValues]: Parser< unknown, - ExtractInputSpecType + ExtractInputSpecType > } const variants = {} as { diff --git a/sdk/base/lib/actions/input/index.ts b/sdk/base/lib/actions/input/index.ts index 3fc16f585..64ea77dcf 100644 --- a/sdk/base/lib/actions/input/index.ts +++ b/sdk/base/lib/actions/input/index.ts @@ -1,3 +1,3 @@ -export * as constants from "./inputSpecConstants" -export * as types from "./inputSpecTypes" -export * as builder from "./builder" +export * as constants from './inputSpecConstants' +export * as types from './inputSpecTypes' +export * as builder from './builder' diff --git a/sdk/base/lib/actions/input/inputSpecConstants.ts b/sdk/base/lib/actions/input/inputSpecConstants.ts index c1c19085d..d6bc2a68b 100644 --- a/sdk/base/lib/actions/input/inputSpecConstants.ts +++ b/sdk/base/lib/actions/input/inputSpecConstants.ts @@ -1,8 +1,8 @@ -import { SmtpValue } from "../../types" -import { GetSystemSmtp, Patterns } from "../../util" -import { InputSpec, InputSpecOf } from "./builder/inputSpec" -import { Value } from "./builder/value" -import { Variants } from "./builder/variants" +import { SmtpValue } from '../../types' +import { GetSystemSmtp, Patterns } from '../../util' +import { InputSpec, InputSpecOf } from './builder/inputSpec' +import { Value } from './builder/value' +import { Variants } from './builder/variants' /** * Base SMTP settings, to be used by StartOS for system wide SMTP @@ -11,12 +11,12 @@ export const customSmtp: InputSpec = InputSpec.of< InputSpecOf >({ server: Value.text({ - name: "SMTP Server", + name: 'SMTP Server', required: true, default: null, }), port: Value.number({ - name: "Port", + name: 'Port', required: true, default: 587, min: 1, @@ -24,20 +24,20 @@ export const customSmtp: InputSpec = InputSpec.of< integer: true, }), from: Value.text({ - name: "From Address", + name: 'From Address', required: true, default: null, - placeholder: "Example Name ", - inputmode: "email", + placeholder: 'Example Name ', + inputmode: 'email', patterns: [Patterns.emailWithName], }), login: Value.text({ - name: "Login", + name: 'Login', required: true, default: null, }), password: Value.text({ - name: "Password", + name: 'Password', required: false, default: null, masked: true, @@ -45,24 +45,24 @@ export const customSmtp: InputSpec = InputSpec.of< }) const smtpVariants = Variants.of({ - disabled: { name: "Disabled", spec: InputSpec.of({}) }, + disabled: { name: 'Disabled', spec: InputSpec.of({}) }, system: { - name: "System Credentials", + name: 'System Credentials', spec: InputSpec.of({ customFrom: Value.text({ - name: "Custom From Address", + name: 'Custom From Address', description: - "A custom from address for this service. If not provided, the system from address will be used.", + 'A custom from address for this service. If not provided, the system from address will be used.', required: false, default: null, - placeholder: "test@example.com", - inputmode: "email", + placeholder: 'test@example.com', + inputmode: 'email', patterns: [Patterns.email], }), }), }, custom: { - name: "Custom Credentials", + name: 'Custom Credentials', spec: customSmtp, }, }) @@ -71,11 +71,11 @@ const smtpVariants = Variants.of({ */ export const smtpInputSpec = Value.dynamicUnion(async ({ effects }) => { const smtp = await new GetSystemSmtp(effects).once() - const disabled = smtp ? [] : ["system"] + const disabled = smtp ? [] : ['system'] return { - name: "SMTP", - description: "Optionally provide an SMTP server for sending emails", - default: "disabled", + name: 'SMTP', + description: 'Optionally provide an SMTP server for sending emails', + default: 'disabled', disabled, variants: smtpVariants, } diff --git a/sdk/base/lib/actions/input/inputSpecTypes.ts b/sdk/base/lib/actions/input/inputSpecTypes.ts index e6e267d5d..2fe5d7b79 100644 --- a/sdk/base/lib/actions/input/inputSpecTypes.ts +++ b/sdk/base/lib/actions/input/inputSpecTypes.ts @@ -1,18 +1,18 @@ export type InputSpec = Record export type ValueType = - | "text" - | "textarea" - | "number" - | "color" - | "datetime" - | "toggle" - | "select" - | "multiselect" - | "list" - | "object" - | "file" - | "union" - | "hidden" + | 'text' + | 'textarea' + | 'number' + | 'color' + | 'datetime' + | 'toggle' + | 'select' + | 'multiselect' + | 'list' + | 'object' + | 'file' + | 'union' + | 'hidden' export type ValueSpec = ValueSpecOf /** core spec types. These types provide the metadata for performing validations */ // prettier-ignore @@ -37,13 +37,13 @@ export type ValueSpecText = { description: string | null warning: string | null - type: "text" + type: 'text' patterns: Pattern[] minLength: number | null maxLength: number | null masked: boolean - inputmode: "text" | "email" | "tel" | "url" + inputmode: 'text' | 'email' | 'tel' | 'url' placeholder: string | null required: boolean @@ -57,7 +57,7 @@ export type ValueSpecTextarea = { description: string | null warning: string | null - type: "textarea" + type: 'textarea' patterns: Pattern[] placeholder: string | null minLength: number | null @@ -71,7 +71,7 @@ export type ValueSpecTextarea = { } export type ValueSpecNumber = { - type: "number" + type: 'number' min: number | null max: number | null integer: boolean @@ -91,7 +91,7 @@ export type ValueSpecColor = { description: string | null warning: string | null - type: "color" + type: 'color' required: boolean default: string | null disabled: false | string @@ -101,9 +101,9 @@ export type ValueSpecDatetime = { name: string description: string | null warning: string | null - type: "datetime" + type: 'datetime' required: boolean - inputmode: "date" | "time" | "datetime-local" + inputmode: 'date' | 'time' | 'datetime-local' min: string | null max: string | null default: string | null @@ -115,7 +115,7 @@ export type ValueSpecSelect = { name: string description: string | null warning: string | null - type: "select" + type: 'select' default: string | null disabled: false | string | string[] immutable: boolean @@ -127,7 +127,7 @@ export type ValueSpecMultiselect = { description: string | null warning: string | null - type: "multiselect" + type: 'multiselect' minLength: number | null maxLength: number | null disabled: false | string | string[] @@ -139,7 +139,7 @@ export type ValueSpecToggle = { description: string | null warning: string | null - type: "toggle" + type: 'toggle' default: boolean | null disabled: false | string immutable: boolean @@ -149,7 +149,7 @@ export type ValueSpecUnion = { description: string | null warning: string | null - type: "union" + type: 'union' variants: Record< string, { @@ -165,7 +165,7 @@ export type ValueSpecFile = { name: string description: string | null warning: string | null - type: "file" + type: 'file' extensions: string[] required: boolean } @@ -173,13 +173,13 @@ export type ValueSpecObject = { name: string description: string | null warning: string | null - type: "object" + type: 'object' spec: InputSpec } export type ValueSpecHidden = { - type: "hidden" + type: 'hidden' } -export type ListValueSpecType = "text" | "object" +export type ListValueSpecType = 'text' | 'object' // prettier-ignore export type ListValueSpecOf = T extends "text" ? ListValueSpecText : @@ -190,7 +190,7 @@ export type ValueSpecListOf = { name: string description: string | null warning: string | null - type: "list" + type: 'list' spec: ListValueSpecOf minLength: number | null maxLength: number | null @@ -208,18 +208,18 @@ export type Pattern = { description: string } export type ListValueSpecText = { - type: "text" + type: 'text' patterns: Pattern[] minLength: number | null maxLength: number | null masked: boolean generate: null | RandomString - inputmode: "text" | "email" | "tel" | "url" + inputmode: 'text' | 'email' | 'tel' | 'url' placeholder: string | null } export type ListValueSpecObject = { - type: "object" + type: 'object' spec: InputSpec uniqueBy: UniqueBy displayAs: string | null @@ -244,5 +244,5 @@ export function isValueSpecListOf( t: ValueSpec, s: S, ): t is ValueSpecListOf & { spec: ListValueSpecOf } { - return "spec" in t && t.spec.type === s + return 'spec' in t && t.spec.type === s } diff --git a/sdk/base/lib/actions/setupActions.ts b/sdk/base/lib/actions/setupActions.ts index 26a72a117..d056be56e 100644 --- a/sdk/base/lib/actions/setupActions.ts +++ b/sdk/base/lib/actions/setupActions.ts @@ -1,16 +1,16 @@ -import { InputSpec } from "./input/builder" -import { ExtractInputSpecType } from "./input/builder/inputSpec" -import * as T from "../types" -import { once } from "../util" -import { InitScript } from "../inits" -import { Parser } from "ts-matches" +import { InputSpec } from './input/builder' +import { ExtractInputSpecType } from './input/builder/inputSpec' +import * as T from '../types' +import { once } from '../util' +import { InitScript } from '../inits' +import { Parser } from 'ts-matches' type MaybeInputSpec = {} extends Type ? null : InputSpec export type Run> = (options: { effects: T.Effects input: A spec: T.inputSpecTypes.InputSpec -}) => Promise<(T.ActionResult & { version: "1" }) | null | void | undefined> +}) => Promise<(T.ActionResult & { version: '1' }) | null | void | undefined> export type GetInput> = (options: { effects: T.Effects }) => Promise> @@ -65,7 +65,7 @@ export class Action> InputSpecType extends InputSpec>, >( id: Id, - metadata: MaybeFn>, + metadata: MaybeFn>, inputSpec: InputSpecType, getInput: GetInput>, run: Run>, @@ -80,7 +80,7 @@ export class Action> } static withoutInput( id: Id, - metadata: MaybeFn>, + metadata: MaybeFn>, run: Run<{}>, ): Action { return new Action( @@ -156,7 +156,7 @@ export class Actions< } addAction>( action: A, // TODO: prevent duplicates - ): Actions { + ): Actions { return new Actions({ ...this.actions, [action.id]: action }) } async init(effects: T.Effects): Promise { diff --git a/sdk/base/lib/dependencies/dependencies.ts b/sdk/base/lib/dependencies/dependencies.ts index 23bd1f1c8..80d2c2c8a 100644 --- a/sdk/base/lib/dependencies/dependencies.ts +++ b/sdk/base/lib/dependencies/dependencies.ts @@ -1,11 +1,11 @@ -import { ExtendedVersion, VersionRange } from "../exver" +import { ExtendedVersion, VersionRange } from '../exver' import { PackageId, HealthCheckId, DependencyRequirement, CheckDependenciesResult, -} from "../types" -import { Effects } from "../Effects" +} from '../types' +import { Effects } from '../Effects' export type CheckDependencies = { infoFor: (packageId: DependencyId) => { @@ -73,11 +73,11 @@ export async function checkDependencies< } const runningSatisfied = (packageId: DependencyId) => { const dep = infoFor(packageId) - return dep.requirement.kind !== "running" || dep.result.isRunning + return dep.requirement.kind !== 'running' || dep.result.isRunning } const tasksSatisfied = (packageId: DependencyId) => Object.entries(infoFor(packageId).result.tasks).filter( - ([_, t]) => t?.active && t.task.severity === "critical", + ([_, t]) => t?.active && t.task.severity === 'critical', ).length === 0 const healthCheckSatisfied = ( packageId: DependencyId, @@ -86,17 +86,17 @@ export async function checkDependencies< const dep = infoFor(packageId) if ( healthCheckId && - (dep.requirement.kind !== "running" || + (dep.requirement.kind !== 'running' || !dep.requirement.healthChecks.includes(healthCheckId)) ) { throw new Error(`Unknown HealthCheckId ${healthCheckId}`) } const errors = - dep.requirement.kind === "running" + dep.requirement.kind === 'running' ? dep.requirement.healthChecks .map((id) => [id, dep.result.healthChecks[id] ?? null] as const) .filter(([id, _]) => (healthCheckId ? id === healthCheckId : true)) - .filter(([_, res]) => res?.result !== "success") + .filter(([_, res]) => res?.result !== 'success') : [] return errors.length === 0 } @@ -138,7 +138,7 @@ export async function checkDependencies< } const throwIfRunningNotSatisfied = (packageId: DependencyId) => { const dep = infoFor(packageId) - if (dep.requirement.kind === "running" && !dep.result.isRunning) { + if (dep.requirement.kind === 'running' && !dep.result.isRunning) { throw new Error(`${dep.result.title || packageId} is not running`) } return null @@ -146,11 +146,11 @@ export async function checkDependencies< const throwIfTasksNotSatisfied = (packageId: DependencyId) => { const dep = infoFor(packageId) const reqs = Object.entries(dep.result.tasks) - .filter(([_, t]) => t?.active && t.task.severity === "critical") + .filter(([_, t]) => t?.active && t.task.severity === 'critical') .map(([id, _]) => id) if (reqs.length) { throw new Error( - `The following action requests have not been fulfilled: ${reqs.join(", ")}`, + `The following action requests have not been fulfilled: ${reqs.join(', ')}`, ) } return null @@ -162,27 +162,27 @@ export async function checkDependencies< const dep = infoFor(packageId) if ( healthCheckId && - (dep.requirement.kind !== "running" || + (dep.requirement.kind !== 'running' || !dep.requirement.healthChecks.includes(healthCheckId)) ) { throw new Error(`Unknown HealthCheckId ${healthCheckId}`) } const errors = - dep.requirement.kind === "running" + dep.requirement.kind === 'running' ? dep.requirement.healthChecks .map((id) => [id, dep.result.healthChecks[id] ?? null] as const) .filter(([id, _]) => (healthCheckId ? id === healthCheckId : true)) - .filter(([_, res]) => res?.result !== "success") + .filter(([_, res]) => res?.result !== 'success') : [] if (errors.length) { throw new Error( errors .map(([id, e]) => e - ? `Health Check ${e.name} of ${dep.result.title || packageId} failed with status ${e.result}${e.message ? `: ${e.message}` : ""}` + ? `Health Check ${e.name} of ${dep.result.title || packageId} failed with status ${e.result}${e.message ? `: ${e.message}` : ''}` : `Health Check ${id} of ${dep.result.title} does not exist`, ) - .join("; "), + .join('; '), ) } return null @@ -209,7 +209,7 @@ export async function checkDependencies< return [] }) if (err.length) { - throw new Error(err.join("; ")) + throw new Error(err.join('; ')) } return null })() diff --git a/sdk/base/lib/dependencies/setupDependencies.ts b/sdk/base/lib/dependencies/setupDependencies.ts index 85b88fa66..14a65021a 100644 --- a/sdk/base/lib/dependencies/setupDependencies.ts +++ b/sdk/base/lib/dependencies/setupDependencies.ts @@ -1,27 +1,27 @@ -import * as T from "../types" -import { once } from "../util" +import * as T from '../types' +import { once } from '../util' export type RequiredDependenciesOf = { - [K in keyof Manifest["dependencies"]]: Exclude< - Manifest["dependencies"][K], + [K in keyof Manifest['dependencies']]: Exclude< + Manifest['dependencies'][K], undefined - >["optional"] extends false + >['optional'] extends false ? K : never -}[keyof Manifest["dependencies"]] +}[keyof Manifest['dependencies']] export type OptionalDependenciesOf = Exclude< - keyof Manifest["dependencies"], + keyof Manifest['dependencies'], RequiredDependenciesOf > type DependencyRequirement = | { - kind: "running" + kind: 'running' healthChecks: Array versionRange: string } | { - kind: "exists" + kind: 'exists' versionRange: string } type Matches = T extends U ? (U extends T ? null : never) : never diff --git a/sdk/base/lib/exver/exver.ts b/sdk/base/lib/exver/exver.ts index 94202fde1..352178cca 100644 --- a/sdk/base/lib/exver/exver.ts +++ b/sdk/base/lib/exver/exver.ts @@ -1,2902 +1,3195 @@ /* eslint-disable */ +const peggyParser: { parse: any; SyntaxError: any; DefaultTracer?: any } = // Generated by Peggy 3.0.2. + // + // https://peggyjs.org/ + // @ts-ignore + (function () { + // @ts-ignore + 'use strict' - -const peggyParser: {parse: any, SyntaxError: any, DefaultTracer?: any} = // Generated by Peggy 3.0.2. -// -// https://peggyjs.org/ -// @ts-ignore -(function() { -// @ts-ignore - "use strict"; - -// @ts-ignore -function peg$subclass(child, parent) { -// @ts-ignore - function C() { this.constructor = child; } -// @ts-ignore - C.prototype = parent.prototype; -// @ts-ignore - child.prototype = new C(); -} - -// @ts-ignore -function peg$SyntaxError(message, expected, found, location) { -// @ts-ignore - var self = Error.call(this, message); - // istanbul ignore next Check is a necessary evil to support older environments -// @ts-ignore - if (Object.setPrototypeOf) { -// @ts-ignore - Object.setPrototypeOf(self, peg$SyntaxError.prototype); - } -// @ts-ignore - self.expected = expected; -// @ts-ignore - self.found = found; -// @ts-ignore - self.location = location; -// @ts-ignore - self.name = "SyntaxError"; -// @ts-ignore - return self; -} - -// @ts-ignore -peg$subclass(peg$SyntaxError, Error); - -// @ts-ignore -function peg$padEnd(str, targetLength, padString) { -// @ts-ignore - padString = padString || " "; -// @ts-ignore - if (str.length > targetLength) { return str; } -// @ts-ignore - targetLength -= str.length; -// @ts-ignore - padString += padString.repeat(targetLength); -// @ts-ignore - return str + padString.slice(0, targetLength); -} - -// @ts-ignore -peg$SyntaxError.prototype.format = function(sources) { -// @ts-ignore - var str = "Error: " + this.message; -// @ts-ignore - if (this.location) { -// @ts-ignore - var src = null; -// @ts-ignore - var k; -// @ts-ignore - for (k = 0; k < sources.length; k++) { -// @ts-ignore - if (sources[k].source === this.location.source) { -// @ts-ignore - src = sources[k].text.split(/\r\n|\n|\r/g); -// @ts-ignore - break; + // @ts-ignore + function peg$subclass(child, parent) { + // @ts-ignore + function C() { + this.constructor = child } + // @ts-ignore + C.prototype = parent.prototype + // @ts-ignore + child.prototype = new C() } -// @ts-ignore - var s = this.location.start; -// @ts-ignore - var offset_s = (this.location.source && (typeof this.location.source.offset === "function")) -// @ts-ignore - ? this.location.source.offset(s) -// @ts-ignore - : s; -// @ts-ignore - var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column; -// @ts-ignore - if (src) { -// @ts-ignore - var e = this.location.end; -// @ts-ignore - var filler = peg$padEnd("", offset_s.line.toString().length, ' '); -// @ts-ignore - var line = src[s.line - 1]; -// @ts-ignore - var last = s.line === e.line ? e.column : line.length + 1; -// @ts-ignore - var hatLen = (last - s.column) || 1; -// @ts-ignore - str += "\n --> " + loc + "\n" -// @ts-ignore - + filler + " |\n" -// @ts-ignore - + offset_s.line + " | " + line + "\n" -// @ts-ignore - + filler + " | " + peg$padEnd("", s.column - 1, ' ') -// @ts-ignore - + peg$padEnd("", hatLen, "^"); -// @ts-ignore - } else { -// @ts-ignore - str += "\n at " + loc; - } - } -// @ts-ignore - return str; -}; -// @ts-ignore -peg$SyntaxError.buildMessage = function(expected, found) { -// @ts-ignore - var DESCRIBE_EXPECTATION_FNS = { -// @ts-ignore - literal: function(expectation) { -// @ts-ignore - return "\"" + literalEscape(expectation.text) + "\""; - }, - -// @ts-ignore - class: function(expectation) { -// @ts-ignore - var escapedParts = expectation.parts.map(function(part) { -// @ts-ignore - return Array.isArray(part) -// @ts-ignore - ? classEscape(part[0]) + "-" + classEscape(part[1]) -// @ts-ignore - : classEscape(part); - }); - -// @ts-ignore - return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]"; - }, - -// @ts-ignore - any: function() { -// @ts-ignore - return "any character"; - }, - -// @ts-ignore - end: function() { -// @ts-ignore - return "end of input"; - }, - -// @ts-ignore - other: function(expectation) { -// @ts-ignore - return expectation.description; - } - }; - -// @ts-ignore - function hex(ch) { -// @ts-ignore - return ch.charCodeAt(0).toString(16).toUpperCase(); - } - -// @ts-ignore - function literalEscape(s) { -// @ts-ignore - return s -// @ts-ignore - .replace(/\\/g, "\\\\") -// @ts-ignore - .replace(/"/g, "\\\"") -// @ts-ignore - .replace(/\0/g, "\\0") -// @ts-ignore - .replace(/\t/g, "\\t") -// @ts-ignore - .replace(/\n/g, "\\n") -// @ts-ignore - .replace(/\r/g, "\\r") -// @ts-ignore - .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); }) -// @ts-ignore - .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); }); - } - -// @ts-ignore - function classEscape(s) { -// @ts-ignore - return s -// @ts-ignore - .replace(/\\/g, "\\\\") -// @ts-ignore - .replace(/\]/g, "\\]") -// @ts-ignore - .replace(/\^/g, "\\^") -// @ts-ignore - .replace(/-/g, "\\-") -// @ts-ignore - .replace(/\0/g, "\\0") -// @ts-ignore - .replace(/\t/g, "\\t") -// @ts-ignore - .replace(/\n/g, "\\n") -// @ts-ignore - .replace(/\r/g, "\\r") -// @ts-ignore - .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); }) -// @ts-ignore - .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); }); - } - -// @ts-ignore - function describeExpectation(expectation) { -// @ts-ignore - return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); - } - -// @ts-ignore - function describeExpected(expected) { -// @ts-ignore - var descriptions = expected.map(describeExpectation); -// @ts-ignore - var i, j; - -// @ts-ignore - descriptions.sort(); - -// @ts-ignore - if (descriptions.length > 0) { -// @ts-ignore - for (i = 1, j = 1; i < descriptions.length; i++) { -// @ts-ignore - if (descriptions[i - 1] !== descriptions[i]) { -// @ts-ignore - descriptions[j] = descriptions[i]; -// @ts-ignore - j++; - } + // @ts-ignore + function peg$SyntaxError(message, expected, found, location) { + // @ts-ignore + var self = Error.call(this, message) + // istanbul ignore next Check is a necessary evil to support older environments + // @ts-ignore + if (Object.setPrototypeOf) { + // @ts-ignore + Object.setPrototypeOf(self, peg$SyntaxError.prototype) } -// @ts-ignore - descriptions.length = j; + // @ts-ignore + self.expected = expected + // @ts-ignore + self.found = found + // @ts-ignore + self.location = location + // @ts-ignore + self.name = 'SyntaxError' + // @ts-ignore + return self } -// @ts-ignore - switch (descriptions.length) { -// @ts-ignore - case 1: -// @ts-ignore - return descriptions[0]; + // @ts-ignore + peg$subclass(peg$SyntaxError, Error) -// @ts-ignore - case 2: -// @ts-ignore - return descriptions[0] + " or " + descriptions[1]; - -// @ts-ignore - default: -// @ts-ignore - return descriptions.slice(0, -1).join(", ") -// @ts-ignore - + ", or " -// @ts-ignore - + descriptions[descriptions.length - 1]; - } - } - -// @ts-ignore - function describeFound(found) { -// @ts-ignore - return found ? "\"" + literalEscape(found) + "\"" : "end of input"; - } - -// @ts-ignore - return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; -}; - -// @ts-ignore -function peg$parse(input, options) { -// @ts-ignore - options = options !== undefined ? options : {}; - -// @ts-ignore - var peg$FAILED = {}; -// @ts-ignore - var peg$source = options.grammarSource; - -// @ts-ignore - var peg$startRuleFunctions = { VersionRange: peg$parseVersionRange, Or: peg$parseOr, And: peg$parseAnd, VersionRangeAtom: peg$parseVersionRangeAtom, Parens: peg$parseParens, Anchor: peg$parseAnchor, VersionSpec: peg$parseVersionSpec, FlavorAtom: peg$parseFlavorAtom, Not: peg$parseNot, Any: peg$parseAny, None: peg$parseNone, CmpOp: peg$parseCmpOp, ExtendedVersion: peg$parseExtendedVersion, EmverVersionRange: peg$parseEmverVersionRange, EmverVersionRangeAtom: peg$parseEmverVersionRangeAtom, EmverParens: peg$parseEmverParens, EmverAnchor: peg$parseEmverAnchor, EmverNot: peg$parseEmverNot, Emver: peg$parseEmver, Flavor: peg$parseFlavor, FlavorString: peg$parseFlavorString, String: peg$parseString, Version: peg$parseVersion, PreRelease: peg$parsePreRelease, PreReleaseSegment: peg$parsePreReleaseSegment, VersionNumber: peg$parseVersionNumber, Digit: peg$parseDigit, _: peg$parse_ }; -// @ts-ignore - var peg$startRuleFunction = peg$parseVersionRange; - -// @ts-ignore - var peg$c0 = "||"; - var peg$c1 = "&&"; - var peg$c2 = "("; - var peg$c3 = ")"; - var peg$c4 = ":"; - var peg$c5 = "#"; - var peg$c6 = "!"; - var peg$c7 = "*"; - var peg$c8 = ">="; - var peg$c9 = "<="; - var peg$c10 = ">"; - var peg$c11 = "<"; - var peg$c12 = "="; - var peg$c13 = "!="; - var peg$c14 = "^"; - var peg$c15 = "~"; - var peg$c16 = "."; - var peg$c17 = "-"; - - var peg$r0 = /^[a-z]/; - var peg$r1 = /^[a-zA-Z]/; - var peg$r2 = /^[0-9]/; - var peg$r3 = /^[ \t\n\r]/; - - var peg$e0 = peg$literalExpectation("||", false); - var peg$e1 = peg$literalExpectation("&&", false); - var peg$e2 = peg$literalExpectation("(", false); - var peg$e3 = peg$literalExpectation(")", false); - var peg$e4 = peg$literalExpectation(":", false); - var peg$e5 = peg$literalExpectation("#", false); - var peg$e6 = peg$literalExpectation("!", false); - var peg$e7 = peg$literalExpectation("*", false); - var peg$e8 = peg$literalExpectation(">=", false); - var peg$e9 = peg$literalExpectation("<=", false); - var peg$e10 = peg$literalExpectation(">", false); - var peg$e11 = peg$literalExpectation("<", false); - var peg$e12 = peg$literalExpectation("=", false); - var peg$e13 = peg$literalExpectation("!=", false); - var peg$e14 = peg$literalExpectation("^", false); - var peg$e15 = peg$literalExpectation("~", false); - var peg$e16 = peg$literalExpectation(".", false); - var peg$e17 = peg$classExpectation([["a", "z"]], false, false); - var peg$e18 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false); - var peg$e19 = peg$literalExpectation("-", false); - var peg$e20 = peg$classExpectation([["0", "9"]], false, false); - var peg$e21 = peg$otherExpectation("whitespace"); - var peg$e22 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false); -// @ts-ignore - - var peg$f0 = function(expr) {// @ts-ignore - return { type: "Parens", expr } };// @ts-ignore - - var peg$f1 = function(operator, version) {// @ts-ignore - return { type: "Anchor", operator, version } };// @ts-ignore - - var peg$f2 = function(flavor, upstream, downstream) {// @ts-ignore - return { flavor: flavor || null, upstream, downstream: downstream ? downstream[1] : { number: [0], prerelease: [] } } };// @ts-ignore - - var peg$f3 = function(flavor) {// @ts-ignore - return { type: "Flavor", flavor: flavor } };// @ts-ignore - - var peg$f4 = function(value) {// @ts-ignore - return { type: "Not", value: value }};// @ts-ignore - - var peg$f5 = function() {// @ts-ignore - return { type: "Any" } };// @ts-ignore - - var peg$f6 = function() {// @ts-ignore - return { type: "None" } };// @ts-ignore - - var peg$f7 = function() {// @ts-ignore - return ">="; };// @ts-ignore - - var peg$f8 = function() {// @ts-ignore - return "<="; };// @ts-ignore - - var peg$f9 = function() {// @ts-ignore - return ">"; };// @ts-ignore - - var peg$f10 = function() {// @ts-ignore - return "<"; };// @ts-ignore - - var peg$f11 = function() {// @ts-ignore - return "="; };// @ts-ignore - - var peg$f12 = function() {// @ts-ignore - return "!="; };// @ts-ignore - - var peg$f13 = function() {// @ts-ignore - return "^"; };// @ts-ignore - - var peg$f14 = function() {// @ts-ignore - return "~"; };// @ts-ignore - - var peg$f15 = function(flavor, upstream, downstream) { -// @ts-ignore - return { flavor: flavor || null, upstream, downstream } - };// @ts-ignore - - var peg$f16 = function(expr) {// @ts-ignore - return { type: "Parens", expr } };// @ts-ignore - - var peg$f17 = function(operator, version) {// @ts-ignore - return { type: "Anchor", operator, version } };// @ts-ignore - - var peg$f18 = function(value) {// @ts-ignore - return { type: "Not", value: value }};// @ts-ignore - - var peg$f19 = function(major, minor, patch, revision) {// @ts-ignore - return revision };// @ts-ignore - - var peg$f20 = function(major, minor, patch, revision) { -// @ts-ignore - return { -// @ts-ignore - flavor: null, -// @ts-ignore - upstream: { -// @ts-ignore - number: [major, minor, patch], -// @ts-ignore - prerelease: [], - }, -// @ts-ignore - downstream: { -// @ts-ignore - number: [revision || 0], -// @ts-ignore - prerelease: [], - }, - } - };// @ts-ignore - - var peg$f21 = function(flavor) {// @ts-ignore - return flavor };// @ts-ignore - - var peg$f22 = function() {// @ts-ignore - return text() };// @ts-ignore - - var peg$f23 = function() {// @ts-ignore - return text(); };// @ts-ignore - - var peg$f24 = function(number, prerelease) { -// @ts-ignore - return { -// @ts-ignore - number, -// @ts-ignore - prerelease: prerelease || [] - }; - };// @ts-ignore - - var peg$f25 = function(first, rest) { -// @ts-ignore - return [first].concat(rest.map(r => r[1])); - };// @ts-ignore - - var peg$f26 = function(segment) { -// @ts-ignore - return segment; - };// @ts-ignore - - var peg$f27 = function(first, rest) { -// @ts-ignore - return [first].concat(rest.map(r => r[1])); - };// @ts-ignore - - var peg$f28 = function() {// @ts-ignore - return parseInt(text(), 10); }; -// @ts-ignore - var peg$currPos = 0; -// @ts-ignore - var peg$savedPos = 0; -// @ts-ignore - var peg$posDetailsCache = [{ line: 1, column: 1 }]; -// @ts-ignore - var peg$maxFailPos = 0; -// @ts-ignore - var peg$maxFailExpected = []; -// @ts-ignore - var peg$silentFails = 0; - -// @ts-ignore - var peg$result; - -// @ts-ignore - if ("startRule" in options) { -// @ts-ignore - if (!(options.startRule in peg$startRuleFunctions)) { -// @ts-ignore - throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); - } - -// @ts-ignore - peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; - } - -// @ts-ignore - function text() { -// @ts-ignore - return input.substring(peg$savedPos, peg$currPos); - } - -// @ts-ignore - function offset() { -// @ts-ignore - return peg$savedPos; - } - -// @ts-ignore - function range() { -// @ts-ignore - return { -// @ts-ignore - source: peg$source, -// @ts-ignore - start: peg$savedPos, -// @ts-ignore - end: peg$currPos - }; - } - -// @ts-ignore - function location() { -// @ts-ignore - return peg$computeLocation(peg$savedPos, peg$currPos); - } - -// @ts-ignore - function expected(description, location) { -// @ts-ignore - location = location !== undefined -// @ts-ignore - ? location -// @ts-ignore - : peg$computeLocation(peg$savedPos, peg$currPos); - -// @ts-ignore - throw peg$buildStructuredError( -// @ts-ignore - [peg$otherExpectation(description)], -// @ts-ignore - input.substring(peg$savedPos, peg$currPos), -// @ts-ignore - location - ); - } - -// @ts-ignore - function error(message, location) { -// @ts-ignore - location = location !== undefined -// @ts-ignore - ? location -// @ts-ignore - : peg$computeLocation(peg$savedPos, peg$currPos); - -// @ts-ignore - throw peg$buildSimpleError(message, location); - } - -// @ts-ignore - function peg$literalExpectation(text, ignoreCase) { -// @ts-ignore - return { type: "literal", text: text, ignoreCase: ignoreCase }; - } - -// @ts-ignore - function peg$classExpectation(parts, inverted, ignoreCase) { -// @ts-ignore - return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase }; - } - -// @ts-ignore - function peg$anyExpectation() { -// @ts-ignore - return { type: "any" }; - } - -// @ts-ignore - function peg$endExpectation() { -// @ts-ignore - return { type: "end" }; - } - -// @ts-ignore - function peg$otherExpectation(description) { -// @ts-ignore - return { type: "other", description: description }; - } - -// @ts-ignore - function peg$computePosDetails(pos) { -// @ts-ignore - var details = peg$posDetailsCache[pos]; -// @ts-ignore - var p; - -// @ts-ignore - if (details) { -// @ts-ignore - return details; -// @ts-ignore - } else { -// @ts-ignore - p = pos - 1; -// @ts-ignore - while (!peg$posDetailsCache[p]) { -// @ts-ignore - p--; + // @ts-ignore + function peg$padEnd(str, targetLength, padString) { + // @ts-ignore + padString = padString || ' ' + // @ts-ignore + if (str.length > targetLength) { + return str } - -// @ts-ignore - details = peg$posDetailsCache[p]; -// @ts-ignore - details = { -// @ts-ignore - line: details.line, -// @ts-ignore - column: details.column - }; - -// @ts-ignore - while (p < pos) { -// @ts-ignore - if (input.charCodeAt(p) === 10) { -// @ts-ignore - details.line++; -// @ts-ignore - details.column = 1; -// @ts-ignore - } else { -// @ts-ignore - details.column++; - } - -// @ts-ignore - p++; - } - -// @ts-ignore - peg$posDetailsCache[pos] = details; - -// @ts-ignore - return details; - } - } - -// @ts-ignore - function peg$computeLocation(startPos, endPos, offset) { -// @ts-ignore - var startPosDetails = peg$computePosDetails(startPos); -// @ts-ignore - var endPosDetails = peg$computePosDetails(endPos); - -// @ts-ignore - var res = { -// @ts-ignore - source: peg$source, -// @ts-ignore - start: { -// @ts-ignore - offset: startPos, -// @ts-ignore - line: startPosDetails.line, -// @ts-ignore - column: startPosDetails.column - }, -// @ts-ignore - end: { -// @ts-ignore - offset: endPos, -// @ts-ignore - line: endPosDetails.line, -// @ts-ignore - column: endPosDetails.column - } - }; -// @ts-ignore - if (offset && peg$source && (typeof peg$source.offset === "function")) { -// @ts-ignore - res.start = peg$source.offset(res.start); -// @ts-ignore - res.end = peg$source.offset(res.end); - } -// @ts-ignore - return res; - } - -// @ts-ignore - function peg$fail(expected) { -// @ts-ignore - if (peg$currPos < peg$maxFailPos) { return; } - -// @ts-ignore - if (peg$currPos > peg$maxFailPos) { -// @ts-ignore - peg$maxFailPos = peg$currPos; -// @ts-ignore - peg$maxFailExpected = []; + // @ts-ignore + targetLength -= str.length + // @ts-ignore + padString += padString.repeat(targetLength) + // @ts-ignore + return str + padString.slice(0, targetLength) } -// @ts-ignore - peg$maxFailExpected.push(expected); - } - -// @ts-ignore - function peg$buildSimpleError(message, location) { -// @ts-ignore - return new peg$SyntaxError(message, null, null, location); - } - -// @ts-ignore - function peg$buildStructuredError(expected, found, location) { -// @ts-ignore - return new peg$SyntaxError( -// @ts-ignore - peg$SyntaxError.buildMessage(expected, found), -// @ts-ignore - expected, -// @ts-ignore - found, -// @ts-ignore - location - ); - } - -// @ts-ignore - function // @ts-ignore -peg$parseVersionRange() { -// @ts-ignore - var s0, s1, s2, s3, s4, s5, s6, s7; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - s1 = peg$parseVersionRangeAtom(); -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - s2 = []; -// @ts-ignore - s3 = peg$currPos; -// @ts-ignore - s4 = peg$parse_(); -// @ts-ignore - s5 = peg$currPos; -// @ts-ignore - s6 = peg$parseOr(); -// @ts-ignore - if (s6 === peg$FAILED) { -// @ts-ignore - s6 = peg$parseAnd(); - } -// @ts-ignore - if (s6 !== peg$FAILED) { -// @ts-ignore - s7 = peg$parse_(); -// @ts-ignore - s6 = [s6, s7]; -// @ts-ignore - s5 = s6; -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s5; -// @ts-ignore - s5 = peg$FAILED; - } -// @ts-ignore - if (s5 === peg$FAILED) { -// @ts-ignore - s5 = null; - } -// @ts-ignore - s6 = peg$parseVersionRangeAtom(); -// @ts-ignore - if (s6 !== peg$FAILED) { -// @ts-ignore - s4 = [s4, s5, s6]; -// @ts-ignore - s3 = s4; -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s3; -// @ts-ignore - s3 = peg$FAILED; - } -// @ts-ignore - while (s3 !== peg$FAILED) { -// @ts-ignore - s2.push(s3); -// @ts-ignore - s3 = peg$currPos; -// @ts-ignore - s4 = peg$parse_(); -// @ts-ignore - s5 = peg$currPos; -// @ts-ignore - s6 = peg$parseOr(); -// @ts-ignore - if (s6 === peg$FAILED) { -// @ts-ignore - s6 = peg$parseAnd(); - } -// @ts-ignore - if (s6 !== peg$FAILED) { -// @ts-ignore - s7 = peg$parse_(); -// @ts-ignore - s6 = [s6, s7]; -// @ts-ignore - s5 = s6; -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s5; -// @ts-ignore - s5 = peg$FAILED; - } -// @ts-ignore - if (s5 === peg$FAILED) { -// @ts-ignore - s5 = null; - } -// @ts-ignore - s6 = peg$parseVersionRangeAtom(); -// @ts-ignore - if (s6 !== peg$FAILED) { -// @ts-ignore - s4 = [s4, s5, s6]; -// @ts-ignore - s3 = s4; -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s3; -// @ts-ignore - s3 = peg$FAILED; - } - } -// @ts-ignore - s1 = [s1, s2]; -// @ts-ignore - s0 = s1; -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseOr() { -// @ts-ignore - var s0; - -// @ts-ignore - if (input.substr(peg$currPos, 2) === peg$c0) { -// @ts-ignore - s0 = peg$c0; -// @ts-ignore - peg$currPos += 2; -// @ts-ignore - } else { -// @ts-ignore - s0 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e0); } - } - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseAnd() { -// @ts-ignore - var s0; - -// @ts-ignore - if (input.substr(peg$currPos, 2) === peg$c1) { -// @ts-ignore - s0 = peg$c1; -// @ts-ignore - peg$currPos += 2; -// @ts-ignore - } else { -// @ts-ignore - s0 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e1); } - } - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseVersionRangeAtom() { -// @ts-ignore - var s0; - -// @ts-ignore - s0 = peg$parseParens(); -// @ts-ignore - if (s0 === peg$FAILED) { -// @ts-ignore - s0 = peg$parseAnchor(); -// @ts-ignore - if (s0 === peg$FAILED) { -// @ts-ignore - s0 = peg$parseNot(); -// @ts-ignore - if (s0 === peg$FAILED) { -// @ts-ignore - s0 = peg$parseAny(); -// @ts-ignore - if (s0 === peg$FAILED) { -// @ts-ignore - s0 = peg$parseNone(); -// @ts-ignore - if (s0 === peg$FAILED) { -// @ts-ignore - s0 = peg$parseFlavorAtom(); - } + // @ts-ignore + peg$SyntaxError.prototype.format = function (sources) { + // @ts-ignore + var str = 'Error: ' + this.message + // @ts-ignore + if (this.location) { + // @ts-ignore + var src = null + // @ts-ignore + var k + // @ts-ignore + for (k = 0; k < sources.length; k++) { + // @ts-ignore + if (sources[k].source === this.location.source) { + // @ts-ignore + src = sources[k].text.split(/\r\n|\n|\r/g) + // @ts-ignore + break } } - } - } - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseParens() { -// @ts-ignore - var s0, s1, s2, s3, s4, s5; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 40) { -// @ts-ignore - s1 = peg$c2; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s1 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e2); } - } -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - s2 = peg$parse_(); -// @ts-ignore - s3 = peg$parseVersionRange(); -// @ts-ignore - if (s3 !== peg$FAILED) { -// @ts-ignore - s4 = peg$parse_(); -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 41) { -// @ts-ignore - s5 = peg$c3; -// @ts-ignore - peg$currPos++; -// @ts-ignore + // @ts-ignore + var s = this.location.start + // @ts-ignore + var offset_s = + this.location.source && + typeof this.location.source.offset === 'function' + ? // @ts-ignore + this.location.source.offset(s) + : // @ts-ignore + s + // @ts-ignore + var loc = + this.location.source + ':' + offset_s.line + ':' + offset_s.column + // @ts-ignore + if (src) { + // @ts-ignore + var e = this.location.end + // @ts-ignore + var filler = peg$padEnd('', offset_s.line.toString().length, ' ') + // @ts-ignore + var line = src[s.line - 1] + // @ts-ignore + var last = s.line === e.line ? e.column : line.length + 1 + // @ts-ignore + var hatLen = last - s.column || 1 + // @ts-ignore + str += + '\n --> ' + + loc + + '\n' + + // @ts-ignore + filler + + ' |\n' + + // @ts-ignore + offset_s.line + + ' | ' + + line + + '\n' + + // @ts-ignore + filler + + ' | ' + + peg$padEnd('', s.column - 1, ' ') + + // @ts-ignore + peg$padEnd('', hatLen, '^') + // @ts-ignore } else { -// @ts-ignore - s5 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e3); } + // @ts-ignore + str += '\n at ' + loc } -// @ts-ignore - if (s5 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s0 = peg$f0(s3); -// @ts-ignore + } + // @ts-ignore + return str + } + + // @ts-ignore + peg$SyntaxError.buildMessage = function (expected, found) { + // @ts-ignore + var DESCRIBE_EXPECTATION_FNS = { + // @ts-ignore + literal: function (expectation) { + // @ts-ignore + return '"' + literalEscape(expectation.text) + '"' + }, + + // @ts-ignore + class: function (expectation) { + // @ts-ignore + var escapedParts = expectation.parts.map(function (part) { + // @ts-ignore + return Array.isArray(part) + ? // @ts-ignore + classEscape(part[0]) + '-' + classEscape(part[1]) + : // @ts-ignore + classEscape(part) + }) + + // @ts-ignore + return ( + '[' + + (expectation.inverted ? '^' : '') + + escapedParts.join('') + + ']' + ) + }, + + // @ts-ignore + any: function () { + // @ts-ignore + return 'any character' + }, + + // @ts-ignore + end: function () { + // @ts-ignore + return 'end of input' + }, + + // @ts-ignore + other: function (expectation) { + // @ts-ignore + return expectation.description + }, + } + + // @ts-ignore + function hex(ch) { + // @ts-ignore + return ch.charCodeAt(0).toString(16).toUpperCase() + } + + // @ts-ignore + function literalEscape(s) { + // @ts-ignore + return ( + s + // @ts-ignore + .replace(/\\/g, '\\\\') + // @ts-ignore + .replace(/"/g, '\\"') + // @ts-ignore + .replace(/\0/g, '\\0') + // @ts-ignore + .replace(/\t/g, '\\t') + // @ts-ignore + .replace(/\n/g, '\\n') + // @ts-ignore + .replace(/\r/g, '\\r') + // @ts-ignore + .replace(/[\x00-\x0F]/g, function (ch) { + return '\\x0' + hex(ch) + }) + // @ts-ignore + .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { + return '\\x' + hex(ch) + }) + ) + } + + // @ts-ignore + function classEscape(s) { + // @ts-ignore + return ( + s + // @ts-ignore + .replace(/\\/g, '\\\\') + // @ts-ignore + .replace(/\]/g, '\\]') + // @ts-ignore + .replace(/\^/g, '\\^') + // @ts-ignore + .replace(/-/g, '\\-') + // @ts-ignore + .replace(/\0/g, '\\0') + // @ts-ignore + .replace(/\t/g, '\\t') + // @ts-ignore + .replace(/\n/g, '\\n') + // @ts-ignore + .replace(/\r/g, '\\r') + // @ts-ignore + .replace(/[\x00-\x0F]/g, function (ch) { + return '\\x0' + hex(ch) + }) + // @ts-ignore + .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { + return '\\x' + hex(ch) + }) + ) + } + + // @ts-ignore + function describeExpectation(expectation) { + // @ts-ignore + return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation) + } + + // @ts-ignore + function describeExpected(expected) { + // @ts-ignore + var descriptions = expected.map(describeExpectation) + // @ts-ignore + var i, j + + // @ts-ignore + descriptions.sort() + + // @ts-ignore + if (descriptions.length > 0) { + // @ts-ignore + for (i = 1, j = 1; i < descriptions.length; i++) { + // @ts-ignore + if (descriptions[i - 1] !== descriptions[i]) { + // @ts-ignore + descriptions[j] = descriptions[i] + // @ts-ignore + j++ + } + } + // @ts-ignore + descriptions.length = j + } + + // @ts-ignore + switch (descriptions.length) { + // @ts-ignore + case 1: + // @ts-ignore + return descriptions[0] + + // @ts-ignore + case 2: + // @ts-ignore + return descriptions[0] + ' or ' + descriptions[1] + + // @ts-ignore + default: + // @ts-ignore + return ( + descriptions.slice(0, -1).join(', ') + + // @ts-ignore + ', or ' + + // @ts-ignore + descriptions[descriptions.length - 1] + ) + } + } + + // @ts-ignore + function describeFound(found) { + // @ts-ignore + return found ? '"' + literalEscape(found) + '"' : 'end of input' + } + + // @ts-ignore + return ( + 'Expected ' + + describeExpected(expected) + + ' but ' + + describeFound(found) + + ' found.' + ) + } + + // @ts-ignore + function peg$parse(input, options) { + // @ts-ignore + options = options !== undefined ? options : {} + + // @ts-ignore + var peg$FAILED = {} + // @ts-ignore + var peg$source = options.grammarSource + + // @ts-ignore + var peg$startRuleFunctions = { + VersionRange: peg$parseVersionRange, + Or: peg$parseOr, + And: peg$parseAnd, + VersionRangeAtom: peg$parseVersionRangeAtom, + Parens: peg$parseParens, + Anchor: peg$parseAnchor, + VersionSpec: peg$parseVersionSpec, + FlavorAtom: peg$parseFlavorAtom, + Not: peg$parseNot, + Any: peg$parseAny, + None: peg$parseNone, + CmpOp: peg$parseCmpOp, + ExtendedVersion: peg$parseExtendedVersion, + EmverVersionRange: peg$parseEmverVersionRange, + EmverVersionRangeAtom: peg$parseEmverVersionRangeAtom, + EmverParens: peg$parseEmverParens, + EmverAnchor: peg$parseEmverAnchor, + EmverNot: peg$parseEmverNot, + Emver: peg$parseEmver, + Flavor: peg$parseFlavor, + FlavorString: peg$parseFlavorString, + String: peg$parseString, + Version: peg$parseVersion, + PreRelease: peg$parsePreRelease, + PreReleaseSegment: peg$parsePreReleaseSegment, + VersionNumber: peg$parseVersionNumber, + Digit: peg$parseDigit, + _: peg$parse_, + } + // @ts-ignore + var peg$startRuleFunction = peg$parseVersionRange + + // @ts-ignore + var peg$c0 = '||' + var peg$c1 = '&&' + var peg$c2 = '(' + var peg$c3 = ')' + var peg$c4 = ':' + var peg$c5 = '#' + var peg$c6 = '!' + var peg$c7 = '*' + var peg$c8 = '>=' + var peg$c9 = '<=' + var peg$c10 = '>' + var peg$c11 = '<' + var peg$c12 = '=' + var peg$c13 = '!=' + var peg$c14 = '^' + var peg$c15 = '~' + var peg$c16 = '.' + var peg$c17 = '-' + + var peg$r0 = /^[a-z]/ + var peg$r1 = /^[a-zA-Z]/ + var peg$r2 = /^[0-9]/ + var peg$r3 = /^[ \t\n\r]/ + + var peg$e0 = peg$literalExpectation('||', false) + var peg$e1 = peg$literalExpectation('&&', false) + var peg$e2 = peg$literalExpectation('(', false) + var peg$e3 = peg$literalExpectation(')', false) + var peg$e4 = peg$literalExpectation(':', false) + var peg$e5 = peg$literalExpectation('#', false) + var peg$e6 = peg$literalExpectation('!', false) + var peg$e7 = peg$literalExpectation('*', false) + var peg$e8 = peg$literalExpectation('>=', false) + var peg$e9 = peg$literalExpectation('<=', false) + var peg$e10 = peg$literalExpectation('>', false) + var peg$e11 = peg$literalExpectation('<', false) + var peg$e12 = peg$literalExpectation('=', false) + var peg$e13 = peg$literalExpectation('!=', false) + var peg$e14 = peg$literalExpectation('^', false) + var peg$e15 = peg$literalExpectation('~', false) + var peg$e16 = peg$literalExpectation('.', false) + var peg$e17 = peg$classExpectation([['a', 'z']], false, false) + var peg$e18 = peg$classExpectation( + [ + ['a', 'z'], + ['A', 'Z'], + ], + false, + false, + ) + var peg$e19 = peg$literalExpectation('-', false) + var peg$e20 = peg$classExpectation([['0', '9']], false, false) + var peg$e21 = peg$otherExpectation('whitespace') + var peg$e22 = peg$classExpectation([' ', '\t', '\n', '\r'], false, false) + // @ts-ignore + + var peg$f0 = function (expr) { + // @ts-ignore + return { type: 'Parens', expr } + } // @ts-ignore + + var peg$f1 = function (operator, version) { + // @ts-ignore + return { type: 'Anchor', operator, version } + } // @ts-ignore + + var peg$f2 = function (flavor, upstream, downstream) { + // @ts-ignore + return { + flavor: flavor || null, + upstream, + downstream: downstream + ? downstream[1] + : { number: [0], prerelease: [] }, + } + } // @ts-ignore + + var peg$f3 = function (flavor) { + // @ts-ignore + return { type: 'Flavor', flavor: flavor } + } // @ts-ignore + + var peg$f4 = function (value) { + // @ts-ignore + return { type: 'Not', value: value } + } // @ts-ignore + + var peg$f5 = function () { + // @ts-ignore + return { type: 'Any' } + } // @ts-ignore + + var peg$f6 = function () { + // @ts-ignore + return { type: 'None' } + } // @ts-ignore + + var peg$f7 = function () { + // @ts-ignore + return '>=' + } // @ts-ignore + + var peg$f8 = function () { + // @ts-ignore + return '<=' + } // @ts-ignore + + var peg$f9 = function () { + // @ts-ignore + return '>' + } // @ts-ignore + + var peg$f10 = function () { + // @ts-ignore + return '<' + } // @ts-ignore + + var peg$f11 = function () { + // @ts-ignore + return '=' + } // @ts-ignore + + var peg$f12 = function () { + // @ts-ignore + return '!=' + } // @ts-ignore + + var peg$f13 = function () { + // @ts-ignore + return '^' + } // @ts-ignore + + var peg$f14 = function () { + // @ts-ignore + return '~' + } // @ts-ignore + + var peg$f15 = function (flavor, upstream, downstream) { + // @ts-ignore + return { flavor: flavor || null, upstream, downstream } + } // @ts-ignore + + var peg$f16 = function (expr) { + // @ts-ignore + return { type: 'Parens', expr } + } // @ts-ignore + + var peg$f17 = function (operator, version) { + // @ts-ignore + return { type: 'Anchor', operator, version } + } // @ts-ignore + + var peg$f18 = function (value) { + // @ts-ignore + return { type: 'Not', value: value } + } // @ts-ignore + + var peg$f19 = function (major, minor, patch, revision) { + // @ts-ignore + return revision + } // @ts-ignore + + var peg$f20 = function (major, minor, patch, revision) { + // @ts-ignore + return { + // @ts-ignore + flavor: null, + // @ts-ignore + upstream: { + // @ts-ignore + number: [major, minor, patch], + // @ts-ignore + prerelease: [], + }, + // @ts-ignore + downstream: { + // @ts-ignore + number: [revision || 0], + // @ts-ignore + prerelease: [], + }, + } + } // @ts-ignore + + var peg$f21 = function (flavor) { + // @ts-ignore + return flavor + } // @ts-ignore + + var peg$f22 = function () { + // @ts-ignore + return text() + } // @ts-ignore + + var peg$f23 = function () { + // @ts-ignore + return text() + } // @ts-ignore + + var peg$f24 = function (number, prerelease) { + // @ts-ignore + return { + // @ts-ignore + number, + // @ts-ignore + prerelease: prerelease || [], + } + } // @ts-ignore + + var peg$f25 = function (first, rest) { + // @ts-ignore + return [first].concat(rest.map((r) => r[1])) + } // @ts-ignore + + var peg$f26 = function (segment) { + // @ts-ignore + return segment + } // @ts-ignore + + var peg$f27 = function (first, rest) { + // @ts-ignore + return [first].concat(rest.map((r) => r[1])) + } // @ts-ignore + + var peg$f28 = function () { + // @ts-ignore + return parseInt(text(), 10) + } + // @ts-ignore + var peg$currPos = 0 + // @ts-ignore + var peg$savedPos = 0 + // @ts-ignore + var peg$posDetailsCache = [{ line: 1, column: 1 }] + // @ts-ignore + var peg$maxFailPos = 0 + // @ts-ignore + var peg$maxFailExpected = [] + // @ts-ignore + var peg$silentFails = 0 + + // @ts-ignore + var peg$result + + // @ts-ignore + if ('startRule' in options) { + // @ts-ignore + if (!(options.startRule in peg$startRuleFunctions)) { + // @ts-ignore + throw new Error( + 'Can\'t start parsing from rule "' + options.startRule + '".', + ) + } + + // @ts-ignore + peg$startRuleFunction = peg$startRuleFunctions[options.startRule] + } + + // @ts-ignore + function text() { + // @ts-ignore + return input.substring(peg$savedPos, peg$currPos) + } + + // @ts-ignore + function offset() { + // @ts-ignore + return peg$savedPos + } + + // @ts-ignore + function range() { + // @ts-ignore + return { + // @ts-ignore + source: peg$source, + // @ts-ignore + start: peg$savedPos, + // @ts-ignore + end: peg$currPos, + } + } + + // @ts-ignore + function location() { + // @ts-ignore + return peg$computeLocation(peg$savedPos, peg$currPos) + } + + // @ts-ignore + function expected(description, location) { + // @ts-ignore + location = + location !== undefined + ? // @ts-ignore + location + : // @ts-ignore + peg$computeLocation(peg$savedPos, peg$currPos) + + // @ts-ignore + throw peg$buildStructuredError( + // @ts-ignore + [peg$otherExpectation(description)], + // @ts-ignore + input.substring(peg$savedPos, peg$currPos), + // @ts-ignore + location, + ) + } + + // @ts-ignore + function error(message, location) { + // @ts-ignore + location = + location !== undefined + ? // @ts-ignore + location + : // @ts-ignore + peg$computeLocation(peg$savedPos, peg$currPos) + + // @ts-ignore + throw peg$buildSimpleError(message, location) + } + + // @ts-ignore + function peg$literalExpectation(text, ignoreCase) { + // @ts-ignore + return { type: 'literal', text: text, ignoreCase: ignoreCase } + } + + // @ts-ignore + function peg$classExpectation(parts, inverted, ignoreCase) { + // @ts-ignore + return { + type: 'class', + parts: parts, + inverted: inverted, + ignoreCase: ignoreCase, + } + } + + // @ts-ignore + function peg$anyExpectation() { + // @ts-ignore + return { type: 'any' } + } + + // @ts-ignore + function peg$endExpectation() { + // @ts-ignore + return { type: 'end' } + } + + // @ts-ignore + function peg$otherExpectation(description) { + // @ts-ignore + return { type: 'other', description: description } + } + + // @ts-ignore + function peg$computePosDetails(pos) { + // @ts-ignore + var details = peg$posDetailsCache[pos] + // @ts-ignore + var p + + // @ts-ignore + if (details) { + // @ts-ignore + return details + // @ts-ignore } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; + // @ts-ignore + p = pos - 1 + // @ts-ignore + while (!peg$posDetailsCache[p]) { + // @ts-ignore + p-- + } + + // @ts-ignore + details = peg$posDetailsCache[p] + // @ts-ignore + details = { + // @ts-ignore + line: details.line, + // @ts-ignore + column: details.column, + } + + // @ts-ignore + while (p < pos) { + // @ts-ignore + if (input.charCodeAt(p) === 10) { + // @ts-ignore + details.line++ + // @ts-ignore + details.column = 1 + // @ts-ignore + } else { + // @ts-ignore + details.column++ + } + + // @ts-ignore + p++ + } + + // @ts-ignore + peg$posDetailsCache[pos] = details + + // @ts-ignore + return details } -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; } -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } -// @ts-ignore - return s0; - } + // @ts-ignore + function peg$computeLocation(startPos, endPos, offset) { + // @ts-ignore + var startPosDetails = peg$computePosDetails(startPos) + // @ts-ignore + var endPosDetails = peg$computePosDetails(endPos) -// @ts-ignore - function // @ts-ignore -peg$parseAnchor() { -// @ts-ignore - var s0, s1, s2, s3; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - s1 = peg$parseCmpOp(); -// @ts-ignore - if (s1 === peg$FAILED) { -// @ts-ignore - s1 = null; - } -// @ts-ignore - s2 = peg$parse_(); -// @ts-ignore - s3 = peg$parseVersionSpec(); -// @ts-ignore - if (s3 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s0 = peg$f1(s1, s3); -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseVersionSpec() { -// @ts-ignore - var s0, s1, s2, s3, s4, s5; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - s1 = peg$parseFlavor(); -// @ts-ignore - if (s1 === peg$FAILED) { -// @ts-ignore - s1 = null; - } -// @ts-ignore - s2 = peg$parseVersion(); -// @ts-ignore - if (s2 !== peg$FAILED) { -// @ts-ignore - s3 = peg$currPos; -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 58) { -// @ts-ignore - s4 = peg$c4; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s4 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e4); } - } -// @ts-ignore - if (s4 !== peg$FAILED) { -// @ts-ignore - s5 = peg$parseVersion(); -// @ts-ignore - if (s5 !== peg$FAILED) { -// @ts-ignore - s4 = [s4, s5]; -// @ts-ignore - s3 = s4; -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s3; -// @ts-ignore - s3 = peg$FAILED; + // @ts-ignore + var res = { + // @ts-ignore + source: peg$source, + // @ts-ignore + start: { + // @ts-ignore + offset: startPos, + // @ts-ignore + line: startPosDetails.line, + // @ts-ignore + column: startPosDetails.column, + }, + // @ts-ignore + end: { + // @ts-ignore + offset: endPos, + // @ts-ignore + line: endPosDetails.line, + // @ts-ignore + column: endPosDetails.column, + }, } -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s3; -// @ts-ignore - s3 = peg$FAILED; - } -// @ts-ignore - if (s3 === peg$FAILED) { -// @ts-ignore - s3 = null; - } -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s0 = peg$f2(s1, s2, s3); -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseFlavorAtom() { -// @ts-ignore - var s0, s1, s2; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 35) { -// @ts-ignore - s1 = peg$c5; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s1 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e5); } - } -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - s2 = peg$parseFlavorString(); -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s0 = peg$f3(s2); -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseNot() { -// @ts-ignore - var s0, s1, s2, s3; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 33) { -// @ts-ignore - s1 = peg$c6; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s1 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e6); } - } -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - s2 = peg$parse_(); -// @ts-ignore - s3 = peg$parseVersionRangeAtom(); -// @ts-ignore - if (s3 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s0 = peg$f4(s3); -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseAny() { -// @ts-ignore - var s0, s1; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 42) { -// @ts-ignore - s1 = peg$c7; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s1 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e7); } - } -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s1 = peg$f5(); - } -// @ts-ignore - s0 = s1; - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseNone() { -// @ts-ignore - var s0, s1; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 33) { -// @ts-ignore - s1 = peg$c6; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s1 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e6); } - } -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s1 = peg$f6(); - } -// @ts-ignore - s0 = s1; - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseCmpOp() { -// @ts-ignore - var s0, s1; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - if (input.substr(peg$currPos, 2) === peg$c8) { -// @ts-ignore - s1 = peg$c8; -// @ts-ignore - peg$currPos += 2; -// @ts-ignore - } else { -// @ts-ignore - s1 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e8); } - } -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s1 = peg$f7(); - } -// @ts-ignore - s0 = s1; -// @ts-ignore - if (s0 === peg$FAILED) { -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - if (input.substr(peg$currPos, 2) === peg$c9) { -// @ts-ignore - s1 = peg$c9; -// @ts-ignore - peg$currPos += 2; -// @ts-ignore - } else { -// @ts-ignore - s1 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e9); } - } -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s1 = peg$f8(); - } -// @ts-ignore - s0 = s1; -// @ts-ignore - if (s0 === peg$FAILED) { -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 62) { -// @ts-ignore - s1 = peg$c10; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s1 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e10); } + // @ts-ignore + if (offset && peg$source && typeof peg$source.offset === 'function') { + // @ts-ignore + res.start = peg$source.offset(res.start) + // @ts-ignore + res.end = peg$source.offset(res.end) } -// @ts-ignore + // @ts-ignore + return res + } + + // @ts-ignore + function peg$fail(expected) { + // @ts-ignore + if (peg$currPos < peg$maxFailPos) { + return + } + + // @ts-ignore + if (peg$currPos > peg$maxFailPos) { + // @ts-ignore + peg$maxFailPos = peg$currPos + // @ts-ignore + peg$maxFailExpected = [] + } + + // @ts-ignore + peg$maxFailExpected.push(expected) + } + + // @ts-ignore + function peg$buildSimpleError(message, location) { + // @ts-ignore + return new peg$SyntaxError(message, null, null, location) + } + + // @ts-ignore + function peg$buildStructuredError(expected, found, location) { + // @ts-ignore + return new peg$SyntaxError( + // @ts-ignore + peg$SyntaxError.buildMessage(expected, found), + // @ts-ignore + expected, + // @ts-ignore + found, + // @ts-ignore + location, + ) + } + + // @ts-ignore + function // @ts-ignore + peg$parseVersionRange() { + // @ts-ignore + var s0, s1, s2, s3, s4, s5, s6, s7 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + s1 = peg$parseVersionRangeAtom() + // @ts-ignore if (s1 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s1 = peg$f9(); - } -// @ts-ignore - s0 = s1; -// @ts-ignore - if (s0 === peg$FAILED) { -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 60) { -// @ts-ignore - s1 = peg$c11; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s1 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e11); } + // @ts-ignore + s2 = [] + // @ts-ignore + s3 = peg$currPos + // @ts-ignore + s4 = peg$parse_() + // @ts-ignore + s5 = peg$currPos + // @ts-ignore + s6 = peg$parseOr() + // @ts-ignore + if (s6 === peg$FAILED) { + // @ts-ignore + s6 = peg$parseAnd() } -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s1 = peg$f10(); - } -// @ts-ignore - s0 = s1; -// @ts-ignore - if (s0 === peg$FAILED) { -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 61) { -// @ts-ignore - s1 = peg$c12; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s1 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e12); } - } -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s1 = peg$f11(); - } -// @ts-ignore - s0 = s1; -// @ts-ignore - if (s0 === peg$FAILED) { -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - if (input.substr(peg$currPos, 2) === peg$c13) { -// @ts-ignore - s1 = peg$c13; -// @ts-ignore - peg$currPos += 2; -// @ts-ignore - } else { -// @ts-ignore - s1 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e13); } - } -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s1 = peg$f12(); - } -// @ts-ignore - s0 = s1; -// @ts-ignore - if (s0 === peg$FAILED) { -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 94) { -// @ts-ignore - s1 = peg$c14; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s1 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e14); } - } -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s1 = peg$f13(); - } -// @ts-ignore - s0 = s1; -// @ts-ignore - if (s0 === peg$FAILED) { -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 126) { -// @ts-ignore - s1 = peg$c15; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s1 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e15); } - } -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s1 = peg$f14(); - } -// @ts-ignore - s0 = s1; - } - } - } - } - } - } - } - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseExtendedVersion() { -// @ts-ignore - var s0, s1, s2, s3, s4; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - s1 = peg$parseFlavor(); -// @ts-ignore - if (s1 === peg$FAILED) { -// @ts-ignore - s1 = null; - } -// @ts-ignore - s2 = peg$parseVersion(); -// @ts-ignore - if (s2 !== peg$FAILED) { -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 58) { -// @ts-ignore - s3 = peg$c4; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s3 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e4); } - } -// @ts-ignore - if (s3 !== peg$FAILED) { -// @ts-ignore - s4 = peg$parseVersion(); -// @ts-ignore - if (s4 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s0 = peg$f15(s1, s2, s4); -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseEmverVersionRange() { -// @ts-ignore - var s0, s1, s2, s3, s4, s5, s6, s7; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - s1 = peg$parseEmverVersionRangeAtom(); -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - s2 = []; -// @ts-ignore - s3 = peg$currPos; -// @ts-ignore - s4 = peg$parse_(); -// @ts-ignore - s5 = peg$currPos; -// @ts-ignore - s6 = peg$parseOr(); -// @ts-ignore - if (s6 === peg$FAILED) { -// @ts-ignore - s6 = peg$parseAnd(); - } -// @ts-ignore - if (s6 !== peg$FAILED) { -// @ts-ignore - s7 = peg$parse_(); -// @ts-ignore - s6 = [s6, s7]; -// @ts-ignore - s5 = s6; -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s5; -// @ts-ignore - s5 = peg$FAILED; - } -// @ts-ignore - if (s5 === peg$FAILED) { -// @ts-ignore - s5 = null; - } -// @ts-ignore - s6 = peg$parseEmverVersionRangeAtom(); -// @ts-ignore - if (s6 !== peg$FAILED) { -// @ts-ignore - s4 = [s4, s5, s6]; -// @ts-ignore - s3 = s4; -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s3; -// @ts-ignore - s3 = peg$FAILED; - } -// @ts-ignore - while (s3 !== peg$FAILED) { -// @ts-ignore - s2.push(s3); -// @ts-ignore - s3 = peg$currPos; -// @ts-ignore - s4 = peg$parse_(); -// @ts-ignore - s5 = peg$currPos; -// @ts-ignore - s6 = peg$parseOr(); -// @ts-ignore - if (s6 === peg$FAILED) { -// @ts-ignore - s6 = peg$parseAnd(); - } -// @ts-ignore - if (s6 !== peg$FAILED) { -// @ts-ignore - s7 = peg$parse_(); -// @ts-ignore - s6 = [s6, s7]; -// @ts-ignore - s5 = s6; -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s5; -// @ts-ignore - s5 = peg$FAILED; - } -// @ts-ignore - if (s5 === peg$FAILED) { -// @ts-ignore - s5 = null; - } -// @ts-ignore - s6 = peg$parseEmverVersionRangeAtom(); -// @ts-ignore - if (s6 !== peg$FAILED) { -// @ts-ignore - s4 = [s4, s5, s6]; -// @ts-ignore - s3 = s4; -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s3; -// @ts-ignore - s3 = peg$FAILED; - } - } -// @ts-ignore - s1 = [s1, s2]; -// @ts-ignore - s0 = s1; -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseEmverVersionRangeAtom() { -// @ts-ignore - var s0; - -// @ts-ignore - s0 = peg$parseEmverParens(); -// @ts-ignore - if (s0 === peg$FAILED) { -// @ts-ignore - s0 = peg$parseEmverAnchor(); -// @ts-ignore - if (s0 === peg$FAILED) { -// @ts-ignore - s0 = peg$parseEmverNot(); -// @ts-ignore - if (s0 === peg$FAILED) { -// @ts-ignore - s0 = peg$parseAny(); -// @ts-ignore - if (s0 === peg$FAILED) { -// @ts-ignore - s0 = peg$parseNone(); - } - } - } - } - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseEmverParens() { -// @ts-ignore - var s0, s1, s2, s3, s4, s5; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 40) { -// @ts-ignore - s1 = peg$c2; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s1 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e2); } - } -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - s2 = peg$parse_(); -// @ts-ignore - s3 = peg$parseEmverVersionRange(); -// @ts-ignore - if (s3 !== peg$FAILED) { -// @ts-ignore - s4 = peg$parse_(); -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 41) { -// @ts-ignore - s5 = peg$c3; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s5 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e3); } - } -// @ts-ignore - if (s5 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s0 = peg$f16(s3); -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseEmverAnchor() { -// @ts-ignore - var s0, s1, s2, s3; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - s1 = peg$parseCmpOp(); -// @ts-ignore - if (s1 === peg$FAILED) { -// @ts-ignore - s1 = null; - } -// @ts-ignore - s2 = peg$parse_(); -// @ts-ignore - s3 = peg$parseEmver(); -// @ts-ignore - if (s3 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s0 = peg$f17(s1, s3); -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseEmverNot() { -// @ts-ignore - var s0, s1, s2, s3; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 33) { -// @ts-ignore - s1 = peg$c6; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s1 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e6); } - } -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - s2 = peg$parse_(); -// @ts-ignore - s3 = peg$parseEmverVersionRangeAtom(); -// @ts-ignore - if (s3 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s0 = peg$f18(s3); -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseEmver() { -// @ts-ignore - var s0, s1, s2, s3, s4, s5, s6, s7, s8; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - s1 = peg$parseDigit(); -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 46) { -// @ts-ignore - s2 = peg$c16; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s2 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e16); } - } -// @ts-ignore - if (s2 !== peg$FAILED) { -// @ts-ignore - s3 = peg$parseDigit(); -// @ts-ignore - if (s3 !== peg$FAILED) { -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 46) { -// @ts-ignore - s4 = peg$c16; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s4 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e16); } - } -// @ts-ignore - if (s4 !== peg$FAILED) { -// @ts-ignore - s5 = peg$parseDigit(); -// @ts-ignore - if (s5 !== peg$FAILED) { -// @ts-ignore - s6 = peg$currPos; -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 46) { -// @ts-ignore - s7 = peg$c16; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s7 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e16); } - } -// @ts-ignore - if (s7 !== peg$FAILED) { -// @ts-ignore - s8 = peg$parseDigit(); -// @ts-ignore - if (s8 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s6; -// @ts-ignore - s6 = peg$f19(s1, s3, s5, s8); -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s6; -// @ts-ignore - s6 = peg$FAILED; - } -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s6; -// @ts-ignore - s6 = peg$FAILED; - } -// @ts-ignore - if (s6 === peg$FAILED) { -// @ts-ignore - s6 = null; - } -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s0 = peg$f20(s1, s3, s5, s6); -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseFlavor() { -// @ts-ignore - var s0, s1, s2, s3; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 35) { -// @ts-ignore - s1 = peg$c5; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s1 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e5); } - } -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - s2 = peg$parseFlavorString(); -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 58) { -// @ts-ignore - s3 = peg$c4; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s3 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e4); } - } -// @ts-ignore - if (s3 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s0 = peg$f21(s2); -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseFlavorString() { -// @ts-ignore - var s0, s1, s2; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - s1 = []; -// @ts-ignore - if (peg$r0.test(input.charAt(peg$currPos))) { -// @ts-ignore - s2 = input.charAt(peg$currPos); -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s2 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e17); } - } -// @ts-ignore - while (s2 !== peg$FAILED) { -// @ts-ignore - s1.push(s2); -// @ts-ignore - if (peg$r0.test(input.charAt(peg$currPos))) { -// @ts-ignore - s2 = input.charAt(peg$currPos); -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s2 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e17); } - } - } -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s1 = peg$f22(); -// @ts-ignore - s0 = s1; - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseString() { -// @ts-ignore - var s0, s1, s2; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - s1 = []; -// @ts-ignore - if (peg$r1.test(input.charAt(peg$currPos))) { -// @ts-ignore - s2 = input.charAt(peg$currPos); -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s2 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e18); } - } -// @ts-ignore - if (s2 !== peg$FAILED) { -// @ts-ignore - while (s2 !== peg$FAILED) { -// @ts-ignore - s1.push(s2); -// @ts-ignore - if (peg$r1.test(input.charAt(peg$currPos))) { -// @ts-ignore - s2 = input.charAt(peg$currPos); -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s2 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e18); } - } - } -// @ts-ignore - } else { -// @ts-ignore - s1 = peg$FAILED; - } -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s1 = peg$f23(); - } -// @ts-ignore - s0 = s1; - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseVersion() { -// @ts-ignore - var s0, s1, s2; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - s1 = peg$parseVersionNumber(); -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - s2 = peg$parsePreRelease(); -// @ts-ignore - if (s2 === peg$FAILED) { -// @ts-ignore - s2 = null; - } -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s0 = peg$f24(s1, s2); -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parsePreRelease() { -// @ts-ignore - var s0, s1, s2, s3, s4, s5, s6; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 45) { -// @ts-ignore - s1 = peg$c17; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s1 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e19); } - } -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - s2 = peg$parsePreReleaseSegment(); -// @ts-ignore - if (s2 !== peg$FAILED) { -// @ts-ignore - s3 = []; -// @ts-ignore - s4 = peg$currPos; -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 46) { -// @ts-ignore - s5 = peg$c16; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s5 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e16); } - } -// @ts-ignore - if (s5 !== peg$FAILED) { -// @ts-ignore - s6 = peg$parsePreReleaseSegment(); -// @ts-ignore + // @ts-ignore if (s6 !== peg$FAILED) { -// @ts-ignore - s5 = [s5, s6]; -// @ts-ignore - s4 = s5; -// @ts-ignore + // @ts-ignore + s7 = peg$parse_() + // @ts-ignore + s6 = [s6, s7] + // @ts-ignore + s5 = s6 + // @ts-ignore } else { -// @ts-ignore - peg$currPos = s4; -// @ts-ignore - s4 = peg$FAILED; + // @ts-ignore + peg$currPos = s5 + // @ts-ignore + s5 = peg$FAILED } -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s4; -// @ts-ignore - s4 = peg$FAILED; - } -// @ts-ignore - while (s4 !== peg$FAILED) { -// @ts-ignore - s3.push(s4); -// @ts-ignore - s4 = peg$currPos; -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 46) { -// @ts-ignore - s5 = peg$c16; -// @ts-ignore - peg$currPos++; -// @ts-ignore + // @ts-ignore + if (s5 === peg$FAILED) { + // @ts-ignore + s5 = null + } + // @ts-ignore + s6 = peg$parseVersionRangeAtom() + // @ts-ignore + if (s6 !== peg$FAILED) { + // @ts-ignore + s4 = [s4, s5, s6] + // @ts-ignore + s3 = s4 + // @ts-ignore } else { -// @ts-ignore - s5 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e16); } + // @ts-ignore + peg$currPos = s3 + // @ts-ignore + s3 = peg$FAILED } -// @ts-ignore - if (s5 !== peg$FAILED) { -// @ts-ignore - s6 = peg$parsePreReleaseSegment(); -// @ts-ignore - if (s6 !== peg$FAILED) { -// @ts-ignore - s5 = [s5, s6]; -// @ts-ignore - s4 = s5; -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s4; -// @ts-ignore - s4 = peg$FAILED; + // @ts-ignore + while (s3 !== peg$FAILED) { + // @ts-ignore + s2.push(s3) + // @ts-ignore + s3 = peg$currPos + // @ts-ignore + s4 = peg$parse_() + // @ts-ignore + s5 = peg$currPos + // @ts-ignore + s6 = peg$parseOr() + // @ts-ignore + if (s6 === peg$FAILED) { + // @ts-ignore + s6 = peg$parseAnd() } -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s4; -// @ts-ignore - s4 = peg$FAILED; + // @ts-ignore + if (s6 !== peg$FAILED) { + // @ts-ignore + s7 = peg$parse_() + // @ts-ignore + s6 = [s6, s7] + // @ts-ignore + s5 = s6 + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s5 + // @ts-ignore + s5 = peg$FAILED + } + // @ts-ignore + if (s5 === peg$FAILED) { + // @ts-ignore + s5 = null + } + // @ts-ignore + s6 = peg$parseVersionRangeAtom() + // @ts-ignore + if (s6 !== peg$FAILED) { + // @ts-ignore + s4 = [s4, s5, s6] + // @ts-ignore + s3 = s4 + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s3 + // @ts-ignore + s3 = peg$FAILED + } + } + // @ts-ignore + s1 = [s1, s2] + // @ts-ignore + s0 = s1 + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parseOr() { + // @ts-ignore + var s0 + + // @ts-ignore + if (input.substr(peg$currPos, 2) === peg$c0) { + // @ts-ignore + s0 = peg$c0 + // @ts-ignore + peg$currPos += 2 + // @ts-ignore + } else { + // @ts-ignore + s0 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e0) } } -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s0 = peg$f25(s2, s3); -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; + + // @ts-ignore + return s0 } -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } -// @ts-ignore - return s0; - } + // @ts-ignore + function // @ts-ignore + peg$parseAnd() { + // @ts-ignore + var s0 -// @ts-ignore - function // @ts-ignore -peg$parsePreReleaseSegment() { -// @ts-ignore - var s0, s1, s2; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 46) { -// @ts-ignore - s1 = peg$c16; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s1 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e16); } - } -// @ts-ignore - if (s1 === peg$FAILED) { -// @ts-ignore - s1 = null; - } -// @ts-ignore - s2 = peg$parseDigit(); -// @ts-ignore - if (s2 === peg$FAILED) { -// @ts-ignore - s2 = peg$parseString(); - } -// @ts-ignore - if (s2 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s0 = peg$f26(s2); -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } - -// @ts-ignore - return s0; - } - -// @ts-ignore - function // @ts-ignore -peg$parseVersionNumber() { -// @ts-ignore - var s0, s1, s2, s3, s4, s5; - -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - s1 = peg$parseDigit(); -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - s2 = []; -// @ts-ignore - s3 = peg$currPos; -// @ts-ignore - if (input.charCodeAt(peg$currPos) === 46) { -// @ts-ignore - s4 = peg$c16; -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s4 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e16); } - } -// @ts-ignore - if (s4 !== peg$FAILED) { -// @ts-ignore - s5 = peg$parseDigit(); -// @ts-ignore - if (s5 !== peg$FAILED) { -// @ts-ignore - s4 = [s4, s5]; -// @ts-ignore - s3 = s4; -// @ts-ignore + // @ts-ignore + if (input.substr(peg$currPos, 2) === peg$c1) { + // @ts-ignore + s0 = peg$c1 + // @ts-ignore + peg$currPos += 2 + // @ts-ignore } else { -// @ts-ignore - peg$currPos = s3; -// @ts-ignore - s3 = peg$FAILED; + // @ts-ignore + s0 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e1) + } } -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s3; -// @ts-ignore - s3 = peg$FAILED; + + // @ts-ignore + return s0 } -// @ts-ignore - while (s3 !== peg$FAILED) { -// @ts-ignore - s2.push(s3); -// @ts-ignore - s3 = peg$currPos; -// @ts-ignore + + // @ts-ignore + function // @ts-ignore + peg$parseVersionRangeAtom() { + // @ts-ignore + var s0 + + // @ts-ignore + s0 = peg$parseParens() + // @ts-ignore + if (s0 === peg$FAILED) { + // @ts-ignore + s0 = peg$parseAnchor() + // @ts-ignore + if (s0 === peg$FAILED) { + // @ts-ignore + s0 = peg$parseNot() + // @ts-ignore + if (s0 === peg$FAILED) { + // @ts-ignore + s0 = peg$parseAny() + // @ts-ignore + if (s0 === peg$FAILED) { + // @ts-ignore + s0 = peg$parseNone() + // @ts-ignore + if (s0 === peg$FAILED) { + // @ts-ignore + s0 = peg$parseFlavorAtom() + } + } + } + } + } + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parseParens() { + // @ts-ignore + var s0, s1, s2, s3, s4, s5 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 40) { + // @ts-ignore + s1 = peg$c2 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s1 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e2) + } + } + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + s2 = peg$parse_() + // @ts-ignore + s3 = peg$parseVersionRange() + // @ts-ignore + if (s3 !== peg$FAILED) { + // @ts-ignore + s4 = peg$parse_() + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 41) { + // @ts-ignore + s5 = peg$c3 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s5 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e3) + } + } + // @ts-ignore + if (s5 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s0 = peg$f0(s3) + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parseAnchor() { + // @ts-ignore + var s0, s1, s2, s3 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + s1 = peg$parseCmpOp() + // @ts-ignore + if (s1 === peg$FAILED) { + // @ts-ignore + s1 = null + } + // @ts-ignore + s2 = peg$parse_() + // @ts-ignore + s3 = peg$parseVersionSpec() + // @ts-ignore + if (s3 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s0 = peg$f1(s1, s3) + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parseVersionSpec() { + // @ts-ignore + var s0, s1, s2, s3, s4, s5 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + s1 = peg$parseFlavor() + // @ts-ignore + if (s1 === peg$FAILED) { + // @ts-ignore + s1 = null + } + // @ts-ignore + s2 = peg$parseVersion() + // @ts-ignore + if (s2 !== peg$FAILED) { + // @ts-ignore + s3 = peg$currPos + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 58) { + // @ts-ignore + s4 = peg$c4 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s4 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e4) + } + } + // @ts-ignore + if (s4 !== peg$FAILED) { + // @ts-ignore + s5 = peg$parseVersion() + // @ts-ignore + if (s5 !== peg$FAILED) { + // @ts-ignore + s4 = [s4, s5] + // @ts-ignore + s3 = s4 + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s3 + // @ts-ignore + s3 = peg$FAILED + } + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s3 + // @ts-ignore + s3 = peg$FAILED + } + // @ts-ignore + if (s3 === peg$FAILED) { + // @ts-ignore + s3 = null + } + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s0 = peg$f2(s1, s2, s3) + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parseFlavorAtom() { + // @ts-ignore + var s0, s1, s2 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 35) { + // @ts-ignore + s1 = peg$c5 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s1 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e5) + } + } + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + s2 = peg$parseFlavorString() + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s0 = peg$f3(s2) + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parseNot() { + // @ts-ignore + var s0, s1, s2, s3 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 33) { + // @ts-ignore + s1 = peg$c6 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s1 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e6) + } + } + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + s2 = peg$parse_() + // @ts-ignore + s3 = peg$parseVersionRangeAtom() + // @ts-ignore + if (s3 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s0 = peg$f4(s3) + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parseAny() { + // @ts-ignore + var s0, s1 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 42) { + // @ts-ignore + s1 = peg$c7 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s1 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e7) + } + } + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s1 = peg$f5() + } + // @ts-ignore + s0 = s1 + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parseNone() { + // @ts-ignore + var s0, s1 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 33) { + // @ts-ignore + s1 = peg$c6 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s1 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e6) + } + } + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s1 = peg$f6() + } + // @ts-ignore + s0 = s1 + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parseCmpOp() { + // @ts-ignore + var s0, s1 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + if (input.substr(peg$currPos, 2) === peg$c8) { + // @ts-ignore + s1 = peg$c8 + // @ts-ignore + peg$currPos += 2 + // @ts-ignore + } else { + // @ts-ignore + s1 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e8) + } + } + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s1 = peg$f7() + } + // @ts-ignore + s0 = s1 + // @ts-ignore + if (s0 === peg$FAILED) { + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + if (input.substr(peg$currPos, 2) === peg$c9) { + // @ts-ignore + s1 = peg$c9 + // @ts-ignore + peg$currPos += 2 + // @ts-ignore + } else { + // @ts-ignore + s1 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e9) + } + } + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s1 = peg$f8() + } + // @ts-ignore + s0 = s1 + // @ts-ignore + if (s0 === peg$FAILED) { + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 62) { + // @ts-ignore + s1 = peg$c10 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s1 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e10) + } + } + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s1 = peg$f9() + } + // @ts-ignore + s0 = s1 + // @ts-ignore + if (s0 === peg$FAILED) { + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 60) { + // @ts-ignore + s1 = peg$c11 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s1 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e11) + } + } + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s1 = peg$f10() + } + // @ts-ignore + s0 = s1 + // @ts-ignore + if (s0 === peg$FAILED) { + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 61) { + // @ts-ignore + s1 = peg$c12 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s1 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e12) + } + } + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s1 = peg$f11() + } + // @ts-ignore + s0 = s1 + // @ts-ignore + if (s0 === peg$FAILED) { + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + if (input.substr(peg$currPos, 2) === peg$c13) { + // @ts-ignore + s1 = peg$c13 + // @ts-ignore + peg$currPos += 2 + // @ts-ignore + } else { + // @ts-ignore + s1 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e13) + } + } + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s1 = peg$f12() + } + // @ts-ignore + s0 = s1 + // @ts-ignore + if (s0 === peg$FAILED) { + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 94) { + // @ts-ignore + s1 = peg$c14 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s1 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e14) + } + } + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s1 = peg$f13() + } + // @ts-ignore + s0 = s1 + // @ts-ignore + if (s0 === peg$FAILED) { + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 126) { + // @ts-ignore + s1 = peg$c15 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s1 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e15) + } + } + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s1 = peg$f14() + } + // @ts-ignore + s0 = s1 + } + } + } + } + } + } + } + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parseExtendedVersion() { + // @ts-ignore + var s0, s1, s2, s3, s4 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + s1 = peg$parseFlavor() + // @ts-ignore + if (s1 === peg$FAILED) { + // @ts-ignore + s1 = null + } + // @ts-ignore + s2 = peg$parseVersion() + // @ts-ignore + if (s2 !== peg$FAILED) { + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 58) { + // @ts-ignore + s3 = peg$c4 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s3 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e4) + } + } + // @ts-ignore + if (s3 !== peg$FAILED) { + // @ts-ignore + s4 = peg$parseVersion() + // @ts-ignore + if (s4 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s0 = peg$f15(s1, s2, s4) + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parseEmverVersionRange() { + // @ts-ignore + var s0, s1, s2, s3, s4, s5, s6, s7 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + s1 = peg$parseEmverVersionRangeAtom() + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + s2 = [] + // @ts-ignore + s3 = peg$currPos + // @ts-ignore + s4 = peg$parse_() + // @ts-ignore + s5 = peg$currPos + // @ts-ignore + s6 = peg$parseOr() + // @ts-ignore + if (s6 === peg$FAILED) { + // @ts-ignore + s6 = peg$parseAnd() + } + // @ts-ignore + if (s6 !== peg$FAILED) { + // @ts-ignore + s7 = peg$parse_() + // @ts-ignore + s6 = [s6, s7] + // @ts-ignore + s5 = s6 + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s5 + // @ts-ignore + s5 = peg$FAILED + } + // @ts-ignore + if (s5 === peg$FAILED) { + // @ts-ignore + s5 = null + } + // @ts-ignore + s6 = peg$parseEmverVersionRangeAtom() + // @ts-ignore + if (s6 !== peg$FAILED) { + // @ts-ignore + s4 = [s4, s5, s6] + // @ts-ignore + s3 = s4 + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s3 + // @ts-ignore + s3 = peg$FAILED + } + // @ts-ignore + while (s3 !== peg$FAILED) { + // @ts-ignore + s2.push(s3) + // @ts-ignore + s3 = peg$currPos + // @ts-ignore + s4 = peg$parse_() + // @ts-ignore + s5 = peg$currPos + // @ts-ignore + s6 = peg$parseOr() + // @ts-ignore + if (s6 === peg$FAILED) { + // @ts-ignore + s6 = peg$parseAnd() + } + // @ts-ignore + if (s6 !== peg$FAILED) { + // @ts-ignore + s7 = peg$parse_() + // @ts-ignore + s6 = [s6, s7] + // @ts-ignore + s5 = s6 + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s5 + // @ts-ignore + s5 = peg$FAILED + } + // @ts-ignore + if (s5 === peg$FAILED) { + // @ts-ignore + s5 = null + } + // @ts-ignore + s6 = peg$parseEmverVersionRangeAtom() + // @ts-ignore + if (s6 !== peg$FAILED) { + // @ts-ignore + s4 = [s4, s5, s6] + // @ts-ignore + s3 = s4 + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s3 + // @ts-ignore + s3 = peg$FAILED + } + } + // @ts-ignore + s1 = [s1, s2] + // @ts-ignore + s0 = s1 + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parseEmverVersionRangeAtom() { + // @ts-ignore + var s0 + + // @ts-ignore + s0 = peg$parseEmverParens() + // @ts-ignore + if (s0 === peg$FAILED) { + // @ts-ignore + s0 = peg$parseEmverAnchor() + // @ts-ignore + if (s0 === peg$FAILED) { + // @ts-ignore + s0 = peg$parseEmverNot() + // @ts-ignore + if (s0 === peg$FAILED) { + // @ts-ignore + s0 = peg$parseAny() + // @ts-ignore + if (s0 === peg$FAILED) { + // @ts-ignore + s0 = peg$parseNone() + } + } + } + } + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parseEmverParens() { + // @ts-ignore + var s0, s1, s2, s3, s4, s5 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 40) { + // @ts-ignore + s1 = peg$c2 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s1 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e2) + } + } + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + s2 = peg$parse_() + // @ts-ignore + s3 = peg$parseEmverVersionRange() + // @ts-ignore + if (s3 !== peg$FAILED) { + // @ts-ignore + s4 = peg$parse_() + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 41) { + // @ts-ignore + s5 = peg$c3 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s5 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e3) + } + } + // @ts-ignore + if (s5 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s0 = peg$f16(s3) + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parseEmverAnchor() { + // @ts-ignore + var s0, s1, s2, s3 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + s1 = peg$parseCmpOp() + // @ts-ignore + if (s1 === peg$FAILED) { + // @ts-ignore + s1 = null + } + // @ts-ignore + s2 = peg$parse_() + // @ts-ignore + s3 = peg$parseEmver() + // @ts-ignore + if (s3 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s0 = peg$f17(s1, s3) + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parseEmverNot() { + // @ts-ignore + var s0, s1, s2, s3 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 33) { + // @ts-ignore + s1 = peg$c6 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s1 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e6) + } + } + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + s2 = peg$parse_() + // @ts-ignore + s3 = peg$parseEmverVersionRangeAtom() + // @ts-ignore + if (s3 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s0 = peg$f18(s3) + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parseEmver() { + // @ts-ignore + var s0, s1, s2, s3, s4, s5, s6, s7, s8 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + s1 = peg$parseDigit() + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 46) { + // @ts-ignore + s2 = peg$c16 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s2 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e16) + } + } + // @ts-ignore + if (s2 !== peg$FAILED) { + // @ts-ignore + s3 = peg$parseDigit() + // @ts-ignore + if (s3 !== peg$FAILED) { + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 46) { + // @ts-ignore + s4 = peg$c16 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s4 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e16) + } + } + // @ts-ignore + if (s4 !== peg$FAILED) { + // @ts-ignore + s5 = peg$parseDigit() + // @ts-ignore + if (s5 !== peg$FAILED) { + // @ts-ignore + s6 = peg$currPos + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 46) { + // @ts-ignore + s7 = peg$c16 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s7 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e16) + } + } + // @ts-ignore + if (s7 !== peg$FAILED) { + // @ts-ignore + s8 = peg$parseDigit() + // @ts-ignore + if (s8 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s6 + // @ts-ignore + s6 = peg$f19(s1, s3, s5, s8) + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s6 + // @ts-ignore + s6 = peg$FAILED + } + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s6 + // @ts-ignore + s6 = peg$FAILED + } + // @ts-ignore + if (s6 === peg$FAILED) { + // @ts-ignore + s6 = null + } + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s0 = peg$f20(s1, s3, s5, s6) + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parseFlavor() { + // @ts-ignore + var s0, s1, s2, s3 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 35) { + // @ts-ignore + s1 = peg$c5 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s1 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e5) + } + } + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + s2 = peg$parseFlavorString() + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 58) { + // @ts-ignore + s3 = peg$c4 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s3 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e4) + } + } + // @ts-ignore + if (s3 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s0 = peg$f21(s2) + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parseFlavorString() { + // @ts-ignore + var s0, s1, s2 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + s1 = [] + // @ts-ignore + if (peg$r0.test(input.charAt(peg$currPos))) { + // @ts-ignore + s2 = input.charAt(peg$currPos) + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s2 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e17) + } + } + // @ts-ignore + while (s2 !== peg$FAILED) { + // @ts-ignore + s1.push(s2) + // @ts-ignore + if (peg$r0.test(input.charAt(peg$currPos))) { + // @ts-ignore + s2 = input.charAt(peg$currPos) + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s2 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e17) + } + } + } + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s1 = peg$f22() + // @ts-ignore + s0 = s1 + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parseString() { + // @ts-ignore + var s0, s1, s2 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + s1 = [] + // @ts-ignore + if (peg$r1.test(input.charAt(peg$currPos))) { + // @ts-ignore + s2 = input.charAt(peg$currPos) + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s2 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e18) + } + } + // @ts-ignore + if (s2 !== peg$FAILED) { + // @ts-ignore + while (s2 !== peg$FAILED) { + // @ts-ignore + s1.push(s2) + // @ts-ignore + if (peg$r1.test(input.charAt(peg$currPos))) { + // @ts-ignore + s2 = input.charAt(peg$currPos) + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s2 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e18) + } + } + } + // @ts-ignore + } else { + // @ts-ignore + s1 = peg$FAILED + } + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s1 = peg$f23() + } + // @ts-ignore + s0 = s1 + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parseVersion() { + // @ts-ignore + var s0, s1, s2 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + s1 = peg$parseVersionNumber() + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + s2 = peg$parsePreRelease() + // @ts-ignore + if (s2 === peg$FAILED) { + // @ts-ignore + s2 = null + } + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s0 = peg$f24(s1, s2) + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parsePreRelease() { + // @ts-ignore + var s0, s1, s2, s3, s4, s5, s6 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 45) { + // @ts-ignore + s1 = peg$c17 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s1 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e19) + } + } + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + s2 = peg$parsePreReleaseSegment() + // @ts-ignore + if (s2 !== peg$FAILED) { + // @ts-ignore + s3 = [] + // @ts-ignore + s4 = peg$currPos + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 46) { + // @ts-ignore + s5 = peg$c16 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s5 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e16) + } + } + // @ts-ignore + if (s5 !== peg$FAILED) { + // @ts-ignore + s6 = peg$parsePreReleaseSegment() + // @ts-ignore + if (s6 !== peg$FAILED) { + // @ts-ignore + s5 = [s5, s6] + // @ts-ignore + s4 = s5 + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s4 + // @ts-ignore + s4 = peg$FAILED + } + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s4 + // @ts-ignore + s4 = peg$FAILED + } + // @ts-ignore + while (s4 !== peg$FAILED) { + // @ts-ignore + s3.push(s4) + // @ts-ignore + s4 = peg$currPos + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 46) { + // @ts-ignore + s5 = peg$c16 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s5 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e16) + } + } + // @ts-ignore + if (s5 !== peg$FAILED) { + // @ts-ignore + s6 = peg$parsePreReleaseSegment() + // @ts-ignore + if (s6 !== peg$FAILED) { + // @ts-ignore + s5 = [s5, s6] + // @ts-ignore + s4 = s5 + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s4 + // @ts-ignore + s4 = peg$FAILED + } + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s4 + // @ts-ignore + s4 = peg$FAILED + } + } + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s0 = peg$f25(s2, s3) + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parsePreReleaseSegment() { + // @ts-ignore + var s0, s1, s2 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore if (input.charCodeAt(peg$currPos) === 46) { -// @ts-ignore - s4 = peg$c16; -// @ts-ignore - peg$currPos++; -// @ts-ignore + // @ts-ignore + s1 = peg$c16 + // @ts-ignore + peg$currPos++ + // @ts-ignore } else { -// @ts-ignore - s4 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e16); } - } -// @ts-ignore - if (s4 !== peg$FAILED) { -// @ts-ignore - s5 = peg$parseDigit(); -// @ts-ignore - if (s5 !== peg$FAILED) { -// @ts-ignore - s4 = [s4, s5]; -// @ts-ignore - s3 = s4; -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s3; -// @ts-ignore - s3 = peg$FAILED; + // @ts-ignore + s1 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e16) } -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s3; -// @ts-ignore - s3 = peg$FAILED; } + // @ts-ignore + if (s1 === peg$FAILED) { + // @ts-ignore + s1 = null + } + // @ts-ignore + s2 = peg$parseDigit() + // @ts-ignore + if (s2 === peg$FAILED) { + // @ts-ignore + s2 = peg$parseString() + } + // @ts-ignore + if (s2 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s0 = peg$f26(s2) + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } + + // @ts-ignore + return s0 } -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s0 = peg$f27(s1, s2); -// @ts-ignore - } else { -// @ts-ignore - peg$currPos = s0; -// @ts-ignore - s0 = peg$FAILED; - } -// @ts-ignore - return s0; - } + // @ts-ignore + function // @ts-ignore + peg$parseVersionNumber() { + // @ts-ignore + var s0, s1, s2, s3, s4, s5 -// @ts-ignore - function // @ts-ignore -peg$parseDigit() { -// @ts-ignore - var s0, s1, s2; + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + s1 = peg$parseDigit() + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + s2 = [] + // @ts-ignore + s3 = peg$currPos + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 46) { + // @ts-ignore + s4 = peg$c16 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s4 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e16) + } + } + // @ts-ignore + if (s4 !== peg$FAILED) { + // @ts-ignore + s5 = peg$parseDigit() + // @ts-ignore + if (s5 !== peg$FAILED) { + // @ts-ignore + s4 = [s4, s5] + // @ts-ignore + s3 = s4 + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s3 + // @ts-ignore + s3 = peg$FAILED + } + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s3 + // @ts-ignore + s3 = peg$FAILED + } + // @ts-ignore + while (s3 !== peg$FAILED) { + // @ts-ignore + s2.push(s3) + // @ts-ignore + s3 = peg$currPos + // @ts-ignore + if (input.charCodeAt(peg$currPos) === 46) { + // @ts-ignore + s4 = peg$c16 + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s4 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e16) + } + } + // @ts-ignore + if (s4 !== peg$FAILED) { + // @ts-ignore + s5 = peg$parseDigit() + // @ts-ignore + if (s5 !== peg$FAILED) { + // @ts-ignore + s4 = [s4, s5] + // @ts-ignore + s3 = s4 + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s3 + // @ts-ignore + s3 = peg$FAILED + } + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s3 + // @ts-ignore + s3 = peg$FAILED + } + } + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s0 = peg$f27(s1, s2) + // @ts-ignore + } else { + // @ts-ignore + peg$currPos = s0 + // @ts-ignore + s0 = peg$FAILED + } -// @ts-ignore - s0 = peg$currPos; -// @ts-ignore - s1 = []; -// @ts-ignore - if (peg$r2.test(input.charAt(peg$currPos))) { -// @ts-ignore - s2 = input.charAt(peg$currPos); -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s2 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e20); } - } -// @ts-ignore - if (s2 !== peg$FAILED) { -// @ts-ignore - while (s2 !== peg$FAILED) { -// @ts-ignore - s1.push(s2); -// @ts-ignore + // @ts-ignore + return s0 + } + + // @ts-ignore + function // @ts-ignore + peg$parseDigit() { + // @ts-ignore + var s0, s1, s2 + + // @ts-ignore + s0 = peg$currPos + // @ts-ignore + s1 = [] + // @ts-ignore if (peg$r2.test(input.charAt(peg$currPos))) { -// @ts-ignore - s2 = input.charAt(peg$currPos); -// @ts-ignore - peg$currPos++; -// @ts-ignore + // @ts-ignore + s2 = input.charAt(peg$currPos) + // @ts-ignore + peg$currPos++ + // @ts-ignore } else { -// @ts-ignore - s2 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e20); } + // @ts-ignore + s2 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e20) + } } + // @ts-ignore + if (s2 !== peg$FAILED) { + // @ts-ignore + while (s2 !== peg$FAILED) { + // @ts-ignore + s1.push(s2) + // @ts-ignore + if (peg$r2.test(input.charAt(peg$currPos))) { + // @ts-ignore + s2 = input.charAt(peg$currPos) + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s2 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e20) + } + } + } + // @ts-ignore + } else { + // @ts-ignore + s1 = peg$FAILED + } + // @ts-ignore + if (s1 !== peg$FAILED) { + // @ts-ignore + peg$savedPos = s0 + // @ts-ignore + s1 = peg$f28() + } + // @ts-ignore + s0 = s1 + + // @ts-ignore + return s0 } -// @ts-ignore - } else { -// @ts-ignore - s1 = peg$FAILED; - } -// @ts-ignore - if (s1 !== peg$FAILED) { -// @ts-ignore - peg$savedPos = s0; -// @ts-ignore - s1 = peg$f28(); - } -// @ts-ignore - s0 = s1; -// @ts-ignore - return s0; - } + // @ts-ignore + function // @ts-ignore + peg$parse_() { + // @ts-ignore + var s0, s1 -// @ts-ignore - function // @ts-ignore -peg$parse_() { -// @ts-ignore - var s0, s1; + // @ts-ignore + peg$silentFails++ + // @ts-ignore + s0 = [] + // @ts-ignore + if (peg$r3.test(input.charAt(peg$currPos))) { + // @ts-ignore + s1 = input.charAt(peg$currPos) + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s1 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e22) + } + } + // @ts-ignore + while (s1 !== peg$FAILED) { + // @ts-ignore + s0.push(s1) + // @ts-ignore + if (peg$r3.test(input.charAt(peg$currPos))) { + // @ts-ignore + s1 = input.charAt(peg$currPos) + // @ts-ignore + peg$currPos++ + // @ts-ignore + } else { + // @ts-ignore + s1 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e22) + } + } + } + // @ts-ignore + peg$silentFails-- + // @ts-ignore + s1 = peg$FAILED + // @ts-ignore + if (peg$silentFails === 0) { + peg$fail(peg$e21) + } -// @ts-ignore - peg$silentFails++; -// @ts-ignore - s0 = []; -// @ts-ignore - if (peg$r3.test(input.charAt(peg$currPos))) { -// @ts-ignore - s1 = input.charAt(peg$currPos); -// @ts-ignore - peg$currPos++; -// @ts-ignore - } else { -// @ts-ignore - s1 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e22); } - } -// @ts-ignore - while (s1 !== peg$FAILED) { -// @ts-ignore - s0.push(s1); -// @ts-ignore - if (peg$r3.test(input.charAt(peg$currPos))) { -// @ts-ignore - s1 = input.charAt(peg$currPos); -// @ts-ignore - peg$currPos++; -// @ts-ignore + // @ts-ignore + return s0 + } + + // @ts-ignore + peg$result = peg$startRuleFunction() + + // @ts-ignore + if (peg$result !== peg$FAILED && peg$currPos === input.length) { + // @ts-ignore + return peg$result + // @ts-ignore } else { -// @ts-ignore - s1 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e22); } + // @ts-ignore + if (peg$result !== peg$FAILED && peg$currPos < input.length) { + // @ts-ignore + peg$fail(peg$endExpectation()) + } + + // @ts-ignore + throw peg$buildStructuredError( + // @ts-ignore + peg$maxFailExpected, + // @ts-ignore + peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, + // @ts-ignore + peg$maxFailPos < input.length + ? // @ts-ignore + peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) + : // @ts-ignore + peg$computeLocation(peg$maxFailPos, peg$maxFailPos), + ) } } -// @ts-ignore - peg$silentFails--; -// @ts-ignore - s1 = peg$FAILED; -// @ts-ignore - if (peg$silentFails === 0) { peg$fail(peg$e21); } -// @ts-ignore - return s0; - } - -// @ts-ignore - peg$result = peg$startRuleFunction(); - -// @ts-ignore - if (peg$result !== peg$FAILED && peg$currPos === input.length) { -// @ts-ignore - return peg$result; -// @ts-ignore - } else { -// @ts-ignore - if (peg$result !== peg$FAILED && peg$currPos < input.length) { -// @ts-ignore - peg$fail(peg$endExpectation()); + // @ts-ignore + return { + SyntaxError: peg$SyntaxError, + parse: peg$parse, } - -// @ts-ignore - throw peg$buildStructuredError( -// @ts-ignore - peg$maxFailExpected, -// @ts-ignore - peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, -// @ts-ignore - peg$maxFailPos < input.length -// @ts-ignore - ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) -// @ts-ignore - : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) - ); - } -} - -// @ts-ignore - return { - SyntaxError: peg$SyntaxError, - parse: peg$parse - }; -})() + })() export interface FilePosition { - offset: number; - line: number; - column: number; + offset: number + line: number + column: number } export interface FileRange { - start: FilePosition; - end: FilePosition; - source: string; + start: FilePosition + end: FilePosition + source: string } export interface LiteralExpectation { - type: "literal"; - text: string; - ignoreCase: boolean; + type: 'literal' + text: string + ignoreCase: boolean } export interface ClassParts extends Array {} export interface ClassExpectation { - type: "class"; - parts: ClassParts; - inverted: boolean; - ignoreCase: boolean; + type: 'class' + parts: ClassParts + inverted: boolean + ignoreCase: boolean } export interface AnyExpectation { - type: "any"; + type: 'any' } export interface EndExpectation { - type: "end"; + type: 'end' } export interface OtherExpectation { - type: "other"; - description: string; + type: 'other' + description: string } -export type Expectation = LiteralExpectation | ClassExpectation | AnyExpectation | EndExpectation | OtherExpectation; +export type Expectation = + | LiteralExpectation + | ClassExpectation + | AnyExpectation + | EndExpectation + | OtherExpectation declare class _PeggySyntaxError extends Error { - public static buildMessage(expected: Expectation[], found: string | null): string; - public message: string; - public expected: Expectation[]; - public found: string | null; - public location: FileRange; - public name: string; - constructor(message: string, expected: Expectation[], found: string | null, location: FileRange); - format(sources: { - source?: any; - text: string; - }[]): string; + public static buildMessage( + expected: Expectation[], + found: string | null, + ): string + public message: string + public expected: Expectation[] + public found: string | null + public location: FileRange + public name: string + constructor( + message: string, + expected: Expectation[], + found: string | null, + location: FileRange, + ) + format( + sources: { + source?: any + text: string + }[], + ): string } export interface TraceEvent { - type: string; - rule: string; - result?: any; - location: FileRange; - } + type: string + rule: string + result?: any + location: FileRange +} declare class _DefaultTracer { - private indentLevel: number; - public trace(event: TraceEvent): void; + private indentLevel: number + public trace(event: TraceEvent): void } -peggyParser.SyntaxError.prototype.name = "PeggySyntaxError"; +peggyParser.SyntaxError.prototype.name = 'PeggySyntaxError' export interface ParseOptions { - filename?: string; - startRule?: "VersionRange" | "Or" | "And" | "VersionRangeAtom" | "Parens" | "Anchor" | "VersionSpec" | "FlavorAtom" | "Not" | "Any" | "None" | "CmpOp" | "ExtendedVersion" | "EmverVersionRange" | "EmverVersionRangeAtom" | "EmverParens" | "EmverAnchor" | "EmverNot" | "Emver" | "Flavor" | "FlavorString" | "String" | "Version" | "PreRelease" | "PreReleaseSegment" | "VersionNumber" | "Digit" | "_"; - tracer?: any; - [key: string]: any; + filename?: string + startRule?: + | 'VersionRange' + | 'Or' + | 'And' + | 'VersionRangeAtom' + | 'Parens' + | 'Anchor' + | 'VersionSpec' + | 'FlavorAtom' + | 'Not' + | 'Any' + | 'None' + | 'CmpOp' + | 'ExtendedVersion' + | 'EmverVersionRange' + | 'EmverVersionRangeAtom' + | 'EmverParens' + | 'EmverAnchor' + | 'EmverNot' + | 'Emver' + | 'Flavor' + | 'FlavorString' + | 'String' + | 'Version' + | 'PreRelease' + | 'PreReleaseSegment' + | 'VersionNumber' + | 'Digit' + | '_' + tracer?: any + [key: string]: any } export type ParseFunction = ( - input: string, - options?: Options - ) => Options extends { startRule: infer StartRule } ? - StartRule extends "VersionRange" ? VersionRange : - StartRule extends "Or" ? Or : - StartRule extends "And" ? And : - StartRule extends "VersionRangeAtom" ? VersionRangeAtom : - StartRule extends "Parens" ? Parens : - StartRule extends "Anchor" ? Anchor : - StartRule extends "VersionSpec" ? VersionSpec : - StartRule extends "FlavorAtom" ? FlavorAtom : - StartRule extends "Not" ? Not : - StartRule extends "Any" ? Any : - StartRule extends "None" ? None : - StartRule extends "CmpOp" ? CmpOp : - StartRule extends "ExtendedVersion" ? ExtendedVersion : - StartRule extends "EmverVersionRange" ? EmverVersionRange : - StartRule extends "EmverVersionRangeAtom" ? EmverVersionRangeAtom : - StartRule extends "EmverParens" ? EmverParens : - StartRule extends "EmverAnchor" ? EmverAnchor : - StartRule extends "EmverNot" ? EmverNot : - StartRule extends "Emver" ? Emver : - StartRule extends "Flavor" ? Flavor : - StartRule extends "FlavorString" ? FlavorString : - StartRule extends "String" ? String_1 : - StartRule extends "Version" ? Version : - StartRule extends "PreRelease" ? PreRelease : - StartRule extends "PreReleaseSegment" ? PreReleaseSegment : - StartRule extends "VersionNumber" ? VersionNumber : - StartRule extends "Digit" ? Digit : - StartRule extends "_" ? _ : VersionRange - : VersionRange; -export const parse: ParseFunction = peggyParser.parse; + input: string, + options?: Options, +) => Options extends { startRule: infer StartRule } + ? StartRule extends 'VersionRange' + ? VersionRange + : StartRule extends 'Or' + ? Or + : StartRule extends 'And' + ? And + : StartRule extends 'VersionRangeAtom' + ? VersionRangeAtom + : StartRule extends 'Parens' + ? Parens + : StartRule extends 'Anchor' + ? Anchor + : StartRule extends 'VersionSpec' + ? VersionSpec + : StartRule extends 'FlavorAtom' + ? FlavorAtom + : StartRule extends 'Not' + ? Not + : StartRule extends 'Any' + ? Any + : StartRule extends 'None' + ? None + : StartRule extends 'CmpOp' + ? CmpOp + : StartRule extends 'ExtendedVersion' + ? ExtendedVersion + : StartRule extends 'EmverVersionRange' + ? EmverVersionRange + : StartRule extends 'EmverVersionRangeAtom' + ? EmverVersionRangeAtom + : StartRule extends 'EmverParens' + ? EmverParens + : StartRule extends 'EmverAnchor' + ? EmverAnchor + : StartRule extends 'EmverNot' + ? EmverNot + : StartRule extends 'Emver' + ? Emver + : StartRule extends 'Flavor' + ? Flavor + : StartRule extends 'FlavorString' + ? FlavorString + : StartRule extends 'String' + ? String_1 + : StartRule extends 'Version' + ? Version + : StartRule extends 'PreRelease' + ? PreRelease + : StartRule extends 'PreReleaseSegment' + ? PreReleaseSegment + : StartRule extends 'VersionNumber' + ? VersionNumber + : StartRule extends 'Digit' + ? Digit + : StartRule extends '_' + ? _ + : VersionRange + : VersionRange +export const parse: ParseFunction = peggyParser.parse -export const PeggySyntaxError = peggyParser.SyntaxError as typeof _PeggySyntaxError; +export const PeggySyntaxError = + peggyParser.SyntaxError as typeof _PeggySyntaxError -export type PeggySyntaxError = _PeggySyntaxError; +export type PeggySyntaxError = _PeggySyntaxError // These types were autogenerated by ts-pegjs export type VersionRange = [ VersionRangeAtom, - [_, [Or | And, _] | null, VersionRangeAtom][] -]; -export type Or = "||"; -export type And = "&&"; -export type VersionRangeAtom = Parens | Anchor | Not | Any | None | FlavorAtom; -export type Parens = { type: "Parens"; expr: VersionRange }; + [_, [Or | And, _] | null, VersionRangeAtom][], +] +export type Or = '||' +export type And = '&&' +export type VersionRangeAtom = Parens | Anchor | Not | Any | None | FlavorAtom +export type Parens = { type: 'Parens'; expr: VersionRange } export type Anchor = { - type: "Anchor"; - operator: CmpOp | null; - version: VersionSpec; -}; + type: 'Anchor' + operator: CmpOp | null + version: VersionSpec +} export type VersionSpec = { - flavor: NonNullable | null; - upstream: Version; - downstream: any; -}; -export type FlavorAtom = { type: "Flavor"; flavor: FlavorString }; -export type Not = { type: "Not"; value: VersionRangeAtom }; -export type Any = { type: "Any" }; -export type None = { type: "None" }; -export type CmpOp = ">=" | "<=" | ">" | "<" | "=" | "!=" | "^" | "~"; + flavor: NonNullable | null + upstream: Version + downstream: any +} +export type FlavorAtom = { type: 'Flavor'; flavor: FlavorString } +export type Not = { type: 'Not'; value: VersionRangeAtom } +export type Any = { type: 'Any' } +export type None = { type: 'None' } +export type CmpOp = '>=' | '<=' | '>' | '<' | '=' | '!=' | '^' | '~' export type ExtendedVersion = { - flavor: NonNullable | null; - upstream: Version; - downstream: Version; -}; + flavor: NonNullable | null + upstream: Version + downstream: Version +} export type EmverVersionRange = [ EmverVersionRangeAtom, - [_, [Or | And, _] | null, EmverVersionRangeAtom][] -]; + [_, [Or | And, _] | null, EmverVersionRangeAtom][], +] export type EmverVersionRangeAtom = | EmverParens | EmverAnchor | EmverNot | Any - | None; -export type EmverParens = { type: "Parens"; expr: EmverVersionRange }; + | None +export type EmverParens = { type: 'Parens'; expr: EmverVersionRange } export type EmverAnchor = { - type: "Anchor"; - operator: CmpOp | null; - version: Emver; -}; -export type EmverNot = { type: "Not"; value: EmverVersionRangeAtom }; + type: 'Anchor' + operator: CmpOp | null + version: Emver +} +export type EmverNot = { type: 'Not'; value: EmverVersionRangeAtom } export type Emver = { - flavor: null; - upstream: { number: [Digit, Digit, Digit]; prerelease: [] }; - downstream: { number: [0 | NonNullable]; prerelease: [] }; -}; -export type Flavor = FlavorString; -export type FlavorString = string; -export type String_1 = string; + flavor: null + upstream: { number: [Digit, Digit, Digit]; prerelease: [] } + downstream: { number: [0 | NonNullable]; prerelease: [] } +} +export type Flavor = FlavorString +export type FlavorString = string +export type String_1 = string export type Version = { - number: VersionNumber; - prerelease: never[] | NonNullable; -}; -export type PreRelease = PreReleaseSegment[]; -export type PreReleaseSegment = Digit | String_1; -export type VersionNumber = Digit[]; -export type Digit = number; -export type _ = string[]; + number: VersionNumber + prerelease: never[] | NonNullable +} +export type PreRelease = PreReleaseSegment[] +export type PreReleaseSegment = Digit | String_1 +export type VersionNumber = Digit[] +export type Digit = number +export type _ = string[] diff --git a/sdk/base/lib/exver/index.ts b/sdk/base/lib/exver/index.ts index 4d4731a59..3eb818097 100644 --- a/sdk/base/lib/exver/index.ts +++ b/sdk/base/lib/exver/index.ts @@ -1,5 +1,5 @@ -import { DeepMap } from "deep-equality-data-structures" -import * as P from "./exver" +import { DeepMap } from 'deep-equality-data-structures' +import * as P from './exver' // prettier-ignore export type ValidateVersion = @@ -22,35 +22,35 @@ export type ValidateExVers = never[] type Anchor = { - type: "Anchor" + type: 'Anchor' operator: P.CmpOp version: ExtendedVersion } type And = { - type: "And" + type: 'And' left: VersionRange right: VersionRange } type Or = { - type: "Or" + type: 'Or' left: VersionRange right: VersionRange } type Not = { - type: "Not" + type: 'Not' value: VersionRange } type Flavor = { - type: "Flavor" + type: 'Flavor' flavor: string | null } type FlavorNot = { - type: "FlavorNot" + type: 'FlavorNot' flavors: Set } @@ -107,8 +107,8 @@ function adjacentVersionRangePoints( } function flavorAnd(a: FlavorAtom, b: FlavorAtom): FlavorAtom | null { - if (a.type == "Flavor") { - if (b.type == "Flavor") { + if (a.type == 'Flavor') { + if (b.type == 'Flavor') { if (a.flavor == b.flavor) { return a } else { @@ -122,7 +122,7 @@ function flavorAnd(a: FlavorAtom, b: FlavorAtom): FlavorAtom | null { } } } else { - if (b.type == "Flavor") { + if (b.type == 'Flavor') { if (a.flavors.has(b.flavor)) { return null } else { @@ -131,7 +131,7 @@ function flavorAnd(a: FlavorAtom, b: FlavorAtom): FlavorAtom | null { } else { // TODO: use Set.union if targeting esnext or later return { - type: "FlavorNot", + type: 'FlavorNot', flavors: new Set([...a.flavors, ...b.flavors]), } } @@ -218,12 +218,12 @@ class VersionRangeTable { static eqFlavor(flavor: string | null): VersionRangeTables { return new DeepMap([ [ - { type: "Flavor", flavor } as FlavorAtom, + { type: 'Flavor', flavor } as FlavorAtom, new VersionRangeTable([], [true]), ], // make sure the truth table is exhaustive, or `not` will not work properly. [ - { type: "FlavorNot", flavors: new Set([flavor]) } as FlavorAtom, + { type: 'FlavorNot', flavors: new Set([flavor]) } as FlavorAtom, new VersionRangeTable([], [false]), ], ]) @@ -241,12 +241,12 @@ class VersionRangeTable { ): VersionRangeTables { return new DeepMap([ [ - { type: "Flavor", flavor } as FlavorAtom, + { type: 'Flavor', flavor } as FlavorAtom, new VersionRangeTable([point], [left, right]), ], // make sure the truth table is exhaustive, or `not` will not work properly. [ - { type: "FlavorNot", flavors: new Set([flavor]) } as FlavorAtom, + { type: 'FlavorNot', flavors: new Set([flavor]) } as FlavorAtom, new VersionRangeTable([], [false]), ], ]) @@ -383,7 +383,7 @@ class VersionRangeTable { let sum_terms: VersionRange[] = [] for (let [flavor, table] of tables) { let cmp_flavor = null - if (flavor.type == "Flavor") { + if (flavor.type == 'Flavor') { cmp_flavor = flavor.flavor } for (let i = 0; i < table.values.length; i++) { @@ -392,7 +392,7 @@ class VersionRangeTable { continue } - if (flavor.type == "FlavorNot") { + if (flavor.type == 'FlavorNot') { for (let not_flavor of flavor.flavors) { term.push(VersionRange.flavor(not_flavor).not()) } @@ -410,7 +410,7 @@ class VersionRangeTable { if (p != null && q != null && adjacentVersionRangePoints(p, q)) { term.push( VersionRange.anchor( - "=", + '=', new ExtendedVersion(cmp_flavor, p.upstream, p.downstream), ), ) @@ -418,7 +418,7 @@ class VersionRangeTable { if (p != null && p.side < 0) { term.push( VersionRange.anchor( - ">=", + '>=', new ExtendedVersion(cmp_flavor, p.upstream, p.downstream), ), ) @@ -426,7 +426,7 @@ class VersionRangeTable { if (p != null && p.side >= 0) { term.push( VersionRange.anchor( - ">", + '>', new ExtendedVersion(cmp_flavor, p.upstream, p.downstream), ), ) @@ -434,7 +434,7 @@ class VersionRangeTable { if (q != null && q.side < 0) { term.push( VersionRange.anchor( - "<", + '<', new ExtendedVersion(cmp_flavor, q.upstream, q.downstream), ), ) @@ -442,7 +442,7 @@ class VersionRangeTable { if (q != null && q.side >= 0) { term.push( VersionRange.anchor( - "<=", + '<=', new ExtendedVersion(cmp_flavor, q.upstream, q.downstream), ), ) @@ -463,26 +463,26 @@ class VersionRangeTable { export class VersionRange { constructor(public atom: Anchor | And | Or | Not | P.Any | P.None | Flavor) {} - toStringParens(parent: "And" | "Or" | "Not") { + toStringParens(parent: 'And' | 'Or' | 'Not') { let needs = true switch (this.atom.type) { - case "And": - case "Or": + case 'And': + case 'Or': needs = parent != this.atom.type break - case "Anchor": - case "Any": - case "None": - needs = parent == "Not" + case 'Anchor': + case 'Any': + case 'None': + needs = parent == 'Not' break - case "Not": - case "Flavor": + case 'Not': + case 'Flavor': needs = false break } if (needs) { - return "(" + this.toString() + ")" + return '(' + this.toString() + ')' } else { return this.toString() } @@ -490,36 +490,36 @@ export class VersionRange { toString(): string { switch (this.atom.type) { - case "Anchor": + case 'Anchor': return `${this.atom.operator}${this.atom.version}` - case "And": + case 'And': return `${this.atom.left.toStringParens(this.atom.type)} && ${this.atom.right.toStringParens(this.atom.type)}` - case "Or": + case 'Or': return `${this.atom.left.toStringParens(this.atom.type)} || ${this.atom.right.toStringParens(this.atom.type)}` - case "Not": + case 'Not': return `!${this.atom.value.toStringParens(this.atom.type)}` - case "Flavor": + case 'Flavor': return this.atom.flavor == null ? `#` : `#${this.atom.flavor}` - case "Any": - return "*" - case "None": - return "!" + case 'Any': + return '*' + case 'None': + return '!' } } private static parseAtom(atom: P.VersionRangeAtom): VersionRange { switch (atom.type) { - case "Not": + case 'Not': return new VersionRange({ - type: "Not", + type: 'Not', value: VersionRange.parseAtom(atom.value), }) - case "Parens": + case 'Parens': return VersionRange.parseRange(atom.expr) - case "Anchor": + case 'Anchor': return new VersionRange({ - type: "Anchor", - operator: atom.operator || "^", + type: 'Anchor', + operator: atom.operator || '^', version: new ExtendedVersion( atom.version.flavor, new Version( @@ -532,7 +532,7 @@ export class VersionRange { ), ), }) - case "Flavor": + case 'Flavor': return VersionRange.flavor(atom.flavor) default: return new VersionRange(atom) @@ -543,17 +543,17 @@ export class VersionRange { let result = VersionRange.parseAtom(range[0]) for (const next of range[1]) { switch (next[1]?.[0]) { - case "||": + case '||': result = new VersionRange({ - type: "Or", + type: 'Or', left: result, right: VersionRange.parseAtom(next[2]), }) break - case "&&": + case '&&': default: result = new VersionRange({ - type: "And", + type: 'And', left: result, right: VersionRange.parseAtom(next[2]), }) @@ -565,49 +565,49 @@ export class VersionRange { static parse(range: string): VersionRange { return VersionRange.parseRange( - P.parse(range, { startRule: "VersionRange" }), + P.parse(range, { startRule: 'VersionRange' }), ) } static anchor(operator: P.CmpOp, version: ExtendedVersion) { - return new VersionRange({ type: "Anchor", operator, version }) + return new VersionRange({ type: 'Anchor', operator, version }) } static flavor(flavor: string | null) { - return new VersionRange({ type: "Flavor", flavor }) + return new VersionRange({ type: 'Flavor', flavor }) } static parseEmver(range: string): VersionRange { return VersionRange.parseRange( - P.parse(range, { startRule: "EmverVersionRange" }), + P.parse(range, { startRule: 'EmverVersionRange' }), ) } and(right: VersionRange) { - return new VersionRange({ type: "And", left: this, right }) + return new VersionRange({ type: 'And', left: this, right }) } or(right: VersionRange) { - return new VersionRange({ type: "Or", left: this, right }) + return new VersionRange({ type: 'Or', left: this, right }) } not() { - return new VersionRange({ type: "Not", value: this }) + return new VersionRange({ type: 'Not', value: this }) } static and(...xs: Array) { let y = VersionRange.any() for (let x of xs) { - if (x.atom.type == "Any") { + if (x.atom.type == 'Any') { continue } - if (x.atom.type == "None") { + if (x.atom.type == 'None') { return x } - if (y.atom.type == "Any") { + if (y.atom.type == 'Any') { y = x } else { - y = new VersionRange({ type: "And", left: y, right: x }) + y = new VersionRange({ type: 'And', left: y, right: x }) } } return y @@ -616,27 +616,27 @@ export class VersionRange { static or(...xs: Array) { let y = VersionRange.none() for (let x of xs) { - if (x.atom.type == "None") { + if (x.atom.type == 'None') { continue } - if (x.atom.type == "Any") { + if (x.atom.type == 'Any') { return x } - if (y.atom.type == "None") { + if (y.atom.type == 'None') { y = x } else { - y = new VersionRange({ type: "Or", left: y, right: x }) + y = new VersionRange({ type: 'Or', left: y, right: x }) } } return y } static any() { - return new VersionRange({ type: "Any" }) + return new VersionRange({ type: 'Any' }) } static none() { - return new VersionRange({ type: "None" }) + return new VersionRange({ type: 'None' }) } satisfiedBy(version: Version | ExtendedVersion) { @@ -645,23 +645,23 @@ export class VersionRange { tables(): VersionRangeTables { switch (this.atom.type) { - case "Anchor": + case 'Anchor': switch (this.atom.operator) { - case "=": + case '=': // `=1.2.3` is equivalent to `>=1.2.3 && <=1.2.4 && #flavor` return VersionRangeTable.and( VersionRangeTable.cmp(this.atom.version, -1, false, true), VersionRangeTable.cmp(this.atom.version, 1, true, false), ) - case ">": + case '>': return VersionRangeTable.cmp(this.atom.version, 1, false, true) - case "<": + case '<': return VersionRangeTable.cmp(this.atom.version, -1, true, false) - case ">=": + case '>=': return VersionRangeTable.cmp(this.atom.version, -1, false, true) - case "<=": + case '<=': return VersionRangeTable.cmp(this.atom.version, 1, true, false) - case "!=": + case '!=': // `!=1.2.3` is equivalent to `!(>=1.2.3 && <=1.2.3 && #flavor)` // **not** equivalent to `(<1.2.3 || >1.2.3) && #flavor` return VersionRangeTable.not( @@ -670,7 +670,7 @@ export class VersionRange { VersionRangeTable.cmp(this.atom.version, 1, true, false), ), ) - case "^": + case '^': // `^1.2.3` is equivalent to `>=1.2.3 && <2.0.0 && #flavor` return VersionRangeTable.and( VersionRangeTable.cmp(this.atom.version, -1, false, true), @@ -681,7 +681,7 @@ export class VersionRange { false, ), ) - case "~": + case '~': // `~1.2.3` is equivalent to `>=1.2.3 && <1.3.0 && #flavor` return VersionRangeTable.and( VersionRangeTable.cmp(this.atom.version, -1, false, true), @@ -693,23 +693,23 @@ export class VersionRange { ), ) } - case "Flavor": + case 'Flavor': return VersionRangeTable.eqFlavor(this.atom.flavor) - case "Not": + case 'Not': return VersionRangeTable.not(this.atom.value.tables()) - case "And": + case 'And': return VersionRangeTable.and( this.atom.left.tables(), this.atom.right.tables(), ) - case "Or": + case 'Or': return VersionRangeTable.or( this.atom.left.tables(), this.atom.right.tables(), ) - case "Any": + case 'Any': return true - case "None": + case 'None': return false } } @@ -734,23 +734,23 @@ export class Version { ) {} toString(): string { - return `${this.number.join(".")}${this.prerelease.length > 0 ? `-${this.prerelease.join(".")}` : ""}` + return `${this.number.join('.')}${this.prerelease.length > 0 ? `-${this.prerelease.join('.')}` : ''}` } - compare(other: Version): "greater" | "equal" | "less" { + compare(other: Version): 'greater' | 'equal' | 'less' { const numLen = Math.max(this.number.length, other.number.length) for (let i = 0; i < numLen; i++) { if ((this.number[i] || 0) > (other.number[i] || 0)) { - return "greater" + return 'greater' } else if ((this.number[i] || 0) < (other.number[i] || 0)) { - return "less" + return 'less' } } if (this.prerelease.length === 0 && other.prerelease.length !== 0) { - return "greater" + return 'greater' } else if (this.prerelease.length !== 0 && other.prerelease.length === 0) { - return "less" + return 'less' } const prereleaseLen = Math.max( @@ -760,42 +760,42 @@ export class Version { for (let i = 0; i < prereleaseLen; i++) { if (typeof this.prerelease[i] === typeof other.prerelease[i]) { if (this.prerelease[i] > other.prerelease[i]) { - return "greater" + return 'greater' } else if (this.prerelease[i] < other.prerelease[i]) { - return "less" + return 'less' } } else { switch (`${typeof this.prerelease[1]}:${typeof other.prerelease[i]}`) { - case "number:string": - return "less" - case "string:number": - return "greater" - case "number:undefined": - case "string:undefined": - return "greater" - case "undefined:number": - case "undefined:string": - return "less" + case 'number:string': + return 'less' + case 'string:number': + return 'greater' + case 'number:undefined': + case 'string:undefined': + return 'greater' + case 'undefined:number': + case 'undefined:string': + return 'less' } } } - return "equal" + return 'equal' } compareForSort(other: Version): -1 | 0 | 1 { switch (this.compare(other)) { - case "greater": + case 'greater': return 1 - case "equal": + case 'equal': return 0 - case "less": + case 'less': return -1 } } static parse(version: string): Version { - const parsed = P.parse(version, { startRule: "Version" }) + const parsed = P.parse(version, { startRule: 'Version' }) return new Version(parsed.number, parsed.prerelease) } @@ -815,25 +815,25 @@ export class ExtendedVersion { ) {} toString(): string { - return `${this.flavor ? `#${this.flavor}:` : ""}${this.upstream.toString()}:${this.downstream.toString()}` + return `${this.flavor ? `#${this.flavor}:` : ''}${this.upstream.toString()}:${this.downstream.toString()}` } - compare(other: ExtendedVersion): "greater" | "equal" | "less" | null { + compare(other: ExtendedVersion): 'greater' | 'equal' | 'less' | null { if (this.flavor !== other.flavor) { return null } const upstreamCmp = this.upstream.compare(other.upstream) - if (upstreamCmp !== "equal") { + if (upstreamCmp !== 'equal') { return upstreamCmp } return this.downstream.compare(other.downstream) } - compareLexicographic(other: ExtendedVersion): "greater" | "equal" | "less" { - if ((this.flavor || "") > (other.flavor || "")) { - return "greater" - } else if ((this.flavor || "") > (other.flavor || "")) { - return "less" + compareLexicographic(other: ExtendedVersion): 'greater' | 'equal' | 'less' { + if ((this.flavor || '') > (other.flavor || '')) { + return 'greater' + } else if ((this.flavor || '') > (other.flavor || '')) { + return 'less' } else { return this.compare(other)! } @@ -841,37 +841,37 @@ export class ExtendedVersion { compareForSort(other: ExtendedVersion): 1 | 0 | -1 { switch (this.compareLexicographic(other)) { - case "greater": + case 'greater': return 1 - case "equal": + case 'equal': return 0 - case "less": + case 'less': return -1 } } greaterThan(other: ExtendedVersion): boolean { - return this.compare(other) === "greater" + return this.compare(other) === 'greater' } greaterThanOrEqual(other: ExtendedVersion): boolean { - return ["greater", "equal"].includes(this.compare(other) as string) + return ['greater', 'equal'].includes(this.compare(other) as string) } equals(other: ExtendedVersion): boolean { - return this.compare(other) === "equal" + return this.compare(other) === 'equal' } lessThan(other: ExtendedVersion): boolean { - return this.compare(other) === "less" + return this.compare(other) === 'less' } lessThanOrEqual(other: ExtendedVersion): boolean { - return ["less", "equal"].includes(this.compare(other) as string) + return ['less', 'equal'].includes(this.compare(other) as string) } static parse(extendedVersion: string): ExtendedVersion { - const parsed = P.parse(extendedVersion, { startRule: "ExtendedVersion" }) + const parsed = P.parse(extendedVersion, { startRule: 'ExtendedVersion' }) return new ExtendedVersion( parsed.flavor || null, new Version(parsed.upstream.number, parsed.upstream.prerelease), @@ -881,7 +881,7 @@ export class ExtendedVersion { static parseEmver(extendedVersion: string): ExtendedVersion { try { - const parsed = P.parse(extendedVersion, { startRule: "Emver" }) + const parsed = P.parse(extendedVersion, { startRule: 'Emver' }) return new ExtendedVersion( parsed.flavor || null, new Version(parsed.upstream.number, parsed.upstream.prerelease), @@ -956,22 +956,22 @@ export class ExtendedVersion { */ satisfies(versionRange: VersionRange): boolean { switch (versionRange.atom.type) { - case "Anchor": + case 'Anchor': const otherVersion = versionRange.atom.version switch (versionRange.atom.operator) { - case "=": + case '=': return this.equals(otherVersion) - case ">": + case '>': return this.greaterThan(otherVersion) - case "<": + case '<': return this.lessThan(otherVersion) - case ">=": + case '>=': return this.greaterThanOrEqual(otherVersion) - case "<=": + case '<=': return this.lessThanOrEqual(otherVersion) - case "!=": + case '!=': return !this.equals(otherVersion) - case "^": + case '^': const nextMajor = versionRange.atom.version.incrementMajor() if ( this.greaterThanOrEqual(otherVersion) && @@ -981,7 +981,7 @@ export class ExtendedVersion { } else { return false } - case "~": + case '~': const nextMinor = versionRange.atom.version.incrementMinor() if ( this.greaterThanOrEqual(otherVersion) && @@ -992,23 +992,23 @@ export class ExtendedVersion { return false } } - case "Flavor": + case 'Flavor': return versionRange.atom.flavor == this.flavor - case "And": + case 'And': return ( this.satisfies(versionRange.atom.left) && this.satisfies(versionRange.atom.right) ) - case "Or": + case 'Or': return ( this.satisfies(versionRange.atom.left) || this.satisfies(versionRange.atom.right) ) - case "Not": + case 'Not': return !this.satisfies(versionRange.atom.value) - case "Any": + case 'Any': return true - case "None": + case 'None': return false } } @@ -1020,34 +1020,34 @@ export const testTypeVersion = (t: T & ValidateVersion) => t function tests() { - testTypeVersion("1.2.3") - testTypeVersion("1") - testTypeVersion("12.34.56") - testTypeVersion("1.2-3") - testTypeVersion("1-3") - testTypeVersion("1-alpha") + testTypeVersion('1.2.3') + testTypeVersion('1') + testTypeVersion('12.34.56') + testTypeVersion('1.2-3') + testTypeVersion('1-3') + testTypeVersion('1-alpha') // @ts-expect-error - testTypeVersion("-3") + testTypeVersion('-3') // @ts-expect-error - testTypeVersion("1.2.3:1") + testTypeVersion('1.2.3:1') // @ts-expect-error - testTypeVersion("#cat:1:1") + testTypeVersion('#cat:1:1') - testTypeExVer("1.2.3:1.2.3") - testTypeExVer("1.2.3.4.5.6.7.8.9.0:1") - testTypeExVer("100:1") - testTypeExVer("#cat:1:1") - testTypeExVer("1.2.3.4.5.6.7.8.9.11.22.33:1") - testTypeExVer("1-0:1") - testTypeExVer("1-0:1") + testTypeExVer('1.2.3:1.2.3') + testTypeExVer('1.2.3.4.5.6.7.8.9.0:1') + testTypeExVer('100:1') + testTypeExVer('#cat:1:1') + testTypeExVer('1.2.3.4.5.6.7.8.9.11.22.33:1') + testTypeExVer('1-0:1') + testTypeExVer('1-0:1') // @ts-expect-error - testTypeExVer("1.2-3") + testTypeExVer('1.2-3') // @ts-expect-error - testTypeExVer("1-3") + testTypeExVer('1-3') // @ts-expect-error - testTypeExVer("1.2.3.4.5.6.7.8.9.0.10:1" as string) + testTypeExVer('1.2.3.4.5.6.7.8.9.0.10:1' as string) // @ts-expect-error - testTypeExVer("1.-2:1") + testTypeExVer('1.-2:1') // @ts-expect-error - testTypeExVer("1..2.3:3") + testTypeExVer('1..2.3:3') } diff --git a/sdk/base/lib/index.ts b/sdk/base/lib/index.ts index 4d4088abe..85d00a794 100644 --- a/sdk/base/lib/index.ts +++ b/sdk/base/lib/index.ts @@ -1,13 +1,13 @@ -export { S9pk } from "./s9pk" -export { VersionRange, ExtendedVersion, Version } from "./exver" +export { S9pk } from './s9pk' +export { VersionRange, ExtendedVersion, Version } from './exver' -export * as inputSpec from "./actions/input" -export * as ISB from "./actions/input/builder" -export * as IST from "./actions/input/inputSpecTypes" -export * as types from "./types" -export * as T from "./types" -export * as yaml from "yaml" -export * as inits from "./inits" -export * as matches from "ts-matches" +export * as inputSpec from './actions/input' +export * as ISB from './actions/input/builder' +export * as IST from './actions/input/inputSpecTypes' +export * as types from './types' +export * as T from './types' +export * as yaml from 'yaml' +export * as inits from './inits' +export * as matches from 'ts-matches' -export * as utils from "./util" +export * as utils from './util' diff --git a/sdk/base/lib/inits/index.ts b/sdk/base/lib/inits/index.ts index 0522089b1..fb74aba2f 100644 --- a/sdk/base/lib/inits/index.ts +++ b/sdk/base/lib/inits/index.ts @@ -1,2 +1,2 @@ -export * from "./setupInit" -export * from "./setupUninit" +export * from './setupInit' +export * from './setupUninit' diff --git a/sdk/base/lib/inits/setupInit.ts b/sdk/base/lib/inits/setupInit.ts index a8a33946e..25f499e42 100644 --- a/sdk/base/lib/inits/setupInit.ts +++ b/sdk/base/lib/inits/setupInit.ts @@ -1,8 +1,8 @@ -import { VersionRange } from "../../../base/lib/exver" -import * as T from "../../../base/lib/types" -import { once } from "../util" +import { VersionRange } from '../../../base/lib/exver' +import * as T from '../../../base/lib/types' +import { once } from '../util' -export type InitKind = "install" | "update" | "restore" | null +export type InitKind = 'install' | 'update' | 'restore' | null export type InitFn = ( effects: T.Effects, @@ -31,7 +31,7 @@ export function setupInit(...inits: InitScriptOrFn[]): T.ExpectedExports.init { complete.then(() => fn()).catch(console.error), ) try { - if ("init" in init) await init.init(e, opts.kind) + if ('init' in init) await init.init(e, opts.kind) else await init(e, opts.kind) } finally { res() @@ -43,7 +43,7 @@ export function setupInit(...inits: InitScriptOrFn[]): T.ExpectedExports.init { } export function setupOnInit(onInit: InitScriptOrFn): InitScript { - return "init" in onInit + return 'init' in onInit ? onInit : { init: async (effects, kind) => { diff --git a/sdk/base/lib/inits/setupUninit.ts b/sdk/base/lib/inits/setupUninit.ts index 263a64caf..52d111fa5 100644 --- a/sdk/base/lib/inits/setupUninit.ts +++ b/sdk/base/lib/inits/setupUninit.ts @@ -1,5 +1,5 @@ -import { ExtendedVersion, VersionRange } from "../../../base/lib/exver" -import * as T from "../../../base/lib/types" +import { ExtendedVersion, VersionRange } from '../../../base/lib/exver' +import * as T from '../../../base/lib/types' export type UninitFn = ( effects: T.Effects, @@ -34,14 +34,14 @@ export function setupUninit( ): T.ExpectedExports.uninit { return async (opts) => { for (const uninit of uninits) { - if ("uninit" in uninit) await uninit.uninit(opts.effects, opts.target) + if ('uninit' in uninit) await uninit.uninit(opts.effects, opts.target) else await uninit(opts.effects, opts.target) } } } export function setupOnUninit(onUninit: UninitScriptOrFn): UninitScript { - return "uninit" in onUninit + return 'uninit' in onUninit ? onUninit : { uninit: async (effects, target) => { diff --git a/sdk/base/lib/interfaces/Host.ts b/sdk/base/lib/interfaces/Host.ts index ac693a3b6..0ad4424ba 100644 --- a/sdk/base/lib/interfaces/Host.ts +++ b/sdk/base/lib/interfaces/Host.ts @@ -1,10 +1,10 @@ -import { object, string } from "ts-matches" -import { Effects } from "../Effects" -import { Origin } from "./Origin" -import { AddSslOptions, BindParams } from "../osBindings" -import { Security } from "../osBindings" -import { BindOptions } from "../osBindings" -import { AlpnInfo } from "../osBindings" +import { object, string } from 'ts-matches' +import { Effects } from '../Effects' +import { Origin } from './Origin' +import { AddSslOptions, BindParams } from '../osBindings' +import { Security } from '../osBindings' +import { BindOptions } from '../osBindings' +import { AlpnInfo } from '../osBindings' export { AddSslOptions, Security, BindOptions } @@ -12,8 +12,8 @@ export const knownProtocols = { http: { secure: null, defaultPort: 80, - withSsl: "https", - alpn: { specified: ["http/1.1"] } as AlpnInfo, + withSsl: 'https', + alpn: { specified: ['http/1.1'] } as AlpnInfo, }, https: { secure: { ssl: true }, @@ -22,8 +22,8 @@ export const knownProtocols = { ws: { secure: null, defaultPort: 80, - withSsl: "wss", - alpn: { specified: ["http/1.1"] } as AlpnInfo, + withSsl: 'wss', + alpn: { specified: ['http/1.1'] } as AlpnInfo, }, wss: { secure: { ssl: true }, @@ -140,8 +140,8 @@ export class MultiHost { addXForwardedHeaders: false, preferredExternalPort: knownProtocols[sslProto].defaultPort, scheme: sslProto, - alpn: "alpn" in protoInfo ? protoInfo.alpn : null, - ...("addSsl" in options ? options.addSsl : null), + alpn: 'alpn' in protoInfo ? protoInfo.alpn : null, + ...('addSsl' in options ? options.addSsl : null), } : options.addSsl ? { @@ -149,7 +149,7 @@ export class MultiHost { preferredExternalPort: 443, scheme: sslProto, alpn: null, - ...("addSsl" in options ? options.addSsl : null), + ...('addSsl' in options ? options.addSsl : null), } : null @@ -169,8 +169,8 @@ export class MultiHost { private getSslProto(options: BindOptionsByKnownProtocol) { const proto = options.protocol const protoInfo = knownProtocols[proto] - if (inObject("noAddSsl", options) && options.noAddSsl) return null - if ("withSsl" in protoInfo && protoInfo.withSsl) return protoInfo.withSsl + if (inObject('noAddSsl', options) && options.noAddSsl) return null + if ('withSsl' in protoInfo && protoInfo.withSsl) return protoInfo.withSsl if (protoInfo.secure?.ssl) return proto return null } diff --git a/sdk/base/lib/interfaces/Origin.ts b/sdk/base/lib/interfaces/Origin.ts index e749e48f1..cbad1f5c9 100644 --- a/sdk/base/lib/interfaces/Origin.ts +++ b/sdk/base/lib/interfaces/Origin.ts @@ -1,7 +1,7 @@ -import { AddressInfo } from "../types" -import { AddressReceipt } from "./AddressReceipt" -import { MultiHost, Scheme } from "./Host" -import { ServiceInterfaceBuilder } from "./ServiceInterfaceBuilder" +import { AddressInfo } from '../types' +import { AddressReceipt } from './AddressReceipt' +import { MultiHost, Scheme } from './Host' +import { ServiceInterfaceBuilder } from './ServiceInterfaceBuilder' export class Origin { constructor( @@ -21,9 +21,9 @@ export class Origin { .map( ([key, val]) => `${encodeURIComponent(key)}=${encodeURIComponent(val)}`, ) - .join("&") + .join('&') - const qp = qpEntries.length ? `?${qpEntries}` : "" + const qp = qpEntries.length ? `?${qpEntries}` : '' return { hostId: this.host.options.id, diff --git a/sdk/base/lib/interfaces/ServiceInterfaceBuilder.ts b/sdk/base/lib/interfaces/ServiceInterfaceBuilder.ts index d8cd8e38e..9145b4d38 100644 --- a/sdk/base/lib/interfaces/ServiceInterfaceBuilder.ts +++ b/sdk/base/lib/interfaces/ServiceInterfaceBuilder.ts @@ -1,6 +1,6 @@ -import { ServiceInterfaceType } from "../types" -import { Effects } from "../Effects" -import { Scheme } from "./Host" +import { ServiceInterfaceType } from '../types' +import { Effects } from '../Effects' +import { Scheme } from './Host' /** * A helper class for creating a Network Interface diff --git a/sdk/base/lib/interfaces/setupInterfaces.ts b/sdk/base/lib/interfaces/setupInterfaces.ts index 8e9c4b61a..13baf8d57 100644 --- a/sdk/base/lib/interfaces/setupInterfaces.ts +++ b/sdk/base/lib/interfaces/setupInterfaces.ts @@ -1,6 +1,6 @@ -import * as T from "../types" -import { once } from "../util" -import { AddressReceipt } from "./AddressReceipt" +import * as T from '../types' +import { once } from '../util' +import { AddressReceipt } from './AddressReceipt' declare const UpdateServiceInterfacesProof: unique symbol export type UpdateServiceInterfacesReceipt = { diff --git a/sdk/base/lib/osBindings/AcceptSigners.ts b/sdk/base/lib/osBindings/AcceptSigners.ts index 1ef417623..1f7d2c0d0 100644 --- a/sdk/base/lib/osBindings/AcceptSigners.ts +++ b/sdk/base/lib/osBindings/AcceptSigners.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AnyVerifyingKey } from "./AnyVerifyingKey" +import type { AnyVerifyingKey } from './AnyVerifyingKey' export type AcceptSigners = | { signer: AnyVerifyingKey } diff --git a/sdk/base/lib/osBindings/ActionInput.ts b/sdk/base/lib/osBindings/ActionInput.ts index c81ce7547..a714c15e4 100644 --- a/sdk/base/lib/osBindings/ActionInput.ts +++ b/sdk/base/lib/osBindings/ActionInput.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Guid } from "./Guid" +import type { Guid } from './Guid' export type ActionInput = { eventId: Guid diff --git a/sdk/base/lib/osBindings/ActionMetadata.ts b/sdk/base/lib/osBindings/ActionMetadata.ts index 01809ab57..76d4c4dd8 100644 --- a/sdk/base/lib/osBindings/ActionMetadata.ts +++ b/sdk/base/lib/osBindings/ActionMetadata.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ActionVisibility } from "./ActionVisibility" -import type { AllowedStatuses } from "./AllowedStatuses" +import type { ActionVisibility } from './ActionVisibility' +import type { AllowedStatuses } from './AllowedStatuses' export type ActionMetadata = { /** diff --git a/sdk/base/lib/osBindings/ActionResult.ts b/sdk/base/lib/osBindings/ActionResult.ts index 7422dcde3..f293b4afe 100644 --- a/sdk/base/lib/osBindings/ActionResult.ts +++ b/sdk/base/lib/osBindings/ActionResult.ts @@ -1,7 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ActionResultV0 } from "./ActionResultV0" -import type { ActionResultV1 } from "./ActionResultV1" +import type { ActionResultV0 } from './ActionResultV0' +import type { ActionResultV1 } from './ActionResultV1' export type ActionResult = - | ({ version: "0" } & ActionResultV0) - | ({ version: "1" } & ActionResultV1) + | ({ version: '0' } & ActionResultV0) + | ({ version: '1' } & ActionResultV1) diff --git a/sdk/base/lib/osBindings/ActionResultMember.ts b/sdk/base/lib/osBindings/ActionResultMember.ts index c27a6a3a9..f5782c4c5 100644 --- a/sdk/base/lib/osBindings/ActionResultMember.ts +++ b/sdk/base/lib/osBindings/ActionResultMember.ts @@ -11,7 +11,7 @@ export type ActionResultMember = { description: string | null } & ( | { - type: "single" + type: 'single' /** * The actual string value to display */ @@ -30,7 +30,7 @@ export type ActionResultMember = { masked: boolean } | { - type: "group" + type: 'group' /** * An new group of nested values, experienced by the user as an accordion dropdown */ diff --git a/sdk/base/lib/osBindings/ActionResultV1.ts b/sdk/base/lib/osBindings/ActionResultV1.ts index ee06ebab9..e191844f9 100644 --- a/sdk/base/lib/osBindings/ActionResultV1.ts +++ b/sdk/base/lib/osBindings/ActionResultV1.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ActionResultValue } from "./ActionResultValue" +import type { ActionResultValue } from './ActionResultValue' export type ActionResultV1 = { /** diff --git a/sdk/base/lib/osBindings/ActionResultValue.ts b/sdk/base/lib/osBindings/ActionResultValue.ts index 3ffabef8b..dc3325c46 100644 --- a/sdk/base/lib/osBindings/ActionResultValue.ts +++ b/sdk/base/lib/osBindings/ActionResultValue.ts @@ -1,9 +1,9 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ActionResultMember } from "./ActionResultMember" +import type { ActionResultMember } from './ActionResultMember' export type ActionResultValue = | { - type: "single" + type: 'single' /** * The actual string value to display */ @@ -22,7 +22,7 @@ export type ActionResultValue = masked: boolean } | { - type: "group" + type: 'group' /** * An new group of nested values, experienced by the user as an accordion dropdown */ diff --git a/sdk/base/lib/osBindings/ActionVisibility.ts b/sdk/base/lib/osBindings/ActionVisibility.ts index ab1e6e1b9..4f9adb2af 100644 --- a/sdk/base/lib/osBindings/ActionVisibility.ts +++ b/sdk/base/lib/osBindings/ActionVisibility.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 ActionVisibility = "hidden" | { disabled: string } | "enabled" +export type ActionVisibility = 'hidden' | { disabled: string } | 'enabled' diff --git a/sdk/base/lib/osBindings/AddAdminParams.ts b/sdk/base/lib/osBindings/AddAdminParams.ts index 9da08b54b..2b6810827 100644 --- a/sdk/base/lib/osBindings/AddAdminParams.ts +++ b/sdk/base/lib/osBindings/AddAdminParams.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 { Guid } from "./Guid" +import type { Guid } from './Guid' export type AddAdminParams = { signer: Guid } diff --git a/sdk/base/lib/osBindings/AddAssetParams.ts b/sdk/base/lib/osBindings/AddAssetParams.ts index 7522a1cb4..92a14ce14 100644 --- a/sdk/base/lib/osBindings/AddAssetParams.ts +++ b/sdk/base/lib/osBindings/AddAssetParams.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AnySignature } from "./AnySignature" -import type { Blake3Commitment } from "./Blake3Commitment" +import type { AnySignature } from './AnySignature' +import type { Blake3Commitment } from './Blake3Commitment' export type AddAssetParams = { version: string diff --git a/sdk/base/lib/osBindings/AddCategoryParams.ts b/sdk/base/lib/osBindings/AddCategoryParams.ts index b6dfa3fac..d8a6736d4 100644 --- a/sdk/base/lib/osBindings/AddCategoryParams.ts +++ b/sdk/base/lib/osBindings/AddCategoryParams.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 { LocaleString } from "./LocaleString" +import type { LocaleString } from './LocaleString' export type AddCategoryParams = { id: string; name: LocaleString } diff --git a/sdk/base/lib/osBindings/AddMirrorParams.ts b/sdk/base/lib/osBindings/AddMirrorParams.ts index 2aa708376..1b8f8406b 100644 --- a/sdk/base/lib/osBindings/AddMirrorParams.ts +++ b/sdk/base/lib/osBindings/AddMirrorParams.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AnySignature } from "./AnySignature" -import type { MerkleArchiveCommitment } from "./MerkleArchiveCommitment" +import type { AnySignature } from './AnySignature' +import type { MerkleArchiveCommitment } from './MerkleArchiveCommitment' export type AddMirrorParams = { url: string diff --git a/sdk/base/lib/osBindings/AddPackageParams.ts b/sdk/base/lib/osBindings/AddPackageParams.ts index a21619c00..ab0192911 100644 --- a/sdk/base/lib/osBindings/AddPackageParams.ts +++ b/sdk/base/lib/osBindings/AddPackageParams.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AnySignature } from "./AnySignature" -import type { MerkleArchiveCommitment } from "./MerkleArchiveCommitment" +import type { AnySignature } from './AnySignature' +import type { MerkleArchiveCommitment } from './MerkleArchiveCommitment' export type AddPackageParams = { urls: string[] diff --git a/sdk/base/lib/osBindings/AddPackageSignerParams.ts b/sdk/base/lib/osBindings/AddPackageSignerParams.ts index 6b8714936..2ca630678 100644 --- a/sdk/base/lib/osBindings/AddPackageSignerParams.ts +++ b/sdk/base/lib/osBindings/AddPackageSignerParams.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Guid } from "./Guid" -import type { PackageId } from "./PackageId" +import type { Guid } from './Guid' +import type { PackageId } from './PackageId' export type AddPackageSignerParams = { id: PackageId diff --git a/sdk/base/lib/osBindings/AddPackageToCategoryParams.ts b/sdk/base/lib/osBindings/AddPackageToCategoryParams.ts index 2ac9c2ff3..14f12f8da 100644 --- a/sdk/base/lib/osBindings/AddPackageToCategoryParams.ts +++ b/sdk/base/lib/osBindings/AddPackageToCategoryParams.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 { PackageId } from "./PackageId" +import type { PackageId } from './PackageId' export type AddPackageToCategoryParams = { id: string; package: PackageId } diff --git a/sdk/base/lib/osBindings/AddSslOptions.ts b/sdk/base/lib/osBindings/AddSslOptions.ts index ab1124351..3efec565e 100644 --- a/sdk/base/lib/osBindings/AddSslOptions.ts +++ b/sdk/base/lib/osBindings/AddSslOptions.ts @@ -1,5 +1,5 @@ // 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" +import type { AlpnInfo } from './AlpnInfo' export type AddSslOptions = { preferredExternalPort: number diff --git a/sdk/base/lib/osBindings/AddressInfo.ts b/sdk/base/lib/osBindings/AddressInfo.ts index c7a1c1af1..705b3df1d 100644 --- a/sdk/base/lib/osBindings/AddressInfo.ts +++ b/sdk/base/lib/osBindings/AddressInfo.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { HostId } from "./HostId" +import type { HostId } from './HostId' export type AddressInfo = { username: string | null diff --git a/sdk/base/lib/osBindings/Alerts.ts b/sdk/base/lib/osBindings/Alerts.ts index 9103c1582..d43c10049 100644 --- a/sdk/base/lib/osBindings/Alerts.ts +++ b/sdk/base/lib/osBindings/Alerts.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { LocaleString } from "./LocaleString" +import type { LocaleString } from './LocaleString' export type Alerts = { install: LocaleString | null diff --git a/sdk/base/lib/osBindings/Algorithm.ts b/sdk/base/lib/osBindings/Algorithm.ts index 94f2040e1..aed631923 100644 --- a/sdk/base/lib/osBindings/Algorithm.ts +++ b/sdk/base/lib/osBindings/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" +export type Algorithm = 'ecdsa' | 'ed25519' diff --git a/sdk/base/lib/osBindings/AllPackageData.ts b/sdk/base/lib/osBindings/AllPackageData.ts index b51b41bf5..0d993be30 100644 --- a/sdk/base/lib/osBindings/AllPackageData.ts +++ b/sdk/base/lib/osBindings/AllPackageData.ts @@ -1,5 +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" +import type { PackageDataEntry } from './PackageDataEntry' +import type { PackageId } from './PackageId' export type AllPackageData = { [key: PackageId]: PackageDataEntry } diff --git a/sdk/base/lib/osBindings/AllowedStatuses.ts b/sdk/base/lib/osBindings/AllowedStatuses.ts index ed5851495..b00eae295 100644 --- a/sdk/base/lib/osBindings/AllowedStatuses.ts +++ b/sdk/base/lib/osBindings/AllowedStatuses.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 AllowedStatuses = "only-running" | "only-stopped" | "any" +export type AllowedStatuses = 'only-running' | 'only-stopped' | 'any' diff --git a/sdk/base/lib/osBindings/AlpnInfo.ts b/sdk/base/lib/osBindings/AlpnInfo.ts index 2dacb3d3f..8c73cbc7c 100644 --- a/sdk/base/lib/osBindings/AlpnInfo.ts +++ b/sdk/base/lib/osBindings/AlpnInfo.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 { MaybeUtf8String } from "./MaybeUtf8String" +import type { MaybeUtf8String } from './MaybeUtf8String' -export type AlpnInfo = "reflect" | { specified: Array } +export type AlpnInfo = 'reflect' | { specified: Array } diff --git a/sdk/base/lib/osBindings/ApiState.ts b/sdk/base/lib/osBindings/ApiState.ts index c3a43828a..05ba13fb7 100644 --- a/sdk/base/lib/osBindings/ApiState.ts +++ b/sdk/base/lib/osBindings/ApiState.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 ApiState = "error" | "initializing" | "running" +export type ApiState = 'error' | 'initializing' | 'running' diff --git a/sdk/base/lib/osBindings/AttachParams.ts b/sdk/base/lib/osBindings/AttachParams.ts index 36ba7f958..31283fec6 100644 --- a/sdk/base/lib/osBindings/AttachParams.ts +++ b/sdk/base/lib/osBindings/AttachParams.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { EncryptedWire } from "./EncryptedWire" +import type { EncryptedWire } from './EncryptedWire' export type AttachParams = { password: EncryptedWire | null diff --git a/sdk/base/lib/osBindings/BackupTargetFS.ts b/sdk/base/lib/osBindings/BackupTargetFS.ts index 0cff2cc4e..64d9d34f5 100644 --- a/sdk/base/lib/osBindings/BackupTargetFS.ts +++ b/sdk/base/lib/osBindings/BackupTargetFS.ts @@ -1,7 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { BlockDev } from "./BlockDev" -import type { Cifs } from "./Cifs" +import type { BlockDev } from './BlockDev' +import type { Cifs } from './Cifs' export type BackupTargetFS = - | ({ type: "disk" } & BlockDev) - | ({ type: "cifs" } & Cifs) + | ({ type: 'disk' } & BlockDev) + | ({ type: 'cifs' } & Cifs) diff --git a/sdk/base/lib/osBindings/BindId.ts b/sdk/base/lib/osBindings/BindId.ts index 778d95346..155a8c73d 100644 --- a/sdk/base/lib/osBindings/BindId.ts +++ b/sdk/base/lib/osBindings/BindId.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 { HostId } from "./HostId" +import type { HostId } from './HostId' export type BindId = { id: HostId; internalPort: number } diff --git a/sdk/base/lib/osBindings/BindInfo.ts b/sdk/base/lib/osBindings/BindInfo.ts index b03dbe6b2..eba1fe446 100644 --- a/sdk/base/lib/osBindings/BindInfo.ts +++ b/sdk/base/lib/osBindings/BindInfo.ts @@ -1,5 +1,5 @@ // 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 { NetInfo } from "./NetInfo" +import type { BindOptions } from './BindOptions' +import type { NetInfo } from './NetInfo' export type BindInfo = { enabled: boolean; options: BindOptions; net: NetInfo } diff --git a/sdk/base/lib/osBindings/BindOptions.ts b/sdk/base/lib/osBindings/BindOptions.ts index 49d9ecbf2..93859dce1 100644 --- a/sdk/base/lib/osBindings/BindOptions.ts +++ b/sdk/base/lib/osBindings/BindOptions.ts @@ -1,6 +1,6 @@ // 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 { Security } from "./Security" +import type { AddSslOptions } from './AddSslOptions' +import type { Security } from './Security' export type BindOptions = { preferredExternalPort: number diff --git a/sdk/base/lib/osBindings/BindParams.ts b/sdk/base/lib/osBindings/BindParams.ts index 9064a33b1..6f9879e28 100644 --- a/sdk/base/lib/osBindings/BindParams.ts +++ b/sdk/base/lib/osBindings/BindParams.ts @@ -1,7 +1,7 @@ // 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 { HostId } from "./HostId" -import type { Security } from "./Security" +import type { AddSslOptions } from './AddSslOptions' +import type { HostId } from './HostId' +import type { Security } from './Security' export type BindParams = { id: HostId diff --git a/sdk/base/lib/osBindings/BindingGatewaySetEnabledParams.ts b/sdk/base/lib/osBindings/BindingGatewaySetEnabledParams.ts index f38b5d095..fb90cdaa7 100644 --- a/sdk/base/lib/osBindings/BindingGatewaySetEnabledParams.ts +++ b/sdk/base/lib/osBindings/BindingGatewaySetEnabledParams.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { GatewayId } from "./GatewayId" +import type { GatewayId } from './GatewayId' export type BindingGatewaySetEnabledParams = { internalPort: number diff --git a/sdk/base/lib/osBindings/Blake3Commitment.ts b/sdk/base/lib/osBindings/Blake3Commitment.ts index 690559122..1d908aff8 100644 --- a/sdk/base/lib/osBindings/Blake3Commitment.ts +++ b/sdk/base/lib/osBindings/Blake3Commitment.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 { Base64 } from "./Base64" +import type { Base64 } from './Base64' export type Blake3Commitment = { hash: Base64; size: number } diff --git a/sdk/base/lib/osBindings/Category.ts b/sdk/base/lib/osBindings/Category.ts index cc2bc35ac..5f73bf438 100644 --- a/sdk/base/lib/osBindings/Category.ts +++ b/sdk/base/lib/osBindings/Category.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 { LocaleString } from "./LocaleString" +import type { LocaleString } from './LocaleString' export type Category = { name: LocaleString } diff --git a/sdk/base/lib/osBindings/CheckDependenciesParam.ts b/sdk/base/lib/osBindings/CheckDependenciesParam.ts index 3a00faf4f..c363a8435 100644 --- a/sdk/base/lib/osBindings/CheckDependenciesParam.ts +++ b/sdk/base/lib/osBindings/CheckDependenciesParam.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 { PackageId } from "./PackageId" +import type { PackageId } from './PackageId' export type CheckDependenciesParam = { packageIds?: Array } diff --git a/sdk/base/lib/osBindings/CheckDependenciesResult.ts b/sdk/base/lib/osBindings/CheckDependenciesResult.ts index 2ddce973d..34298cad4 100644 --- a/sdk/base/lib/osBindings/CheckDependenciesResult.ts +++ b/sdk/base/lib/osBindings/CheckDependenciesResult.ts @@ -1,10 +1,10 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { HealthCheckId } from "./HealthCheckId" -import type { NamedHealthCheckResult } from "./NamedHealthCheckResult" -import type { PackageId } from "./PackageId" -import type { ReplayId } from "./ReplayId" -import type { TaskEntry } from "./TaskEntry" -import type { Version } from "./Version" +import type { HealthCheckId } from './HealthCheckId' +import type { NamedHealthCheckResult } from './NamedHealthCheckResult' +import type { PackageId } from './PackageId' +import type { ReplayId } from './ReplayId' +import type { TaskEntry } from './TaskEntry' +import type { Version } from './Version' export type CheckDependenciesResult = { packageId: PackageId diff --git a/sdk/base/lib/osBindings/ClearActionsParams.ts b/sdk/base/lib/osBindings/ClearActionsParams.ts index 68cff676a..f8bc184be 100644 --- a/sdk/base/lib/osBindings/ClearActionsParams.ts +++ b/sdk/base/lib/osBindings/ClearActionsParams.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 { ActionId } from "./ActionId" +import type { ActionId } from './ActionId' export type ClearActionsParams = { except: Array } diff --git a/sdk/base/lib/osBindings/ClearBindingsParams.ts b/sdk/base/lib/osBindings/ClearBindingsParams.ts index 41f1d5741..c8120e165 100644 --- a/sdk/base/lib/osBindings/ClearBindingsParams.ts +++ b/sdk/base/lib/osBindings/ClearBindingsParams.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 { BindId } from "./BindId" +import type { BindId } from './BindId' export type ClearBindingsParams = { except: Array } diff --git a/sdk/base/lib/osBindings/ClearServiceInterfacesParams.ts b/sdk/base/lib/osBindings/ClearServiceInterfacesParams.ts index 02c177978..e09ca39ee 100644 --- a/sdk/base/lib/osBindings/ClearServiceInterfacesParams.ts +++ b/sdk/base/lib/osBindings/ClearServiceInterfacesParams.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 { ServiceInterfaceId } from "./ServiceInterfaceId" +import type { ServiceInterfaceId } from './ServiceInterfaceId' export type ClearServiceInterfacesParams = { except: Array } diff --git a/sdk/base/lib/osBindings/CreateSubcontainerFsParams.ts b/sdk/base/lib/osBindings/CreateSubcontainerFsParams.ts index 32d301e4a..0b3a6c92e 100644 --- a/sdk/base/lib/osBindings/CreateSubcontainerFsParams.ts +++ b/sdk/base/lib/osBindings/CreateSubcontainerFsParams.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ImageId } from "./ImageId" +import type { ImageId } from './ImageId' export type CreateSubcontainerFsParams = { imageId: ImageId diff --git a/sdk/base/lib/osBindings/CreateTaskParams.ts b/sdk/base/lib/osBindings/CreateTaskParams.ts index 0abb70f3b..f597a6bbc 100644 --- a/sdk/base/lib/osBindings/CreateTaskParams.ts +++ b/sdk/base/lib/osBindings/CreateTaskParams.ts @@ -1,10 +1,10 @@ // 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 { PackageId } from "./PackageId" -import type { ReplayId } from "./ReplayId" -import type { TaskInput } from "./TaskInput" -import type { TaskSeverity } from "./TaskSeverity" -import type { TaskTrigger } from "./TaskTrigger" +import type { ActionId } from './ActionId' +import type { PackageId } from './PackageId' +import type { ReplayId } from './ReplayId' +import type { TaskInput } from './TaskInput' +import type { TaskSeverity } from './TaskSeverity' +import type { TaskTrigger } from './TaskTrigger' export type CreateTaskParams = { replayId: ReplayId diff --git a/sdk/base/lib/osBindings/CurrentDependencies.ts b/sdk/base/lib/osBindings/CurrentDependencies.ts index 029a2f018..7ea6f3078 100644 --- a/sdk/base/lib/osBindings/CurrentDependencies.ts +++ b/sdk/base/lib/osBindings/CurrentDependencies.ts @@ -1,5 +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" +import type { CurrentDependencyInfo } from './CurrentDependencyInfo' +import type { PackageId } from './PackageId' export type CurrentDependencies = { [key: PackageId]: CurrentDependencyInfo } diff --git a/sdk/base/lib/osBindings/CurrentDependencyInfo.ts b/sdk/base/lib/osBindings/CurrentDependencyInfo.ts index aaabea857..a4d066685 100644 --- a/sdk/base/lib/osBindings/CurrentDependencyInfo.ts +++ b/sdk/base/lib/osBindings/CurrentDependencyInfo.ts @@ -1,9 +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" -import type { LocaleString } from "./LocaleString" +import type { DataUrl } from './DataUrl' +import type { LocaleString } from './LocaleString' export type CurrentDependencyInfo = { title: LocaleString | null icon: DataUrl | null versionRange: string -} & ({ kind: "exists" } | { kind: "running"; healthChecks: string[] }) +} & ({ kind: 'exists' } | { kind: 'running'; healthChecks: string[] }) diff --git a/sdk/base/lib/osBindings/DepInfo.ts b/sdk/base/lib/osBindings/DepInfo.ts index 47e2c9b2e..cd8e482cc 100644 --- a/sdk/base/lib/osBindings/DepInfo.ts +++ b/sdk/base/lib/osBindings/DepInfo.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { MetadataSrc } from "./MetadataSrc" +import type { MetadataSrc } from './MetadataSrc' export type DepInfo = { description: string | null diff --git a/sdk/base/lib/osBindings/Dependencies.ts b/sdk/base/lib/osBindings/Dependencies.ts index ad4c9b745..580e6620c 100644 --- a/sdk/base/lib/osBindings/Dependencies.ts +++ b/sdk/base/lib/osBindings/Dependencies.ts @@ -1,5 +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" +import type { DepInfo } from './DepInfo' +import type { PackageId } from './PackageId' export type Dependencies = { [key: PackageId]: DepInfo } diff --git a/sdk/base/lib/osBindings/DependencyMetadata.ts b/sdk/base/lib/osBindings/DependencyMetadata.ts index 1af1c2ba8..22f530a96 100644 --- a/sdk/base/lib/osBindings/DependencyMetadata.ts +++ b/sdk/base/lib/osBindings/DependencyMetadata.ts @@ -1,6 +1,6 @@ // 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" -import type { LocaleString } from "./LocaleString" +import type { DataUrl } from './DataUrl' +import type { LocaleString } from './LocaleString' export type DependencyMetadata = { title: LocaleString | null diff --git a/sdk/base/lib/osBindings/DependencyRequirement.ts b/sdk/base/lib/osBindings/DependencyRequirement.ts index 3b857c476..022e47e20 100644 --- a/sdk/base/lib/osBindings/DependencyRequirement.ts +++ b/sdk/base/lib/osBindings/DependencyRequirement.ts @@ -1,12 +1,12 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { HealthCheckId } from "./HealthCheckId" -import type { PackageId } from "./PackageId" +import type { HealthCheckId } from './HealthCheckId' +import type { PackageId } from './PackageId' export type DependencyRequirement = | { - kind: "running" + kind: 'running' id: PackageId healthChecks: Array versionRange: string } - | { kind: "exists"; id: PackageId; versionRange: string } + | { kind: 'exists'; id: PackageId; versionRange: string } diff --git a/sdk/base/lib/osBindings/Description.ts b/sdk/base/lib/osBindings/Description.ts index e69b2e90c..b27564041 100644 --- a/sdk/base/lib/osBindings/Description.ts +++ b/sdk/base/lib/osBindings/Description.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 { LocaleString } from "./LocaleString" +import type { LocaleString } from './LocaleString' export type Description = { short: LocaleString; long: LocaleString } diff --git a/sdk/base/lib/osBindings/DesiredStatus.ts b/sdk/base/lib/osBindings/DesiredStatus.ts index b0b755bae..72411a339 100644 --- a/sdk/base/lib/osBindings/DesiredStatus.ts +++ b/sdk/base/lib/osBindings/DesiredStatus.ts @@ -1,8 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { StartStop } from "./StartStop" +import type { StartStop } from './StartStop' export type DesiredStatus = - | { main: "stopped" } - | { main: "restarting" } - | { main: "running" } - | { main: "backing-up"; onComplete: StartStop } + | { main: 'stopped' } + | { main: 'restarting' } + | { main: 'running' } + | { main: 'backing-up'; onComplete: StartStop } diff --git a/sdk/base/lib/osBindings/DestroySubcontainerFsParams.ts b/sdk/base/lib/osBindings/DestroySubcontainerFsParams.ts index 3f85d2217..4dfa03baa 100644 --- a/sdk/base/lib/osBindings/DestroySubcontainerFsParams.ts +++ b/sdk/base/lib/osBindings/DestroySubcontainerFsParams.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 { Guid } from "./Guid" +import type { Guid } from './Guid' export type DestroySubcontainerFsParams = { guid: Guid } diff --git a/sdk/base/lib/osBindings/DeviceFilter.ts b/sdk/base/lib/osBindings/DeviceFilter.ts index c50468e37..3aadcdd41 100644 --- a/sdk/base/lib/osBindings/DeviceFilter.ts +++ b/sdk/base/lib/osBindings/DeviceFilter.ts @@ -2,7 +2,7 @@ export type DeviceFilter = { description: string - class: "processor" | "display" + class: 'processor' | 'display' product: string | null vendor: string | null capabilities?: Array diff --git a/sdk/base/lib/osBindings/DomainSettings.ts b/sdk/base/lib/osBindings/DomainSettings.ts index 276135926..0ba13bdab 100644 --- a/sdk/base/lib/osBindings/DomainSettings.ts +++ b/sdk/base/lib/osBindings/DomainSettings.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 { GatewayId } from "./GatewayId" +import type { GatewayId } from './GatewayId' export type DomainSettings = { gateway: GatewayId } diff --git a/sdk/base/lib/osBindings/EditSignerParams.ts b/sdk/base/lib/osBindings/EditSignerParams.ts index 9532709a6..d996a0b2a 100644 --- a/sdk/base/lib/osBindings/EditSignerParams.ts +++ b/sdk/base/lib/osBindings/EditSignerParams.ts @@ -1,7 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AnyVerifyingKey } from "./AnyVerifyingKey" -import type { ContactInfo } from "./ContactInfo" -import type { Guid } from "./Guid" +import type { AnyVerifyingKey } from './AnyVerifyingKey' +import type { ContactInfo } from './ContactInfo' +import type { Guid } from './Guid' export type EditSignerParams = { id: Guid diff --git a/sdk/base/lib/osBindings/EventId.ts b/sdk/base/lib/osBindings/EventId.ts index 4449fb8a3..643146925 100644 --- a/sdk/base/lib/osBindings/EventId.ts +++ b/sdk/base/lib/osBindings/EventId.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 { Guid } from "./Guid" +import type { Guid } from './Guid' export type EventId = { eventId: Guid } diff --git a/sdk/base/lib/osBindings/ExportActionParams.ts b/sdk/base/lib/osBindings/ExportActionParams.ts index d4aa33102..75e7c2b88 100644 --- a/sdk/base/lib/osBindings/ExportActionParams.ts +++ b/sdk/base/lib/osBindings/ExportActionParams.ts @@ -1,5 +1,5 @@ // 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 { ActionId } from './ActionId' +import type { ActionMetadata } from './ActionMetadata' export type ExportActionParams = { id: ActionId; metadata: ActionMetadata } diff --git a/sdk/base/lib/osBindings/ExportServiceInterfaceParams.ts b/sdk/base/lib/osBindings/ExportServiceInterfaceParams.ts index 675c3e06d..2b0b86ef4 100644 --- a/sdk/base/lib/osBindings/ExportServiceInterfaceParams.ts +++ b/sdk/base/lib/osBindings/ExportServiceInterfaceParams.ts @@ -1,7 +1,7 @@ // 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" +import type { AddressInfo } from './AddressInfo' +import type { ServiceInterfaceId } from './ServiceInterfaceId' +import type { ServiceInterfaceType } from './ServiceInterfaceType' export type ExportServiceInterfaceParams = { id: ServiceInterfaceId diff --git a/sdk/base/lib/osBindings/FileType.ts b/sdk/base/lib/osBindings/FileType.ts index 85eb97ad6..d48b8d302 100644 --- a/sdk/base/lib/osBindings/FileType.ts +++ b/sdk/base/lib/osBindings/FileType.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 FileType = "file" | "directory" | "infer" +export type FileType = 'file' | 'directory' | 'infer' diff --git a/sdk/base/lib/osBindings/FullIndex.ts b/sdk/base/lib/osBindings/FullIndex.ts index c7889760a..0bb66e8a8 100644 --- a/sdk/base/lib/osBindings/FullIndex.ts +++ b/sdk/base/lib/osBindings/FullIndex.ts @@ -1,9 +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" -import type { Guid } from "./Guid" -import type { OsIndex } from "./OsIndex" -import type { PackageIndex } from "./PackageIndex" -import type { SignerInfo } from "./SignerInfo" +import type { DataUrl } from './DataUrl' +import type { Guid } from './Guid' +import type { OsIndex } from './OsIndex' +import type { PackageIndex } from './PackageIndex' +import type { SignerInfo } from './SignerInfo' export type FullIndex = { name: string | null diff --git a/sdk/base/lib/osBindings/FullProgress.ts b/sdk/base/lib/osBindings/FullProgress.ts index 8961ea0e7..1a05b2263 100644 --- a/sdk/base/lib/osBindings/FullProgress.ts +++ b/sdk/base/lib/osBindings/FullProgress.ts @@ -1,5 +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" +import type { NamedProgress } from './NamedProgress' +import type { Progress } from './Progress' export type FullProgress = { overall: Progress; phases: Array } diff --git a/sdk/base/lib/osBindings/GatewayInfo.ts b/sdk/base/lib/osBindings/GatewayInfo.ts index 2bae94568..520183d4f 100644 --- a/sdk/base/lib/osBindings/GatewayInfo.ts +++ b/sdk/base/lib/osBindings/GatewayInfo.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 { GatewayId } from "./GatewayId" +import type { GatewayId } from './GatewayId' export type GatewayInfo = { id: GatewayId; name: string; public: boolean } diff --git a/sdk/base/lib/osBindings/GetActionInputParams.ts b/sdk/base/lib/osBindings/GetActionInputParams.ts index 568ceb907..3142ca2f0 100644 --- a/sdk/base/lib/osBindings/GetActionInputParams.ts +++ b/sdk/base/lib/osBindings/GetActionInputParams.ts @@ -1,5 +1,5 @@ // 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 { PackageId } from "./PackageId" +import type { ActionId } from './ActionId' +import type { PackageId } from './PackageId' export type GetActionInputParams = { packageId?: PackageId; actionId: ActionId } diff --git a/sdk/base/lib/osBindings/GetContainerIpParams.ts b/sdk/base/lib/osBindings/GetContainerIpParams.ts index 2c84b4960..5dbfd50f9 100644 --- a/sdk/base/lib/osBindings/GetContainerIpParams.ts +++ b/sdk/base/lib/osBindings/GetContainerIpParams.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CallbackId } from "./CallbackId" -import type { PackageId } from "./PackageId" +import type { CallbackId } from './CallbackId' +import type { PackageId } from './PackageId' export type GetContainerIpParams = { packageId?: PackageId diff --git a/sdk/base/lib/osBindings/GetHostInfoParams.ts b/sdk/base/lib/osBindings/GetHostInfoParams.ts index ff6d9d709..13fe57b6a 100644 --- a/sdk/base/lib/osBindings/GetHostInfoParams.ts +++ b/sdk/base/lib/osBindings/GetHostInfoParams.ts @@ -1,7 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CallbackId } from "./CallbackId" -import type { HostId } from "./HostId" -import type { PackageId } from "./PackageId" +import type { CallbackId } from './CallbackId' +import type { HostId } from './HostId' +import type { PackageId } from './PackageId' export type GetHostInfoParams = { hostId: HostId diff --git a/sdk/base/lib/osBindings/GetPackageParams.ts b/sdk/base/lib/osBindings/GetPackageParams.ts index ecee3173f..934f88de8 100644 --- a/sdk/base/lib/osBindings/GetPackageParams.ts +++ b/sdk/base/lib/osBindings/GetPackageParams.ts @@ -1,7 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { PackageDetailLevel } from "./PackageDetailLevel" -import type { PackageId } from "./PackageId" -import type { Version } from "./Version" +import type { PackageDetailLevel } from './PackageDetailLevel' +import type { PackageId } from './PackageId' +import type { Version } from './Version' export type GetPackageParams = { id: PackageId | null diff --git a/sdk/base/lib/osBindings/GetPackageResponse.ts b/sdk/base/lib/osBindings/GetPackageResponse.ts index 3e1dd4e9d..8e8b11a3d 100644 --- a/sdk/base/lib/osBindings/GetPackageResponse.ts +++ b/sdk/base/lib/osBindings/GetPackageResponse.ts @@ -1,7 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { PackageInfoShort } from "./PackageInfoShort" -import type { PackageVersionInfo } from "./PackageVersionInfo" -import type { Version } from "./Version" +import type { PackageInfoShort } from './PackageInfoShort' +import type { PackageVersionInfo } from './PackageVersionInfo' +import type { Version } from './Version' export type GetPackageResponse = { categories: string[] diff --git a/sdk/base/lib/osBindings/GetPackageResponseFull.ts b/sdk/base/lib/osBindings/GetPackageResponseFull.ts index e375dd489..0f4f4357f 100644 --- a/sdk/base/lib/osBindings/GetPackageResponseFull.ts +++ b/sdk/base/lib/osBindings/GetPackageResponseFull.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { PackageVersionInfo } from "./PackageVersionInfo" -import type { Version } from "./Version" +import type { PackageVersionInfo } from './PackageVersionInfo' +import type { Version } from './Version' export type GetPackageResponseFull = { categories: string[] diff --git a/sdk/base/lib/osBindings/GetServiceInterfaceParams.ts b/sdk/base/lib/osBindings/GetServiceInterfaceParams.ts index b71591e17..16a072d99 100644 --- a/sdk/base/lib/osBindings/GetServiceInterfaceParams.ts +++ b/sdk/base/lib/osBindings/GetServiceInterfaceParams.ts @@ -1,7 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CallbackId } from "./CallbackId" -import type { PackageId } from "./PackageId" -import type { ServiceInterfaceId } from "./ServiceInterfaceId" +import type { CallbackId } from './CallbackId' +import type { PackageId } from './PackageId' +import type { ServiceInterfaceId } from './ServiceInterfaceId' export type GetServiceInterfaceParams = { packageId?: PackageId diff --git a/sdk/base/lib/osBindings/GetServiceManifestParams.ts b/sdk/base/lib/osBindings/GetServiceManifestParams.ts index ff9da8112..021886938 100644 --- a/sdk/base/lib/osBindings/GetServiceManifestParams.ts +++ b/sdk/base/lib/osBindings/GetServiceManifestParams.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CallbackId } from "./CallbackId" -import type { PackageId } from "./PackageId" +import type { CallbackId } from './CallbackId' +import type { PackageId } from './PackageId' export type GetServiceManifestParams = { packageId: PackageId diff --git a/sdk/base/lib/osBindings/GetServicePortForwardParams.ts b/sdk/base/lib/osBindings/GetServicePortForwardParams.ts index 63236328e..48e606199 100644 --- a/sdk/base/lib/osBindings/GetServicePortForwardParams.ts +++ b/sdk/base/lib/osBindings/GetServicePortForwardParams.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { HostId } from "./HostId" -import type { PackageId } from "./PackageId" +import type { HostId } from './HostId' +import type { PackageId } from './PackageId' export type GetServicePortForwardParams = { packageId?: PackageId diff --git a/sdk/base/lib/osBindings/GetSslCertificateParams.ts b/sdk/base/lib/osBindings/GetSslCertificateParams.ts index 85c677540..06b8ddf46 100644 --- a/sdk/base/lib/osBindings/GetSslCertificateParams.ts +++ b/sdk/base/lib/osBindings/GetSslCertificateParams.ts @@ -1,6 +1,6 @@ // 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" -import type { CallbackId } from "./CallbackId" +import type { Algorithm } from './Algorithm' +import type { CallbackId } from './CallbackId' export type GetSslCertificateParams = { hostnames: string[] diff --git a/sdk/base/lib/osBindings/GetSslKeyParams.ts b/sdk/base/lib/osBindings/GetSslKeyParams.ts index 2ca3076c8..1fe36b232 100644 --- a/sdk/base/lib/osBindings/GetSslKeyParams.ts +++ b/sdk/base/lib/osBindings/GetSslKeyParams.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 { Algorithm } from "./Algorithm" +import type { Algorithm } from './Algorithm' export type GetSslKeyParams = { hostnames: string[]; algorithm?: Algorithm } diff --git a/sdk/base/lib/osBindings/GetStatusParams.ts b/sdk/base/lib/osBindings/GetStatusParams.ts index a0fbe3bfc..9603078b7 100644 --- a/sdk/base/lib/osBindings/GetStatusParams.ts +++ b/sdk/base/lib/osBindings/GetStatusParams.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CallbackId } from "./CallbackId" -import type { PackageId } from "./PackageId" +import type { CallbackId } from './CallbackId' +import type { PackageId } from './PackageId' export type GetStatusParams = { packageId?: PackageId; callback?: CallbackId } diff --git a/sdk/base/lib/osBindings/GetSystemSmtpParams.ts b/sdk/base/lib/osBindings/GetSystemSmtpParams.ts index 73b91057c..3177cd6b9 100644 --- a/sdk/base/lib/osBindings/GetSystemSmtpParams.ts +++ b/sdk/base/lib/osBindings/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 { CallbackId } from "./CallbackId" +import type { CallbackId } from './CallbackId' export type GetSystemSmtpParams = { callback: CallbackId | null } diff --git a/sdk/base/lib/osBindings/HardwareRequirements.ts b/sdk/base/lib/osBindings/HardwareRequirements.ts index d420f846b..eaa7b1afd 100644 --- a/sdk/base/lib/osBindings/HardwareRequirements.ts +++ b/sdk/base/lib/osBindings/HardwareRequirements.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { DeviceFilter } from "./DeviceFilter" +import type { DeviceFilter } from './DeviceFilter' export type HardwareRequirements = { device: Array diff --git a/sdk/base/lib/osBindings/Host.ts b/sdk/base/lib/osBindings/Host.ts index 33352f9d6..e34af2ae8 100644 --- a/sdk/base/lib/osBindings/Host.ts +++ b/sdk/base/lib/osBindings/Host.ts @@ -1,7 +1,7 @@ // 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 { HostnameInfo } from "./HostnameInfo" -import type { PublicDomainConfig } from "./PublicDomainConfig" +import type { BindInfo } from './BindInfo' +import type { HostnameInfo } from './HostnameInfo' +import type { PublicDomainConfig } from './PublicDomainConfig' export type Host = { bindings: { [key: number]: BindInfo } diff --git a/sdk/base/lib/osBindings/HostnameInfo.ts b/sdk/base/lib/osBindings/HostnameInfo.ts index 26dc76c67..f2bb5e226 100644 --- a/sdk/base/lib/osBindings/HostnameInfo.ts +++ b/sdk/base/lib/osBindings/HostnameInfo.ts @@ -1,8 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { GatewayInfo } from "./GatewayInfo" -import type { IpHostname } from "./IpHostname" -import type { OnionHostname } from "./OnionHostname" +import type { GatewayInfo } from './GatewayInfo' +import type { IpHostname } from './IpHostname' +import type { OnionHostname } from './OnionHostname' export type HostnameInfo = - | { kind: "ip"; gateway: GatewayInfo; public: boolean; hostname: IpHostname } - | { kind: "onion"; hostname: OnionHostname } + | { kind: 'ip'; gateway: GatewayInfo; public: boolean; hostname: IpHostname } + | { kind: 'onion'; hostname: OnionHostname } diff --git a/sdk/base/lib/osBindings/Hosts.ts b/sdk/base/lib/osBindings/Hosts.ts index c7aa84996..1e2b88109 100644 --- a/sdk/base/lib/osBindings/Hosts.ts +++ b/sdk/base/lib/osBindings/Hosts.ts @@ -1,5 +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" +import type { Host } from './Host' +import type { HostId } from './HostId' export type Hosts = { [key: HostId]: Host } diff --git a/sdk/base/lib/osBindings/ImageConfig.ts b/sdk/base/lib/osBindings/ImageConfig.ts index 8a53a8450..bda158e31 100644 --- a/sdk/base/lib/osBindings/ImageConfig.ts +++ b/sdk/base/lib/osBindings/ImageConfig.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ImageSource } from "./ImageSource" +import type { ImageSource } from './ImageSource' export type ImageConfig = { source: ImageSource diff --git a/sdk/base/lib/osBindings/ImageSource.ts b/sdk/base/lib/osBindings/ImageSource.ts index d8f876aef..b665d1477 100644 --- a/sdk/base/lib/osBindings/ImageSource.ts +++ b/sdk/base/lib/osBindings/ImageSource.ts @@ -1,8 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { BuildArg } from "./BuildArg" +import type { BuildArg } from './BuildArg' export type ImageSource = - | "packed" + | 'packed' | { dockerBuild: { workdir?: string diff --git a/sdk/base/lib/osBindings/InitProgressRes.ts b/sdk/base/lib/osBindings/InitProgressRes.ts index 38caf7bdb..e42870a5b 100644 --- a/sdk/base/lib/osBindings/InitProgressRes.ts +++ b/sdk/base/lib/osBindings/InitProgressRes.ts @@ -1,5 +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 { Guid } from "./Guid" +import type { FullProgress } from './FullProgress' +import type { Guid } from './Guid' export type InitProgressRes = { progress: FullProgress; guid: Guid } diff --git a/sdk/base/lib/osBindings/InstallParams.ts b/sdk/base/lib/osBindings/InstallParams.ts index 2b70ad593..82d121163 100644 --- a/sdk/base/lib/osBindings/InstallParams.ts +++ b/sdk/base/lib/osBindings/InstallParams.ts @@ -1,6 +1,6 @@ // 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" -import type { Version } from "./Version" +import type { PackageId } from './PackageId' +import type { Version } from './Version' export type InstallParams = { registry: string diff --git a/sdk/base/lib/osBindings/InstalledState.ts b/sdk/base/lib/osBindings/InstalledState.ts index 48177287e..6cfb1f021 100644 --- a/sdk/base/lib/osBindings/InstalledState.ts +++ b/sdk/base/lib/osBindings/InstalledState.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 { Manifest } from "./Manifest" +import type { Manifest } from './Manifest' export type InstalledState = { manifest: Manifest } diff --git a/sdk/base/lib/osBindings/InstalledVersionParams.ts b/sdk/base/lib/osBindings/InstalledVersionParams.ts index 637f9b6ce..9edbc86e8 100644 --- a/sdk/base/lib/osBindings/InstalledVersionParams.ts +++ b/sdk/base/lib/osBindings/InstalledVersionParams.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 { PackageId } from "./PackageId" +import type { PackageId } from './PackageId' export type InstalledVersionParams = { id: PackageId } diff --git a/sdk/base/lib/osBindings/InstallingInfo.ts b/sdk/base/lib/osBindings/InstallingInfo.ts index 6b77b49d9..bbf3536a6 100644 --- a/sdk/base/lib/osBindings/InstallingInfo.ts +++ b/sdk/base/lib/osBindings/InstallingInfo.ts @@ -1,5 +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" +import type { FullProgress } from './FullProgress' +import type { Manifest } from './Manifest' export type InstallingInfo = { newManifest: Manifest; progress: FullProgress } diff --git a/sdk/base/lib/osBindings/InstallingState.ts b/sdk/base/lib/osBindings/InstallingState.ts index db752df90..cfec10b81 100644 --- a/sdk/base/lib/osBindings/InstallingState.ts +++ b/sdk/base/lib/osBindings/InstallingState.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 { InstallingInfo } from "./InstallingInfo" +import type { InstallingInfo } from './InstallingInfo' export type InstallingState = { installingInfo: InstallingInfo } diff --git a/sdk/base/lib/osBindings/IpHostname.ts b/sdk/base/lib/osBindings/IpHostname.ts index 0fb7c3f3c..6f6be463f 100644 --- a/sdk/base/lib/osBindings/IpHostname.ts +++ b/sdk/base/lib/osBindings/IpHostname.ts @@ -1,22 +1,22 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. export type IpHostname = - | { kind: "ipv4"; value: string; port: number | null; sslPort: number | null } + | { kind: 'ipv4'; value: string; port: number | null; sslPort: number | null } | { - kind: "ipv6" + kind: 'ipv6' value: string scopeId: number port: number | null sslPort: number | null } | { - kind: "local" + kind: 'local' value: string port: number | null sslPort: number | null } | { - kind: "domain" + kind: 'domain' value: string port: number | null sslPort: number | null diff --git a/sdk/base/lib/osBindings/IpInfo.ts b/sdk/base/lib/osBindings/IpInfo.ts index 4fc21f163..8cc7e206e 100644 --- a/sdk/base/lib/osBindings/IpInfo.ts +++ b/sdk/base/lib/osBindings/IpInfo.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { NetworkInterfaceType } from "./NetworkInterfaceType" +import type { NetworkInterfaceType } from './NetworkInterfaceType' export type IpInfo = { name: string diff --git a/sdk/base/lib/osBindings/ListPackageSignersParams.ts b/sdk/base/lib/osBindings/ListPackageSignersParams.ts index 73cd6a745..8ab98249b 100644 --- a/sdk/base/lib/osBindings/ListPackageSignersParams.ts +++ b/sdk/base/lib/osBindings/ListPackageSignersParams.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 { PackageId } from "./PackageId" +import type { PackageId } from './PackageId' export type ListPackageSignersParams = { id: PackageId } diff --git a/sdk/base/lib/osBindings/ListServiceInterfacesParams.ts b/sdk/base/lib/osBindings/ListServiceInterfacesParams.ts index fd27ace2b..b767b9993 100644 --- a/sdk/base/lib/osBindings/ListServiceInterfacesParams.ts +++ b/sdk/base/lib/osBindings/ListServiceInterfacesParams.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CallbackId } from "./CallbackId" -import type { PackageId } from "./PackageId" +import type { CallbackId } from './CallbackId' +import type { PackageId } from './PackageId' export type ListServiceInterfacesParams = { packageId?: PackageId diff --git a/sdk/base/lib/osBindings/LshwDevice.ts b/sdk/base/lib/osBindings/LshwDevice.ts index f2c624be7..cd088a603 100644 --- a/sdk/base/lib/osBindings/LshwDevice.ts +++ b/sdk/base/lib/osBindings/LshwDevice.ts @@ -1,7 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { LshwDisplay } from "./LshwDisplay" -import type { LshwProcessor } from "./LshwProcessor" +import type { LshwDisplay } from './LshwDisplay' +import type { LshwProcessor } from './LshwProcessor' export type LshwDevice = - | ({ class: "processor" } & LshwProcessor) - | ({ class: "display" } & LshwDisplay) + | ({ class: 'processor' } & LshwProcessor) + | ({ class: 'display' } & LshwDisplay) diff --git a/sdk/base/lib/osBindings/Manifest.ts b/sdk/base/lib/osBindings/Manifest.ts index 30b7068f2..98af5c018 100644 --- a/sdk/base/lib/osBindings/Manifest.ts +++ b/sdk/base/lib/osBindings/Manifest.ts @@ -1,15 +1,15 @@ // 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 { GitHash } from "./GitHash" -import type { HardwareRequirements } from "./HardwareRequirements" -import type { ImageConfig } from "./ImageConfig" -import type { ImageId } from "./ImageId" -import type { LocaleString } from "./LocaleString" -import type { PackageId } from "./PackageId" -import type { Version } from "./Version" -import type { VolumeId } from "./VolumeId" +import type { Alerts } from './Alerts' +import type { Dependencies } from './Dependencies' +import type { Description } from './Description' +import type { GitHash } from './GitHash' +import type { HardwareRequirements } from './HardwareRequirements' +import type { ImageConfig } from './ImageConfig' +import type { ImageId } from './ImageId' +import type { LocaleString } from './LocaleString' +import type { PackageId } from './PackageId' +import type { Version } from './Version' +import type { VolumeId } from './VolumeId' export type Manifest = { id: PackageId diff --git a/sdk/base/lib/osBindings/MerkleArchiveCommitment.ts b/sdk/base/lib/osBindings/MerkleArchiveCommitment.ts index 5dcaa0aa3..1fecbef81 100644 --- a/sdk/base/lib/osBindings/MerkleArchiveCommitment.ts +++ b/sdk/base/lib/osBindings/MerkleArchiveCommitment.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Base64 } from "./Base64" +import type { Base64 } from './Base64' export type MerkleArchiveCommitment = { rootSighash: Base64 diff --git a/sdk/base/lib/osBindings/Metadata.ts b/sdk/base/lib/osBindings/Metadata.ts index 842fa17b6..d4c48e14a 100644 --- a/sdk/base/lib/osBindings/Metadata.ts +++ b/sdk/base/lib/osBindings/Metadata.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { LocaleString } from "./LocaleString" -import type { PathOrUrl } from "./PathOrUrl" +import type { LocaleString } from './LocaleString' +import type { PathOrUrl } from './PathOrUrl' export type Metadata = { title: LocaleString; icon: PathOrUrl } diff --git a/sdk/base/lib/osBindings/MetadataSrc.ts b/sdk/base/lib/osBindings/MetadataSrc.ts index 7a386636d..37acf6a77 100644 --- a/sdk/base/lib/osBindings/MetadataSrc.ts +++ b/sdk/base/lib/osBindings/MetadataSrc.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Metadata } from "./Metadata" -import type { PathOrUrl } from "./PathOrUrl" +import type { Metadata } from './Metadata' +import type { PathOrUrl } from './PathOrUrl' export type MetadataSrc = { metadata: Metadata } | { s9pk: PathOrUrl | null } diff --git a/sdk/base/lib/osBindings/Metrics.ts b/sdk/base/lib/osBindings/Metrics.ts index 7a4be1648..9bf81ff26 100644 --- a/sdk/base/lib/osBindings/Metrics.ts +++ b/sdk/base/lib/osBindings/Metrics.ts @@ -1,8 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { MetricsCpu } from "./MetricsCpu" -import type { MetricsDisk } from "./MetricsDisk" -import type { MetricsGeneral } from "./MetricsGeneral" -import type { MetricsMemory } from "./MetricsMemory" +import type { MetricsCpu } from './MetricsCpu' +import type { MetricsDisk } from './MetricsDisk' +import type { MetricsGeneral } from './MetricsGeneral' +import type { MetricsMemory } from './MetricsMemory' export type Metrics = { general: MetricsGeneral diff --git a/sdk/base/lib/osBindings/MetricsCpu.ts b/sdk/base/lib/osBindings/MetricsCpu.ts index 3576bd8c0..e67794752 100644 --- a/sdk/base/lib/osBindings/MetricsCpu.ts +++ b/sdk/base/lib/osBindings/MetricsCpu.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Percentage } from "./Percentage" +import type { Percentage } from './Percentage' export type MetricsCpu = { percentageUsed: Percentage diff --git a/sdk/base/lib/osBindings/MetricsDisk.ts b/sdk/base/lib/osBindings/MetricsDisk.ts index 2085b780d..c4a9c6feb 100644 --- a/sdk/base/lib/osBindings/MetricsDisk.ts +++ b/sdk/base/lib/osBindings/MetricsDisk.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { GigaBytes } from "./GigaBytes" -import type { Percentage } from "./Percentage" +import type { GigaBytes } from './GigaBytes' +import type { Percentage } from './Percentage' export type MetricsDisk = { percentageUsed: Percentage diff --git a/sdk/base/lib/osBindings/MetricsGeneral.ts b/sdk/base/lib/osBindings/MetricsGeneral.ts index 9376e12ee..1e9984316 100644 --- a/sdk/base/lib/osBindings/MetricsGeneral.ts +++ b/sdk/base/lib/osBindings/MetricsGeneral.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 { Celsius } from "./Celsius" +import type { Celsius } from './Celsius' export type MetricsGeneral = { temperature: Celsius | null } diff --git a/sdk/base/lib/osBindings/MetricsMemory.ts b/sdk/base/lib/osBindings/MetricsMemory.ts index 36c576757..7451fcf3d 100644 --- a/sdk/base/lib/osBindings/MetricsMemory.ts +++ b/sdk/base/lib/osBindings/MetricsMemory.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { MebiBytes } from "./MebiBytes" -import type { Percentage } from "./Percentage" +import type { MebiBytes } from './MebiBytes' +import type { Percentage } from './Percentage' export type MetricsMemory = { percentageUsed: Percentage diff --git a/sdk/base/lib/osBindings/MountParams.ts b/sdk/base/lib/osBindings/MountParams.ts index 778983fd6..ab8f7465f 100644 --- a/sdk/base/lib/osBindings/MountParams.ts +++ b/sdk/base/lib/osBindings/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" +import type { MountTarget } from './MountTarget' export type MountParams = { location: string; target: MountTarget } diff --git a/sdk/base/lib/osBindings/MountTarget.ts b/sdk/base/lib/osBindings/MountTarget.ts index 22579f6eb..bfbd0b8dc 100644 --- a/sdk/base/lib/osBindings/MountTarget.ts +++ b/sdk/base/lib/osBindings/MountTarget.ts @@ -1,7 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { IdMap } from "./IdMap" -import type { PackageId } from "./PackageId" -import type { VolumeId } from "./VolumeId" +import type { IdMap } from './IdMap' +import type { PackageId } from './PackageId' +import type { VolumeId } from './VolumeId' export type MountTarget = { packageId: PackageId diff --git a/sdk/base/lib/osBindings/NamedHealthCheckResult.ts b/sdk/base/lib/osBindings/NamedHealthCheckResult.ts index c51254438..56851e3c0 100644 --- a/sdk/base/lib/osBindings/NamedHealthCheckResult.ts +++ b/sdk/base/lib/osBindings/NamedHealthCheckResult.ts @@ -1,10 +1,10 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. export type NamedHealthCheckResult = { name: string } & ( - | { result: "success"; message: string | null } - | { result: "disabled"; message: string | null } - | { result: "starting"; message: string | null } - | { result: "waiting"; message: string | null } - | { result: "loading"; message: string } - | { result: "failure"; message: string } + | { result: 'success'; message: string | null } + | { result: 'disabled'; message: string | null } + | { result: 'starting'; message: string | null } + | { result: 'waiting'; message: string | null } + | { result: 'loading'; message: string } + | { result: 'failure'; message: string } ) diff --git a/sdk/base/lib/osBindings/NamedProgress.ts b/sdk/base/lib/osBindings/NamedProgress.ts index 52a410a51..06ba4367b 100644 --- a/sdk/base/lib/osBindings/NamedProgress.ts +++ b/sdk/base/lib/osBindings/NamedProgress.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 { Progress } from "./Progress" +import type { Progress } from './Progress' export type NamedProgress = { name: string; progress: Progress } diff --git a/sdk/base/lib/osBindings/NetInfo.ts b/sdk/base/lib/osBindings/NetInfo.ts index 6ac8c4204..4483f81b8 100644 --- a/sdk/base/lib/osBindings/NetInfo.ts +++ b/sdk/base/lib/osBindings/NetInfo.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { GatewayId } from "./GatewayId" +import type { GatewayId } from './GatewayId' export type NetInfo = { privateDisabled: Array diff --git a/sdk/base/lib/osBindings/NetworkInfo.ts b/sdk/base/lib/osBindings/NetworkInfo.ts index 514e2931f..5debd58d1 100644 --- a/sdk/base/lib/osBindings/NetworkInfo.ts +++ b/sdk/base/lib/osBindings/NetworkInfo.ts @@ -1,11 +1,11 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AcmeProvider } from "./AcmeProvider" -import type { AcmeSettings } from "./AcmeSettings" -import type { DnsSettings } from "./DnsSettings" -import type { GatewayId } from "./GatewayId" -import type { Host } from "./Host" -import type { NetworkInterfaceInfo } from "./NetworkInterfaceInfo" -import type { WifiInfo } from "./WifiInfo" +import type { AcmeProvider } from './AcmeProvider' +import type { AcmeSettings } from './AcmeSettings' +import type { DnsSettings } from './DnsSettings' +import type { GatewayId } from './GatewayId' +import type { Host } from './Host' +import type { NetworkInterfaceInfo } from './NetworkInterfaceInfo' +import type { WifiInfo } from './WifiInfo' export type NetworkInfo = { wifi: WifiInfo diff --git a/sdk/base/lib/osBindings/NetworkInterfaceInfo.ts b/sdk/base/lib/osBindings/NetworkInterfaceInfo.ts index 8c3f5dca5..dd3be99d9 100644 --- a/sdk/base/lib/osBindings/NetworkInterfaceInfo.ts +++ b/sdk/base/lib/osBindings/NetworkInterfaceInfo.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { IpInfo } from "./IpInfo" +import type { IpInfo } from './IpInfo' export type NetworkInterfaceInfo = { name: string | null diff --git a/sdk/base/lib/osBindings/NetworkInterfaceType.ts b/sdk/base/lib/osBindings/NetworkInterfaceType.ts index d04c37ca2..6c0d9c363 100644 --- a/sdk/base/lib/osBindings/NetworkInterfaceType.ts +++ b/sdk/base/lib/osBindings/NetworkInterfaceType.ts @@ -1,8 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. export type NetworkInterfaceType = - | "ethernet" - | "wireless" - | "bridge" - | "wireguard" - | "loopback" + | 'ethernet' + | 'wireless' + | 'bridge' + | 'wireguard' + | 'loopback' diff --git a/sdk/base/lib/osBindings/OsIndex.ts b/sdk/base/lib/osBindings/OsIndex.ts index fe9a4e395..010c8508a 100644 --- a/sdk/base/lib/osBindings/OsIndex.ts +++ b/sdk/base/lib/osBindings/OsIndex.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 { OsVersionInfoMap } from "./OsVersionInfoMap" +import type { OsVersionInfoMap } from './OsVersionInfoMap' export type OsIndex = { versions: OsVersionInfoMap } diff --git a/sdk/base/lib/osBindings/OsVersionInfo.ts b/sdk/base/lib/osBindings/OsVersionInfo.ts index a88115350..1cc4cb067 100644 --- a/sdk/base/lib/osBindings/OsVersionInfo.ts +++ b/sdk/base/lib/osBindings/OsVersionInfo.ts @@ -1,7 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Blake3Commitment } from "./Blake3Commitment" -import type { Guid } from "./Guid" -import type { RegistryAsset } from "./RegistryAsset" +import type { Blake3Commitment } from './Blake3Commitment' +import type { Guid } from './Guid' +import type { RegistryAsset } from './RegistryAsset' export type OsVersionInfo = { headline: string diff --git a/sdk/base/lib/osBindings/OsVersionInfoMap.ts b/sdk/base/lib/osBindings/OsVersionInfoMap.ts index 6f333f1fb..6cc842087 100644 --- a/sdk/base/lib/osBindings/OsVersionInfoMap.ts +++ b/sdk/base/lib/osBindings/OsVersionInfoMap.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 { OsVersionInfo } from "./OsVersionInfo" +import type { OsVersionInfo } from './OsVersionInfo' export type OsVersionInfoMap = { [key: string]: OsVersionInfo } diff --git a/sdk/base/lib/osBindings/PackageDataEntry.ts b/sdk/base/lib/osBindings/PackageDataEntry.ts index 857ff9e07..05188c792 100644 --- a/sdk/base/lib/osBindings/PackageDataEntry.ts +++ b/sdk/base/lib/osBindings/PackageDataEntry.ts @@ -1,15 +1,15 @@ // 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 { Hosts } from "./Hosts" -import type { PackageState } from "./PackageState" -import type { ReplayId } from "./ReplayId" -import type { ServiceInterface } from "./ServiceInterface" -import type { ServiceInterfaceId } from "./ServiceInterfaceId" -import type { StatusInfo } from "./StatusInfo" -import type { TaskEntry } from "./TaskEntry" +import type { ActionId } from './ActionId' +import type { ActionMetadata } from './ActionMetadata' +import type { CurrentDependencies } from './CurrentDependencies' +import type { DataUrl } from './DataUrl' +import type { Hosts } from './Hosts' +import type { PackageState } from './PackageState' +import type { ReplayId } from './ReplayId' +import type { ServiceInterface } from './ServiceInterface' +import type { ServiceInterfaceId } from './ServiceInterfaceId' +import type { StatusInfo } from './StatusInfo' +import type { TaskEntry } from './TaskEntry' export type PackageDataEntry = { stateInfo: PackageState diff --git a/sdk/base/lib/osBindings/PackageDetailLevel.ts b/sdk/base/lib/osBindings/PackageDetailLevel.ts index f2016f632..977048973 100644 --- a/sdk/base/lib/osBindings/PackageDetailLevel.ts +++ b/sdk/base/lib/osBindings/PackageDetailLevel.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 PackageDetailLevel = "none" | "short" | "full" +export type PackageDetailLevel = 'none' | 'short' | 'full' diff --git a/sdk/base/lib/osBindings/PackageIndex.ts b/sdk/base/lib/osBindings/PackageIndex.ts index 5e8c94945..55a83779d 100644 --- a/sdk/base/lib/osBindings/PackageIndex.ts +++ b/sdk/base/lib/osBindings/PackageIndex.ts @@ -1,7 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Category } from "./Category" -import type { PackageId } from "./PackageId" -import type { PackageInfo } from "./PackageInfo" +import type { Category } from './Category' +import type { PackageId } from './PackageId' +import type { PackageInfo } from './PackageInfo' export type PackageIndex = { categories: { [key: string]: Category } diff --git a/sdk/base/lib/osBindings/PackageInfo.ts b/sdk/base/lib/osBindings/PackageInfo.ts index 9e630bed0..63a2253ec 100644 --- a/sdk/base/lib/osBindings/PackageInfo.ts +++ b/sdk/base/lib/osBindings/PackageInfo.ts @@ -1,7 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Guid } from "./Guid" -import type { PackageVersionInfo } from "./PackageVersionInfo" -import type { Version } from "./Version" +import type { Guid } from './Guid' +import type { PackageVersionInfo } from './PackageVersionInfo' +import type { Version } from './Version' export type PackageInfo = { authorized: { [key: Guid]: string } diff --git a/sdk/base/lib/osBindings/PackageState.ts b/sdk/base/lib/osBindings/PackageState.ts index fd15076ca..5f3d5b2b5 100644 --- a/sdk/base/lib/osBindings/PackageState.ts +++ b/sdk/base/lib/osBindings/PackageState.ts @@ -1,11 +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" +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) + | ({ state: 'installing' } & InstallingState) + | ({ state: 'restoring' } & InstallingState) + | ({ state: 'updating' } & UpdatingState) + | ({ state: 'installed' } & InstalledState) + | ({ state: 'removing' } & InstalledState) diff --git a/sdk/base/lib/osBindings/PackageVersionInfo.ts b/sdk/base/lib/osBindings/PackageVersionInfo.ts index f11249acc..e3a7c28b9 100644 --- a/sdk/base/lib/osBindings/PackageVersionInfo.ts +++ b/sdk/base/lib/osBindings/PackageVersionInfo.ts @@ -1,14 +1,14 @@ // 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 { DataUrl } from "./DataUrl" -import type { DependencyMetadata } from "./DependencyMetadata" -import type { Description } from "./Description" -import type { GitHash } from "./GitHash" -import type { HardwareRequirements } from "./HardwareRequirements" -import type { LocaleString } from "./LocaleString" -import type { MerkleArchiveCommitment } from "./MerkleArchiveCommitment" -import type { PackageId } from "./PackageId" -import type { RegistryAsset } from "./RegistryAsset" +import type { Alerts } from './Alerts' +import type { DataUrl } from './DataUrl' +import type { DependencyMetadata } from './DependencyMetadata' +import type { Description } from './Description' +import type { GitHash } from './GitHash' +import type { HardwareRequirements } from './HardwareRequirements' +import type { LocaleString } from './LocaleString' +import type { MerkleArchiveCommitment } from './MerkleArchiveCommitment' +import type { PackageId } from './PackageId' +import type { RegistryAsset } from './RegistryAsset' export type PackageVersionInfo = { sourceVersion: string | null diff --git a/sdk/base/lib/osBindings/PasswordType.ts b/sdk/base/lib/osBindings/PasswordType.ts index 7fdcc0f5d..e391b8a8a 100644 --- a/sdk/base/lib/osBindings/PasswordType.ts +++ b/sdk/base/lib/osBindings/PasswordType.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 { EncryptedWire } from "./EncryptedWire" +import type { EncryptedWire } from './EncryptedWire' export type PasswordType = EncryptedWire | string diff --git a/sdk/base/lib/osBindings/Progress.ts b/sdk/base/lib/osBindings/Progress.ts index 1ed91afdb..632ea8917 100644 --- a/sdk/base/lib/osBindings/Progress.ts +++ b/sdk/base/lib/osBindings/Progress.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ProgressUnits } from "./ProgressUnits" +import type { ProgressUnits } from './ProgressUnits' export type Progress = | null diff --git a/sdk/base/lib/osBindings/ProgressUnits.ts b/sdk/base/lib/osBindings/ProgressUnits.ts index 44f81fc73..b65b75885 100644 --- a/sdk/base/lib/osBindings/ProgressUnits.ts +++ b/sdk/base/lib/osBindings/ProgressUnits.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 ProgressUnits = "bytes" | "steps" +export type ProgressUnits = 'bytes' | 'steps' diff --git a/sdk/base/lib/osBindings/Public.ts b/sdk/base/lib/osBindings/Public.ts index 4fb186607..cb24ca991 100644 --- a/sdk/base/lib/osBindings/Public.ts +++ b/sdk/base/lib/osBindings/Public.ts @@ -1,6 +1,6 @@ // 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" +import type { AllPackageData } from './AllPackageData' +import type { ServerInfo } from './ServerInfo' export type Public = { serverInfo: ServerInfo diff --git a/sdk/base/lib/osBindings/PublicDomainConfig.ts b/sdk/base/lib/osBindings/PublicDomainConfig.ts index d4058eccd..34a0d6ea2 100644 --- a/sdk/base/lib/osBindings/PublicDomainConfig.ts +++ b/sdk/base/lib/osBindings/PublicDomainConfig.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AcmeProvider } from "./AcmeProvider" -import type { GatewayId } from "./GatewayId" +import type { AcmeProvider } from './AcmeProvider' +import type { GatewayId } from './GatewayId' export type PublicDomainConfig = { gateway: GatewayId diff --git a/sdk/base/lib/osBindings/RecoverySource.ts b/sdk/base/lib/osBindings/RecoverySource.ts index 40061f215..f97feaf9a 100644 --- a/sdk/base/lib/osBindings/RecoverySource.ts +++ b/sdk/base/lib/osBindings/RecoverySource.ts @@ -1,10 +1,10 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { BackupTargetFS } from "./BackupTargetFS" +import type { BackupTargetFS } from './BackupTargetFS' export type RecoverySource = - | { type: "migrate"; guid: string } + | { type: 'migrate'; guid: string } | { - type: "backup" + type: 'backup' target: BackupTargetFS password: Password serverId: string diff --git a/sdk/base/lib/osBindings/RegistryAsset.ts b/sdk/base/lib/osBindings/RegistryAsset.ts index 3b8c85bf2..81866a452 100644 --- a/sdk/base/lib/osBindings/RegistryAsset.ts +++ b/sdk/base/lib/osBindings/RegistryAsset.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AnySignature } from "./AnySignature" -import type { AnyVerifyingKey } from "./AnyVerifyingKey" +import type { AnySignature } from './AnySignature' +import type { AnyVerifyingKey } from './AnyVerifyingKey' export type RegistryAsset = { publishedAt: string diff --git a/sdk/base/lib/osBindings/RegistryInfo.ts b/sdk/base/lib/osBindings/RegistryInfo.ts index f9265fdec..5be0ecd93 100644 --- a/sdk/base/lib/osBindings/RegistryInfo.ts +++ b/sdk/base/lib/osBindings/RegistryInfo.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Category } from "./Category" -import type { DataUrl } from "./DataUrl" +import type { Category } from './Category' +import type { DataUrl } from './DataUrl' export type RegistryInfo = { name: string | null diff --git a/sdk/base/lib/osBindings/RemoveAdminParams.ts b/sdk/base/lib/osBindings/RemoveAdminParams.ts index 80ca0e823..87f87f85a 100644 --- a/sdk/base/lib/osBindings/RemoveAdminParams.ts +++ b/sdk/base/lib/osBindings/RemoveAdminParams.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 { Guid } from "./Guid" +import type { Guid } from './Guid' export type RemoveAdminParams = { signer: Guid } diff --git a/sdk/base/lib/osBindings/RemoveMirrorParams.ts b/sdk/base/lib/osBindings/RemoveMirrorParams.ts index 5d3ef3f6b..cd5f5ed16 100644 --- a/sdk/base/lib/osBindings/RemoveMirrorParams.ts +++ b/sdk/base/lib/osBindings/RemoveMirrorParams.ts @@ -1,6 +1,6 @@ // 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" -import type { Version } from "./Version" +import type { PackageId } from './PackageId' +import type { Version } from './Version' export type RemoveMirrorParams = { id: PackageId diff --git a/sdk/base/lib/osBindings/RemovePackageFromCategoryParams.ts b/sdk/base/lib/osBindings/RemovePackageFromCategoryParams.ts index c12dc6002..159ee69f6 100644 --- a/sdk/base/lib/osBindings/RemovePackageFromCategoryParams.ts +++ b/sdk/base/lib/osBindings/RemovePackageFromCategoryParams.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 { PackageId } from "./PackageId" +import type { PackageId } from './PackageId' export type RemovePackageFromCategoryParams = { id: string; package: PackageId } diff --git a/sdk/base/lib/osBindings/RemovePackageParams.ts b/sdk/base/lib/osBindings/RemovePackageParams.ts index a22eba4e3..47fbd3418 100644 --- a/sdk/base/lib/osBindings/RemovePackageParams.ts +++ b/sdk/base/lib/osBindings/RemovePackageParams.ts @@ -1,7 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Base64 } from "./Base64" -import type { PackageId } from "./PackageId" -import type { Version } from "./Version" +import type { Base64 } from './Base64' +import type { PackageId } from './PackageId' +import type { Version } from './Version' export type RemovePackageParams = { id: PackageId diff --git a/sdk/base/lib/osBindings/RemovePackageSignerParams.ts b/sdk/base/lib/osBindings/RemovePackageSignerParams.ts index fab6431ea..26aa97b43 100644 --- a/sdk/base/lib/osBindings/RemovePackageSignerParams.ts +++ b/sdk/base/lib/osBindings/RemovePackageSignerParams.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Guid } from "./Guid" -import type { PackageId } from "./PackageId" +import type { Guid } from './Guid' +import type { PackageId } from './PackageId' export type RemovePackageSignerParams = { id: PackageId; signer: Guid } diff --git a/sdk/base/lib/osBindings/RemoveTunnelParams.ts b/sdk/base/lib/osBindings/RemoveTunnelParams.ts index 67c7b08c5..0161a1503 100644 --- a/sdk/base/lib/osBindings/RemoveTunnelParams.ts +++ b/sdk/base/lib/osBindings/RemoveTunnelParams.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 { GatewayId } from "./GatewayId" +import type { GatewayId } from './GatewayId' export type RemoveTunnelParams = { id: GatewayId } diff --git a/sdk/base/lib/osBindings/RequestCommitment.ts b/sdk/base/lib/osBindings/RequestCommitment.ts index 89df04e4a..93cb65958 100644 --- a/sdk/base/lib/osBindings/RequestCommitment.ts +++ b/sdk/base/lib/osBindings/RequestCommitment.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Base64 } from "./Base64" +import type { Base64 } from './Base64' export type RequestCommitment = { timestamp: number diff --git a/sdk/base/lib/osBindings/RunActionParams.ts b/sdk/base/lib/osBindings/RunActionParams.ts index 33864d1e6..7dabffce6 100644 --- a/sdk/base/lib/osBindings/RunActionParams.ts +++ b/sdk/base/lib/osBindings/RunActionParams.ts @@ -1,6 +1,6 @@ // 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 { PackageId } from "./PackageId" +import type { ActionId } from './ActionId' +import type { PackageId } from './PackageId' export type RunActionParams = { packageId?: PackageId diff --git a/sdk/base/lib/osBindings/ServerInfo.ts b/sdk/base/lib/osBindings/ServerInfo.ts index 1beef03de..23ff7ab4b 100644 --- a/sdk/base/lib/osBindings/ServerInfo.ts +++ b/sdk/base/lib/osBindings/ServerInfo.ts @@ -1,10 +1,10 @@ // 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 { KeyboardOptions } from "./KeyboardOptions" -import type { LshwDevice } from "./LshwDevice" -import type { NetworkInfo } from "./NetworkInfo" -import type { ServerStatus } from "./ServerStatus" -import type { SmtpValue } from "./SmtpValue" +import type { Governor } from './Governor' +import type { KeyboardOptions } from './KeyboardOptions' +import type { LshwDevice } from './LshwDevice' +import type { NetworkInfo } from './NetworkInfo' +import type { ServerStatus } from './ServerStatus' +import type { SmtpValue } from './SmtpValue' export type ServerInfo = { arch: string diff --git a/sdk/base/lib/osBindings/ServerStatus.ts b/sdk/base/lib/osBindings/ServerStatus.ts index 6bce57333..def945b16 100644 --- a/sdk/base/lib/osBindings/ServerStatus.ts +++ b/sdk/base/lib/osBindings/ServerStatus.ts @@ -1,7 +1,7 @@ // 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 { FullProgress } from "./FullProgress" -import type { PackageId } from "./PackageId" +import type { BackupProgress } from './BackupProgress' +import type { FullProgress } from './FullProgress' +import type { PackageId } from './PackageId' export type ServerStatus = { backupProgress: { [key: PackageId]: BackupProgress } | null diff --git a/sdk/base/lib/osBindings/ServiceInterface.ts b/sdk/base/lib/osBindings/ServiceInterface.ts index 6a58675a4..f05e5c674 100644 --- a/sdk/base/lib/osBindings/ServiceInterface.ts +++ b/sdk/base/lib/osBindings/ServiceInterface.ts @@ -1,7 +1,7 @@ // 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" +import type { AddressInfo } from './AddressInfo' +import type { ServiceInterfaceId } from './ServiceInterfaceId' +import type { ServiceInterfaceType } from './ServiceInterfaceType' export type ServiceInterface = { id: ServiceInterfaceId diff --git a/sdk/base/lib/osBindings/ServiceInterfaceType.ts b/sdk/base/lib/osBindings/ServiceInterfaceType.ts index 109691474..c15160e8b 100644 --- a/sdk/base/lib/osBindings/ServiceInterfaceType.ts +++ b/sdk/base/lib/osBindings/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" +export type ServiceInterfaceType = 'ui' | 'p2p' | 'api' diff --git a/sdk/base/lib/osBindings/SessionList.ts b/sdk/base/lib/osBindings/SessionList.ts index af36aaa8a..fa7d48186 100644 --- a/sdk/base/lib/osBindings/SessionList.ts +++ b/sdk/base/lib/osBindings/SessionList.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 { Sessions } from "./Sessions" +import type { Sessions } from './Sessions' export type SessionList = { current: string | null; sessions: Sessions } diff --git a/sdk/base/lib/osBindings/Sessions.ts b/sdk/base/lib/osBindings/Sessions.ts index 6a15449e2..340315855 100644 --- a/sdk/base/lib/osBindings/Sessions.ts +++ b/sdk/base/lib/osBindings/Sessions.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 { Session } from "./Session" +import type { Session } from './Session' export type Sessions = { [key: string]: Session } diff --git a/sdk/base/lib/osBindings/SetDependenciesParams.ts b/sdk/base/lib/osBindings/SetDependenciesParams.ts index 7b34b50c9..badb3ae2b 100644 --- a/sdk/base/lib/osBindings/SetDependenciesParams.ts +++ b/sdk/base/lib/osBindings/SetDependenciesParams.ts @@ -1,5 +1,5 @@ // 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" +import type { DependencyRequirement } from './DependencyRequirement' export type SetDependenciesParams = { dependencies: Array diff --git a/sdk/base/lib/osBindings/SetHealth.ts b/sdk/base/lib/osBindings/SetHealth.ts index 79e268f4a..2bc4180a9 100644 --- a/sdk/base/lib/osBindings/SetHealth.ts +++ b/sdk/base/lib/osBindings/SetHealth.ts @@ -1,11 +1,11 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { HealthCheckId } from "./HealthCheckId" +import type { HealthCheckId } from './HealthCheckId' export type SetHealth = { id: HealthCheckId; name: string } & ( - | { result: "success"; message: string | null } - | { result: "disabled"; message: string | null } - | { result: "starting"; message: string | null } - | { result: "waiting"; message: string | null } - | { result: "loading"; message: string } - | { result: "failure"; message: string } + | { result: 'success'; message: string | null } + | { result: 'disabled'; message: string | null } + | { result: 'starting'; message: string | null } + | { result: 'waiting'; message: string | null } + | { result: 'loading'; message: string } + | { result: 'failure'; message: string } ) diff --git a/sdk/base/lib/osBindings/SetIconParams.ts b/sdk/base/lib/osBindings/SetIconParams.ts index f10eaa50b..941d673f5 100644 --- a/sdk/base/lib/osBindings/SetIconParams.ts +++ b/sdk/base/lib/osBindings/SetIconParams.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 { DataUrl } from "./DataUrl" +import type { DataUrl } from './DataUrl' export type SetIconParams = { icon: DataUrl } diff --git a/sdk/base/lib/osBindings/SetMainStatus.ts b/sdk/base/lib/osBindings/SetMainStatus.ts index 6dcca73e9..6d92c4420 100644 --- a/sdk/base/lib/osBindings/SetMainStatus.ts +++ b/sdk/base/lib/osBindings/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 { SetMainStatusStatus } from "./SetMainStatusStatus" +import type { SetMainStatusStatus } from './SetMainStatusStatus' export type SetMainStatus = { status: SetMainStatusStatus } diff --git a/sdk/base/lib/osBindings/SetMainStatusStatus.ts b/sdk/base/lib/osBindings/SetMainStatusStatus.ts index 03bb4a119..213df94fe 100644 --- a/sdk/base/lib/osBindings/SetMainStatusStatus.ts +++ b/sdk/base/lib/osBindings/SetMainStatusStatus.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 SetMainStatusStatus = "running" | "stopped" +export type SetMainStatusStatus = 'running' | 'stopped' diff --git a/sdk/base/lib/osBindings/SetupExecuteParams.ts b/sdk/base/lib/osBindings/SetupExecuteParams.ts index a8e1e4ae1..0df094f0b 100644 --- a/sdk/base/lib/osBindings/SetupExecuteParams.ts +++ b/sdk/base/lib/osBindings/SetupExecuteParams.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { EncryptedWire } from "./EncryptedWire" -import type { RecoverySource } from "./RecoverySource" +import type { EncryptedWire } from './EncryptedWire' +import type { RecoverySource } from './RecoverySource' export type SetupExecuteParams = { guid: string diff --git a/sdk/base/lib/osBindings/SetupProgress.ts b/sdk/base/lib/osBindings/SetupProgress.ts index 845636da3..083fb7703 100644 --- a/sdk/base/lib/osBindings/SetupProgress.ts +++ b/sdk/base/lib/osBindings/SetupProgress.ts @@ -1,5 +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 { Guid } from "./Guid" +import type { FullProgress } from './FullProgress' +import type { Guid } from './Guid' export type SetupProgress = { progress: FullProgress; guid: Guid } diff --git a/sdk/base/lib/osBindings/SetupResult.ts b/sdk/base/lib/osBindings/SetupResult.ts index 4d7f51bce..c11e5ae0d 100644 --- a/sdk/base/lib/osBindings/SetupResult.ts +++ b/sdk/base/lib/osBindings/SetupResult.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Pem } from "./Pem" +import type { Pem } from './Pem' export type SetupResult = { hostname: string diff --git a/sdk/base/lib/osBindings/SetupStatusRes.ts b/sdk/base/lib/osBindings/SetupStatusRes.ts index a7f0342ec..bbca97b95 100644 --- a/sdk/base/lib/osBindings/SetupStatusRes.ts +++ b/sdk/base/lib/osBindings/SetupStatusRes.ts @@ -1,10 +1,10 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { SetupInfo } from "./SetupInfo" -import type { SetupProgress } from "./SetupProgress" -import type { SetupResult } from "./SetupResult" +import type { SetupInfo } from './SetupInfo' +import type { SetupProgress } from './SetupProgress' +import type { SetupResult } from './SetupResult' export type SetupStatusRes = - | { status: "needs-install" } - | ({ status: "incomplete" } & SetupInfo) - | ({ status: "running" } & SetupProgress) - | ({ status: "complete" } & SetupResult) + | { status: 'needs-install' } + | ({ status: 'incomplete' } & SetupInfo) + | ({ status: 'running' } & SetupProgress) + | ({ status: 'complete' } & SetupResult) diff --git a/sdk/base/lib/osBindings/SignAssetParams.ts b/sdk/base/lib/osBindings/SignAssetParams.ts index 39f54ad69..3dcff08f5 100644 --- a/sdk/base/lib/osBindings/SignAssetParams.ts +++ b/sdk/base/lib/osBindings/SignAssetParams.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AnySignature } from "./AnySignature" +import type { AnySignature } from './AnySignature' export type SignAssetParams = { version: string diff --git a/sdk/base/lib/osBindings/SignerInfo.ts b/sdk/base/lib/osBindings/SignerInfo.ts index 7e7aa2588..be83504d8 100644 --- a/sdk/base/lib/osBindings/SignerInfo.ts +++ b/sdk/base/lib/osBindings/SignerInfo.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AnyVerifyingKey } from "./AnyVerifyingKey" -import type { ContactInfo } from "./ContactInfo" +import type { AnyVerifyingKey } from './AnyVerifyingKey' +import type { ContactInfo } from './ContactInfo' export type SignerInfo = { name: string diff --git a/sdk/base/lib/osBindings/StartStop.ts b/sdk/base/lib/osBindings/StartStop.ts index c8be35fb7..5e9fd3109 100644 --- a/sdk/base/lib/osBindings/StartStop.ts +++ b/sdk/base/lib/osBindings/StartStop.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 StartStop = "start" | "stop" +export type StartStop = 'start' | 'stop' diff --git a/sdk/base/lib/osBindings/StatusInfo.ts b/sdk/base/lib/osBindings/StatusInfo.ts index c4b90ee62..fd72e5fb8 100644 --- a/sdk/base/lib/osBindings/StatusInfo.ts +++ b/sdk/base/lib/osBindings/StatusInfo.ts @@ -1,8 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { DesiredStatus } from "./DesiredStatus" -import type { ErrorData } from "./ErrorData" -import type { HealthCheckId } from "./HealthCheckId" -import type { NamedHealthCheckResult } from "./NamedHealthCheckResult" +import type { DesiredStatus } from './DesiredStatus' +import type { ErrorData } from './ErrorData' +import type { HealthCheckId } from './HealthCheckId' +import type { NamedHealthCheckResult } from './NamedHealthCheckResult' export type StatusInfo = { health: { [key: HealthCheckId]: NamedHealthCheckResult } diff --git a/sdk/base/lib/osBindings/Task.ts b/sdk/base/lib/osBindings/Task.ts index 8b781a5d3..a2f2d5cee 100644 --- a/sdk/base/lib/osBindings/Task.ts +++ b/sdk/base/lib/osBindings/Task.ts @@ -1,9 +1,9 @@ // 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 { PackageId } from "./PackageId" -import type { TaskInput } from "./TaskInput" -import type { TaskSeverity } from "./TaskSeverity" -import type { TaskTrigger } from "./TaskTrigger" +import type { ActionId } from './ActionId' +import type { PackageId } from './PackageId' +import type { TaskInput } from './TaskInput' +import type { TaskSeverity } from './TaskSeverity' +import type { TaskTrigger } from './TaskTrigger' export type Task = { packageId: PackageId diff --git a/sdk/base/lib/osBindings/TaskCondition.ts b/sdk/base/lib/osBindings/TaskCondition.ts index 9e48cdae8..5c07685af 100644 --- a/sdk/base/lib/osBindings/TaskCondition.ts +++ b/sdk/base/lib/osBindings/TaskCondition.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 TaskCondition = "input-not-matches" +export type TaskCondition = 'input-not-matches' diff --git a/sdk/base/lib/osBindings/TaskEntry.ts b/sdk/base/lib/osBindings/TaskEntry.ts index 3607176bf..73b1b7468 100644 --- a/sdk/base/lib/osBindings/TaskEntry.ts +++ b/sdk/base/lib/osBindings/TaskEntry.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 { Task } from "./Task" +import type { Task } from './Task' export type TaskEntry = { task: Task; active: boolean } diff --git a/sdk/base/lib/osBindings/TaskInput.ts b/sdk/base/lib/osBindings/TaskInput.ts index 3415105bf..82ffc94d8 100644 --- a/sdk/base/lib/osBindings/TaskInput.ts +++ b/sdk/base/lib/osBindings/TaskInput.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 TaskInput = { kind: "partial"; value: Record } +export type TaskInput = { kind: 'partial'; value: Record } diff --git a/sdk/base/lib/osBindings/TaskSeverity.ts b/sdk/base/lib/osBindings/TaskSeverity.ts index a80540fe4..d5e4dc115 100644 --- a/sdk/base/lib/osBindings/TaskSeverity.ts +++ b/sdk/base/lib/osBindings/TaskSeverity.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 TaskSeverity = "optional" | "important" | "critical" +export type TaskSeverity = 'optional' | 'important' | 'critical' diff --git a/sdk/base/lib/osBindings/TaskTrigger.ts b/sdk/base/lib/osBindings/TaskTrigger.ts index ac46f2774..84f3832b8 100644 --- a/sdk/base/lib/osBindings/TaskTrigger.ts +++ b/sdk/base/lib/osBindings/TaskTrigger.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 { TaskCondition } from "./TaskCondition" +import type { TaskCondition } from './TaskCondition' export type TaskTrigger = { once: boolean; condition: TaskCondition } diff --git a/sdk/base/lib/osBindings/UpdatingState.ts b/sdk/base/lib/osBindings/UpdatingState.ts index 4e43c9443..7c388352e 100644 --- a/sdk/base/lib/osBindings/UpdatingState.ts +++ b/sdk/base/lib/osBindings/UpdatingState.ts @@ -1,6 +1,6 @@ // 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" +import type { InstallingInfo } from './InstallingInfo' +import type { Manifest } from './Manifest' export type UpdatingState = { manifest: Manifest diff --git a/sdk/base/lib/osBindings/VerifyCifsParams.ts b/sdk/base/lib/osBindings/VerifyCifsParams.ts index 407e6caaa..52bf04d12 100644 --- a/sdk/base/lib/osBindings/VerifyCifsParams.ts +++ b/sdk/base/lib/osBindings/VerifyCifsParams.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { EncryptedWire } from "./EncryptedWire" +import type { EncryptedWire } from './EncryptedWire' export type VerifyCifsParams = { hostname: string diff --git a/sdk/base/lib/osBindings/VersionSignerParams.ts b/sdk/base/lib/osBindings/VersionSignerParams.ts index 781e2a4df..a14ea967d 100644 --- a/sdk/base/lib/osBindings/VersionSignerParams.ts +++ b/sdk/base/lib/osBindings/VersionSignerParams.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 { Guid } from "./Guid" +import type { Guid } from './Guid' export type VersionSignerParams = { version: string; signer: Guid } diff --git a/sdk/base/lib/osBindings/index.ts b/sdk/base/lib/osBindings/index.ts index 32d67a358..4d9049856 100644 --- a/sdk/base/lib/osBindings/index.ts +++ b/sdk/base/lib/osBindings/index.ts @@ -1,226 +1,226 @@ -export { AcceptSigners } from "./AcceptSigners" -export { AcmeProvider } from "./AcmeProvider" -export { AcmeSettings } from "./AcmeSettings" -export { ActionId } from "./ActionId" -export { ActionInput } from "./ActionInput" -export { ActionMetadata } from "./ActionMetadata" -export { ActionResultMember } from "./ActionResultMember" -export { ActionResult } from "./ActionResult" -export { ActionResultV0 } from "./ActionResultV0" -export { ActionResultV1 } from "./ActionResultV1" -export { ActionResultValue } from "./ActionResultValue" -export { ActionVisibility } from "./ActionVisibility" -export { AddAdminParams } from "./AddAdminParams" -export { AddAssetParams } from "./AddAssetParams" -export { AddCategoryParams } from "./AddCategoryParams" -export { AddMirrorParams } from "./AddMirrorParams" -export { AddPackageParams } from "./AddPackageParams" -export { AddPackageSignerParams } from "./AddPackageSignerParams" -export { AddPackageToCategoryParams } from "./AddPackageToCategoryParams" -export { AddressInfo } from "./AddressInfo" -export { AddSslOptions } from "./AddSslOptions" -export { AddTunnelParams } from "./AddTunnelParams" -export { AddVersionParams } from "./AddVersionParams" -export { Alerts } from "./Alerts" -export { Algorithm } from "./Algorithm" -export { AllowedStatuses } from "./AllowedStatuses" -export { AllPackageData } from "./AllPackageData" -export { AlpnInfo } from "./AlpnInfo" -export { AnySignature } from "./AnySignature" -export { AnySigningKey } from "./AnySigningKey" -export { AnyVerifyingKey } from "./AnyVerifyingKey" -export { ApiState } from "./ApiState" -export { AttachParams } from "./AttachParams" -export { BackupProgress } from "./BackupProgress" -export { BackupTargetFS } from "./BackupTargetFS" -export { Base64 } from "./Base64" -export { BindId } from "./BindId" -export { BindInfo } from "./BindInfo" -export { BindingGatewaySetEnabledParams } from "./BindingGatewaySetEnabledParams" -export { BindOptions } from "./BindOptions" -export { BindParams } from "./BindParams" -export { Blake3Commitment } from "./Blake3Commitment" -export { BlockDev } from "./BlockDev" -export { BuildArg } from "./BuildArg" -export { CallbackId } from "./CallbackId" -export { Category } from "./Category" -export { Celsius } from "./Celsius" -export { CheckDependenciesParam } from "./CheckDependenciesParam" -export { CheckDependenciesResult } from "./CheckDependenciesResult" -export { Cifs } from "./Cifs" -export { ClearActionsParams } from "./ClearActionsParams" -export { ClearBindingsParams } from "./ClearBindingsParams" -export { ClearCallbacksParams } from "./ClearCallbacksParams" -export { ClearServiceInterfacesParams } from "./ClearServiceInterfacesParams" -export { ClearTasksParams } from "./ClearTasksParams" -export { CliSetIconParams } from "./CliSetIconParams" -export { ContactInfo } from "./ContactInfo" -export { CreateSubcontainerFsParams } from "./CreateSubcontainerFsParams" -export { CreateTaskParams } from "./CreateTaskParams" -export { CurrentDependencies } from "./CurrentDependencies" -export { CurrentDependencyInfo } from "./CurrentDependencyInfo" -export { DataUrl } from "./DataUrl" -export { Dependencies } from "./Dependencies" -export { DependencyMetadata } from "./DependencyMetadata" -export { DependencyRequirement } from "./DependencyRequirement" -export { DepInfo } from "./DepInfo" -export { Description } from "./Description" -export { DesiredStatus } from "./DesiredStatus" -export { DestroySubcontainerFsParams } from "./DestroySubcontainerFsParams" -export { DeviceFilter } from "./DeviceFilter" -export { DnsSettings } from "./DnsSettings" -export { DomainSettings } from "./DomainSettings" -export { Duration } from "./Duration" -export { EchoParams } from "./EchoParams" -export { EditSignerParams } from "./EditSignerParams" -export { EncryptedWire } from "./EncryptedWire" -export { ErrorData } from "./ErrorData" -export { EventId } from "./EventId" -export { ExportActionParams } from "./ExportActionParams" -export { ExportServiceInterfaceParams } from "./ExportServiceInterfaceParams" -export { FileType } from "./FileType" -export { FullIndex } from "./FullIndex" -export { FullProgress } from "./FullProgress" -export { GatewayId } from "./GatewayId" -export { GatewayInfo } from "./GatewayInfo" -export { GetActionInputParams } from "./GetActionInputParams" -export { GetContainerIpParams } from "./GetContainerIpParams" -export { GetHostInfoParams } from "./GetHostInfoParams" -export { GetOsAssetParams } from "./GetOsAssetParams" -export { GetOsVersionParams } from "./GetOsVersionParams" -export { GetPackageParams } from "./GetPackageParams" -export { GetPackageResponseFull } from "./GetPackageResponseFull" -export { GetPackageResponse } from "./GetPackageResponse" -export { GetServiceInterfaceParams } from "./GetServiceInterfaceParams" -export { GetServiceManifestParams } from "./GetServiceManifestParams" -export { GetServicePortForwardParams } from "./GetServicePortForwardParams" -export { GetSslCertificateParams } from "./GetSslCertificateParams" -export { GetSslKeyParams } from "./GetSslKeyParams" -export { GetStatusParams } from "./GetStatusParams" -export { GetSystemSmtpParams } from "./GetSystemSmtpParams" -export { GigaBytes } from "./GigaBytes" -export { GitHash } from "./GitHash" -export { Governor } from "./Governor" -export { Guid } from "./Guid" -export { HardwareRequirements } from "./HardwareRequirements" -export { HealthCheckId } from "./HealthCheckId" -export { HostId } from "./HostId" -export { HostnameInfo } from "./HostnameInfo" -export { Hosts } from "./Hosts" -export { Host } from "./Host" -export { IdMap } from "./IdMap" -export { ImageConfig } from "./ImageConfig" -export { ImageId } from "./ImageId" -export { ImageMetadata } from "./ImageMetadata" -export { ImageSource } from "./ImageSource" -export { InitProgressRes } from "./InitProgressRes" -export { InstalledState } from "./InstalledState" -export { InstalledVersionParams } from "./InstalledVersionParams" -export { InstallingInfo } from "./InstallingInfo" -export { InstallingState } from "./InstallingState" -export { InstallParams } from "./InstallParams" -export { IpHostname } from "./IpHostname" -export { IpInfo } from "./IpInfo" -export { KeyboardOptions } from "./KeyboardOptions" -export { ListPackageSignersParams } from "./ListPackageSignersParams" -export { ListServiceInterfacesParams } from "./ListServiceInterfacesParams" -export { ListVersionSignersParams } from "./ListVersionSignersParams" -export { LocaleString } from "./LocaleString" -export { LoginParams } from "./LoginParams" -export { LshwDevice } from "./LshwDevice" -export { LshwDisplay } from "./LshwDisplay" -export { LshwProcessor } from "./LshwProcessor" -export { Manifest } from "./Manifest" -export { MaybeUtf8String } from "./MaybeUtf8String" -export { MebiBytes } from "./MebiBytes" -export { MerkleArchiveCommitment } from "./MerkleArchiveCommitment" -export { MetadataSrc } from "./MetadataSrc" -export { Metadata } from "./Metadata" -export { MetricsCpu } from "./MetricsCpu" -export { MetricsDisk } from "./MetricsDisk" -export { MetricsGeneral } from "./MetricsGeneral" -export { MetricsMemory } from "./MetricsMemory" -export { Metrics } from "./Metrics" -export { MountParams } from "./MountParams" -export { MountTarget } from "./MountTarget" -export { NamedHealthCheckResult } from "./NamedHealthCheckResult" -export { NamedProgress } from "./NamedProgress" -export { NetInfo } from "./NetInfo" -export { NetworkInfo } from "./NetworkInfo" -export { NetworkInterfaceInfo } from "./NetworkInterfaceInfo" -export { NetworkInterfaceType } from "./NetworkInterfaceType" -export { OnionHostname } from "./OnionHostname" -export { OsIndex } from "./OsIndex" -export { OsVersionInfoMap } from "./OsVersionInfoMap" -export { OsVersionInfo } from "./OsVersionInfo" -export { PackageDataEntry } from "./PackageDataEntry" -export { PackageDetailLevel } from "./PackageDetailLevel" -export { PackageId } from "./PackageId" -export { PackageIndex } from "./PackageIndex" -export { PackageInfoShort } from "./PackageInfoShort" -export { PackageInfo } from "./PackageInfo" -export { PackageState } from "./PackageState" -export { PackageVersionInfo } from "./PackageVersionInfo" -export { PasswordType } from "./PasswordType" -export { PathOrUrl } from "./PathOrUrl" -export { Pem } from "./Pem" -export { Percentage } from "./Percentage" -export { Progress } from "./Progress" -export { ProgressUnits } from "./ProgressUnits" -export { PublicDomainConfig } from "./PublicDomainConfig" -export { Public } from "./Public" -export { RecoverySource } from "./RecoverySource" -export { RegistryAsset } from "./RegistryAsset" -export { RegistryInfo } from "./RegistryInfo" -export { RemoveAdminParams } from "./RemoveAdminParams" -export { RemoveAssetParams } from "./RemoveAssetParams" -export { RemoveCategoryParams } from "./RemoveCategoryParams" -export { RemoveMirrorParams } from "./RemoveMirrorParams" -export { RemovePackageFromCategoryParams } from "./RemovePackageFromCategoryParams" -export { RemovePackageParams } from "./RemovePackageParams" -export { RemovePackageSignerParams } from "./RemovePackageSignerParams" -export { RemoveTunnelParams } from "./RemoveTunnelParams" -export { RemoveVersionParams } from "./RemoveVersionParams" -export { ReplayId } from "./ReplayId" -export { RequestCommitment } from "./RequestCommitment" -export { RunActionParams } from "./RunActionParams" -export { Security } from "./Security" -export { ServerInfo } from "./ServerInfo" -export { ServerSpecs } from "./ServerSpecs" -export { ServerStatus } from "./ServerStatus" -export { ServiceInterfaceId } from "./ServiceInterfaceId" -export { ServiceInterface } from "./ServiceInterface" -export { ServiceInterfaceType } from "./ServiceInterfaceType" -export { SessionList } from "./SessionList" -export { Sessions } from "./Sessions" -export { Session } from "./Session" -export { SetDataVersionParams } from "./SetDataVersionParams" -export { SetDependenciesParams } from "./SetDependenciesParams" -export { SetHealth } from "./SetHealth" -export { SetIconParams } from "./SetIconParams" -export { SetMainStatusStatus } from "./SetMainStatusStatus" -export { SetMainStatus } from "./SetMainStatus" -export { SetNameParams } from "./SetNameParams" -export { SetupExecuteParams } from "./SetupExecuteParams" -export { SetupInfo } from "./SetupInfo" -export { SetupProgress } from "./SetupProgress" -export { SetupResult } from "./SetupResult" -export { SetupStatusRes } from "./SetupStatusRes" -export { SignAssetParams } from "./SignAssetParams" -export { SignerInfo } from "./SignerInfo" -export { SmtpValue } from "./SmtpValue" -export { StartStop } from "./StartStop" -export { StatusInfo } from "./StatusInfo" -export { TaskCondition } from "./TaskCondition" -export { TaskEntry } from "./TaskEntry" -export { TaskInput } from "./TaskInput" -export { TaskSeverity } from "./TaskSeverity" -export { TaskTrigger } from "./TaskTrigger" -export { Task } from "./Task" -export { TestSmtpParams } from "./TestSmtpParams" -export { UpdatingState } from "./UpdatingState" -export { VerifyCifsParams } from "./VerifyCifsParams" -export { VersionSignerParams } from "./VersionSignerParams" -export { Version } from "./Version" -export { VolumeId } from "./VolumeId" -export { WifiInfo } from "./WifiInfo" +export { AcceptSigners } from './AcceptSigners' +export { AcmeProvider } from './AcmeProvider' +export { AcmeSettings } from './AcmeSettings' +export { ActionId } from './ActionId' +export { ActionInput } from './ActionInput' +export { ActionMetadata } from './ActionMetadata' +export { ActionResultMember } from './ActionResultMember' +export { ActionResult } from './ActionResult' +export { ActionResultV0 } from './ActionResultV0' +export { ActionResultV1 } from './ActionResultV1' +export { ActionResultValue } from './ActionResultValue' +export { ActionVisibility } from './ActionVisibility' +export { AddAdminParams } from './AddAdminParams' +export { AddAssetParams } from './AddAssetParams' +export { AddCategoryParams } from './AddCategoryParams' +export { AddMirrorParams } from './AddMirrorParams' +export { AddPackageParams } from './AddPackageParams' +export { AddPackageSignerParams } from './AddPackageSignerParams' +export { AddPackageToCategoryParams } from './AddPackageToCategoryParams' +export { AddressInfo } from './AddressInfo' +export { AddSslOptions } from './AddSslOptions' +export { AddTunnelParams } from './AddTunnelParams' +export { AddVersionParams } from './AddVersionParams' +export { Alerts } from './Alerts' +export { Algorithm } from './Algorithm' +export { AllowedStatuses } from './AllowedStatuses' +export { AllPackageData } from './AllPackageData' +export { AlpnInfo } from './AlpnInfo' +export { AnySignature } from './AnySignature' +export { AnySigningKey } from './AnySigningKey' +export { AnyVerifyingKey } from './AnyVerifyingKey' +export { ApiState } from './ApiState' +export { AttachParams } from './AttachParams' +export { BackupProgress } from './BackupProgress' +export { BackupTargetFS } from './BackupTargetFS' +export { Base64 } from './Base64' +export { BindId } from './BindId' +export { BindInfo } from './BindInfo' +export { BindingGatewaySetEnabledParams } from './BindingGatewaySetEnabledParams' +export { BindOptions } from './BindOptions' +export { BindParams } from './BindParams' +export { Blake3Commitment } from './Blake3Commitment' +export { BlockDev } from './BlockDev' +export { BuildArg } from './BuildArg' +export { CallbackId } from './CallbackId' +export { Category } from './Category' +export { Celsius } from './Celsius' +export { CheckDependenciesParam } from './CheckDependenciesParam' +export { CheckDependenciesResult } from './CheckDependenciesResult' +export { Cifs } from './Cifs' +export { ClearActionsParams } from './ClearActionsParams' +export { ClearBindingsParams } from './ClearBindingsParams' +export { ClearCallbacksParams } from './ClearCallbacksParams' +export { ClearServiceInterfacesParams } from './ClearServiceInterfacesParams' +export { ClearTasksParams } from './ClearTasksParams' +export { CliSetIconParams } from './CliSetIconParams' +export { ContactInfo } from './ContactInfo' +export { CreateSubcontainerFsParams } from './CreateSubcontainerFsParams' +export { CreateTaskParams } from './CreateTaskParams' +export { CurrentDependencies } from './CurrentDependencies' +export { CurrentDependencyInfo } from './CurrentDependencyInfo' +export { DataUrl } from './DataUrl' +export { Dependencies } from './Dependencies' +export { DependencyMetadata } from './DependencyMetadata' +export { DependencyRequirement } from './DependencyRequirement' +export { DepInfo } from './DepInfo' +export { Description } from './Description' +export { DesiredStatus } from './DesiredStatus' +export { DestroySubcontainerFsParams } from './DestroySubcontainerFsParams' +export { DeviceFilter } from './DeviceFilter' +export { DnsSettings } from './DnsSettings' +export { DomainSettings } from './DomainSettings' +export { Duration } from './Duration' +export { EchoParams } from './EchoParams' +export { EditSignerParams } from './EditSignerParams' +export { EncryptedWire } from './EncryptedWire' +export { ErrorData } from './ErrorData' +export { EventId } from './EventId' +export { ExportActionParams } from './ExportActionParams' +export { ExportServiceInterfaceParams } from './ExportServiceInterfaceParams' +export { FileType } from './FileType' +export { FullIndex } from './FullIndex' +export { FullProgress } from './FullProgress' +export { GatewayId } from './GatewayId' +export { GatewayInfo } from './GatewayInfo' +export { GetActionInputParams } from './GetActionInputParams' +export { GetContainerIpParams } from './GetContainerIpParams' +export { GetHostInfoParams } from './GetHostInfoParams' +export { GetOsAssetParams } from './GetOsAssetParams' +export { GetOsVersionParams } from './GetOsVersionParams' +export { GetPackageParams } from './GetPackageParams' +export { GetPackageResponseFull } from './GetPackageResponseFull' +export { GetPackageResponse } from './GetPackageResponse' +export { GetServiceInterfaceParams } from './GetServiceInterfaceParams' +export { GetServiceManifestParams } from './GetServiceManifestParams' +export { GetServicePortForwardParams } from './GetServicePortForwardParams' +export { GetSslCertificateParams } from './GetSslCertificateParams' +export { GetSslKeyParams } from './GetSslKeyParams' +export { GetStatusParams } from './GetStatusParams' +export { GetSystemSmtpParams } from './GetSystemSmtpParams' +export { GigaBytes } from './GigaBytes' +export { GitHash } from './GitHash' +export { Governor } from './Governor' +export { Guid } from './Guid' +export { HardwareRequirements } from './HardwareRequirements' +export { HealthCheckId } from './HealthCheckId' +export { HostId } from './HostId' +export { HostnameInfo } from './HostnameInfo' +export { Hosts } from './Hosts' +export { Host } from './Host' +export { IdMap } from './IdMap' +export { ImageConfig } from './ImageConfig' +export { ImageId } from './ImageId' +export { ImageMetadata } from './ImageMetadata' +export { ImageSource } from './ImageSource' +export { InitProgressRes } from './InitProgressRes' +export { InstalledState } from './InstalledState' +export { InstalledVersionParams } from './InstalledVersionParams' +export { InstallingInfo } from './InstallingInfo' +export { InstallingState } from './InstallingState' +export { InstallParams } from './InstallParams' +export { IpHostname } from './IpHostname' +export { IpInfo } from './IpInfo' +export { KeyboardOptions } from './KeyboardOptions' +export { ListPackageSignersParams } from './ListPackageSignersParams' +export { ListServiceInterfacesParams } from './ListServiceInterfacesParams' +export { ListVersionSignersParams } from './ListVersionSignersParams' +export { LocaleString } from './LocaleString' +export { LoginParams } from './LoginParams' +export { LshwDevice } from './LshwDevice' +export { LshwDisplay } from './LshwDisplay' +export { LshwProcessor } from './LshwProcessor' +export { Manifest } from './Manifest' +export { MaybeUtf8String } from './MaybeUtf8String' +export { MebiBytes } from './MebiBytes' +export { MerkleArchiveCommitment } from './MerkleArchiveCommitment' +export { MetadataSrc } from './MetadataSrc' +export { Metadata } from './Metadata' +export { MetricsCpu } from './MetricsCpu' +export { MetricsDisk } from './MetricsDisk' +export { MetricsGeneral } from './MetricsGeneral' +export { MetricsMemory } from './MetricsMemory' +export { Metrics } from './Metrics' +export { MountParams } from './MountParams' +export { MountTarget } from './MountTarget' +export { NamedHealthCheckResult } from './NamedHealthCheckResult' +export { NamedProgress } from './NamedProgress' +export { NetInfo } from './NetInfo' +export { NetworkInfo } from './NetworkInfo' +export { NetworkInterfaceInfo } from './NetworkInterfaceInfo' +export { NetworkInterfaceType } from './NetworkInterfaceType' +export { OnionHostname } from './OnionHostname' +export { OsIndex } from './OsIndex' +export { OsVersionInfoMap } from './OsVersionInfoMap' +export { OsVersionInfo } from './OsVersionInfo' +export { PackageDataEntry } from './PackageDataEntry' +export { PackageDetailLevel } from './PackageDetailLevel' +export { PackageId } from './PackageId' +export { PackageIndex } from './PackageIndex' +export { PackageInfoShort } from './PackageInfoShort' +export { PackageInfo } from './PackageInfo' +export { PackageState } from './PackageState' +export { PackageVersionInfo } from './PackageVersionInfo' +export { PasswordType } from './PasswordType' +export { PathOrUrl } from './PathOrUrl' +export { Pem } from './Pem' +export { Percentage } from './Percentage' +export { Progress } from './Progress' +export { ProgressUnits } from './ProgressUnits' +export { PublicDomainConfig } from './PublicDomainConfig' +export { Public } from './Public' +export { RecoverySource } from './RecoverySource' +export { RegistryAsset } from './RegistryAsset' +export { RegistryInfo } from './RegistryInfo' +export { RemoveAdminParams } from './RemoveAdminParams' +export { RemoveAssetParams } from './RemoveAssetParams' +export { RemoveCategoryParams } from './RemoveCategoryParams' +export { RemoveMirrorParams } from './RemoveMirrorParams' +export { RemovePackageFromCategoryParams } from './RemovePackageFromCategoryParams' +export { RemovePackageParams } from './RemovePackageParams' +export { RemovePackageSignerParams } from './RemovePackageSignerParams' +export { RemoveTunnelParams } from './RemoveTunnelParams' +export { RemoveVersionParams } from './RemoveVersionParams' +export { ReplayId } from './ReplayId' +export { RequestCommitment } from './RequestCommitment' +export { RunActionParams } from './RunActionParams' +export { Security } from './Security' +export { ServerInfo } from './ServerInfo' +export { ServerSpecs } from './ServerSpecs' +export { ServerStatus } from './ServerStatus' +export { ServiceInterfaceId } from './ServiceInterfaceId' +export { ServiceInterface } from './ServiceInterface' +export { ServiceInterfaceType } from './ServiceInterfaceType' +export { SessionList } from './SessionList' +export { Sessions } from './Sessions' +export { Session } from './Session' +export { SetDataVersionParams } from './SetDataVersionParams' +export { SetDependenciesParams } from './SetDependenciesParams' +export { SetHealth } from './SetHealth' +export { SetIconParams } from './SetIconParams' +export { SetMainStatusStatus } from './SetMainStatusStatus' +export { SetMainStatus } from './SetMainStatus' +export { SetNameParams } from './SetNameParams' +export { SetupExecuteParams } from './SetupExecuteParams' +export { SetupInfo } from './SetupInfo' +export { SetupProgress } from './SetupProgress' +export { SetupResult } from './SetupResult' +export { SetupStatusRes } from './SetupStatusRes' +export { SignAssetParams } from './SignAssetParams' +export { SignerInfo } from './SignerInfo' +export { SmtpValue } from './SmtpValue' +export { StartStop } from './StartStop' +export { StatusInfo } from './StatusInfo' +export { TaskCondition } from './TaskCondition' +export { TaskEntry } from './TaskEntry' +export { TaskInput } from './TaskInput' +export { TaskSeverity } from './TaskSeverity' +export { TaskTrigger } from './TaskTrigger' +export { Task } from './Task' +export { TestSmtpParams } from './TestSmtpParams' +export { UpdatingState } from './UpdatingState' +export { VerifyCifsParams } from './VerifyCifsParams' +export { VersionSignerParams } from './VersionSignerParams' +export { Version } from './Version' +export { VolumeId } from './VolumeId' +export { WifiInfo } from './WifiInfo' diff --git a/sdk/base/lib/osBindings/tunnel/Sessions.ts b/sdk/base/lib/osBindings/tunnel/Sessions.ts index 6a15449e2..340315855 100644 --- a/sdk/base/lib/osBindings/tunnel/Sessions.ts +++ b/sdk/base/lib/osBindings/tunnel/Sessions.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 { Session } from "./Session" +import type { Session } from './Session' export type Sessions = { [key: string]: Session } diff --git a/sdk/base/lib/osBindings/tunnel/TunnelCertData.ts b/sdk/base/lib/osBindings/tunnel/TunnelCertData.ts index 7a6aa0d13..8a28ef25c 100644 --- a/sdk/base/lib/osBindings/tunnel/TunnelCertData.ts +++ b/sdk/base/lib/osBindings/tunnel/TunnelCertData.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 { Pem } from "./Pem" +import type { Pem } from './Pem' export type TunnelCertData = { key: Pem; cert: Pem } diff --git a/sdk/base/lib/osBindings/tunnel/TunnelDatabase.ts b/sdk/base/lib/osBindings/tunnel/TunnelDatabase.ts index 813b4996f..2f484b5b7 100644 --- a/sdk/base/lib/osBindings/tunnel/TunnelDatabase.ts +++ b/sdk/base/lib/osBindings/tunnel/TunnelDatabase.ts @@ -1,10 +1,10 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AnyVerifyingKey } from "./AnyVerifyingKey" -import type { PortForwards } from "./PortForwards" -import type { Sessions } from "./Sessions" -import type { SignerInfo } from "./SignerInfo" -import type { WebserverInfo } from "./WebserverInfo" -import type { WgServer } from "./WgServer" +import type { AnyVerifyingKey } from './AnyVerifyingKey' +import type { PortForwards } from './PortForwards' +import type { Sessions } from './Sessions' +import type { SignerInfo } from './SignerInfo' +import type { WebserverInfo } from './WebserverInfo' +import type { WgServer } from './WgServer' export type TunnelDatabase = { webserver: WebserverInfo diff --git a/sdk/base/lib/osBindings/tunnel/WebserverInfo.ts b/sdk/base/lib/osBindings/tunnel/WebserverInfo.ts index 9eea3361f..c5a48ace0 100644 --- a/sdk/base/lib/osBindings/tunnel/WebserverInfo.ts +++ b/sdk/base/lib/osBindings/tunnel/WebserverInfo.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { TunnelCertData } from "./TunnelCertData" +import type { TunnelCertData } from './TunnelCertData' export type WebserverInfo = { enabled: boolean diff --git a/sdk/base/lib/osBindings/tunnel/WgConfig.ts b/sdk/base/lib/osBindings/tunnel/WgConfig.ts index 441177578..4ca18e900 100644 --- a/sdk/base/lib/osBindings/tunnel/WgConfig.ts +++ b/sdk/base/lib/osBindings/tunnel/WgConfig.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 { Base64 } from "./Base64" +import type { Base64 } from './Base64' export type WgConfig = { name: string; key: Base64; psk: Base64 } diff --git a/sdk/base/lib/osBindings/tunnel/WgServer.ts b/sdk/base/lib/osBindings/tunnel/WgServer.ts index b56e310bb..c6bbb7c9c 100644 --- a/sdk/base/lib/osBindings/tunnel/WgServer.ts +++ b/sdk/base/lib/osBindings/tunnel/WgServer.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Base64 } from "./Base64" -import type { WgSubnetMap } from "./WgSubnetMap" +import type { Base64 } from './Base64' +import type { WgSubnetMap } from './WgSubnetMap' export type WgServer = { port: number; key: Base64; subnets: WgSubnetMap } diff --git a/sdk/base/lib/osBindings/tunnel/WgSubnetClients.ts b/sdk/base/lib/osBindings/tunnel/WgSubnetClients.ts index 608b52b14..023c51ca5 100644 --- a/sdk/base/lib/osBindings/tunnel/WgSubnetClients.ts +++ b/sdk/base/lib/osBindings/tunnel/WgSubnetClients.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 { WgConfig } from "./WgConfig" +import type { WgConfig } from './WgConfig' export type WgSubnetClients = { [key: string]: WgConfig } diff --git a/sdk/base/lib/osBindings/tunnel/WgSubnetConfig.ts b/sdk/base/lib/osBindings/tunnel/WgSubnetConfig.ts index adfd68110..37c9af3a1 100644 --- a/sdk/base/lib/osBindings/tunnel/WgSubnetConfig.ts +++ b/sdk/base/lib/osBindings/tunnel/WgSubnetConfig.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 { WgSubnetClients } from "./WgSubnetClients" +import type { WgSubnetClients } from './WgSubnetClients' export type WgSubnetConfig = { name: string; clients: WgSubnetClients } diff --git a/sdk/base/lib/osBindings/tunnel/WgSubnetMap.ts b/sdk/base/lib/osBindings/tunnel/WgSubnetMap.ts index a38e09650..8347dcf84 100644 --- a/sdk/base/lib/osBindings/tunnel/WgSubnetMap.ts +++ b/sdk/base/lib/osBindings/tunnel/WgSubnetMap.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 { WgSubnetConfig } from "./WgSubnetConfig" +import type { WgSubnetConfig } from './WgSubnetConfig' export type WgSubnetMap = { [key: string]: WgSubnetConfig } diff --git a/sdk/base/lib/s9pk/index.ts b/sdk/base/lib/s9pk/index.ts index bb928384c..1c3b74c6d 100644 --- a/sdk/base/lib/s9pk/index.ts +++ b/sdk/base/lib/s9pk/index.ts @@ -4,11 +4,11 @@ import { Manifest, MerkleArchiveCommitment, PackageId, -} from "../osBindings" -import { ArrayBufferReader, MerkleArchive } from "./merkleArchive" -import mime from "mime" -import { DirectoryContents } from "./merkleArchive/directoryContents" -import { FileContents } from "./merkleArchive/fileContents" +} from '../osBindings' +import { ArrayBufferReader, MerkleArchive } from './merkleArchive' +import mime from 'mime' +import { DirectoryContents } from './merkleArchive/directoryContents' +import { FileContents } from './merkleArchive/fileContents' const magicAndVersion = new Uint8Array([59, 59, 2]) @@ -37,12 +37,12 @@ export class S9pk { ) const magicVersion = new Uint8Array(header.next(magicAndVersion.length)) if (!compare(magicVersion, magicAndVersion)) { - throw new Error("Invalid Magic or Unexpected Version") + throw new Error('Invalid Magic or Unexpected Version') } const archive = await MerkleArchive.deserialize( source, - "s9pk", + 's9pk', header, commitment, ) @@ -50,7 +50,7 @@ export class S9pk { const manifest = JSON.parse( new TextDecoder().decode( await archive.contents - .getPath(["manifest.json"]) + .getPath(['manifest.json']) ?.verifiedFileContents(), ), ) @@ -60,24 +60,24 @@ export class S9pk { async icon(): Promise { const iconName = Object.keys(this.archive.contents.contents).find( (name) => - name.startsWith("icon.") && mime.getType(name)?.startsWith("image/"), + name.startsWith('icon.') && mime.getType(name)?.startsWith('image/'), ) if (!iconName) { - throw new Error("no icon found in archive") + throw new Error('no icon found in archive') } return ( `data:${mime.getType(iconName)};base64,` + Buffer.from( await this.archive.contents.getPath([iconName])!.verifiedFileContents(), - ).toString("base64") + ).toString('base64') ) } async dependencyMetadataFor(id: PackageId) { const entry = this.archive.contents.getPath([ - "dependencies", + 'dependencies', id, - "metadata.json", + 'metadata.json', ]) if (!entry) return null return JSON.parse( @@ -86,18 +86,18 @@ export class S9pk { } async dependencyIconFor(id: PackageId) { - const dir = this.archive.contents.getPath(["dependencies", id]) + const dir = this.archive.contents.getPath(['dependencies', id]) if (!dir || !(dir.contents instanceof DirectoryContents)) return null const iconName = Object.keys(dir.contents.contents).find( (name) => - name.startsWith("icon.") && mime.getType(name)?.startsWith("image/"), + name.startsWith('icon.') && mime.getType(name)?.startsWith('image/'), ) if (!iconName) return null return ( `data:${mime.getType(iconName)};base64,` + Buffer.from( await dir.contents.getPath([iconName])!.verifiedFileContents(), - ).toString("base64") + ).toString('base64') ) } @@ -120,9 +120,9 @@ export class S9pk { } async license(): Promise { - const file = this.archive.contents.getPath(["LICENSE.md"]) + const file = this.archive.contents.getPath(['LICENSE.md']) if (!file || !(file.contents instanceof FileContents)) - throw new Error("license.md not found in archive") + throw new Error('license.md not found in archive') return new TextDecoder().decode(await file.verifiedFileContents()) } } diff --git a/sdk/base/lib/s9pk/merkleArchive/directoryContents.ts b/sdk/base/lib/s9pk/merkleArchive/directoryContents.ts index dab7ef53a..5e7c07492 100644 --- a/sdk/base/lib/s9pk/merkleArchive/directoryContents.ts +++ b/sdk/base/lib/s9pk/merkleArchive/directoryContents.ts @@ -1,8 +1,8 @@ -import { ArrayBufferReader, Entry } from "." -import { blake3 } from "@noble/hashes/blake3" -import { serializeVarint } from "./varint" -import { FileContents } from "./fileContents" -import { compare } from ".." +import { ArrayBufferReader, Entry } from '.' +import { blake3 } from '@noble/hashes/blake3' +import { serializeVarint } from './varint' +import { FileContents } from './fileContents' +import { compare } from '..' export class DirectoryContents { static readonly headerSize = @@ -18,7 +18,7 @@ export class DirectoryContents { const position = header.nextU64() const size = header.nextU64() if (size > maxSize) { - throw new Error("size is greater than signed") + throw new Error('size is greater than signed') } const tocReader = new ArrayBufferReader( @@ -37,7 +37,7 @@ export class DirectoryContents { const res = new DirectoryContents(entries) if (!compare(res.sighash(), sighash)) { - throw new Error("hash sum does not match") + throw new Error('hash sum does not match') } return res diff --git a/sdk/base/lib/s9pk/merkleArchive/fileContents.ts b/sdk/base/lib/s9pk/merkleArchive/fileContents.ts index 7a936f1e8..e3e246c5b 100644 --- a/sdk/base/lib/s9pk/merkleArchive/fileContents.ts +++ b/sdk/base/lib/s9pk/merkleArchive/fileContents.ts @@ -1,6 +1,6 @@ -import { blake3 } from "@noble/hashes/blake3" -import { ArrayBufferReader } from "." -import { compare } from ".." +import { blake3 } from '@noble/hashes/blake3' +import { ArrayBufferReader } from '.' +import { compare } from '..' export class FileContents { private constructor(readonly contents: Blob) {} @@ -17,7 +17,7 @@ export class FileContents { async verified(hash: Uint8Array): Promise { const res = await this.contents.arrayBuffer() if (!compare(hash, blake3(new Uint8Array(res)))) { - throw new Error("hash sum mismatch") + throw new Error('hash sum mismatch') } return res } diff --git a/sdk/base/lib/s9pk/merkleArchive/index.ts b/sdk/base/lib/s9pk/merkleArchive/index.ts index 068363599..06c1a4ce7 100644 --- a/sdk/base/lib/s9pk/merkleArchive/index.ts +++ b/sdk/base/lib/s9pk/merkleArchive/index.ts @@ -1,10 +1,10 @@ -import { MerkleArchiveCommitment } from "../../osBindings" -import { DirectoryContents } from "./directoryContents" -import { FileContents } from "./fileContents" -import { ed25519ph } from "@noble/curves/ed25519" -import { sha512 } from "@noble/hashes/sha2" -import { VarIntProcessor } from "./varint" -import { compare } from ".." +import { MerkleArchiveCommitment } from '../../osBindings' +import { DirectoryContents } from './directoryContents' +import { FileContents } from './fileContents' +import { ed25519ph } from '@noble/curves/ed25519' +import { sha512 } from '@noble/hashes/sha2' +import { VarIntProcessor } from './varint' +import { compare } from '..' const maxVarstringLen = 1024 * 1024 @@ -33,7 +33,7 @@ export class ArrayBufferReader { } const res = p.decode() if (res === null) { - throw new Error("Reached EOF") + throw new Error('Reached EOF') } return res } @@ -79,24 +79,24 @@ export class MerkleArchive { }, ) ) { - throw new Error("signature verification failed") + throw new Error('signature verification failed') } if (commitment) { if ( !compare( sighash, - new Uint8Array(Buffer.from(commitment.rootSighash, "base64").buffer), + new Uint8Array(Buffer.from(commitment.rootSighash, 'base64').buffer), ) ) { - throw new Error("merkle root mismatch") + throw new Error('merkle root mismatch') } if (maxSize > commitment.rootMaxsize) { - throw new Error("root directory max size too large") + throw new Error('root directory max size too large') } } else if (maxSize > 1024 * 1024) { throw new Error( - "root directory max size over 1MiB, cancelling download in case of DOS attack", + 'root directory max size over 1MiB, cancelling download in case of DOS attack', ) } @@ -137,10 +137,10 @@ export class Entry { } async verifiedFileContents(): Promise { if (!this.contents) { - throw new Error("file is missing from archive") + throw new Error('file is missing from archive') } if (!(this.contents instanceof FileContents)) { - throw new Error("is not a regular file") + throw new Error('is not a regular file') } return this.contents.verified(this.hash) } diff --git a/sdk/base/lib/s9pk/merkleArchive/varint.ts b/sdk/base/lib/s9pk/merkleArchive/varint.ts index a6a425289..4f01afa37 100644 --- a/sdk/base/lib/s9pk/merkleArchive/varint.ts +++ b/sdk/base/lib/s9pk/merkleArchive/varint.ts @@ -1,4 +1,4 @@ -import { asError } from "../../util" +import { asError } from '../../util' const msb = 0x80 const dropMsb = 0x7f @@ -13,7 +13,7 @@ export class VarIntProcessor { } push(b: number) { if (this.i >= maxSize) { - throw new Error("Unterminated varint") + throw new Error('Unterminated varint') } this.buf[this.i] = b this.i += 1 diff --git a/sdk/base/lib/test/exver.test.ts b/sdk/base/lib/test/exver.test.ts index 776796966..b96fd0c97 100644 --- a/sdk/base/lib/test/exver.test.ts +++ b/sdk/base/lib/test/exver.test.ts @@ -1,310 +1,310 @@ -import { VersionRange, ExtendedVersion } from "../exver" -describe("ExVer", () => { +import { VersionRange, ExtendedVersion } from '../exver' +describe('ExVer', () => { { { - const checker = VersionRange.parse("*") + const checker = VersionRange.parse('*') test("VersionRange.parse('*')", () => { - checker.satisfiedBy(ExtendedVersion.parse("1:0")) - checker.satisfiedBy(ExtendedVersion.parse("1.2:0")) - checker.satisfiedBy(ExtendedVersion.parse("1.2.3:0")) - checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4")) - checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4.5")) - checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4.5.6")) - expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(true) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2:0"))).toEqual( + checker.satisfiedBy(ExtendedVersion.parse('1:0')) + checker.satisfiedBy(ExtendedVersion.parse('1.2:0')) + checker.satisfiedBy(ExtendedVersion.parse('1.2.3:0')) + checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4')) + checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4.5')) + checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4.5.6')) + expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(true) + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2:0'))).toEqual( true, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4'))).toEqual( true, ) }) test("VersionRange.parse('*') invalid", () => { - expect(() => checker.satisfiedBy(ExtendedVersion.parse("a"))).toThrow() - expect(() => checker.satisfiedBy(ExtendedVersion.parse(""))).toThrow() + expect(() => checker.satisfiedBy(ExtendedVersion.parse('a'))).toThrow() + expect(() => checker.satisfiedBy(ExtendedVersion.parse(''))).toThrow() expect(() => - checker.satisfiedBy(ExtendedVersion.parse("1..3")), + checker.satisfiedBy(ExtendedVersion.parse('1..3')), ).toThrow() }) } { - const checker = VersionRange.parse(">1.2.3:4") + const checker = VersionRange.parse('>1.2.3:4') test(`VersionRange.parse(">1.2.3:4") valid`, () => { expect( - checker.satisfiedBy(ExtendedVersion.parse("2-beta.123:0")), + checker.satisfiedBy(ExtendedVersion.parse('2-beta.123:0')), ).toEqual(true) - expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(true) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:5"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(true) + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:5'))).toEqual( true, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4.1"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4.1'))).toEqual( true, ) }) test(`VersionRange.parse(">1.2.3:4") invalid`, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4'))).toEqual( false, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:0'))).toEqual( false, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(false) + expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(false) }) } { - const checker = VersionRange.parse("=1.2.3") + const checker = VersionRange.parse('=1.2.3') test(`VersionRange.parse("=1.2.3") valid`, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:0'))).toEqual( true, ) }) test(`VersionRange.parse("=1.2.3") invalid`, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(false) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:1"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(false) + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:1'))).toEqual( false, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2:0'))).toEqual( false, ) }) } { // TODO: this this correct? if not, also fix normalize - const checker = VersionRange.parse("=1") + const checker = VersionRange.parse('=1') test(`VersionRange.parse("=1") valid`, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("1.0.0:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.0.0:0'))).toEqual( true, ) }) test(`VersionRange.parse("=1") invalid`, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("1.0.1:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.0.1:0'))).toEqual( false, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.0.0:1"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.0.0:1'))).toEqual( false, ) }) } { - const checker = VersionRange.parse(">=1.2.3:4") + const checker = VersionRange.parse('>=1.2.3:4') test(`VersionRange.parse(">=1.2.3:4") valid`, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(true) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:5"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(true) + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:5'))).toEqual( true, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4.1"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4.1'))).toEqual( true, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4'))).toEqual( true, ) }) test(`VersionRange.parse(">=1.2.3:4") invalid`, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:0'))).toEqual( false, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(false) + expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(false) }) } { - const checker = VersionRange.parse("<1.2.3:4") + const checker = VersionRange.parse('<1.2.3:4') test(`VersionRange.parse("<1.2.3:4") invalid`, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(false) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:5"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(false) + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:5'))).toEqual( false, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4.1"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4.1'))).toEqual( false, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4'))).toEqual( false, ) }) test(`VersionRange.parse("<1.2.3:4") valid`, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:0'))).toEqual( true, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(true) + expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(true) }) } { - const checker = VersionRange.parse("<=1.2.3:4") + const checker = VersionRange.parse('<=1.2.3:4') test(`VersionRange.parse("<=1.2.3:4") invalid`, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(false) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:5"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(false) + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:5'))).toEqual( false, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4.1"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4.1'))).toEqual( false, ) }) test(`VersionRange.parse("<=1.2.3:4") valid`, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:0'))).toEqual( true, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(true) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(true) + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4'))).toEqual( true, ) }) } { - const checkA = VersionRange.parse(">1") - const checkB = VersionRange.parse("<=2") + const checkA = VersionRange.parse('>1') + const checkB = VersionRange.parse('<=2') const checker = checkA.and(checkB) test(`simple and(checkers) valid`, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(true) + expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(true) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.1:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.1:0'))).toEqual( true, ) }) test(`simple and(checkers) invalid`, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("2.1:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('2.1:0'))).toEqual( false, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(false) - expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(false) + expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(false) + expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(false) }) } { - const checkA = VersionRange.parse("<1") - const checkB = VersionRange.parse("=2") + const checkA = VersionRange.parse('<1') + const checkB = VersionRange.parse('=2') const checker = checkA.or(checkB) test(`simple or(checkers) valid`, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(true) - expect(checker.satisfiedBy(ExtendedVersion.parse("0.1:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(true) + expect(checker.satisfiedBy(ExtendedVersion.parse('0.1:0'))).toEqual( true, ) }) test(`simple or(checkers) invalid`, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("2.1:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('2.1:0'))).toEqual( false, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(false) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.1:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(false) + expect(checker.satisfiedBy(ExtendedVersion.parse('1.1:0'))).toEqual( false, ) }) } { - const checker = VersionRange.parse("~1.2") + const checker = VersionRange.parse('~1.2') test(`VersionRange.parse(~1.2) valid`, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2:0'))).toEqual( true, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.1:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.1:0'))).toEqual( true, ) }) test(`VersionRange.parse(~1.2) invalid`, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("1.3:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.3:0'))).toEqual( false, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.3.1:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.3.1:0'))).toEqual( false, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.1.1:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.1.1:0'))).toEqual( false, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.1:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.1:0'))).toEqual( false, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(false) + expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(false) - expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(false) + expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(false) }) } { - const checker = VersionRange.parse("~1.2").not() + const checker = VersionRange.parse('~1.2').not() test(`VersionRange.parse(~1.2).not() valid`, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("1.3:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.3:0'))).toEqual( true, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.3.1:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.3.1:0'))).toEqual( true, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.1.1:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.1.1:0'))).toEqual( true, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.1:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.1:0'))).toEqual( true, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(true) + expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(true) - expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(true) + expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(true) }) test(`VersionRange.parse(~1.2).not() invalid `, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2:0'))).toEqual( false, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.1:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.1:0'))).toEqual( false, ) }) } { - const checker = VersionRange.parse("!~1.2") + const checker = VersionRange.parse('!~1.2') test(`!(VersionRange.parse(~1.2)) valid`, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("1.3:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.3:0'))).toEqual( true, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.3.1:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.3.1:0'))).toEqual( true, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.1.1:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.1.1:0'))).toEqual( true, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.1:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.1:0'))).toEqual( true, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(true) + expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(true) - expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(true) + expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(true) }) test(`!(VersionRange.parse(~1.2)) invalid `, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2:0'))).toEqual( false, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.1:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.1:0'))).toEqual( false, ) }) } { - const checker = VersionRange.parse("!>1.2.3:4") + const checker = VersionRange.parse('!>1.2.3:4') test(`VersionRange.parse("!>1.2.3:4") invalid`, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(false) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:5"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(false) + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:5'))).toEqual( false, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4.1"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4.1'))).toEqual( false, ) }) test(`VersionRange.parse("!>1.2.3:4") valid`, () => { - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4'))).toEqual( true, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:0'))).toEqual( true, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(true) + expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(true) }) } @@ -316,103 +316,103 @@ describe("ExVer", () => { }) } - testNormalization("=2.0", "=2.0:0") - testNormalization("=1 && =2", "!") - testNormalization("!(=1 && =2)", "*") - testNormalization("!=1 || !=2", "*") - testNormalization("(!=#foo:1 || !=#foo:2) && #foo", "#foo") + testNormalization('=2.0', '=2.0:0') + testNormalization('=1 && =2', '!') + testNormalization('!(=1 && =2)', '*') + testNormalization('!=1 || !=2', '*') + testNormalization('(!=#foo:1 || !=#foo:2) && #foo', '#foo') testNormalization( - "!=#foo:1 || !=#bar:2", - "<#foo:1:0 || >#foo:1:0 || !#foo || <#bar:2:0 || >#bar:2:0 || !#bar", + '!=#foo:1 || !=#bar:2', + '<#foo:1:0 || >#foo:1:0 || !#foo || <#bar:2:0 || >#bar:2:0 || !#bar', ) - testNormalization("!(=1 || =2)", "<1:0 || (>1:0 && <2:0) || >2:0 || !#") - testNormalization("=1 && (=2 || =3)", "!") - testNormalization("=1 && (=1 || =2)", "=1:0") - testNormalization("=#foo:1 && =#bar:1", "!") + testNormalization('!(=1 || =2)', '<1:0 || (>1:0 && <2:0) || >2:0 || !#') + testNormalization('=1 && (=2 || =3)', '!') + testNormalization('=1 && (=1 || =2)', '=1:0') + testNormalization('=#foo:1 && =#bar:1', '!') testNormalization( - "!(=#foo:1) && !(=#bar:1)", - "<#foo:1:0 || >#foo:1:0 || <#bar:1:0 || >#bar:1:0 || (!#foo && !#bar)", + '!(=#foo:1) && !(=#bar:1)', + '<#foo:1:0 || >#foo:1:0 || <#bar:1:0 || >#bar:1:0 || (!#foo && !#bar)', ) - testNormalization("!(=#foo:1) && !(=#bar:1) && >2", ">2:0") - testNormalization("~1.2.3", ">=1.2.3:0 && <1.3.0:0") - testNormalization("^1.2.3", ">=1.2.3:0 && <2.0.0:0") + testNormalization('!(=#foo:1) && !(=#bar:1) && >2', '>2:0') + testNormalization('~1.2.3', '>=1.2.3:0 && <1.3.0:0') + testNormalization('^1.2.3', '>=1.2.3:0 && <2.0.0:0') testNormalization( - "^1.2.3 && >=1 && >=1.2 && >=1.3", - ">=1.3:0 && <2.0.0:0", + '^1.2.3 && >=1 && >=1.2 && >=1.3', + '>=1.3:0 && <2.0.0:0', ) testNormalization( - "(>=1.0 && <1.1) || (>=1.1 && <1.2) || (>=1.2 && <1.3)", - ">=1.0:0 && <1.3:0", + '(>=1.0 && <1.1) || (>=1.1 && <1.2) || (>=1.2 && <1.3)', + '>=1.0:0 && <1.3:0', ) - testNormalization(">1 || <2", "#") + testNormalization('>1 || <2', '#') - testNormalization("=1 && =1.2 && =1.2.3", "!") + testNormalization('=1 && =1.2 && =1.2.3', '!') // testNormalization("=1 && =1.2 && =1.2.3", "=1.2.3:0"); TODO: should it be this instead? - testNormalization("=1 || =1.2 || =1.2.3", "=1:0 || =1.2:0 || =1.2.3:0") + testNormalization('=1 || =1.2 || =1.2.3', '=1:0 || =1.2:0 || =1.2.3:0') // testNormalization("=1 || =1.2 || =1.2.3", "=1:0"); TODO: should it be this instead? } { - test(">1 && =1.2", () => { - const checker = VersionRange.parse(">1 && =1.2") + test('>1 && =1.2', () => { + const checker = VersionRange.parse('>1 && =1.2') - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2:0'))).toEqual( true, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.1:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.1:0'))).toEqual( false, ) }) - test("=1 || =2", () => { - const checker = VersionRange.parse("=1 || =2") + test('=1 || =2', () => { + const checker = VersionRange.parse('=1 || =2') - expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(true) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(true) + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2:0'))).toEqual( false, ) // really? - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:0'))).toEqual( false, ) // really? - expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(true) - expect(checker.satisfiedBy(ExtendedVersion.parse("3:0"))).toEqual(false) + expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(true) + expect(checker.satisfiedBy(ExtendedVersion.parse('3:0'))).toEqual(false) }) - test(">1 && =1.2 || =2", () => { - const checker = VersionRange.parse(">1 && =1.2 || =2") + test('>1 && =1.2 || =2', () => { + const checker = VersionRange.parse('>1 && =1.2 || =2') - expect(checker.satisfiedBy(ExtendedVersion.parse("1.2:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.2:0'))).toEqual( true, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(false) - expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(true) - expect(checker.satisfiedBy(ExtendedVersion.parse("3:0"))).toEqual(false) + expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(false) + expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(true) + expect(checker.satisfiedBy(ExtendedVersion.parse('3:0'))).toEqual(false) }) - test("&& before || order of operationns: <1.5 && >1 || >1.5 && <3", () => { - const checker = VersionRange.parse("<1.5 && >1 || >1.5 && <3") - expect(checker.satisfiedBy(ExtendedVersion.parse("1.1:0"))).toEqual( + test('&& before || order of operationns: <1.5 && >1 || >1.5 && <3', () => { + const checker = VersionRange.parse('<1.5 && >1 || >1.5 && <3') + expect(checker.satisfiedBy(ExtendedVersion.parse('1.1:0'))).toEqual( true, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(true) + expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(true) - expect(checker.satisfiedBy(ExtendedVersion.parse("1.5:0"))).toEqual( + expect(checker.satisfiedBy(ExtendedVersion.parse('1.5:0'))).toEqual( false, ) - expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(false) - expect(checker.satisfiedBy(ExtendedVersion.parse("3:0"))).toEqual(false) + expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(false) + expect(checker.satisfiedBy(ExtendedVersion.parse('3:0'))).toEqual(false) }) - test("Compare function on the emver", () => { - const a = ExtendedVersion.parse("1.2.3:0") - const b = ExtendedVersion.parse("1.2.4:0") + test('Compare function on the emver', () => { + const a = ExtendedVersion.parse('1.2.3:0') + const b = ExtendedVersion.parse('1.2.4:0') - expect(a.compare(b)).toEqual("less") - expect(b.compare(a)).toEqual("greater") - expect(a.compare(a)).toEqual("equal") + expect(a.compare(b)).toEqual('less') + expect(b.compare(a)).toEqual('greater') + expect(a.compare(a)).toEqual('equal') }) - test("Compare for sort function on the emver", () => { - const a = ExtendedVersion.parse("1.2.3:0") - const b = ExtendedVersion.parse("1.2.4:0") + test('Compare for sort function on the emver', () => { + const a = ExtendedVersion.parse('1.2.3:0') + const b = ExtendedVersion.parse('1.2.4:0') expect(a.compareForSort(b)).toEqual(-1) expect(b.compareForSort(a)).toEqual(1) diff --git a/sdk/base/lib/test/graph.test.ts b/sdk/base/lib/test/graph.test.ts index a738123d6..e6f4477b7 100644 --- a/sdk/base/lib/test/graph.test.ts +++ b/sdk/base/lib/test/graph.test.ts @@ -1,110 +1,110 @@ -import { Graph } from "../util" +import { Graph } from '../util' -describe("graph", () => { +describe('graph', () => { { { - test("findVertex", () => { + test('findVertex', () => { const graph = new Graph() - const foo = graph.addVertex("foo", [], []) + const foo = graph.addVertex('foo', [], []) const bar = graph.addVertex( - "bar", - [{ from: foo, metadata: "foo-bar" }], + 'bar', + [{ from: foo, metadata: 'foo-bar' }], [], ) const baz = graph.addVertex( - "baz", - [{ from: bar, metadata: "bar-baz" }], + 'baz', + [{ from: bar, metadata: 'bar-baz' }], [], ) const qux = graph.addVertex( - "qux", - [{ from: baz, metadata: "baz-qux" }], + 'qux', + [{ from: baz, metadata: 'baz-qux' }], [], ) - const match = Array.from(graph.findVertex((v) => v.metadata === "qux")) + const match = Array.from(graph.findVertex((v) => v.metadata === 'qux')) expect(match).toHaveLength(1) expect(match[0]).toBe(qux) }) - test("shortestPathA", () => { + test('shortestPathA', () => { const graph = new Graph() - const foo = graph.addVertex("foo", [], []) + const foo = graph.addVertex('foo', [], []) const bar = graph.addVertex( - "bar", - [{ from: foo, metadata: "foo-bar" }], + 'bar', + [{ from: foo, metadata: 'foo-bar' }], [], ) const baz = graph.addVertex( - "baz", - [{ from: bar, metadata: "bar-baz" }], + 'baz', + [{ from: bar, metadata: 'bar-baz' }], [], ) const qux = graph.addVertex( - "qux", - [{ from: baz, metadata: "baz-qux" }], + 'qux', + [{ from: baz, metadata: 'baz-qux' }], [], ) - graph.addEdge("foo-qux", foo, qux) + graph.addEdge('foo-qux', foo, qux) expect(graph.shortestPath(foo, qux) || []).toHaveLength(1) }) - test("shortestPathB", () => { + test('shortestPathB', () => { const graph = new Graph() - const foo = graph.addVertex("foo", [], []) + const foo = graph.addVertex('foo', [], []) const bar = graph.addVertex( - "bar", - [{ from: foo, metadata: "foo-bar" }], + 'bar', + [{ from: foo, metadata: 'foo-bar' }], [], ) const baz = graph.addVertex( - "baz", - [{ from: bar, metadata: "bar-baz" }], + 'baz', + [{ from: bar, metadata: 'bar-baz' }], [], ) const qux = graph.addVertex( - "qux", - [{ from: baz, metadata: "baz-qux" }], + 'qux', + [{ from: baz, metadata: 'baz-qux' }], [], ) - graph.addEdge("bar-qux", bar, qux) + graph.addEdge('bar-qux', bar, qux) expect(graph.shortestPath(foo, qux) || []).toHaveLength(2) }) - test("shortestPathC", () => { + test('shortestPathC', () => { const graph = new Graph() - const foo = graph.addVertex("foo", [], []) + const foo = graph.addVertex('foo', [], []) const bar = graph.addVertex( - "bar", - [{ from: foo, metadata: "foo-bar" }], + 'bar', + [{ from: foo, metadata: 'foo-bar' }], [], ) const baz = graph.addVertex( - "baz", - [{ from: bar, metadata: "bar-baz" }], + 'baz', + [{ from: bar, metadata: 'bar-baz' }], [], ) const qux = graph.addVertex( - "qux", - [{ from: baz, metadata: "baz-qux" }], - [{ to: foo, metadata: "qux-foo" }], + 'qux', + [{ from: baz, metadata: 'baz-qux' }], + [{ to: foo, metadata: 'qux-foo' }], ) expect(graph.shortestPath(foo, qux) || []).toHaveLength(3) }) - test("bfs", () => { + test('bfs', () => { const graph = new Graph() - const foo = graph.addVertex("foo", [], []) + const foo = graph.addVertex('foo', [], []) const bar = graph.addVertex( - "bar", - [{ from: foo, metadata: "foo-bar" }], + 'bar', + [{ from: foo, metadata: 'foo-bar' }], [], ) const baz = graph.addVertex( - "baz", - [{ from: bar, metadata: "bar-baz" }], + 'baz', + [{ from: bar, metadata: 'bar-baz' }], [], ) const qux = graph.addVertex( - "qux", + 'qux', [ - { from: foo, metadata: "foo-qux" }, - { from: baz, metadata: "baz-qux" }, + { from: foo, metadata: 'foo-qux' }, + { from: baz, metadata: 'baz-qux' }, ], [], ) @@ -115,24 +115,24 @@ describe("graph", () => { expect(bfs[2]).toBe(qux) expect(bfs[3]).toBe(baz) }) - test("reverseBfs", () => { + test('reverseBfs', () => { const graph = new Graph() - const foo = graph.addVertex("foo", [], []) + const foo = graph.addVertex('foo', [], []) const bar = graph.addVertex( - "bar", - [{ from: foo, metadata: "foo-bar" }], + 'bar', + [{ from: foo, metadata: 'foo-bar' }], [], ) const baz = graph.addVertex( - "baz", - [{ from: bar, metadata: "bar-baz" }], + 'baz', + [{ from: bar, metadata: 'bar-baz' }], [], ) const qux = graph.addVertex( - "qux", + 'qux', [ - { from: foo, metadata: "foo-qux" }, - { from: baz, metadata: "baz-qux" }, + { from: foo, metadata: 'foo-qux' }, + { from: baz, metadata: 'baz-qux' }, ], [], ) diff --git a/sdk/base/lib/test/inputSpecTypes.test.ts b/sdk/base/lib/test/inputSpecTypes.test.ts index 5665fe1d7..8ef1fc534 100644 --- a/sdk/base/lib/test/inputSpecTypes.test.ts +++ b/sdk/base/lib/test/inputSpecTypes.test.ts @@ -1,13 +1,13 @@ import { ListValueSpecOf, isValueSpecListOf, -} from "../actions/input/inputSpecTypes" -import { InputSpec } from "../actions/input/builder/inputSpec" -import { List } from "../actions/input/builder/list" -import { Value } from "../actions/input/builder/value" +} from '../actions/input/inputSpecTypes' +import { InputSpec } from '../actions/input/builder/inputSpec' +import { List } from '../actions/input/builder/list' +import { Value } from '../actions/input/builder/value' -describe("InputSpec Types", () => { - test("isValueSpecListOf", async () => { +describe('InputSpec Types', () => { + test('isValueSpecListOf', async () => { const options = [List.obj, List.text] for (const option of options) { const test = (option as any)( @@ -15,13 +15,13 @@ describe("InputSpec Types", () => { { spec: InputSpec.of({}) } as any, ) as any const someList = await Value.list(test).build({} as any) - if (isValueSpecListOf(someList.spec, "text")) { - someList.spec.spec satisfies ListValueSpecOf<"text"> - } else if (isValueSpecListOf(someList.spec, "object")) { - someList.spec.spec satisfies ListValueSpecOf<"object"> + if (isValueSpecListOf(someList.spec, 'text')) { + someList.spec.spec satisfies ListValueSpecOf<'text'> + } else if (isValueSpecListOf(someList.spec, 'object')) { + someList.spec.spec satisfies ListValueSpecOf<'object'> } else { throw new Error( - "Failed to figure out the type: " + JSON.stringify(someList), + 'Failed to figure out the type: ' + JSON.stringify(someList), ) } } diff --git a/sdk/base/lib/test/startosTypeValidation.test.ts b/sdk/base/lib/test/startosTypeValidation.test.ts index cdd7cbc0f..bcb9f6abb 100644 --- a/sdk/base/lib/test/startosTypeValidation.test.ts +++ b/sdk/base/lib/test/startosTypeValidation.test.ts @@ -1,4 +1,4 @@ -import { Effects } from "../types" +import { Effects } from '../types' import { CheckDependenciesParam, ClearTasksParams, @@ -14,27 +14,27 @@ import { SetDataVersionParams, SetMainStatus, GetServiceManifestParams, -} from ".././osBindings" -import { CreateSubcontainerFsParams } from ".././osBindings" -import { DestroySubcontainerFsParams } from ".././osBindings" -import { BindParams } from ".././osBindings" -import { GetHostInfoParams } from ".././osBindings" -import { SetHealth } from ".././osBindings" -import { GetSslCertificateParams } from ".././osBindings" -import { GetSslKeyParams } from ".././osBindings" -import { GetServiceInterfaceParams } from ".././osBindings" -import { SetDependenciesParams } from ".././osBindings" -import { GetSystemSmtpParams } from ".././osBindings" -import { GetServicePortForwardParams } from ".././osBindings" -import { ExportServiceInterfaceParams } from ".././osBindings" -import { ListServiceInterfacesParams } from ".././osBindings" -import { ExportActionParams } from ".././osBindings" -import { MountParams } from ".././osBindings" -import { StringObject } from "../util" -import { ExtendedVersion, VersionRange } from "../exver" +} from '.././osBindings' +import { CreateSubcontainerFsParams } from '.././osBindings' +import { DestroySubcontainerFsParams } from '.././osBindings' +import { BindParams } from '.././osBindings' +import { GetHostInfoParams } from '.././osBindings' +import { SetHealth } from '.././osBindings' +import { GetSslCertificateParams } from '.././osBindings' +import { GetSslKeyParams } from '.././osBindings' +import { GetServiceInterfaceParams } from '.././osBindings' +import { SetDependenciesParams } from '.././osBindings' +import { GetSystemSmtpParams } from '.././osBindings' +import { GetServicePortForwardParams } from '.././osBindings' +import { ExportServiceInterfaceParams } from '.././osBindings' +import { ListServiceInterfacesParams } from '.././osBindings' +import { ExportActionParams } from '.././osBindings' +import { MountParams } from '.././osBindings' +import { StringObject } from '../util' +import { ExtendedVersion, VersionRange } from '../exver' function typeEquality(_a: ExpectedType) {} -type WithCallback = Omit & { callback: () => void } +type WithCallback = Omit & { callback: () => void } type EffectsTypeChecker = { [K in keyof T]: T[K] extends (args: infer A) => any @@ -44,11 +44,11 @@ type EffectsTypeChecker = { : never } -describe("startosTypeValidation ", () => { +describe('startosTypeValidation ', () => { test(`checking the params match`, () => { typeEquality({ eventId: {} as never, - child: "", + child: '', isInContext: {} as never, onLeaveContext: () => {}, clearCallbacks: {} as ClearCallbacksParams, diff --git a/sdk/base/lib/test/util.deepMerge.test.ts b/sdk/base/lib/test/util.deepMerge.test.ts index 74ff92c26..df5d203ba 100644 --- a/sdk/base/lib/test/util.deepMerge.test.ts +++ b/sdk/base/lib/test/util.deepMerge.test.ts @@ -1,30 +1,30 @@ -import { deepEqual } from "../util" -import { deepMerge } from "../util" +import { deepEqual } from '../util' +import { deepMerge } from '../util' -describe("deepMerge", () => { - test("deepMerge({}, {a: 1}, {b: 2}) should return {a: 1, b: 2}", () => { +describe('deepMerge', () => { + test('deepMerge({}, {a: 1}, {b: 2}) should return {a: 1, b: 2}', () => { expect(deepMerge({}, { a: 1 }, { b: 2 })).toEqual({ a: 1, b: 2 }) }) - test("deepMerge(null, [1,2,3]) should equal [1,2,3]", () => { + test('deepMerge(null, [1,2,3]) should equal [1,2,3]', () => { expect(deepMerge(null, [1, 2, 3])).toEqual([1, 2, 3]) }) - test("deepMerge({a: {b: 1, c:2}}, {a: {b: 3}}) should equal {a: {b: 3, c: 2}}", () => { + test('deepMerge({a: {b: 1, c:2}}, {a: {b: 3}}) should equal {a: {b: 3, c: 2}}', () => { expect(deepMerge({ a: { b: 1, c: 2 } }, { a: { b: 3 } })).toEqual({ a: { b: 3, c: 2 }, }) }) - test("deepMerge({a: {b: 1, c:2}}, {a: {b: 3}}) should equal {a: {b: 3, c: 2}} with deep equal", () => { + test('deepMerge({a: {b: 1, c:2}}, {a: {b: 3}}) should equal {a: {b: 3, c: 2}} with deep equal', () => { expect( deepEqual(deepMerge({ a: { b: 1, c: 2 } }, { a: { b: 3 } }), { a: { b: 3, c: 2 }, }), ).toBeTruthy() }) - test("Test that merging lists has Set semantics", () => { - const merge = deepMerge(["a", "b"], ["b", "c"]) + test('Test that merging lists has Set semantics', () => { + const merge = deepMerge(['a', 'b'], ['b', 'c']) expect(merge).toHaveLength(3) - expect(merge).toContain("a") - expect(merge).toContain("b") - expect(merge).toContain("c") + expect(merge).toContain('a') + expect(merge).toContain('b') + expect(merge).toContain('c') }) }) diff --git a/sdk/base/lib/test/util.getNetworkInterface.test.ts b/sdk/base/lib/test/util.getNetworkInterface.test.ts index df7ac73c6..14f389938 100644 --- a/sdk/base/lib/test/util.getNetworkInterface.test.ts +++ b/sdk/base/lib/test/util.getNetworkInterface.test.ts @@ -1,15 +1,15 @@ -import { getHostname } from "../util/getServiceInterface" +import { getHostname } from '../util/getServiceInterface' -describe("getHostname ", () => { +describe('getHostname ', () => { const inputToExpected = [ - ["http://localhost:3000", "localhost"], - ["http://localhost", "localhost"], - ["localhost", "localhost"], - ["http://127.0.0.1/", "127.0.0.1"], - ["http://127.0.0.1/testing/1234?314345", "127.0.0.1"], - ["127.0.0.1/", "127.0.0.1"], - ["http://mail.google.com/", "mail.google.com"], - ["mail.google.com/", "mail.google.com"], + ['http://localhost:3000', 'localhost'], + ['http://localhost', 'localhost'], + ['localhost', 'localhost'], + ['http://127.0.0.1/', '127.0.0.1'], + ['http://127.0.0.1/testing/1234?314345', '127.0.0.1'], + ['127.0.0.1/', '127.0.0.1'], + ['http://mail.google.com/', 'mail.google.com'], + ['mail.google.com/', 'mail.google.com'], ] for (const [input, expectValue] of inputToExpected) { diff --git a/sdk/base/lib/types.ts b/sdk/base/lib/types.ts index c86743696..006e6dc66 100644 --- a/sdk/base/lib/types.ts +++ b/sdk/base/lib/types.ts @@ -1,4 +1,4 @@ -export * as inputSpecTypes from "./actions/input/inputSpecTypes" +export * as inputSpecTypes from './actions/input/inputSpecTypes' import { DependencyRequirement, @@ -6,19 +6,19 @@ import { Manifest, ServiceInterface, ActionId, -} from "./osBindings" -import { Affine, StringObject, ToKebab } from "./util" -import { Action, Actions } from "./actions/setupActions" -import { Effects } from "./Effects" -import { ExtendedVersion, VersionRange } from "./exver" +} from './osBindings' +import { Affine, StringObject, ToKebab } from './util' +import { Action, Actions } from './actions/setupActions' +import { Effects } from './Effects' +import { ExtendedVersion, VersionRange } from './exver' export { Effects } -export * from "./osBindings" -export { SDKManifest } from "./types/ManifestTypes" +export * from './osBindings' +export { SDKManifest } from './types/ManifestTypes' export { RequiredDependenciesOf as RequiredDependencies, OptionalDependenciesOf as OptionalDependencies, CurrentDependenciesResult, -} from "./dependencies/setupDependencies" +} from './dependencies/setupDependencies' export type DaemonBuildable = { build(): Promise<{ @@ -26,10 +26,10 @@ export type DaemonBuildable = { }> } -export type ServiceInterfaceType = "ui" | "p2p" | "api" +export type ServiceInterfaceType = 'ui' | 'p2p' | 'api' export type Signals = NodeJS.Signals -export const SIGTERM: Signals = "SIGTERM" -export const SIGKILL: Signals = "SIGKILL" +export const SIGTERM: Signals = 'SIGTERM' +export const SIGKILL: Signals = 'SIGKILL' export const NO_TIMEOUT = -1 export type PathMaker = (options: { volume: string; path: string }) => string @@ -52,7 +52,7 @@ export namespace ExpectedExports { */ export type init = (options: { effects: Effects - kind: "install" | "update" | "restore" | null + kind: 'install' | 'update' | 'restore' | null }) => Promise /** This will be ran during any time a package is uninstalled, for example during a update * this will be called. @@ -87,7 +87,7 @@ export type Daemon = { [DaemonProof]: never } -export type HealthStatus = NamedHealthCheckResult["result"] +export type HealthStatus = NamedHealthCheckResult['result'] export type SmtpValue = { server: string port: number @@ -97,13 +97,13 @@ export type SmtpValue = { } export class UseEntrypoint { - readonly USE_ENTRYPOINT = "USE_ENTRYPOINT" + readonly USE_ENTRYPOINT = 'USE_ENTRYPOINT' constructor(readonly overridCmd?: string[]) {} } export function isUseEntrypoint( command: CommandType, ): command is UseEntrypoint { - return typeof command === "object" && "USE_ENTRYPOINT" in command + return typeof command === 'object' && 'USE_ENTRYPOINT' in command } export type CommandType = string | [string, ...string[]] | UseEntrypoint @@ -163,7 +163,7 @@ export type SetResult = { export type PackageId = string export type Message = string -export type DependencyKind = "running" | "exists" +export type DependencyKind = 'running' | 'exists' export type DependsOn = { [packageId: string]: string[] | readonly string[] diff --git a/sdk/base/lib/types/ManifestTypes.ts b/sdk/base/lib/types/ManifestTypes.ts index b255a6393..3173ef9c2 100644 --- a/sdk/base/lib/types/ManifestTypes.ts +++ b/sdk/base/lib/types/ManifestTypes.ts @@ -1,5 +1,5 @@ -import { T } from ".." -import { ImageId, ImageSource } from "../types" +import { T } from '..' +import { ImageId, ImageSource } from '../types' export type SDKManifest = { /** @@ -156,29 +156,29 @@ export type SDKManifest = { // this is hacky but idk a more elegant way type ArchOptions = { - 0: ["x86_64", "aarch64", "riscv64"] - 1: ["aarch64", "x86_64", "riscv64"] - 2: ["x86_64", "riscv64", "aarch64"] - 3: ["aarch64", "riscv64", "x86_64"] - 4: ["riscv64", "x86_64", "aarch64"] - 5: ["riscv64", "aarch64", "x86_64"] - 6: ["x86_64", "aarch64"] - 7: ["aarch64", "x86_64"] - 8: ["x86_64", "riscv64"] - 9: ["aarch64", "riscv64"] - 10: ["riscv64", "aarch64"] - 11: ["riscv64", "x86_64"] - 12: ["x86_64"] - 13: ["aarch64"] - 14: ["riscv64"] + 0: ['x86_64', 'aarch64', 'riscv64'] + 1: ['aarch64', 'x86_64', 'riscv64'] + 2: ['x86_64', 'riscv64', 'aarch64'] + 3: ['aarch64', 'riscv64', 'x86_64'] + 4: ['riscv64', 'x86_64', 'aarch64'] + 5: ['riscv64', 'aarch64', 'x86_64'] + 6: ['x86_64', 'aarch64'] + 7: ['aarch64', 'x86_64'] + 8: ['x86_64', 'riscv64'] + 9: ['aarch64', 'riscv64'] + 10: ['riscv64', 'aarch64'] + 11: ['riscv64', 'x86_64'] + 12: ['x86_64'] + 13: ['aarch64'] + 14: ['riscv64'] } export type SDKImageInputSpec = { [A in keyof ArchOptions]: { - source: Exclude + source: Exclude arch?: ArchOptions[A] emulateMissingAs?: ArchOptions[A][number] | null nvidiaContainer?: boolean } }[keyof ArchOptions] -export type ManifestDependency = T.Manifest["dependencies"][string] +export type ManifestDependency = T.Manifest['dependencies'][string] diff --git a/sdk/base/lib/util/Drop.ts b/sdk/base/lib/util/Drop.ts index 62dd61f0f..7be2afbe6 100644 --- a/sdk/base/lib/util/Drop.ts +++ b/sdk/base/lib/util/Drop.ts @@ -1,4 +1,4 @@ -const dropId: unique symbol = Symbol("id") +const dropId: unique symbol = Symbol('id') export type DropRef = { [dropId]: number } export abstract class Drop { @@ -19,7 +19,7 @@ export abstract class Drop { return new Proxy(this, { set(target: any, prop, value) { - if (prop === "dropRef" || prop == "dropId") return false + if (prop === 'dropRef' || prop == 'dropId') return false target[prop] = value ;(weak as any)[prop] = value return true @@ -60,7 +60,7 @@ export class DropPromise implements Promise { private static idCtr: number = 0 private dropId: number private dropRef: DropRef; - [Symbol.toStringTag] = "DropPromise" + [Symbol.toStringTag] = 'DropPromise' private constructor( private readonly promise: Promise, dropFnOrRef?: (() => void) | DropRef, diff --git a/sdk/base/lib/util/GetSystemSmtp.ts b/sdk/base/lib/util/GetSystemSmtp.ts index 9e0c4af15..69e6c1279 100644 --- a/sdk/base/lib/util/GetSystemSmtp.ts +++ b/sdk/base/lib/util/GetSystemSmtp.ts @@ -1,6 +1,6 @@ -import { Effects } from "../Effects" -import * as T from "../types" -import { DropGenerator, DropPromise } from "./Drop" +import { Effects } from '../Effects' +import * as T from '../types' +import { DropGenerator, DropPromise } from './Drop' export class GetSystemSmtp { constructor(readonly effects: Effects) {} @@ -27,7 +27,7 @@ export class GetSystemSmtp { this.effects.onLeaveContext(() => { resolveCell.resolve() }) - abort?.addEventListener("abort", () => resolveCell.resolve()) + abort?.addEventListener('abort', () => resolveCell.resolve()) while (this.effects.isInContext && !abort?.aborted) { let callback: () => void = () => {} const waitForNext = new Promise((resolve) => { @@ -39,7 +39,7 @@ export class GetSystemSmtp { }) await waitForNext } - return new Promise((_, rej) => rej(new Error("aborted"))) + return new Promise((_, rej) => rej(new Error('aborted'))) } /** @@ -49,7 +49,7 @@ export class GetSystemSmtp { abort?: AbortSignal, ): AsyncGenerator { const ctrl = new AbortController() - abort?.addEventListener("abort", () => ctrl.abort()) + abort?.addEventListener('abort', () => ctrl.abort()) return DropGenerator.of(this.watchGen(ctrl.signal), () => ctrl.abort()) } @@ -73,7 +73,7 @@ export class GetSystemSmtp { } } catch (e) { console.error( - "callback function threw an error @ GetSystemSmtp.onChange", + 'callback function threw an error @ GetSystemSmtp.onChange', e, ) } @@ -82,7 +82,7 @@ export class GetSystemSmtp { .catch((e) => callback(null, e)) .catch((e) => console.error( - "callback function threw an error @ GetSystemSmtp.onChange", + 'callback function threw an error @ GetSystemSmtp.onChange', e, ), ) diff --git a/sdk/base/lib/util/asError.ts b/sdk/base/lib/util/asError.ts index c3454e0e4..5f0a3884d 100644 --- a/sdk/base/lib/util/asError.ts +++ b/sdk/base/lib/util/asError.ts @@ -2,7 +2,7 @@ export const asError = (e: unknown) => { if (e instanceof Error) { return new Error(e as any) } - if (typeof e === "string") { + if (typeof e === 'string') { return new Error(`${e}`) } return new Error(`${JSON.stringify(e)}`) diff --git a/sdk/base/lib/util/deepEqual.ts b/sdk/base/lib/util/deepEqual.ts index 7a1d534cc..e64c23429 100644 --- a/sdk/base/lib/util/deepEqual.ts +++ b/sdk/base/lib/util/deepEqual.ts @@ -1,4 +1,4 @@ -import { object } from "ts-matches" +import { object } from 'ts-matches' export function deepEqual(...args: unknown[]) { const objects = args.filter(object.test) diff --git a/sdk/base/lib/util/deepMerge.ts b/sdk/base/lib/util/deepMerge.ts index 452a8549d..f64a2ef50 100644 --- a/sdk/base/lib/util/deepMerge.ts +++ b/sdk/base/lib/util/deepMerge.ts @@ -23,7 +23,7 @@ export function partialDiff( } else { return } - } else if (typeof prev === "object" && typeof next === "object") { + } else if (typeof prev === 'object' && typeof next === 'object') { if (prev === null || next === null) return { diff: next } const res = { diff: {} as Record } const keys = Object.keys(next) as (keyof T)[] @@ -48,14 +48,14 @@ export function partialDiff( export function deepMerge(...args: unknown[]): unknown { const lastItem = (args as any)[args.length - 1] - if (typeof lastItem !== "object" || !lastItem) return lastItem + if (typeof lastItem !== 'object' || !lastItem) return lastItem if (Array.isArray(lastItem)) return deepMergeList( ...(args.filter((x) => Array.isArray(x)) as unknown[][]), ) return deepMergeObject( ...(args.filter( - (x) => typeof x === "object" && x && !Array.isArray(x), + (x) => typeof x === 'object' && x && !Array.isArray(x), ) as object[]), ) } diff --git a/sdk/base/lib/util/getDefaultString.ts b/sdk/base/lib/util/getDefaultString.ts index 2bbf8d279..7468c1e00 100644 --- a/sdk/base/lib/util/getDefaultString.ts +++ b/sdk/base/lib/util/getDefaultString.ts @@ -1,8 +1,8 @@ -import { DefaultString } from "../actions/input/inputSpecTypes" -import { getRandomString } from "./getRandomString" +import { DefaultString } from '../actions/input/inputSpecTypes' +import { getRandomString } from './getRandomString' export function getDefaultString(defaultSpec: DefaultString): string { - if (typeof defaultSpec === "string") { + if (typeof defaultSpec === 'string') { return defaultSpec } else { return getRandomString(defaultSpec) diff --git a/sdk/base/lib/util/getRandomCharInSet.ts b/sdk/base/lib/util/getRandomCharInSet.ts index 7914209a3..4877ed765 100644 --- a/sdk/base/lib/util/getRandomCharInSet.ts +++ b/sdk/base/lib/util/getRandomCharInSet.ts @@ -11,7 +11,7 @@ export function getRandomCharInSet(charset: string): string { } charIdx -= range.len } - throw new Error("unreachable") + throw new Error('unreachable') } function stringToCharSet(charset: string): CharSet { let set: CharSet = { ranges: [], len: 0 } @@ -20,10 +20,10 @@ function stringToCharSet(charset: string): CharSet { let in_range = false for (let char of charset) { switch (char) { - case ",": + case ',': if (start !== null && end !== null) { if (start!.charCodeAt(0) > end!.charCodeAt(0)) { - throw new Error("start > end of charset") + throw new Error('start > end of charset') } const len = end.charCodeAt(0) - start.charCodeAt(0) + 1 set.ranges.push({ @@ -40,20 +40,20 @@ function stringToCharSet(charset: string): CharSet { set.ranges.push({ start, end: start, len: 1 }) start = null } else if (start !== null && in_range) { - end = "," + end = ',' } else if (start === null && end === null && !in_range) { - start = "," + start = ',' } else { throw new Error('unexpected ","') } break - case "-": + case '-': if (start === null) { - start = "-" + start = '-' } else if (!in_range) { in_range = true } else if (in_range && end === null) { - end = "-" + end = '-' } else { throw new Error('unexpected "-"') } @@ -70,7 +70,7 @@ function stringToCharSet(charset: string): CharSet { } if (start !== null && end !== null) { if (start!.charCodeAt(0) > end!.charCodeAt(0)) { - throw new Error("start > end of charset") + throw new Error('start > end of charset') } const len = end.charCodeAt(0) - start.charCodeAt(0) + 1 set.ranges.push({ diff --git a/sdk/base/lib/util/getRandomString.ts b/sdk/base/lib/util/getRandomString.ts index 7b52041d8..fe41d259d 100644 --- a/sdk/base/lib/util/getRandomString.ts +++ b/sdk/base/lib/util/getRandomString.ts @@ -1,8 +1,8 @@ -import { RandomString } from "../actions/input/inputSpecTypes" -import { getRandomCharInSet } from "./getRandomCharInSet" +import { RandomString } from '../actions/input/inputSpecTypes' +import { getRandomCharInSet } from './getRandomCharInSet' export function getRandomString(generator: RandomString): string { - let s = "" + let s = '' for (let i = 0; i < generator.len; i++) { s = s + getRandomCharInSet(generator.charset) } diff --git a/sdk/base/lib/util/getServiceInterface.ts b/sdk/base/lib/util/getServiceInterface.ts index 48d883edb..17186b7d7 100644 --- a/sdk/base/lib/util/getServiceInterface.ts +++ b/sdk/base/lib/util/getServiceInterface.ts @@ -1,11 +1,11 @@ -import { PackageId, ServiceInterfaceId, ServiceInterfaceType } from "../types" -import { knownProtocols } from "../interfaces/Host" -import { AddressInfo, Host, Hostname, HostnameInfo } from "../types" -import { Effects } from "../Effects" -import { DropGenerator, DropPromise } from "./Drop" -import { IpAddress, IPV6_LINK_LOCAL } from "./ip" -import { deepEqual } from "./deepEqual" -import { once } from "./once" +import { PackageId, ServiceInterfaceId, ServiceInterfaceType } from '../types' +import { knownProtocols } from '../interfaces/Host' +import { AddressInfo, Host, Hostname, HostnameInfo } from '../types' +import { Effects } from '../Effects' +import { DropGenerator, DropPromise } from './Drop' +import { IpAddress, IPV6_LINK_LOCAL } from './ip' +import { deepEqual } from './deepEqual' +import { once } from './once' export type UrlString = string export type HostId = string @@ -14,68 +14,68 @@ const getHostnameRegex = /^(\w+:\/\/)?([^\/\:]+)(:\d{1,3})?(\/)?/ export const getHostname = (url: string): Hostname | null => { const founds = url.match(getHostnameRegex)?.[2] if (!founds) return null - const parts = founds.split("@") + const parts = founds.split('@') const last = parts[parts.length - 1] as Hostname | null return last } type FilterKinds = - | "onion" - | "mdns" - | "domain" - | "ip" - | "ipv4" - | "ipv6" - | "localhost" - | "link-local" + | 'onion' + | 'mdns' + | 'domain' + | 'ip' + | 'ipv4' + | 'ipv6' + | 'localhost' + | 'link-local' export type Filter = { - visibility?: "public" | "private" + visibility?: 'public' | 'private' kind?: FilterKinds | FilterKinds[] predicate?: (h: HostnameInfo) => boolean exclude?: Filter } -type VisibilityFilter = V extends "public" - ? (HostnameInfo & { public: true }) | VisibilityFilter> - : V extends "private" +type VisibilityFilter = V extends 'public' + ? (HostnameInfo & { public: true }) | VisibilityFilter> + : V extends 'private' ? | (HostnameInfo & { public: false }) - | VisibilityFilter> + | VisibilityFilter> : never -type KindFilter = K extends "onion" - ? (HostnameInfo & { kind: "onion" }) | KindFilter> - : K extends "mdns" +type KindFilter = K extends 'onion' + ? (HostnameInfo & { kind: 'onion' }) | KindFilter> + : K extends 'mdns' ? - | (HostnameInfo & { kind: "ip"; hostname: { kind: "local" } }) - | KindFilter> - : K extends "domain" + | (HostnameInfo & { kind: 'ip'; hostname: { kind: 'local' } }) + | KindFilter> + : K extends 'domain' ? - | (HostnameInfo & { kind: "ip"; hostname: { kind: "domain" } }) - | KindFilter> - : K extends "ipv4" + | (HostnameInfo & { kind: 'ip'; hostname: { kind: 'domain' } }) + | KindFilter> + : K extends 'ipv4' ? - | (HostnameInfo & { kind: "ip"; hostname: { kind: "ipv4" } }) - | KindFilter> - : K extends "ipv6" + | (HostnameInfo & { kind: 'ip'; hostname: { kind: 'ipv4' } }) + | KindFilter> + : K extends 'ipv6' ? - | (HostnameInfo & { kind: "ip"; hostname: { kind: "ipv6" } }) - | KindFilter> - : K extends "ip" - ? KindFilter | "ipv4" | "ipv6"> + | (HostnameInfo & { kind: 'ip'; hostname: { kind: 'ipv6' } }) + | KindFilter> + : K extends 'ip' + ? KindFilter | 'ipv4' | 'ipv6'> : never type FilterReturnTy = F extends { - visibility: infer V extends "public" | "private" + visibility: infer V extends 'public' | 'private' } - ? VisibilityFilter & FilterReturnTy> + ? VisibilityFilter & FilterReturnTy> : F extends { kind: (infer K extends FilterKinds) | (infer K extends FilterKinds)[] } - ? KindFilter & FilterReturnTy> + ? KindFilter & FilterReturnTy> : F extends { predicate: (h: HostnameInfo) => h is infer H extends HostnameInfo } - ? H & FilterReturnTy> + ? H & FilterReturnTy> : F extends { exclude: infer E extends Filter } // MUST BE LAST ? HostnameInfo extends FilterReturnTy ? HostnameInfo @@ -84,26 +84,26 @@ type FilterReturnTy = F extends { const nonLocalFilter = { exclude: { - kind: ["localhost", "link-local"] as ("localhost" | "link-local")[], + kind: ['localhost', 'link-local'] as ('localhost' | 'link-local')[], }, } as const const publicFilter = { - visibility: "public", + visibility: 'public', } as const const onionFilter = { - kind: "onion", + kind: 'onion', } as const -type Formats = "hostname-info" | "urlstring" | "url" +type Formats = 'hostname-info' | 'urlstring' | 'url' type FormatReturnTy< F extends Filter, Format extends Formats, -> = Format extends "hostname-info" - ? FilterReturnTy | FormatReturnTy> - : Format extends "url" - ? URL | FormatReturnTy> - : Format extends "urlstring" - ? UrlString | FormatReturnTy> +> = Format extends 'hostname-info' + ? FilterReturnTy | FormatReturnTy> + : Format extends 'url' + ? URL | FormatReturnTy> + : Format extends 'urlstring' + ? UrlString | FormatReturnTy> : never export type Filled = { @@ -114,7 +114,7 @@ export type Filled = { sslUrl: UrlString | null } - format: ( + format: ( format?: Format, ) => FormatReturnTy<{}, Format>[] @@ -162,12 +162,12 @@ export const addressHostToUrl = ( scheme in knownProtocols && port === knownProtocols[scheme as keyof typeof knownProtocols].defaultPort let hostname - if (host.kind === "onion") { + if (host.kind === 'onion') { hostname = host.hostname.value - } else if (host.kind === "ip") { - if (host.hostname.kind === "domain") { + } else if (host.kind === 'ip') { + if (host.hostname.kind === 'domain') { hostname = host.hostname.value - } else if (host.hostname.kind === "ipv6") { + } else if (host.hostname.kind === 'ipv6') { hostname = IPV6_LINK_LOCAL.contains(host.hostname.value) ? `[${host.hostname.value}%${host.hostname.scopeId}]` : `[${host.hostname.value}]` @@ -175,9 +175,9 @@ export const addressHostToUrl = ( hostname = host.hostname.value } } - return `${scheme ? `${scheme}://` : ""}${ - username ? `${username}@` : "" - }${hostname}${excludePort ? "" : `:${port}`}${suffix}` + return `${scheme ? `${scheme}://` : ''}${ + username ? `${username}@` : '' + }${hostname}${excludePort ? '' : `:${port}`}${suffix}` } let url = null if (hostname.hostname.port !== null) { @@ -200,39 +200,39 @@ function filterRec( const pred = filter.predicate hostnames = hostnames.filter((h) => invert !== pred(h)) } - if (filter.visibility === "public") + if (filter.visibility === 'public') hostnames = hostnames.filter( - (h) => invert !== (h.kind === "onion" || h.public), + (h) => invert !== (h.kind === 'onion' || h.public), ) - if (filter.visibility === "private") + if (filter.visibility === 'private') hostnames = hostnames.filter( - (h) => invert !== (h.kind !== "onion" && !h.public), + (h) => invert !== (h.kind !== 'onion' && !h.public), ) if (filter.kind) { const kind = new Set( Array.isArray(filter.kind) ? filter.kind : [filter.kind], ) - if (kind.has("ip")) { - kind.add("ipv4") - kind.add("ipv6") + if (kind.has('ip')) { + kind.add('ipv4') + kind.add('ipv6') } hostnames = hostnames.filter( (h) => invert !== - ((kind.has("onion") && h.kind === "onion") || - (kind.has("mdns") && - h.kind === "ip" && - h.hostname.kind === "local") || - (kind.has("domain") && - h.kind === "ip" && - h.hostname.kind === "domain") || - (kind.has("ipv4") && h.kind === "ip" && h.hostname.kind === "ipv4") || - (kind.has("ipv6") && h.kind === "ip" && h.hostname.kind === "ipv6") || - (kind.has("localhost") && - ["localhost", "127.0.0.1", "::1"].includes(h.hostname.value)) || - (kind.has("link-local") && - h.kind === "ip" && - h.hostname.kind === "ipv6" && + ((kind.has('onion') && h.kind === 'onion') || + (kind.has('mdns') && + h.kind === 'ip' && + h.hostname.kind === 'local') || + (kind.has('domain') && + h.kind === 'ip' && + h.hostname.kind === 'domain') || + (kind.has('ipv4') && h.kind === 'ip' && h.hostname.kind === 'ipv4') || + (kind.has('ipv6') && h.kind === 'ip' && h.hostname.kind === 'ipv6') || + (kind.has('localhost') && + ['localhost', '127.0.0.1', '::1'].includes(h.hostname.value)) || + (kind.has('link-local') && + h.kind === 'ip' && + h.hostname.kind === 'ipv6' && IPV6_LINK_LOCAL.contains(IpAddress.parse(h.hostname.value)))), ) } @@ -275,11 +275,11 @@ export const filledAddress = ( ...addressInfo, hostnames, toUrls, - format: (format?: Format) => { + format: (format?: Format) => { let res: FormatReturnTy<{}, Format>[] = hostnames as any - if (format === "hostname-info") return res + if (format === 'hostname-info') return res const urls = hostnames.flatMap(toUrlArray) - if (format === "url") res = urls.map((u) => new URL(u)) as any + if (format === 'url') res = urls.map((u) => new URL(u)) as any else res = urls as any return res }, @@ -386,7 +386,7 @@ export class GetServiceInterface { this.effects.onLeaveContext(() => { resolveCell.resolve() }) - abort?.addEventListener("abort", () => resolveCell.resolve()) + abort?.addEventListener('abort', () => resolveCell.resolve()) while (this.effects.isInContext && !abort?.aborted) { let callback: () => void = () => {} const waitForNext = new Promise((resolve) => { @@ -406,7 +406,7 @@ export class GetServiceInterface { } await waitForNext } - return new Promise((_, rej) => rej(new Error("aborted"))) + return new Promise((_, rej) => rej(new Error('aborted'))) } /** @@ -414,7 +414,7 @@ export class GetServiceInterface { */ watch(abort?: AbortSignal): AsyncGenerator { const ctrl = new AbortController() - abort?.addEventListener("abort", () => ctrl.abort()) + abort?.addEventListener('abort', () => ctrl.abort()) return DropGenerator.of(this.watchGen(ctrl.signal), () => ctrl.abort()) } @@ -438,7 +438,7 @@ export class GetServiceInterface { } } catch (e) { console.error( - "callback function threw an error @ GetServiceInterface.onChange", + 'callback function threw an error @ GetServiceInterface.onChange', e, ) } @@ -447,7 +447,7 @@ export class GetServiceInterface { .catch((e) => callback(null, e)) .catch((e) => console.error( - "callback function threw an error @ GetServiceInterface.onChange", + 'callback function threw an error @ GetServiceInterface.onChange', e, ), ) @@ -465,7 +465,7 @@ export class GetServiceInterface { return next } } - throw new Error("context left before predicate passed") + throw new Error('context left before predicate passed') }), () => ctrl.abort(), ) diff --git a/sdk/base/lib/util/getServiceInterfaces.ts b/sdk/base/lib/util/getServiceInterfaces.ts index e2eb6131a..ea11d7c65 100644 --- a/sdk/base/lib/util/getServiceInterfaces.ts +++ b/sdk/base/lib/util/getServiceInterfaces.ts @@ -1,8 +1,8 @@ -import { Effects } from "../Effects" -import { PackageId } from "../osBindings" -import { deepEqual } from "./deepEqual" -import { DropGenerator, DropPromise } from "./Drop" -import { ServiceInterfaceFilled, filledAddress } from "./getServiceInterface" +import { Effects } from '../Effects' +import { PackageId } from '../osBindings' +import { deepEqual } from './deepEqual' +import { DropGenerator, DropPromise } from './Drop' +import { ServiceInterfaceFilled, filledAddress } from './getServiceInterface' const makeManyInterfaceFilled = async ({ effects, @@ -86,7 +86,7 @@ export class GetServiceInterfaces { this.effects.onLeaveContext(() => { resolveCell.resolve() }) - abort?.addEventListener("abort", () => resolveCell.resolve()) + abort?.addEventListener('abort', () => resolveCell.resolve()) while (this.effects.isInContext && !abort?.aborted) { let callback: () => void = () => {} const waitForNext = new Promise((resolve) => { @@ -105,7 +105,7 @@ export class GetServiceInterfaces { } await waitForNext } - return new Promise((_, rej) => rej(new Error("aborted"))) + return new Promise((_, rej) => rej(new Error('aborted'))) } /** @@ -113,7 +113,7 @@ export class GetServiceInterfaces { */ watch(abort?: AbortSignal): AsyncGenerator { const ctrl = new AbortController() - abort?.addEventListener("abort", () => ctrl.abort()) + abort?.addEventListener('abort', () => ctrl.abort()) return DropGenerator.of(this.watchGen(ctrl.signal), () => ctrl.abort()) } @@ -137,7 +137,7 @@ export class GetServiceInterfaces { } } catch (e) { console.error( - "callback function threw an error @ GetServiceInterfaces.onChange", + 'callback function threw an error @ GetServiceInterfaces.onChange', e, ) } @@ -146,7 +146,7 @@ export class GetServiceInterfaces { .catch((e) => callback(null, e)) .catch((e) => console.error( - "callback function threw an error @ GetServiceInterfaces.onChange", + 'callback function threw an error @ GetServiceInterfaces.onChange', e, ), ) @@ -164,7 +164,7 @@ export class GetServiceInterfaces { return next } } - throw new Error("context left before predicate passed") + throw new Error('context left before predicate passed') }), () => ctrl.abort(), ) diff --git a/sdk/base/lib/util/graph.ts b/sdk/base/lib/util/graph.ts index fccccbf70..f2ba5ff09 100644 --- a/sdk/base/lib/util/graph.ts +++ b/sdk/base/lib/util/graph.ts @@ -1,5 +1,5 @@ -import { boolean } from "ts-matches" -import { ExtendedVersion } from "../exver" +import { boolean } from 'ts-matches' +import { ExtendedVersion } from '../exver' export type Vertex = { metadata: VMetadata @@ -23,9 +23,9 @@ export class Graph { return JSON.stringify( this.vertices, (k, v) => { - if (k === "metadata") return metadataRepr(v) - if (k === "from") return metadataRepr(v.metadata) - if (k === "to") return metadataRepr(v.metadata) + if (k === 'metadata') return metadataRepr(v) + if (k === 'from') return metadataRepr(v.metadata) + if (k === 'to') return metadataRepr(v.metadata) return v }, 2, @@ -33,8 +33,8 @@ export class Graph { } addVertex( metadata: VMetadata, - fromEdges: Array, "to">>, - toEdges: Array, "from">>, + fromEdges: Array, 'to'>>, + toEdges: Array, 'from'>>, ): Vertex { const vertex: Vertex = { metadata, diff --git a/sdk/base/lib/util/inMs.test.ts b/sdk/base/lib/util/inMs.test.ts index fbf71bf2c..fa70c7b88 100644 --- a/sdk/base/lib/util/inMs.test.ts +++ b/sdk/base/lib/util/inMs.test.ts @@ -1,34 +1,34 @@ -import { inMs } from "./inMs" +import { inMs } from './inMs' -describe("inMs", () => { - test("28.001s", () => { - expect(inMs("28.001s")).toBe(28001) +describe('inMs', () => { + test('28.001s', () => { + expect(inMs('28.001s')).toBe(28001) }) - test("28.123s", () => { - expect(inMs("28.123s")).toBe(28123) + test('28.123s', () => { + expect(inMs('28.123s')).toBe(28123) }) - test(".123s", () => { - expect(inMs(".123s")).toBe(123) + test('.123s', () => { + expect(inMs('.123s')).toBe(123) }) - test("123ms", () => { - expect(inMs("123ms")).toBe(123) + test('123ms', () => { + expect(inMs('123ms')).toBe(123) }) - test("1h", () => { - expect(inMs("1h")).toBe(3600000) + test('1h', () => { + expect(inMs('1h')).toBe(3600000) }) - test("1m", () => { - expect(inMs("1m")).toBe(60000) + test('1m', () => { + expect(inMs('1m')).toBe(60000) }) - test("1m", () => { - expect(inMs("1d")).toBe(1000 * 60 * 60 * 24) + test('1m', () => { + expect(inMs('1d')).toBe(1000 * 60 * 60 * 24) }) - test("123", () => { - expect(() => inMs("123")).toThrowError("Invalid time format: 123") + test('123', () => { + expect(() => inMs('123')).toThrowError('Invalid time format: 123') }) - test("123 as number", () => { + test('123 as number', () => { expect(inMs(123)).toBe(123) }) - test.only("undefined", () => { + test.only('undefined', () => { expect(inMs(undefined)).toBe(undefined) }) }) diff --git a/sdk/base/lib/util/inMs.ts b/sdk/base/lib/util/inMs.ts index 548eb14bf..bf03f78d4 100644 --- a/sdk/base/lib/util/inMs.ts +++ b/sdk/base/lib/util/inMs.ts @@ -2,11 +2,11 @@ const matchTimeRegex = /^\s*(\d+)?(\.\d+)?\s*(ms|s|m|h|d)/ const unitMultiplier = (unit?: string) => { if (!unit) return 1 - if (unit === "ms") return 1 - if (unit === "s") return 1000 - if (unit === "m") return 1000 * 60 - if (unit === "h") return 1000 * 60 * 60 - if (unit === "d") return 1000 * 60 * 60 * 24 + if (unit === 'ms') return 1 + if (unit === 's') return 1000 + if (unit === 'm') return 1000 * 60 + if (unit === 'h') return 1000 * 60 * 60 + if (unit === 'd') return 1000 * 60 * 60 * 24 throw new Error(`Invalid unit: ${unit}`) } const digitsMs = (digits: string | null, multiplier: number) => { @@ -16,13 +16,13 @@ const digitsMs = (digits: string | null, multiplier: number) => { return Math.round(value * divideBy) } export const inMs = (time?: string | number) => { - if (typeof time === "number") return time + if (typeof time === 'number') return time if (!time) return undefined const matches = time.match(matchTimeRegex) if (!matches) throw new Error(`Invalid time format: ${time}`) const [_, leftHandSide, digits, unit] = matches const multiplier = unitMultiplier(unit) - const firstValue = parseInt(leftHandSide || "0") * multiplier + const firstValue = parseInt(leftHandSide || '0') * multiplier const secondValue = digitsMs(digits, multiplier) return firstValue + secondValue diff --git a/sdk/base/lib/util/index.ts b/sdk/base/lib/util/index.ts index 25c3938f9..303cf5f73 100644 --- a/sdk/base/lib/util/index.ts +++ b/sdk/base/lib/util/index.ts @@ -1,25 +1,25 @@ /// Currently being used -export { addressHostToUrl } from "./getServiceInterface" -export { getDefaultString } from "./getDefaultString" -export * from "./ip" +export { addressHostToUrl } from './getServiceInterface' +export { getDefaultString } from './getDefaultString' +export * from './ip' /// Not being used, but known to be browser compatible export { GetServiceInterface, getServiceInterface, filledAddress, -} from "./getServiceInterface" -export { getServiceInterfaces } from "./getServiceInterfaces" -export { once } from "./once" -export { asError } from "./asError" -export * as Patterns from "./patterns" -export * from "./typeHelpers" -export { GetSystemSmtp } from "./GetSystemSmtp" -export { Graph, Vertex } from "./graph" -export { inMs } from "./inMs" -export { splitCommand } from "./splitCommand" -export { nullIfEmpty } from "./nullIfEmpty" -export { deepMerge, partialDiff } from "./deepMerge" -export { deepEqual } from "./deepEqual" -export * as regexes from "./regexes" -export { stringFromStdErrOut } from "./stringFromStdErrOut" +} from './getServiceInterface' +export { getServiceInterfaces } from './getServiceInterfaces' +export { once } from './once' +export { asError } from './asError' +export * as Patterns from './patterns' +export * from './typeHelpers' +export { GetSystemSmtp } from './GetSystemSmtp' +export { Graph, Vertex } from './graph' +export { inMs } from './inMs' +export { splitCommand } from './splitCommand' +export { nullIfEmpty } from './nullIfEmpty' +export { deepMerge, partialDiff } from './deepMerge' +export { deepEqual } from './deepEqual' +export * as regexes from './regexes' +export { stringFromStdErrOut } from './stringFromStdErrOut' diff --git a/sdk/base/lib/util/ip.ts b/sdk/base/lib/util/ip.ts index 1f2c25067..894d1f08b 100644 --- a/sdk/base/lib/util/ip.ts +++ b/sdk/base/lib/util/ip.ts @@ -8,9 +8,9 @@ export class IpAddress { } static parse(address: string): IpAddress { let octets - if (address.includes(":")) { + if (address.includes(':')) { octets = new Array(16).fill(0) - const segs = address.split(":") + const segs = address.split(':') let idx = 0 let octIdx = 0 while (segs[idx]) { @@ -31,23 +31,23 @@ export class IpAddress { } } } else { - octets = address.split(".").map(Number) - if (octets.length !== 4) throw new Error("invalid ipv4 address") + octets = address.split('.').map(Number) + if (octets.length !== 4) throw new Error('invalid ipv4 address') } if (octets.some((o) => isNaN(o) || o > 255)) { - throw new Error("invalid ip address") + throw new Error('invalid ip address') } return new IpAddress(octets, address) } static fromOctets(octets: number[]) { if (octets.length == 4) { if (octets.some((o) => o > 255)) { - throw new Error("invalid ip address") + throw new Error('invalid ip address') } - return new IpAddress(octets, octets.join(".")) + return new IpAddress(octets, octets.join('.')) } else if (octets.length == 16) { if (octets.some((o) => o > 255)) { - throw new Error("invalid ip address") + throw new Error('invalid ip address') } let pre = octets.slice(0, 8) while (pre[pre.length - 1] == 0) { @@ -58,12 +58,12 @@ export class IpAddress { post.unshift() } if (pre.length + post.length == 16) { - return new IpAddress(octets, octets.join(":")) + return new IpAddress(octets, octets.join(':')) } else { - return new IpAddress(octets, pre.join(":") + "::" + post.join(":")) + return new IpAddress(octets, pre.join(':') + '::' + post.join(':')) } } else { - throw new Error("invalid ip address") + throw new Error('invalid ip address') } } isIpv4(): boolean { @@ -88,7 +88,7 @@ export class IpAddress { } } if (octets[0] > 255) { - throw new Error("overflow incrementing ip") + throw new Error('overflow incrementing ip') } return IpAddress.fromOctets(octets) } @@ -105,12 +105,12 @@ export class IpAddress { } } if (octets[0] < 0) { - throw new Error("underflow decrementing ip") + throw new Error('underflow decrementing ip') } return IpAddress.fromOctets(octets) } cmp(other: string | IpAddress): -1 | 0 | 1 { - if (typeof other === "string") other = IpAddress.parse(other) + if (typeof other === 'string') other = IpAddress.parse(other) const len = Math.max(this.octets.length, other.octets.length) for (let i = 0; i < len; i++) { const left = this.octets[i] || 0 @@ -130,7 +130,7 @@ export class IpAddress { ) { // already rendered } else if (this.octets.length === 4) { - this.renderedAddress = this.octets.join(".") + this.renderedAddress = this.octets.join('.') this.renderedOctets = [...this.octets] } else if (this.octets.length === 16) { const contigZeros = this.octets.reduce( @@ -149,12 +149,12 @@ export class IpAddress { { start: 0, end: 0, current: 0 }, ) if (contigZeros.end - contigZeros.start >= 2) { - return `${this.octets.slice(0, contigZeros.start).join(":")}::${this.octets.slice(contigZeros.end).join(":")}` + return `${this.octets.slice(0, contigZeros.start).join(':')}::${this.octets.slice(contigZeros.end).join(':')}` } - this.renderedAddress = this.octets.join(":") + this.renderedAddress = this.octets.join(':') this.renderedOctets = [...this.octets] } else { - console.warn("invalid octet length for IpAddress", this.octets) + console.warn('invalid octet length for IpAddress', this.octets) } return this.renderedAddress } @@ -170,18 +170,18 @@ export class IpNet extends IpAddress { } static fromIpPrefix(ip: IpAddress, prefix: number): IpNet { if (prefix > ip.octets.length * 8) { - throw new Error("invalid prefix") + throw new Error('invalid prefix') } return new IpNet(ip.octets, prefix, ip.address) } static parse(ipnet: string): IpNet { - const [address, prefixStr] = ipnet.split("/", 2) + const [address, prefixStr] = ipnet.split('/', 2) const ip = IpAddress.parse(address) const prefix = Number(prefixStr) return IpNet.fromIpPrefix(ip, prefix) } contains(address: string | IpAddress | IpNet): boolean { - if (typeof address === "string") address = IpAddress.parse(address) + if (typeof address === 'string') address = IpAddress.parse(address) if (address instanceof IpNet && address.prefix < this.prefix) return false if (this.octets.length !== address.octets.length) return false let prefix = this.prefix @@ -235,14 +235,14 @@ export class IpNet extends IpAddress { } export const PRIVATE_IPV4_RANGES = [ - IpNet.parse("127.0.0.0/8"), - IpNet.parse("10.0.0.0/8"), - IpNet.parse("172.16.0.0/12"), - IpNet.parse("192.168.0.0/16"), + IpNet.parse('127.0.0.0/8'), + IpNet.parse('10.0.0.0/8'), + IpNet.parse('172.16.0.0/12'), + IpNet.parse('192.168.0.0/16'), ] -export const IPV4_LOOPBACK = IpNet.parse("127.0.0.0/8") -export const IPV6_LOOPBACK = IpNet.parse("::1/128") -export const IPV6_LINK_LOCAL = IpNet.parse("fe80::/10") +export const IPV4_LOOPBACK = IpNet.parse('127.0.0.0/8') +export const IPV6_LOOPBACK = IpNet.parse('::1/128') +export const IPV6_LINK_LOCAL = IpNet.parse('fe80::/10') -export const CGNAT = IpNet.parse("100.64.0.0/10") +export const CGNAT = IpNet.parse('100.64.0.0/10') diff --git a/sdk/base/lib/util/patterns.ts b/sdk/base/lib/util/patterns.ts index a61e4269c..59f7a863b 100644 --- a/sdk/base/lib/util/patterns.ts +++ b/sdk/base/lib/util/patterns.ts @@ -1,19 +1,19 @@ -import { Pattern } from "../actions/input/inputSpecTypes" -import * as regexes from "./regexes" +import { Pattern } from '../actions/input/inputSpecTypes' +import * as regexes from './regexes' export const ipv6: Pattern = { regex: regexes.ipv6.matches(), - description: "Must be a valid IPv6 address", + description: 'Must be a valid IPv6 address', } export const ipv4: Pattern = { regex: regexes.ipv4.matches(), - description: "Must be a valid IPv4 address", + description: 'Must be a valid IPv4 address', } export const hostname: Pattern = { regex: regexes.hostname.matches(), - description: "Must be a valid hostname", + description: 'Must be a valid hostname', } export const localHostname: Pattern = { @@ -28,7 +28,7 @@ export const torHostname: Pattern = { export const url: Pattern = { regex: regexes.url.matches(), - description: "Must be a valid URL", + description: 'Must be a valid URL', } export const localUrl: Pattern = { @@ -44,26 +44,26 @@ export const torUrl: Pattern = { export const ascii: Pattern = { regex: regexes.ascii.matches(), description: - "May only contain ASCII characters. See https://www.w3schools.com/charsets/ref_html_ascii.asp", + 'May only contain ASCII characters. See https://www.w3schools.com/charsets/ref_html_ascii.asp', } export const domain: Pattern = { regex: regexes.domain.matches(), - description: "Must be a valid Fully Qualified Domain Name", + description: 'Must be a valid Fully Qualified Domain Name', } export const email: Pattern = { regex: regexes.email.matches(), - description: "Must be a valid email address", + description: 'Must be a valid email address', } export const emailWithName: Pattern = { regex: regexes.emailWithName.matches(), - description: "Must be a valid email address, optionally with a name", + description: 'Must be a valid email address, optionally with a name', } export const base64: Pattern = { regex: regexes.base64.matches(), description: - "May only contain base64 characters. See https://base64.guru/learn/base64-characters", + 'May only contain base64 characters. See https://base64.guru/learn/base64-characters', } diff --git a/sdk/base/lib/util/regexes.ts b/sdk/base/lib/util/regexes.ts index 2ae042b5a..65213a7b3 100644 --- a/sdk/base/lib/util/regexes.ts +++ b/sdk/base/lib/util/regexes.ts @@ -19,7 +19,7 @@ export class ComposableRegex { } export const escapeLiteral = (str: string) => - str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') // https://ihateregex.io/expr/ipv6/ export const ipv6 = new ComposableRegex( diff --git a/sdk/base/lib/util/splitCommand.ts b/sdk/base/lib/util/splitCommand.ts index ac1237574..8a9144b53 100644 --- a/sdk/base/lib/util/splitCommand.ts +++ b/sdk/base/lib/util/splitCommand.ts @@ -1,8 +1,8 @@ -import { arrayOf, string } from "ts-matches" +import { arrayOf, string } from 'ts-matches' export const splitCommand = ( command: string | [string, ...string[]], ): string[] => { if (arrayOf(string).test(command)) return command - return ["sh", "-c", command] + return ['sh', '-c', command] } diff --git a/sdk/base/lib/util/typeHelpers.ts b/sdk/base/lib/util/typeHelpers.ts index d29d5c986..0e8d65841 100644 --- a/sdk/base/lib/util/typeHelpers.ts +++ b/sdk/base/lib/util/typeHelpers.ts @@ -1,4 +1,4 @@ -import * as T from "../types" +import * as T from '../types' // prettier-ignore export type FlattenIntersection = @@ -9,7 +9,7 @@ T extends object ? {} & {[P in keyof T]: T[P]} : export type _ = FlattenIntersection export const isKnownError = (e: unknown): e is T.KnownError => - e instanceof Object && ("error" in e || "error-code" in e) + e instanceof Object && ('error' in e || 'error-code' in e) declare const affine: unique symbol @@ -23,41 +23,41 @@ export type NoAny = NeverPossible extends A : A type CapitalLetters = - | "A" - | "B" - | "C" - | "D" - | "E" - | "F" - | "G" - | "H" - | "I" - | "J" - | "K" - | "L" - | "M" - | "N" - | "O" - | "P" - | "Q" - | "R" - | "S" - | "T" - | "U" - | "V" - | "W" - | "X" - | "Y" - | "Z" + | 'A' + | 'B' + | 'C' + | 'D' + | 'E' + | 'F' + | 'G' + | 'H' + | 'I' + | 'J' + | 'K' + | 'L' + | 'M' + | 'N' + | 'O' + | 'P' + | 'Q' + | 'R' + | 'S' + | 'T' + | 'U' + | 'V' + | 'W' + | 'X' + | 'Y' + | 'Z' -type Numbers = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" +type Numbers = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' type CapitalChars = CapitalLetters | Numbers export type ToKebab = S extends string ? S extends `${infer Head}${CapitalChars}${infer Tail}` // string has a capital char somewhere - ? Head extends "" // there is a capital char in the first position - ? Tail extends "" + ? Head extends '' // there is a capital char in the first position + ? Tail extends '' ? Lowercase /* 'A' */ : S extends `${infer Caps}${Tail}` // tail exists, has capital characters ? Caps extends CapitalChars @@ -68,7 +68,7 @@ export type ToKebab = S extends string : `${ToKebab}${ToKebab}` /* 'AbCD','AbcD', */ /* TODO: if tail is only numbers, append without underscore */ : never /* never reached, used for inference of caps */ : never - : Tail extends "" /* 'aB' 'abCD' 'ABCD' 'AB' */ + : Tail extends '' /* 'aB' 'abCD' 'ABCD' 'AB' */ ? S extends `${Head}${infer Caps}` ? Caps extends CapitalChars ? Head extends Lowercase /* 'abcD' */ @@ -110,7 +110,7 @@ function test() { B extends A ? null : never ) : never )) =>{ } - t<"foo-bar", ToKebab<"FooBar">>(null) + t<'foo-bar', ToKebab<'FooBar'>>(null) // @ts-expect-error - t<"foo-3ar", ToKebab<"FooBar">>(null) + t<'foo-3ar', ToKebab<'FooBar'>>(null) } diff --git a/sdk/base/package.json b/sdk/base/package.json index 6d1997174..1eda223bf 100644 --- a/sdk/base/package.json +++ b/sdk/base/package.json @@ -34,7 +34,7 @@ "trailingComma": "all", "tabWidth": 2, "semi": false, - "singleQuote": false + "singleQuote": true }, "devDependencies": { "@types/jest": "^29.4.0", diff --git a/sdk/package/lib/StartSdk.ts b/sdk/package/lib/StartSdk.ts index 98ea17045..9d1dc0164 100644 --- a/sdk/package/lib/StartSdk.ts +++ b/sdk/package/lib/StartSdk.ts @@ -1,73 +1,73 @@ -import { Value } from "../../base/lib/actions/input/builder/value" -import { InputSpec } from "../../base/lib/actions/input/builder/inputSpec" -import { Variants } from "../../base/lib/actions/input/builder/variants" +import { Value } from '../../base/lib/actions/input/builder/value' +import { InputSpec } from '../../base/lib/actions/input/builder/inputSpec' +import { Variants } from '../../base/lib/actions/input/builder/variants' import { Action, ActionInfo, Actions, -} from "../../base/lib/actions/setupActions" +} from '../../base/lib/actions/setupActions' import { SyncOptions, ServiceInterfaceId, PackageId, ServiceInterfaceType, Effects, -} from "../../base/lib/types" -import * as patterns from "../../base/lib/util/patterns" -import { BackupSync, Backups } from "./backup/Backups" -import { smtpInputSpec } from "../../base/lib/actions/input/inputSpecConstants" -import { Daemon, Daemons } from "./mainFn/Daemons" -import { checkPortListening } from "./health/checkFns/checkPortListening" -import { checkWebUrl, runHealthScript } from "./health/checkFns" -import { List } from "../../base/lib/actions/input/builder/list" -import { SetupBackupsParams, setupBackups } from "./backup/setupBackups" -import { setupMain } from "./mainFn" -import { defaultTrigger } from "./trigger/defaultTrigger" -import { changeOnFirstSuccess, cooldownTrigger } from "./trigger" -import { setupServiceInterfaces } from "../../base/lib/interfaces/setupInterfaces" -import { successFailure } from "./trigger/successFailure" -import { MultiHost, Scheme } from "../../base/lib/interfaces/Host" -import { ServiceInterfaceBuilder } from "../../base/lib/interfaces/ServiceInterfaceBuilder" -import { GetSystemSmtp } from "./util" -import { nullIfEmpty } from "./util" -import { getServiceInterface, getServiceInterfaces } from "./util" +} from '../../base/lib/types' +import * as patterns from '../../base/lib/util/patterns' +import { BackupSync, Backups } from './backup/Backups' +import { smtpInputSpec } from '../../base/lib/actions/input/inputSpecConstants' +import { Daemon, Daemons } from './mainFn/Daemons' +import { checkPortListening } from './health/checkFns/checkPortListening' +import { checkWebUrl, runHealthScript } from './health/checkFns' +import { List } from '../../base/lib/actions/input/builder/list' +import { SetupBackupsParams, setupBackups } from './backup/setupBackups' +import { setupMain } from './mainFn' +import { defaultTrigger } from './trigger/defaultTrigger' +import { changeOnFirstSuccess, cooldownTrigger } from './trigger' +import { setupServiceInterfaces } from '../../base/lib/interfaces/setupInterfaces' +import { successFailure } from './trigger/successFailure' +import { MultiHost, Scheme } from '../../base/lib/interfaces/Host' +import { ServiceInterfaceBuilder } from '../../base/lib/interfaces/ServiceInterfaceBuilder' +import { GetSystemSmtp } from './util' +import { nullIfEmpty } from './util' +import { getServiceInterface, getServiceInterfaces } from './util' import { CommandOptions, ExitError, SubContainer, SubContainerOwned, -} from "./util/SubContainer" -import { splitCommand } from "./util" -import { Mounts } from "./mainFn/Mounts" -import { setupDependencies } from "../../base/lib/dependencies/setupDependencies" -import * as T from "../../base/lib/types" -import { testTypeVersion } from "../../base/lib/exver" +} from './util/SubContainer' +import { splitCommand } from './util' +import { Mounts } from './mainFn/Mounts' +import { setupDependencies } from '../../base/lib/dependencies/setupDependencies' +import * as T from '../../base/lib/types' +import { testTypeVersion } from '../../base/lib/exver' import { CheckDependencies, checkDependencies, -} from "../../base/lib/dependencies/dependencies" -import { GetSslCertificate, getServiceManifest } from "./util" -import { getDataVersion, setDataVersion } from "./version" -import { MaybeFn } from "../../base/lib/actions/setupActions" -import { GetInput } from "../../base/lib/actions/setupActions" -import { Run } from "../../base/lib/actions/setupActions" -import * as actions from "../../base/lib/actions" -import * as fs from "node:fs/promises" +} from '../../base/lib/dependencies/dependencies' +import { GetSslCertificate, getServiceManifest } from './util' +import { getDataVersion, setDataVersion } from './version' +import { MaybeFn } from '../../base/lib/actions/setupActions' +import { GetInput } from '../../base/lib/actions/setupActions' +import { Run } from '../../base/lib/actions/setupActions' +import * as actions from '../../base/lib/actions' +import * as fs from 'node:fs/promises' import { setupInit, setupUninit, setupOnInit, setupOnUninit, -} from "../../base/lib/inits" -import { DropGenerator } from "../../base/lib/util/Drop" +} from '../../base/lib/inits' +import { DropGenerator } from '../../base/lib/util/Drop' import { getOwnServiceInterface, ServiceInterfaceFilled, -} from "../../base/lib/util/getServiceInterface" -import { getOwnServiceInterfaces } from "../../base/lib/util/getServiceInterfaces" -import { Volumes, createVolumes } from "./util/Volume" +} from '../../base/lib/util/getServiceInterface' +import { getOwnServiceInterfaces } from '../../base/lib/util/getServiceInterfaces' +import { Volumes, createVolumes } from './util/Volume' -export const OSVersion = testTypeVersion("0.4.0-alpha.19") +export const OSVersion = testTypeVersion('0.4.0-alpha.19') // prettier-ignore type AnyNeverCond = @@ -85,29 +85,29 @@ export class StartSdk { return new StartSdk(manifest) } - build(isReady: AnyNeverCond<[Manifest], "Build not ready", true>) { - type NestedEffects = "subcontainer" | "store" | "action" + build(isReady: AnyNeverCond<[Manifest], 'Build not ready', true>) { + type NestedEffects = 'subcontainer' | 'store' | 'action' type InterfaceEffects = - | "getServiceInterface" - | "listServiceInterfaces" - | "exportServiceInterface" - | "clearServiceInterfaces" - | "bind" - | "getHostInfo" - type MainUsedEffects = "setMainStatus" + | 'getServiceInterface' + | 'listServiceInterfaces' + | 'exportServiceInterface' + | 'clearServiceInterfaces' + | 'bind' + | 'getHostInfo' + type MainUsedEffects = 'setMainStatus' type CallbackEffects = - | "child" - | "constRetry" - | "isInContext" - | "onLeaveContext" - | "clearCallbacks" + | 'child' + | 'constRetry' + | 'isInContext' + | 'onLeaveContext' + | 'clearCallbacks' type AlreadyExposed = - | "getSslCertificate" - | "getSystemSmtp" - | "getContainerIp" - | "getDataVersion" - | "setDataVersion" - | "getServiceManifest" + | 'getSslCertificate' + | 'getSystemSmtp' + | 'getContainerIp' + | 'getDataVersion' + | 'setDataVersion' + | 'getServiceManifest' // prettier-ignore type StartSdkEffectWrapper = { @@ -171,8 +171,8 @@ export class StartSdk { effects.action.clearTasks({ only: replayIds }), }, checkDependencies: checkDependencies as < - DependencyId extends keyof Manifest["dependencies"] & - PackageId = keyof Manifest["dependencies"] & PackageId, + DependencyId extends keyof Manifest['dependencies'] & + PackageId = keyof Manifest['dependencies'] & PackageId, >( effects: Effects, packageIds?: DependencyId[], @@ -186,8 +186,8 @@ export class StartSdk { getContainerIp: ( effects: T.Effects, options: Omit< - Parameters[0], - "callback" + Parameters[0], + 'callback' > = {}, ) => { async function* watch(abort?: AbortSignal) { @@ -195,7 +195,7 @@ export class StartSdk { effects.onLeaveContext(() => { resolveCell.resolve() }) - abort?.addEventListener("abort", () => resolveCell.resolve()) + abort?.addEventListener('abort', () => resolveCell.resolve()) while (effects.isInContext && !abort?.aborted) { let callback: () => void = () => {} const waitForNext = new Promise((resolve) => { @@ -217,7 +217,7 @@ export class StartSdk { once: () => effects.getContainerIp(options), watch: (abort?: AbortSignal) => { const ctrl = new AbortController() - abort?.addEventListener("abort", () => ctrl.abort()) + abort?.addEventListener('abort', () => ctrl.abort()) return DropGenerator.of(watch(ctrl.signal), () => ctrl.abort()) }, onChange: ( @@ -237,7 +237,7 @@ export class StartSdk { } } catch (e) { console.error( - "callback function threw an error @ getContainerIp.onChange", + 'callback function threw an error @ getContainerIp.onChange', e, ) } @@ -246,7 +246,7 @@ export class StartSdk { .catch((e) => callback(null, e)) .catch((e) => console.error( - "callback function threw an error @ getContainerIp.onChange", + 'callback function threw an error @ getContainerIp.onChange', e, ), ) @@ -388,7 +388,7 @@ export class StartSdk { */ withoutInput: ( id: Id, - metadata: MaybeFn>, + metadata: MaybeFn>, run: Run<{}>, ) => Action.withoutInput(id, metadata, run), }, @@ -701,7 +701,7 @@ export class StartSdk { of( effects: Effects, image: { - imageId: T.ImageId & keyof Manifest["images"] + imageId: T.ImageId & keyof Manifest['images'] sharedRun?: boolean }, mounts: Mounts | null, @@ -724,7 +724,7 @@ export class StartSdk { withTemp( effects: T.Effects, image: { - imageId: T.ImageId & keyof Manifest["images"] + imageId: T.ImageId & keyof Manifest['images'] sharedRun?: boolean }, mounts: Mounts | null, @@ -743,7 +743,7 @@ export class StartSdk { export async function runCommand( effects: Effects, - image: { imageId: keyof Manifest["images"] & T.ImageId; sharedRun?: boolean }, + image: { imageId: keyof Manifest['images'] & T.ImageId; sharedRun?: boolean }, command: T.CommandType, options: CommandOptions & { mounts: Mounts | null @@ -754,9 +754,9 @@ export async function runCommand( if (T.isUseEntrypoint(command)) { const imageMeta: T.ImageMetadata = await fs .readFile(`/media/startos/images/${image.imageId}.json`, { - encoding: "utf8", + encoding: 'utf8', }) - .catch(() => "{}") + .catch(() => '{}') .then(JSON.parse) commands = imageMeta.entrypoint ?? [] commands = commands.concat(...(command.overridCmd ?? imageMeta.cmd ?? [])) @@ -768,13 +768,13 @@ export async function runCommand( name || commands .map((c) => { - if (c.includes(" ")) { + if (c.includes(' ')) { return `"${c.replace(/"/g, `\"`)}"` } else { return c } }) - .join(" "), + .join(' '), async (subcontainer) => { const res = await subcontainer.exec(commands) if (res.exitCode || res.exitSignal) { diff --git a/sdk/package/lib/backup/Backups.ts b/sdk/package/lib/backup/Backups.ts index 8594f3f8f..8add5dba3 100644 --- a/sdk/package/lib/backup/Backups.ts +++ b/sdk/package/lib/backup/Backups.ts @@ -1,9 +1,9 @@ -import * as T from "../../../base/lib/types" -import * as child_process from "child_process" -import * as fs from "fs/promises" -import { Affine, asError } from "../util" -import { ExtendedVersion, VersionRange } from "../../../base/lib" -import { InitKind, InitScript } from "../../../base/lib/inits" +import * as T from '../../../base/lib/types' +import * as child_process from 'child_process' +import * as fs from 'fs/promises' +import { Affine, asError } from '../util' +import { ExtendedVersion, VersionRange } from '../../../base/lib' +import { InitKind, InitScript } from '../../../base/lib/inits' export const DEFAULT_OPTIONS: T.SyncOptions = { delete: true, @@ -17,14 +17,14 @@ export type BackupSync = { restoreOptions?: Partial } -export type BackupEffects = T.Effects & Affine<"Backups"> +export type BackupEffects = T.Effects & Affine<'Backups'> export class Backups implements InitScript { private constructor( private options = DEFAULT_OPTIONS, private restoreOptions: Partial = {}, private backupOptions: Partial = {}, - private backupSet = [] as BackupSync[], + private backupSet = [] as BackupSync[], private preBackup = async (effects: BackupEffects) => {}, private postBackup = async (effects: BackupEffects) => {}, private preRestore = async (effects: BackupEffects) => {}, @@ -32,7 +32,7 @@ export class Backups implements InitScript { ) {} static ofVolumes( - ...volumeNames: Array + ...volumeNames: Array ): Backups { return Backups.ofSyncs( ...volumeNames.map((srcVolume) => ({ @@ -43,7 +43,7 @@ export class Backups implements InitScript { } static ofSyncs( - ...syncs: BackupSync[] + ...syncs: BackupSync[] ) { return syncs.reduce((acc, x) => acc.addSync(x), new Backups()) } @@ -99,7 +99,7 @@ export class Backups implements InitScript { } addVolume( - volume: M["volumes"][number], + volume: M['volumes'][number], options?: Partial<{ options: T.SyncOptions backupOptions: T.SyncOptions @@ -113,7 +113,7 @@ export class Backups implements InitScript { }) } - addSync(sync: BackupSync) { + addSync(sync: BackupSync) { this.backupSet.push(sync) return this } @@ -136,15 +136,15 @@ export class Backups implements InitScript { const dataVersion = await effects.getDataVersion() if (dataVersion) - await fs.writeFile("/media/startos/backup/dataVersion.txt", dataVersion, { - encoding: "utf-8", + await fs.writeFile('/media/startos/backup/dataVersion.txt', dataVersion, { + encoding: 'utf-8', }) await this.postBackup(effects as BackupEffects) return } async init(effects: T.Effects, kind: InitKind): Promise { - if (kind === "restore") { + if (kind === 'restore') { await this.restoreBackup(effects) } } @@ -166,8 +166,8 @@ export class Backups implements InitScript { await rsyncResults.wait() } const dataVersion = await fs - .readFile("/media/startos/backup/dataVersion.txt", { - encoding: "utf-8", + .readFile('/media/startos/backup/dataVersion.txt', { + encoding: 'utf-8', }) .catch((_) => null) if (dataVersion) await effects.setDataVersion({ version: dataVersion }) @@ -189,23 +189,23 @@ async function runRsync(rsyncOptions: { await fs.mkdir(dstPath, { recursive: true }) - const command = "rsync" + const command = 'rsync' const args: string[] = [] if (options.delete) { - args.push("--delete") + args.push('--delete') } for (const exclude of options.exclude) { args.push(`--exclude=${exclude}`) } - args.push("-rlptgocAXH") - args.push("--info=progress2") - args.push("--no-inc-recursive") + args.push('-rlptgocAXH') + args.push('--info=progress2') + args.push('--no-inc-recursive') args.push(srcPath) args.push(dstPath) const spawned = child_process.spawn(command, args, { detached: true }) let percentage = 0.0 - spawned.stdout.on("data", (data: unknown) => { - const lines = String(data).replace(/\r/g, "\n").split("\n") + spawned.stdout.on('data', (data: unknown) => { + const lines = String(data).replace(/\r/g, '\n').split('\n') for (const line of lines) { const parsed = /$([0-9.]+)%/.exec(line)?.[1] if (!parsed) { @@ -216,10 +216,10 @@ async function runRsync(rsyncOptions: { } }) - let stderr = "" + let stderr = '' - spawned.stderr.on("data", (data: string | Buffer) => { - const errString = data.toString("utf-8") + spawned.stderr.on('data', (data: string | Buffer) => { + const errString = data.toString('utf-8') stderr += errString console.error(`Backups.runAsync`, asError(errString)) }) @@ -227,12 +227,12 @@ async function runRsync(rsyncOptions: { const id = async () => { const pid = spawned.pid if (pid === undefined) { - throw new Error("rsync process has no pid") + throw new Error('rsync process has no pid') } return String(pid) } const waitPromise = new Promise((resolve, reject) => { - spawned.on("exit", (code: any) => { + spawned.on('exit', (code: any) => { if (code === 0) { resolve(null) } else { diff --git a/sdk/package/lib/backup/index.ts b/sdk/package/lib/backup/index.ts index 1e7995252..2b8867117 100644 --- a/sdk/package/lib/backup/index.ts +++ b/sdk/package/lib/backup/index.ts @@ -1,2 +1,2 @@ -import "./Backups" -import "./setupBackups" +import './Backups' +import './setupBackups' diff --git a/sdk/package/lib/backup/setupBackups.ts b/sdk/package/lib/backup/setupBackups.ts index 2dbe0c5e0..7c605f849 100644 --- a/sdk/package/lib/backup/setupBackups.ts +++ b/sdk/package/lib/backup/setupBackups.ts @@ -1,10 +1,10 @@ -import { Backups } from "./Backups" -import * as T from "../../../base/lib/types" -import { _ } from "../util" -import { InitScript } from "../../../base/lib/inits" +import { Backups } from './Backups' +import * as T from '../../../base/lib/types' +import { _ } from '../util' +import { InitScript } from '../../../base/lib/inits' export type SetupBackupsParams = - | M["volumes"][number][] + | M['volumes'][number][] | ((_: { effects: T.Effects }) => Promise>) type SetupBackupsRes = { diff --git a/sdk/package/lib/health/HealthCheck.ts b/sdk/package/lib/health/HealthCheck.ts index 786565b8d..9f1f1088a 100644 --- a/sdk/package/lib/health/HealthCheck.ts +++ b/sdk/package/lib/health/HealthCheck.ts @@ -1,10 +1,10 @@ -import { Effects, HealthCheckId } from "../../../base/lib/types" -import { HealthCheckResult } from "./checkFns/HealthCheckResult" -import { Trigger } from "../trigger" -import { TriggerInput } from "../trigger/TriggerInput" -import { defaultTrigger } from "../trigger/defaultTrigger" -import { once, asError, Drop } from "../util" -import { object, unknown } from "ts-matches" +import { Effects, HealthCheckId } from '../../../base/lib/types' +import { HealthCheckResult } from './checkFns/HealthCheckResult' +import { Trigger } from '../trigger' +import { TriggerInput } from '../trigger/TriggerInput' +import { defaultTrigger } from '../trigger/defaultTrigger' +import { once, asError, Drop } from '../util' +import { object, unknown } from 'ts-matches' export type HealthCheckParams = { id: HealthCheckId @@ -59,15 +59,15 @@ export class HealthCheck extends Drop { try { let { result, message } = await o.fn() if ( - result === "failure" && + result === 'failure' && performance.now() - started <= gracePeriod ) - result = "starting" + result = 'starting' await effects.setHealth({ name: o.name, id: o.id, result, - message: message || "", + message: message || '', }) this.currentValue.lastResult = result } catch (e) { @@ -76,11 +76,11 @@ export class HealthCheck extends Drop { id: o.id, result: performance.now() - started <= gracePeriod - ? "starting" - : "failure", - message: asMessage(e) || "", + ? 'starting' + : 'failure', + message: asMessage(e) || '', }) - this.currentValue.lastResult = "failure" + this.currentValue.lastResult = 'failure' } } } else triggered = false diff --git a/sdk/package/lib/health/checkFns/HealthCheckResult.ts b/sdk/package/lib/health/checkFns/HealthCheckResult.ts index 92d4afddf..f62eacfbc 100644 --- a/sdk/package/lib/health/checkFns/HealthCheckResult.ts +++ b/sdk/package/lib/health/checkFns/HealthCheckResult.ts @@ -1,3 +1,3 @@ -import { T } from "../../../../base/lib" +import { T } from '../../../../base/lib' -export type HealthCheckResult = Omit +export type HealthCheckResult = Omit diff --git a/sdk/package/lib/health/checkFns/checkPortListening.ts b/sdk/package/lib/health/checkFns/checkPortListening.ts index 59cd9717f..4aa352691 100644 --- a/sdk/package/lib/health/checkFns/checkPortListening.ts +++ b/sdk/package/lib/health/checkFns/checkPortListening.ts @@ -1,17 +1,17 @@ -import { Effects } from "../../../../base/lib/types" -import { stringFromStdErrOut } from "../../util" -import { HealthCheckResult } from "./HealthCheckResult" -import { promisify } from "node:util" -import * as CP from "node:child_process" +import { Effects } from '../../../../base/lib/types' +import { stringFromStdErrOut } from '../../util' +import { HealthCheckResult } from './HealthCheckResult' +import { promisify } from 'node:util' +import * as CP from 'node:child_process' const cpExec = promisify(CP.exec) export function containsAddress(x: string, port: number, address?: bigint) { const readPorts = x - .split("\n") + .split('\n') .filter(Boolean) .splice(1) - .map((x) => x.split(" ").filter(Boolean)[1]?.split(":")) + .map((x) => x.split(' ').filter(Boolean)[1]?.split(':')) .filter((x) => x?.length > 1) .map(([addr, p]) => [BigInt(`0x${addr}`), Number.parseInt(p, 16)] as const) return !!readPorts.find( @@ -46,19 +46,19 @@ export async function checkPortListening( BigInt(0), ) || containsAddress( - await cpExec("cat /proc/net/udp", {}).then(stringFromStdErrOut), + await cpExec('cat /proc/net/udp', {}).then(stringFromStdErrOut), port, ) || containsAddress( - await cpExec("cat /proc/net/udp6", {}).then(stringFromStdErrOut), + await cpExec('cat /proc/net/udp6', {}).then(stringFromStdErrOut), port, BigInt(0), ) if (hasAddress) { - return { result: "success", message: options.successMessage } + return { result: 'success', message: options.successMessage } } return { - result: "failure", + result: 'failure', message: options.errorMessage, } }), @@ -66,7 +66,7 @@ export async function checkPortListening( setTimeout( () => resolve({ - result: "failure", + result: 'failure', message: options.timeoutMessage || `Timeout trying to check port ${port}`, }), diff --git a/sdk/package/lib/health/checkFns/checkWebUrl.ts b/sdk/package/lib/health/checkFns/checkWebUrl.ts index e04ee7531..abff48947 100644 --- a/sdk/package/lib/health/checkFns/checkWebUrl.ts +++ b/sdk/package/lib/health/checkFns/checkWebUrl.ts @@ -1,8 +1,8 @@ -import { Effects } from "../../../../base/lib/types" -import { asError } from "../../util" -import { HealthCheckResult } from "./HealthCheckResult" -import { timeoutPromise } from "./index" -import "isomorphic-fetch" +import { Effects } from '../../../../base/lib/types' +import { asError } from '../../util' +import { HealthCheckResult } from './HealthCheckResult' +import { timeoutPromise } from './index' +import 'isomorphic-fetch' /** * This is a helper function to check if a web url is reachable. @@ -23,7 +23,7 @@ export const checkWebUrl = async ( .then( (x) => ({ - result: "success", + result: 'success', message: successMessage, }) as const, ) @@ -31,6 +31,6 @@ export const checkWebUrl = async ( console.warn(`Error while fetching URL: ${url}`) console.error(JSON.stringify(e)) console.error(asError(e)) - return { result: "failure" as const, message: errorMessage } + return { result: 'failure' as const, message: errorMessage } }) } diff --git a/sdk/package/lib/health/checkFns/index.ts b/sdk/package/lib/health/checkFns/index.ts index 2de37e38c..cfd297324 100644 --- a/sdk/package/lib/health/checkFns/index.ts +++ b/sdk/package/lib/health/checkFns/index.ts @@ -1,9 +1,9 @@ -import { runHealthScript } from "./runHealthScript" -export { checkPortListening } from "./checkPortListening" -export { HealthCheckResult } from "./HealthCheckResult" -export { checkWebUrl } from "./checkWebUrl" +import { runHealthScript } from './runHealthScript' +export { checkPortListening } from './checkPortListening' +export { HealthCheckResult } from './HealthCheckResult' +export { checkWebUrl } from './checkWebUrl' -export function timeoutPromise(ms: number, { message = "Timed out" } = {}) { +export function timeoutPromise(ms: number, { message = 'Timed out' } = {}) { return new Promise((resolve, reject) => setTimeout(() => reject(new Error(message)), ms), ) diff --git a/sdk/package/lib/health/checkFns/runHealthScript.ts b/sdk/package/lib/health/checkFns/runHealthScript.ts index 14b8569dd..0ded6390c 100644 --- a/sdk/package/lib/health/checkFns/runHealthScript.ts +++ b/sdk/package/lib/health/checkFns/runHealthScript.ts @@ -1,7 +1,7 @@ -import { HealthCheckResult } from "./HealthCheckResult" -import { timeoutPromise } from "./index" -import { SubContainer } from "../../util/SubContainer" -import { SDKManifest } from "../../types" +import { HealthCheckResult } from './HealthCheckResult' +import { timeoutPromise } from './index' +import { SubContainer } from '../../util/SubContainer' +import { SDKManifest } from '../../types' /** * Running a health script, is used when we want to have a simple @@ -27,10 +27,10 @@ export const runHealthScript = async ( console.warn(errorMessage) console.warn(JSON.stringify(e)) console.warn(e.toString()) - throw { result: "failure", message: errorMessage } as HealthCheckResult + throw { result: 'failure', message: errorMessage } as HealthCheckResult }) return { - result: "success", + result: 'success', message: message(res.stdout.toString()), } as HealthCheckResult } diff --git a/sdk/package/lib/health/index.ts b/sdk/package/lib/health/index.ts index 1b9c46595..8cacab03a 100644 --- a/sdk/package/lib/health/index.ts +++ b/sdk/package/lib/health/index.ts @@ -1,3 +1,3 @@ -import "./checkFns" +import './checkFns' -export { HealthCheck } from "./HealthCheck" +export { HealthCheck } from './HealthCheck' diff --git a/sdk/package/lib/i18n/index.ts b/sdk/package/lib/i18n/index.ts index 39b3c9d22..992fb4bd0 100644 --- a/sdk/package/lib/i18n/index.ts +++ b/sdk/package/lib/i18n/index.ts @@ -26,10 +26,10 @@ export function setupI18n< Dict extends Record, Translations extends Record>, >(defaultDict: Dict, translations: Translations, defaultLang: string) { - const lang = process.env.LANG?.replace(/\.UTF-8$/, "") || defaultLang + const lang = process.env.LANG?.replace(/\.UTF-8$/, '') || defaultLang // Convert locale format from en_US to en-US for Intl APIs - const intlLocale = lang.replace("_", "-") + const intlLocale = lang.replace('_', '-') function getTranslation(): Record | null { if (lang === defaultLang) return null @@ -38,7 +38,7 @@ export function setupI18n< const match = availableLangs.find((l) => l === lang) ?? - availableLangs.find((l) => String(l).startsWith(lang.split("_")[0] + "_")) + availableLangs.find((l) => String(l).startsWith(lang.split('_')[0] + '_')) return match ? (translations[match] as Record) : null } @@ -46,7 +46,7 @@ export function setupI18n< const translation = getTranslation() function formatValue(value: ParamValue): string { - if (typeof value === "number") { + if (typeof value === 'number') { return new Intl.NumberFormat(intlLocale).format(value) } if (value instanceof Date) { diff --git a/sdk/package/lib/index.ts b/sdk/package/lib/index.ts index f7a9bcb4c..3526e1c05 100644 --- a/sdk/package/lib/index.ts +++ b/sdk/package/lib/index.ts @@ -9,7 +9,7 @@ import { types, matches, utils, -} from "../../base/lib" +} from '../../base/lib' export { S9pk, @@ -23,23 +23,23 @@ export { matches, utils, } -export { setupI18n } from "./i18n" -export * as T from "./types" -export { Daemons } from "./mainFn/Daemons" -export { SubContainer } from "./util/SubContainer" -export { StartSdk } from "./StartSdk" -export { setupManifest, buildManifest } from "./manifest/setupManifest" -export { FileHelper } from "./util/fileHelper" +export { setupI18n } from './i18n' +export * as T from './types' +export { Daemons } from './mainFn/Daemons' +export { SubContainer } from './util/SubContainer' +export { StartSdk } from './StartSdk' +export { setupManifest, buildManifest } from './manifest/setupManifest' +export { FileHelper } from './util/fileHelper' -export * as actions from "../../base/lib/actions" -export * as backup from "./backup" -export * as daemons from "./mainFn/Daemons" -export * as health from "./health" -export * as healthFns from "./health/checkFns" -export * as mainFn from "./mainFn" -export * as toml from "@iarna/toml" -export * as yaml from "yaml" -export * as startSdk from "./StartSdk" -export * as YAML from "yaml" -export * as TOML from "@iarna/toml" -export * from "./version" +export * as actions from '../../base/lib/actions' +export * as backup from './backup' +export * as daemons from './mainFn/Daemons' +export * as health from './health' +export * as healthFns from './health/checkFns' +export * as mainFn from './mainFn' +export * as toml from '@iarna/toml' +export * as yaml from 'yaml' +export * as startSdk from './StartSdk' +export * as YAML from 'yaml' +export * as TOML from '@iarna/toml' +export * from './version' diff --git a/sdk/package/lib/mainFn/CommandController.ts b/sdk/package/lib/mainFn/CommandController.ts index b325ac585..e58761a6c 100644 --- a/sdk/package/lib/mainFn/CommandController.ts +++ b/sdk/package/lib/mainFn/CommandController.ts @@ -1,12 +1,12 @@ -import { DEFAULT_SIGTERM_TIMEOUT } from "." -import { NO_TIMEOUT, SIGTERM } from "../../../base/lib/types" +import { DEFAULT_SIGTERM_TIMEOUT } from '.' +import { NO_TIMEOUT, SIGTERM } from '../../../base/lib/types' -import * as T from "../../../base/lib/types" -import { SubContainer } from "../util/SubContainer" -import { Drop, splitCommand } from "../util" -import * as cp from "child_process" -import * as fs from "node:fs/promises" -import { DaemonCommandType, ExecCommandOptions, ExecFnOptions } from "./Daemons" +import * as T from '../../../base/lib/types' +import { SubContainer } from '../util/SubContainer' +import { Drop, splitCommand } from '../util' +import * as cp from 'child_process' +import * as fs from 'node:fs/promises' +import { DaemonCommandType, ExecCommandOptions, ExecFnOptions } from './Daemons' export class CommandController< Manifest extends T.SDKManifest, @@ -31,7 +31,7 @@ export class CommandController< exec: DaemonCommandType, ) => { try { - if ("fn" in exec) { + if ('fn' in exec) { const abort = new AbortController() const cell: { ctrl: CommandController } = { ctrl: new CommandController( @@ -63,9 +63,9 @@ export class CommandController< if (T.isUseEntrypoint(exec.command)) { const imageMeta: T.ImageMetadata = await fs .readFile(`/media/startos/images/${subcontainer!.imageId}.json`, { - encoding: "utf8", + encoding: 'utf8', }) - .catch(() => "{}") + .catch(() => '{}') .then(JSON.parse) commands = imageMeta.entrypoint ?? [] commands = commands.concat( @@ -85,21 +85,21 @@ export class CommandController< env: exec.env, user: exec.user, cwd: exec.cwd, - stdio: exec.onStdout || exec.onStderr ? "pipe" : "inherit", + stdio: exec.onStdout || exec.onStderr ? 'pipe' : 'inherit', }) } - if (exec.onStdout) childProcess.stdout?.on("data", exec.onStdout) - if (exec.onStderr) childProcess.stderr?.on("data", exec.onStderr) + if (exec.onStdout) childProcess.stdout?.on('data', exec.onStdout) + if (exec.onStderr) childProcess.stderr?.on('data', exec.onStderr) const state = { exited: false } const answer = new Promise((resolve, reject) => { - childProcess.on("exit", (code) => { + childProcess.on('exit', (code) => { state.exited = true if ( code === 0 || code === 143 || - (code === null && childProcess.signalCode == "SIGTERM") + (code === null && childProcess.signalCode == 'SIGTERM') ) { return resolve(null) } @@ -142,7 +142,7 @@ export class CommandController< new Promise((_, reject) => setTimeout( () => - reject(new Error("Timed out waiting for js command to exit")), + reject(new Error('Timed out waiting for js command to exit')), timeout * 2, ), ), @@ -151,7 +151,7 @@ export class CommandController< } finally { if (!this.state.exited) { if (this.process instanceof AbortController) this.process.abort() - else this.process.kill("SIGKILL") + else this.process.kill('SIGKILL') } await this.subcontainer?.destroy() } @@ -161,10 +161,10 @@ export class CommandController< if (!this.state.exited) { if (this.process instanceof AbortController) return this.process.abort() - if (signal !== "SIGKILL") { + if (signal !== 'SIGKILL') { setTimeout(() => { if (this.process instanceof AbortController) this.process.abort() - else this.process.kill("SIGKILL") + else this.process.kill('SIGKILL') }, timeout) } if (!this.process.kill(signal)) { @@ -180,7 +180,7 @@ export class CommandController< new Promise((_, reject) => setTimeout( () => - reject(new Error("Timed out waiting for js command to exit")), + reject(new Error('Timed out waiting for js command to exit')), timeout * 2, ), ), diff --git a/sdk/package/lib/mainFn/Daemon.ts b/sdk/package/lib/mainFn/Daemon.ts index 24688e6cd..a0110698d 100644 --- a/sdk/package/lib/mainFn/Daemon.ts +++ b/sdk/package/lib/mainFn/Daemon.ts @@ -1,14 +1,14 @@ -import * as T from "../../../base/lib/types" -import { asError } from "../../../base/lib/util/asError" -import { Drop } from "../util" +import * as T from '../../../base/lib/types' +import { asError } from '../../../base/lib/util/asError' +import { Drop } from '../util' import { SubContainer, SubContainerOwned, SubContainerRc, -} from "../util/SubContainer" -import { CommandController } from "./CommandController" -import { DaemonCommandType } from "./Daemons" -import { Oneshot } from "./Oneshot" +} from '../util/SubContainer' +import { CommandController } from './CommandController' +import { DaemonCommandType } from './Daemons' +import { Oneshot } from './Oneshot' const TIMEOUT_INCREMENT_MS = 1000 const MAX_TIMEOUT_MS = 30000 @@ -87,7 +87,7 @@ export class Daemon< try { fn(success) } catch (e) { - console.error("EXIT handler", e) + console.error('EXIT handler', e) } } if (success && this.oneshot) { diff --git a/sdk/package/lib/mainFn/Daemons.ts b/sdk/package/lib/mainFn/Daemons.ts index 0caa18551..374073518 100644 --- a/sdk/package/lib/mainFn/Daemons.ts +++ b/sdk/package/lib/mainFn/Daemons.ts @@ -1,20 +1,20 @@ -import { Signals } from "../../../base/lib/types" +import { Signals } from '../../../base/lib/types' -import { HealthCheckResult } from "../health/checkFns" +import { HealthCheckResult } from '../health/checkFns' -import { Trigger } from "../trigger" -import * as T from "../../../base/lib/types" -import { SubContainer } from "../util/SubContainer" +import { Trigger } from '../trigger' +import * as T from '../../../base/lib/types' +import { SubContainer } from '../util/SubContainer' -import { promisify } from "node:util" -import * as CP from "node:child_process" +import { promisify } from 'node:util' +import * as CP from 'node:child_process' -export { Daemon } from "./Daemon" -export { CommandController } from "./CommandController" -import { EXIT_SUCCESS, HealthDaemon } from "./HealthDaemon" -import { Daemon } from "./Daemon" -import { CommandController } from "./CommandController" -import { Oneshot } from "./Oneshot" +export { Daemon } from './Daemon' +export { CommandController } from './CommandController' +import { EXIT_SUCCESS, HealthDaemon } from './HealthDaemon' +import { Daemon } from './Daemon' +import { CommandController } from './CommandController' +import { Oneshot } from './Oneshot' export const cpExec = promisify(CP.exec) export const cpExecFile = promisify(CP.execFile) @@ -231,7 +231,7 @@ export class Daemons const res = (options: AddDaemonParams | null) => { if (!options) return prev const daemon = - "daemon" in options + 'daemon' in options ? options.daemon : Daemon.of()( this.effects, @@ -369,8 +369,8 @@ export class Daemons const healthDaemon = new HealthDaemon( daemon, [...this.healthDaemons], - "__RUN_UNTIL_SUCCESS", - "EXIT_SUCCESS", + '__RUN_UNTIL_SUCCESS', + 'EXIT_SUCCESS', this.effects, ) const daemons = await new Daemons(this.effects, this.ids, [ @@ -400,7 +400,7 @@ export class Daemons if (canShutdown.length === 0) { // Dependency cycle that should not happen, just shutdown remaining daemons console.warn( - "Dependency cycle detected, shutting down remaining daemons", + 'Dependency cycle detected, shutting down remaining daemons', ) canShutdown.push(...[...remaining].reverse()) } diff --git a/sdk/package/lib/mainFn/HealthDaemon.ts b/sdk/package/lib/mainFn/HealthDaemon.ts index 47c7e4964..e8c194e94 100644 --- a/sdk/package/lib/mainFn/HealthDaemon.ts +++ b/sdk/package/lib/mainFn/HealthDaemon.ts @@ -1,8 +1,8 @@ -import { HealthCheckResult } from "../health/checkFns" -import { defaultTrigger } from "../trigger/defaultTrigger" -import { Ready } from "./Daemons" -import { Daemon } from "./Daemon" -import { SetHealth, Effects, SDKManifest } from "../../../base/lib/types" +import { HealthCheckResult } from '../health/checkFns' +import { defaultTrigger } from '../trigger/defaultTrigger' +import { Ready } from './Daemons' +import { Daemon } from './Daemon' +import { SetHealth, Effects, SDKManifest } from '../../../base/lib/types' const oncePromise = () => { let resolve: (value: T) => void @@ -12,7 +12,7 @@ const oncePromise = () => { return { resolve: resolve!, promise } } -export const EXIT_SUCCESS = "EXIT_SUCCESS" as const +export const EXIT_SUCCESS = 'EXIT_SUCCESS' as const /** * Wanted a structure that deals with controlling daemons by their health status @@ -22,7 +22,7 @@ export const EXIT_SUCCESS = "EXIT_SUCCESS" as const * */ export class HealthDaemon { - private _health: HealthCheckResult = { result: "waiting", message: null } + private _health: HealthCheckResult = { result: 'waiting', message: null } private healthWatchers: Array<() => unknown> = [] private running = false private started?: number @@ -102,21 +102,21 @@ export class HealthDaemon { } private async setupHealthCheck() { this.daemon?.onExit((success) => { - if (success && this.ready === "EXIT_SUCCESS") { - this.setHealth({ result: "success", message: null }) + if (success && this.ready === 'EXIT_SUCCESS') { + this.setHealth({ result: 'success', message: null }) } else if (!success) { this.setHealth({ - result: "failure", + result: 'failure', message: `${this.id} daemon crashed`, }) } else if (!this.daemon?.isOneshot()) { this.setHealth({ - result: "failure", + result: 'failure', message: `${this.id} daemon exited`, }) } }) - if (this.ready === "EXIT_SUCCESS") return + if (this.ready === 'EXIT_SUCCESS') return if (this.healthCheckCleanup) return const trigger = (this.ready.trigger ?? defaultTrigger)(() => ({ lastResult: this._health.result, @@ -127,7 +127,7 @@ export class HealthDaemon { }>() const { promise: exited, resolve: setExited } = oncePromise() new Promise(async () => { - if (this.ready === "EXIT_SUCCESS") return + if (this.ready === 'EXIT_SUCCESS') return for ( let res = await Promise.race([status, trigger.next()]); !res.done; @@ -137,8 +137,8 @@ export class HealthDaemon { this.ready.fn(), ).catch((err) => { return { - result: "failure", - message: "message" in err ? err.message : String(err), + result: 'failure', + message: 'message' in err ? err.message : String(err), } }) @@ -166,23 +166,23 @@ export class HealthDaemon { private async setHealth(health: HealthCheckResult) { const changed = this._health.result !== health.result this._health = health - if (this.resolveReady && health.result === "success") { + if (this.resolveReady && health.result === 'success') { this.resolveReady() } if (changed) this.healthWatchers.forEach((watcher) => watcher()) - if (this.ready === "EXIT_SUCCESS") return + if (this.ready === 'EXIT_SUCCESS') return const display = this.ready.display if (!display) { return } let result = health.result if ( - result === "failure" && + result === 'failure' && this.started && performance.now() - this.started <= (this.ready.gracePeriod ?? 10_000) ) - result = "starting" - if (result === "failure") { + result = 'starting' + if (result === 'failure') { console.error(`Health Check ${this.id} failed:`, health.message) } await this.effects.setHealth({ @@ -197,10 +197,10 @@ export class HealthDaemon { const healths = this.dependencies.map((d) => ({ health: d.running && d._health, id: d.id, - display: typeof d.ready === "object" ? d.ready.display : null, + display: typeof d.ready === 'object' ? d.ready.display : null, })) const waitingOn = healths.filter( - (h) => !h.health || h.health.result !== "success", + (h) => !h.health || h.health.result !== 'success', ) if (waitingOn.length) console.debug( @@ -210,10 +210,10 @@ export class HealthDaemon { const waitingOnNames = waitingOn.flatMap((w) => w.display ? [w.display] : [], ) - const message = waitingOnNames.length ? waitingOnNames.join(", ") : null - await this.setHealth({ result: "waiting", message }) + const message = waitingOnNames.length ? waitingOnNames.join(', ') : null + await this.setHealth({ result: 'waiting', message }) } else { - await this.setHealth({ result: "starting", message: null }) + await this.setHealth({ result: 'starting', message: null }) } await this.changeRunning(!waitingOn.length) } diff --git a/sdk/package/lib/mainFn/Mounts.ts b/sdk/package/lib/mainFn/Mounts.ts index 5a2a5ec8a..b3eb11945 100644 --- a/sdk/package/lib/mainFn/Mounts.ts +++ b/sdk/package/lib/mainFn/Mounts.ts @@ -1,5 +1,5 @@ -import * as T from "../../../base/lib/types" -import { IdMap, MountOptions } from "../util/SubContainer" +import * as T from '../../../base/lib/types' +import { IdMap, MountOptions } from '../util/SubContainer' type MountArray = { mountpoint: string; options: MountOptions }[] @@ -13,7 +13,7 @@ type SharedOptions = { * * defaults to "directory" * */ - type?: "file" | "directory" | "infer" + type?: 'file' | 'directory' | 'infer' // /** // * Whether to map uids/gids for the mount // * @@ -35,16 +35,16 @@ type SharedOptions = { type VolumeOpts = { /** The ID of the volume to mount. Must be one of the volume IDs defined in the manifest */ - volumeId: Manifest["volumes"][number] + volumeId: Manifest['volumes'][number] /** Whether or not the resource should be readonly for this subcontainer */ readonly: boolean } & SharedOptions type DependencyOpts = { /** The ID of the dependency */ - dependencyId: Manifest["id"] + dependencyId: Manifest['id'] /** The ID of the volume to mount. Must be one of the volume IDs defined in the manifest of the dependency */ - volumeId: Manifest["volumes"][number] + volumeId: Manifest['volumes'][number] /** Whether or not the resource should be readonly for this subcontainer */ readonly: boolean } & SharedOptions @@ -126,11 +126,11 @@ export class Mounts< this.volumes.map((v) => ({ mountpoint: v.mountpoint, options: { - type: "volume", + type: 'volume', volumeId: v.volumeId, subpath: v.subpath, readonly: v.readonly, - filetype: v.type ?? "directory", + filetype: v.type ?? 'directory', idmap: [], }, })), @@ -139,9 +139,9 @@ export class Mounts< this.assets.map((a) => ({ mountpoint: a.mountpoint, options: { - type: "assets", + type: 'assets', subpath: a.subpath, - filetype: a.type ?? "directory", + filetype: a.type ?? 'directory', idmap: [], }, })), @@ -150,12 +150,12 @@ export class Mounts< this.dependencies.map((d) => ({ mountpoint: d.mountpoint, options: { - type: "pointer", + type: 'pointer', packageId: d.dependencyId, volumeId: d.volumeId, subpath: d.subpath, readonly: d.readonly, - filetype: d.type ?? "directory", + filetype: d.type ?? 'directory', idmap: [], }, })), @@ -163,6 +163,6 @@ export class Mounts< } } -const a = Mounts.of().mountBackups({ subpath: null, mountpoint: "" }) +const a = Mounts.of().mountBackups({ subpath: null, mountpoint: '' }) // @ts-expect-error const m: Mounts = a diff --git a/sdk/package/lib/mainFn/Oneshot.ts b/sdk/package/lib/mainFn/Oneshot.ts index 380f8a453..9bd56e62f 100644 --- a/sdk/package/lib/mainFn/Oneshot.ts +++ b/sdk/package/lib/mainFn/Oneshot.ts @@ -1,8 +1,8 @@ -import * as T from "../../../base/lib/types" -import { SubContainer, SubContainerOwned } from "../util/SubContainer" -import { CommandController } from "./CommandController" -import { Daemon } from "./Daemon" -import { DaemonCommandType } from "./Daemons" +import * as T from '../../../base/lib/types' +import { SubContainer, SubContainerOwned } from '../util/SubContainer' +import { CommandController } from './CommandController' +import { Daemon } from './Daemon' +import { DaemonCommandType } from './Daemons' /** * This is a wrapper around CommandController that has a state of off, where the command shouldn't be running diff --git a/sdk/package/lib/mainFn/index.ts b/sdk/package/lib/mainFn/index.ts index 45748d194..279cfce29 100644 --- a/sdk/package/lib/mainFn/index.ts +++ b/sdk/package/lib/mainFn/index.ts @@ -1,7 +1,7 @@ -import * as T from "../../../base/lib/types" -import { Daemons } from "./Daemons" -import "../../../base/lib/interfaces/ServiceInterfaceBuilder" -import "../../../base/lib/interfaces/Origin" +import * as T from '../../../base/lib/types' +import { Daemons } from './Daemons' +import '../../../base/lib/interfaces/ServiceInterfaceBuilder' +import '../../../base/lib/interfaces/Origin' export const DEFAULT_SIGTERM_TIMEOUT = 60_000 /** diff --git a/sdk/package/lib/manifest/setupManifest.ts b/sdk/package/lib/manifest/setupManifest.ts index 99dfe4131..1f78e087d 100644 --- a/sdk/package/lib/manifest/setupManifest.ts +++ b/sdk/package/lib/manifest/setupManifest.ts @@ -1,12 +1,12 @@ -import * as T from "../../../base/lib/types" -import { ImageConfig, ImageId, VolumeId } from "../../../base/lib/types" +import * as T from '../../../base/lib/types' +import { ImageConfig, ImageId, VolumeId } from '../../../base/lib/types' import { SDKManifest, SDKImageInputSpec, -} from "../../../base/lib/types/ManifestTypes" -import { OSVersion } from "../StartSdk" -import { VersionGraph } from "../version/VersionGraph" -import { version as sdkVersion } from "../../package.json" +} from '../../../base/lib/types/ManifestTypes' +import { OSVersion } from '../StartSdk' +import { VersionGraph } from '../version/VersionGraph' +import { version as sdkVersion } from '../../package.json' /** * @description Use this function to define critical information about your package @@ -42,10 +42,10 @@ export function buildManifest< ): Manifest & T.Manifest { const images = Object.entries(manifest.images).reduce( (images, [k, v]) => { - v.arch = v.arch ?? ["aarch64", "x86_64", "riscv64"] + v.arch = v.arch ?? ['aarch64', 'x86_64', 'riscv64'] if (v.emulateMissingAs === undefined) - v.emulateMissingAs = (v.arch as string[]).includes("x86_64") - ? "x86_64" + v.emulateMissingAs = (v.arch as string[]).includes('x86_64') + ? 'x86_64' : (v.arch[0] ?? null) v.nvidiaContainer = !!v.nvidiaContainer images[k] = v as ImageConfig diff --git a/sdk/package/lib/test/health.readyCheck.test.ts b/sdk/package/lib/test/health.readyCheck.test.ts index 49efcc759..44acc72b4 100644 --- a/sdk/package/lib/test/health.readyCheck.test.ts +++ b/sdk/package/lib/test/health.readyCheck.test.ts @@ -1,7 +1,7 @@ -import { containsAddress } from "../health/checkFns/checkPortListening" +import { containsAddress } from '../health/checkFns/checkPortListening' -describe("Health ready check", () => { - it("Should be able to parse an example information", () => { +describe('Health ready check', () => { + it('Should be able to parse an example information', () => { let input = ` sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode diff --git a/sdk/package/lib/test/host.test.ts b/sdk/package/lib/test/host.test.ts index 6c49c92db..3700ce9c0 100644 --- a/sdk/package/lib/test/host.test.ts +++ b/sdk/package/lib/test/host.test.ts @@ -1,24 +1,24 @@ -import { ServiceInterfaceBuilder } from "../../../base/lib/interfaces/ServiceInterfaceBuilder" -import { Effects } from "../../../base/lib/Effects" -import { sdk } from "../test/output.sdk" +import { ServiceInterfaceBuilder } from '../../../base/lib/interfaces/ServiceInterfaceBuilder' +import { Effects } from '../../../base/lib/Effects' +import { sdk } from '../test/output.sdk' -describe("host", () => { - test("Testing that the types work", () => { +describe('host', () => { + test('Testing that the types work', () => { async function test(effects: Effects) { - const foo = sdk.MultiHost.of(effects, "foo") + const foo = sdk.MultiHost.of(effects, 'foo') const fooOrigin = await foo.bindPort(80, { - protocol: "http" as const, + protocol: 'http' as const, preferredExternalPort: 80, }) const fooInterface = new ServiceInterfaceBuilder({ effects, - name: "Foo", - id: "foo", - description: "A Foo", - type: "ui", - username: "bar", - path: "/baz", - query: { qux: "yes" }, + name: 'Foo', + id: 'foo', + description: 'A Foo', + type: 'ui', + username: 'bar', + path: '/baz', + query: { qux: 'yes' }, schemeOverride: null, masked: false, }) diff --git a/sdk/package/lib/test/inputSpecBuilder.test.ts b/sdk/package/lib/test/inputSpecBuilder.test.ts index 946e0b2e4..3bbe1a048 100644 --- a/sdk/package/lib/test/inputSpecBuilder.test.ts +++ b/sdk/package/lib/test/inputSpecBuilder.test.ts @@ -1,20 +1,20 @@ -import { testOutput } from "./output.test" -import { InputSpec } from "../../../base/lib/actions/input/builder/inputSpec" -import { List } from "../../../base/lib/actions/input/builder/list" -import { Value } from "../../../base/lib/actions/input/builder/value" -import { Variants } from "../../../base/lib/actions/input/builder/variants" -import { ValueSpec } from "../../../base/lib/actions/input/inputSpecTypes" -import { setupManifest } from "../manifest/setupManifest" -import { StartSdk } from "../StartSdk" +import { testOutput } from './output.test' +import { InputSpec } from '../../../base/lib/actions/input/builder/inputSpec' +import { List } from '../../../base/lib/actions/input/builder/list' +import { Value } from '../../../base/lib/actions/input/builder/value' +import { Variants } from '../../../base/lib/actions/input/builder/variants' +import { ValueSpec } from '../../../base/lib/actions/input/inputSpecTypes' +import { setupManifest } from '../manifest/setupManifest' +import { StartSdk } from '../StartSdk' -describe("builder tests", () => { - test("text", async () => { +describe('builder tests', () => { + test('text', async () => { const bitcoinPropertiesBuilt: { - "peer-tor-address": ValueSpec + 'peer-tor-address': ValueSpec } = await InputSpec.of({ - "peer-tor-address": Value.text({ - name: "Peer tor address", - description: "The Tor address of the peer interface", + 'peer-tor-address': Value.text({ + name: 'Peer tor address', + description: 'The Tor address of the peer interface', required: true, default: null, }), @@ -22,9 +22,9 @@ describe("builder tests", () => { .build({} as any) .then((a) => a.spec) expect(bitcoinPropertiesBuilt).toMatchObject({ - "peer-tor-address": { - type: "text", - description: "The Tor address of the peer interface", + 'peer-tor-address': { + type: 'text', + description: 'The Tor address of the peer interface', warning: null, masked: false, placeholder: null, @@ -32,8 +32,8 @@ describe("builder tests", () => { maxLength: null, patterns: [], disabled: false, - inputmode: "text", - name: "Peer tor address", + inputmode: 'text', + name: 'Peer tor address', required: true, default: null, }, @@ -41,10 +41,10 @@ describe("builder tests", () => { }) }) -describe("values", () => { - test("toggle", async () => { +describe('values', () => { + test('toggle', async () => { const value = await Value.toggle({ - name: "Testing", + name: 'Testing', description: null, warning: null, default: false, @@ -53,87 +53,87 @@ describe("values", () => { validator.unsafeCast(false) testOutput()(null) }) - test("text", async () => { + test('text', async () => { const value = await Value.text({ - name: "Testing", + name: 'Testing', required: true, default: null, }).build({} as any) const validator = value.validator const rawIs = value.spec - validator.unsafeCast("test text") + validator.unsafeCast('test text') expect(() => validator.unsafeCast(null)).toThrowError() testOutput()(null) }) - test("text with default", async () => { + test('text with default', async () => { const value = await Value.text({ - name: "Testing", + name: 'Testing', required: true, - default: "this is a default value", + default: 'this is a default value', }).build({} as any) const validator = value.validator const rawIs = value.spec - validator.unsafeCast("test text") + validator.unsafeCast('test text') expect(() => validator.unsafeCast(null)).toThrowError() testOutput()(null) }) - test("optional text", async () => { + test('optional text', async () => { const value = await Value.text({ - name: "Testing", + name: 'Testing', required: false, default: null, }).build({} as any) const validator = value.validator const rawIs = value.spec - validator.unsafeCast("test text") + validator.unsafeCast('test text') validator.unsafeCast(null) testOutput()(null) }) - test("color", async () => { + test('color', async () => { const value = await Value.color({ - name: "Testing", + name: 'Testing', required: false, default: null, description: null, warning: null, }).build({} as any) const validator = value.validator - validator.unsafeCast("#000000") + validator.unsafeCast('#000000') testOutput()(null) }) - test("datetime", async () => { + test('datetime', async () => { const value = await Value.datetime({ - name: "Testing", + name: 'Testing', required: true, default: null, description: null, warning: null, - inputmode: "date", + inputmode: 'date', min: null, max: null, }).build({} as any) const validator = value.validator - validator.unsafeCast("2021-01-01") + validator.unsafeCast('2021-01-01') testOutput()(null) }) - test("optional datetime", async () => { + test('optional datetime', async () => { const value = await Value.datetime({ - name: "Testing", + name: 'Testing', required: false, default: null, description: null, warning: null, - inputmode: "date", + inputmode: 'date', min: null, max: null, }).build({} as any) const validator = value.validator - validator.unsafeCast("2021-01-01") + validator.unsafeCast('2021-01-01') testOutput()(null) }) - test("textarea", async () => { + test('textarea', async () => { const value = await Value.textarea({ - name: "Testing", + name: 'Testing', required: false, default: null, description: null, @@ -145,12 +145,12 @@ describe("values", () => { placeholder: null, }).build({} as any) const validator = value.validator - validator.unsafeCast("test text") + validator.unsafeCast('test text') testOutput()(null) }) - test("number", async () => { + test('number', async () => { const value = await Value.number({ - name: "Testing", + name: 'Testing', required: true, default: null, integer: false, @@ -166,9 +166,9 @@ describe("values", () => { validator.unsafeCast(2) testOutput()(null) }) - test("optional number", async () => { + test('optional number', async () => { const value = await Value.number({ - name: "Testing", + name: 'Testing', required: false, default: null, integer: false, @@ -184,45 +184,45 @@ describe("values", () => { validator.unsafeCast(2) testOutput()(null) }) - test("select", async () => { + test('select', async () => { const value = await Value.select({ - name: "Testing", - default: "a", + name: 'Testing', + default: 'a', values: { - a: "A", - b: "B", + a: 'A', + b: 'B', }, description: null, warning: null, }).build({} as any) const validator = value.validator - validator.unsafeCast("a") - validator.unsafeCast("b") - expect(() => validator.unsafeCast("c")).toThrowError() - testOutput()(null) + validator.unsafeCast('a') + validator.unsafeCast('b') + expect(() => validator.unsafeCast('c')).toThrowError() + testOutput()(null) }) - test("nullable select", async () => { + test('nullable select', async () => { const value = await Value.select({ - name: "Testing", - default: "a", + name: 'Testing', + default: 'a', values: { - a: "A", - b: "B", + a: 'A', + b: 'B', }, description: null, warning: null, }).build({} as any) const validator = value.validator - validator.unsafeCast("a") - validator.unsafeCast("b") - testOutput()(null) + validator.unsafeCast('a') + validator.unsafeCast('b') + testOutput()(null) }) - test("multiselect", async () => { + test('multiselect', async () => { const value = await Value.multiselect({ - name: "Testing", + name: 'Testing', values: { - a: "A", - b: "B", + a: 'A', + b: 'B', }, default: [], description: null, @@ -232,21 +232,21 @@ describe("values", () => { }).build({} as any) const validator = value.validator validator.unsafeCast([]) - validator.unsafeCast(["a", "b"]) + validator.unsafeCast(['a', 'b']) - expect(() => validator.unsafeCast(["e"])).toThrowError() + expect(() => validator.unsafeCast(['e'])).toThrowError() expect(() => validator.unsafeCast([4])).toThrowError() - testOutput>()(null) + testOutput>()(null) }) - test("object", async () => { + test('object', async () => { const value = await Value.object( { - name: "Testing", + name: 'Testing', description: null, }, InputSpec.of({ a: Value.toggle({ - name: "test", + name: 'test', description: null, warning: null, default: false, @@ -257,18 +257,18 @@ describe("values", () => { validator.unsafeCast({ a: true }) testOutput()(null) }) - test("union", async () => { + test('union', async () => { const value = await Value.union({ - name: "Testing", - default: "a", + name: 'Testing', + default: 'a', description: null, warning: null, variants: Variants.of({ a: { - name: "a", + name: 'a', spec: InputSpec.of({ b: Value.toggle({ - name: "b", + name: 'b', description: null, warning: null, default: false, @@ -278,12 +278,12 @@ describe("values", () => { }), }).build({} as any) const validator = value.validator - validator.unsafeCast({ selection: "a", value: { b: false } }) + validator.unsafeCast({ selection: 'a', value: { b: false } }) type Test = typeof validator._TYPE testOutput< Test, { - selection: "a" + selection: 'a' value: { b: boolean } @@ -292,15 +292,15 @@ describe("values", () => { >()(null) }) - describe("dynamic", () => { + describe('dynamic', () => { const fakeOptions = { - inputSpec: "inputSpec", - effects: "effects", - utils: "utils", + inputSpec: 'inputSpec', + effects: 'effects', + utils: 'utils', } as any - test("toggle", async () => { + test('toggle', async () => { const value = await Value.dynamicToggle(async () => ({ - name: "Testing", + name: 'Testing', description: null, warning: null, default: false, @@ -310,98 +310,98 @@ describe("values", () => { expect(() => validator.unsafeCast(null)).toThrowError() testOutput()(null) expect(value.spec).toMatchObject({ - name: "Testing", + name: 'Testing', description: null, warning: null, default: false, }) }) - test("text", async () => { + test('text', async () => { const value = await Value.dynamicText(async () => ({ - name: "Testing", + name: 'Testing', required: false, default: null, })).build({} as any) const validator = value.validator const rawIs = value.spec - validator.unsafeCast("test text") + validator.unsafeCast('test text') validator.unsafeCast(null) testOutput()(null) expect(value.spec).toMatchObject({ - name: "Testing", + name: 'Testing', required: false, default: null, }) }) - test("text with default", async () => { + test('text with default', async () => { const value = await Value.dynamicText(async () => ({ - name: "Testing", + name: 'Testing', required: false, - default: "this is a default value", + default: 'this is a default value', })).build({} as any) const validator = value.validator - validator.unsafeCast("test text") + validator.unsafeCast('test text') validator.unsafeCast(null) testOutput()(null) expect(value.spec).toMatchObject({ - name: "Testing", + name: 'Testing', required: false, - default: "this is a default value", + default: 'this is a default value', }) }) - test("optional text", async () => { + test('optional text', async () => { const value = await Value.dynamicText(async () => ({ - name: "Testing", + name: 'Testing', required: false, default: null, })).build({} as any) const validator = value.validator const rawIs = value.spec - validator.unsafeCast("test text") + validator.unsafeCast('test text') validator.unsafeCast(null) testOutput()(null) expect(value.spec).toMatchObject({ - name: "Testing", + name: 'Testing', required: false, default: null, }) }) - test("color", async () => { + test('color', async () => { const value = await Value.dynamicColor(async () => ({ - name: "Testing", + name: 'Testing', required: false, default: null, description: null, warning: null, })).build({} as any) const validator = value.validator - validator.unsafeCast("#000000") + validator.unsafeCast('#000000') validator.unsafeCast(null) testOutput()(null) expect(value.spec).toMatchObject({ - name: "Testing", + name: 'Testing', required: false, default: null, description: null, warning: null, }) }) - test("datetime", async () => { + test('datetime', async () => { const sdk = StartSdk.of() .withManifest( setupManifest({ - id: "testOutput", - title: "", - license: "", - wrapperRepo: "", - upstreamRepo: "", - supportSite: "", - marketingSite: "", + id: 'testOutput', + title: '', + license: '', + wrapperRepo: '', + upstreamRepo: '', + supportSite: '', + marketingSite: '', donationUrl: null, - docsUrl: "", + docsUrl: '', description: { - short: "", - long: "", + short: '', + long: '', }, images: {}, volumes: [], @@ -414,10 +414,10 @@ describe("values", () => { stop: null, }, dependencies: { - "remote-test": { - description: "", + 'remote-test': { + description: '', optional: true, - s9pk: "https://example.com/remote-test.s9pk", + s9pk: 'https://example.com/remote-test.s9pk', }, }, }), @@ -426,28 +426,28 @@ describe("values", () => { const value = await Value.dynamicDatetime(async ({ effects }) => { return { - name: "Testing", + name: 'Testing', required: false, default: null, - inputmode: "date", + inputmode: 'date', } }).build({} as any) const validator = value.validator - validator.unsafeCast("2021-01-01") + validator.unsafeCast('2021-01-01') validator.unsafeCast(null) testOutput()(null) expect(value.spec).toMatchObject({ - name: "Testing", + name: 'Testing', required: false, default: null, description: null, warning: null, - inputmode: "date", + inputmode: 'date', }) }) - test("textarea", async () => { + test('textarea', async () => { const value = await Value.dynamicTextarea(async () => ({ - name: "Testing", + name: 'Testing', required: false, default: null, description: null, @@ -459,16 +459,16 @@ describe("values", () => { placeholder: null, })).build({} as any) const validator = value.validator - validator.unsafeCast("test text") + validator.unsafeCast('test text') testOutput()(null) expect(value.spec).toMatchObject({ - name: "Testing", + name: 'Testing', required: false, }) }) - test("number", async () => { + test('number', async () => { const value = await Value.dynamicNumber(() => ({ - name: "Testing", + name: 'Testing', required: false, default: null, integer: false, @@ -483,38 +483,38 @@ describe("values", () => { const validator = value.validator validator.unsafeCast(2) validator.unsafeCast(null) - expect(() => validator.unsafeCast("null")).toThrowError() + expect(() => validator.unsafeCast('null')).toThrowError() testOutput()(null) expect(value.spec).toMatchObject({ - name: "Testing", + name: 'Testing', required: false, }) }) - test("select", async () => { + test('select', async () => { const value = await Value.dynamicSelect(() => ({ - name: "Testing", - default: "a", + name: 'Testing', + default: 'a', values: { - a: "A", - b: "B", + a: 'A', + b: 'B', }, description: null, warning: null, })).build({} as any) const validator = value.validator - validator.unsafeCast("a") - validator.unsafeCast("b") - testOutput()(null) + validator.unsafeCast('a') + validator.unsafeCast('b') + testOutput()(null) expect(value.spec).toMatchObject({ - name: "Testing", + name: 'Testing', }) }) - test("multiselect", async () => { + test('multiselect', async () => { const value = await Value.dynamicMultiselect(() => ({ - name: "Testing", + name: 'Testing', values: { - a: "A", - b: "B", + a: 'A', + b: 'B', }, default: [], description: null, @@ -524,31 +524,31 @@ describe("values", () => { })).build({} as any) const validator = value.validator validator.unsafeCast([]) - validator.unsafeCast(["a", "b"]) + validator.unsafeCast(['a', 'b']) expect(() => validator.unsafeCast([4])).toThrowError() expect(() => validator.unsafeCast(null)).toThrowError() - testOutput>()(null) + testOutput>()(null) expect(value.spec).toMatchObject({ - name: "Testing", + name: 'Testing', default: [], }) }) }) - describe("filtering", () => { - test("union", async () => { + describe('filtering', () => { + test('union', async () => { const value = await Value.dynamicUnion(() => ({ - name: "Testing", - default: "a", + name: 'Testing', + default: 'a', description: null, warning: null, - disabled: ["a", "c"], + disabled: ['a', 'c'], variants: Variants.of({ a: { - name: "a", + name: 'a', spec: InputSpec.of({ b: Value.toggle({ - name: "b", + name: 'b', description: null, warning: null, default: false, @@ -556,10 +556,10 @@ describe("values", () => { }), }, b: { - name: "b", + name: 'b', spec: InputSpec.of({ b: Value.toggle({ - name: "b", + name: 'b', description: null, warning: null, default: false, @@ -569,12 +569,12 @@ describe("values", () => { }), })).build({} as any) const validator = value.validator - validator.unsafeCast({ selection: "a", value: { b: false } }) + validator.unsafeCast({ selection: 'a', value: { b: false } }) type Test = typeof validator._TYPE testOutput< Test, | { - selection: "a" + selection: 'a' value: { b: boolean } @@ -585,7 +585,7 @@ describe("values", () => { } } | { - selection: "b" + selection: 'b' value: { b: boolean } @@ -599,41 +599,41 @@ describe("values", () => { const built = value.spec expect(built).toMatchObject({ - name: "Testing", + name: 'Testing', variants: { b: {}, }, }) expect(built).toMatchObject({ - name: "Testing", + name: 'Testing', variants: { a: {}, b: {}, }, }) expect(built).toMatchObject({ - name: "Testing", + name: 'Testing', variants: { a: {}, b: {}, }, - disabled: ["a", "c"], + disabled: ['a', 'c'], }) }) }) - test("dynamic union", async () => { + test('dynamic union', async () => { const value = await Value.dynamicUnion(() => ({ - disabled: ["a", "c"], - name: "Testing", - default: "b", + disabled: ['a', 'c'], + name: 'Testing', + default: 'b', description: null, warning: null, variants: Variants.of({ a: { - name: "a", + name: 'a', spec: InputSpec.of({ b: Value.toggle({ - name: "b", + name: 'b', description: null, warning: null, default: false, @@ -641,10 +641,10 @@ describe("values", () => { }), }, b: { - name: "b", + name: 'b', spec: InputSpec.of({ b: Value.toggle({ - name: "b", + name: 'b', description: null, warning: null, default: false, @@ -654,12 +654,12 @@ describe("values", () => { }), })).build({} as any) const validator = value.validator - validator.unsafeCast({ selection: "a", value: { b: false } }) + validator.unsafeCast({ selection: 'a', value: { b: false } }) type Test = typeof validator._TYPE testOutput< Test, | { - selection: "a" + selection: 'a' value: { b: boolean } @@ -670,7 +670,7 @@ describe("values", () => { } } | { - selection: "b" + selection: 'b' value: { b: boolean } @@ -684,40 +684,40 @@ describe("values", () => { const built = value.spec expect(built).toMatchObject({ - name: "Testing", + name: 'Testing', variants: { b: {}, }, }) expect(built).toMatchObject({ - name: "Testing", + name: 'Testing', variants: { a: {}, b: {}, }, }) expect(built).toMatchObject({ - name: "Testing", + name: 'Testing', variants: { a: {}, b: {}, }, - disabled: ["a", "c"], + disabled: ['a', 'c'], }) }) }) -describe("Builder List", () => { - test("obj", async () => { +describe('Builder List', () => { + test('obj', async () => { const value = await Value.list( List.obj( { - name: "test", + name: 'test', }, { spec: InputSpec.of({ test: Value.toggle({ - name: "test", + name: 'test', description: null, warning: null, default: false, @@ -730,11 +730,11 @@ describe("Builder List", () => { validator.unsafeCast([{ test: true }]) testOutput()(null) }) - test("text", async () => { + test('text', async () => { const value = await Value.list( List.text( { - name: "test", + name: 'test', }, { patterns: [], @@ -742,53 +742,53 @@ describe("Builder List", () => { ), ).build({} as any) const validator = value.validator - validator.unsafeCast(["test", "text"]) + validator.unsafeCast(['test', 'text']) testOutput()(null) }) - describe("dynamic", () => { - test("text", async () => { + describe('dynamic', () => { + test('text', async () => { const value = await Value.list( List.dynamicText(() => ({ - name: "test", + name: 'test', spec: { patterns: [] }, })), ).build({} as any) const validator = value.validator - validator.unsafeCast(["test", "text"]) + validator.unsafeCast(['test', 'text']) expect(() => validator.unsafeCast([3, 4])).toThrowError() expect(() => validator.unsafeCast(null)).toThrowError() testOutput()(null) expect(value.spec).toMatchObject({ - name: "test", + name: 'test', spec: { patterns: [] }, }) }) }) }) -describe("Nested nullable values", () => { - test("Testing text", async () => { +describe('Nested nullable values', () => { + test('Testing text', async () => { const value = await InputSpec.of({ a: Value.text({ - name: "Temp Name", + name: 'Temp Name', description: - "If no name is provided, the name from inputSpec will be used", + 'If no name is provided, the name from inputSpec will be used', required: false, default: null, }), }).build({} as any) const validator = value.validator validator.unsafeCast({ a: null }) - validator.unsafeCast({ a: "test" }) + validator.unsafeCast({ a: 'test' }) expect(() => validator.unsafeCast({ a: 4 })).toThrowError() testOutput()(null) }) - test("Testing number", async () => { + test('Testing number', async () => { const value = await InputSpec.of({ a: Value.number({ - name: "Temp Name", + name: 'Temp Name', description: - "If no name is provided, the name from inputSpec will be used", + 'If no name is provided, the name from inputSpec will be used', required: false, default: null, warning: null, @@ -803,15 +803,15 @@ describe("Nested nullable values", () => { const validator = value.validator validator.unsafeCast({ a: null }) validator.unsafeCast({ a: 5 }) - expect(() => validator.unsafeCast({ a: "4" })).toThrowError() + expect(() => validator.unsafeCast({ a: '4' })).toThrowError() testOutput()(null) }) - test("Testing color", async () => { + test('Testing color', async () => { const value = await InputSpec.of({ a: Value.color({ - name: "Temp Name", + name: 'Temp Name', description: - "If no name is provided, the name from inputSpec will be used", + 'If no name is provided, the name from inputSpec will be used', required: false, default: null, warning: null, @@ -819,50 +819,50 @@ describe("Nested nullable values", () => { }).build({} as any) const validator = value.validator validator.unsafeCast({ a: null }) - validator.unsafeCast({ a: "5" }) + validator.unsafeCast({ a: '5' }) expect(() => validator.unsafeCast({ a: 4 })).toThrowError() testOutput()(null) }) - test("Testing select", async () => { + test('Testing select', async () => { const value = await InputSpec.of({ a: Value.select({ - name: "Temp Name", + name: 'Temp Name', description: - "If no name is provided, the name from inputSpec will be used", - default: "a", + 'If no name is provided, the name from inputSpec will be used', + default: 'a', warning: null, values: { - a: "A", + a: 'A', }, }), }).build({} as any) const higher = await Value.select({ - name: "Temp Name", + name: 'Temp Name', description: - "If no name is provided, the name from inputSpec will be used", - default: "a", + 'If no name is provided, the name from inputSpec will be used', + default: 'a', warning: null, values: { - a: "A", + a: 'A', }, }).build({} as any) const validator = value.validator - validator.unsafeCast({ a: "a" }) - expect(() => validator.unsafeCast({ a: "4" })).toThrowError() - testOutput()(null) + validator.unsafeCast({ a: 'a' }) + expect(() => validator.unsafeCast({ a: '4' })).toThrowError() + testOutput()(null) }) - test("Testing multiselect", async () => { + test('Testing multiselect', async () => { const value = await InputSpec.of({ a: Value.multiselect({ - name: "Temp Name", + name: 'Temp Name', description: - "If no name is provided, the name from inputSpec will be used", + 'If no name is provided, the name from inputSpec will be used', warning: null, default: [], values: { - a: "A", + a: 'A', }, minLength: null, maxLength: null, @@ -870,9 +870,9 @@ describe("Nested nullable values", () => { }).build({} as any) const validator = value.validator validator.unsafeCast({ a: [] }) - validator.unsafeCast({ a: ["a"] }) - expect(() => validator.unsafeCast({ a: ["4"] })).toThrowError() - expect(() => validator.unsafeCast({ a: "4" })).toThrowError() - testOutput()(null) + validator.unsafeCast({ a: ['a'] }) + expect(() => validator.unsafeCast({ a: ['4'] })).toThrowError() + expect(() => validator.unsafeCast({ a: '4' })).toThrowError() + testOutput()(null) }) }) diff --git a/sdk/package/lib/test/makeOutput.ts b/sdk/package/lib/test/makeOutput.ts index 434484be9..b526aeca3 100644 --- a/sdk/package/lib/test/makeOutput.ts +++ b/sdk/package/lib/test/makeOutput.ts @@ -1,55 +1,55 @@ -import { oldSpecToBuilder } from "../../scripts/oldSpecToBuilder" +import { oldSpecToBuilder } from '../../scripts/oldSpecToBuilder' oldSpecToBuilder( // Make the location - "./lib/test/output.ts", + './lib/test/output.ts', // Put the inputSpec here { mediasources: { - type: "list", - subtype: "enum", - name: "Media Sources", - description: "List of Media Sources to use with Jellyfin", - range: "[1,*)", - default: ["nextcloud"], + type: 'list', + subtype: 'enum', + name: 'Media Sources', + description: 'List of Media Sources to use with Jellyfin', + range: '[1,*)', + default: ['nextcloud'], spec: { - values: ["nextcloud", "filebrowser"], - "value-names": { - nextcloud: "NextCloud", - filebrowser: "File Browser", + values: ['nextcloud', 'filebrowser'], + 'value-names': { + nextcloud: 'NextCloud', + filebrowser: 'File Browser', }, }, }, testListUnion: { - type: "list", - subtype: "union", - name: "Lightning Nodes", - description: "List of Lightning Network node instances to manage", - range: "[1,*)", - default: ["lnd"], + type: 'list', + subtype: 'union', + name: 'Lightning Nodes', + description: 'List of Lightning Network node instances to manage', + range: '[1,*)', + default: ['lnd'], spec: { - type: "string", - "display-as": "{{name}}", - "unique-by": "name", - name: "Node Implementation", + type: 'string', + 'display-as': '{{name}}', + 'unique-by': 'name', + name: 'Node Implementation', tag: { - id: "type", - name: "Type", + id: 'type', + name: 'Type', description: - "- LND: Lightning Network Daemon from Lightning Labs\n- CLN: Core Lightning from Blockstream\n", - "variant-names": { - lnd: "Lightning Network Daemon (LND)", - "c-lightning": "Core Lightning (CLN)", + '- LND: Lightning Network Daemon from Lightning Labs\n- CLN: Core Lightning from Blockstream\n', + 'variant-names': { + lnd: 'Lightning Network Daemon (LND)', + 'c-lightning': 'Core Lightning (CLN)', }, }, - default: "lnd", + default: 'lnd', variants: { lnd: { name: { - type: "string", - name: "Node Name", - description: "Name of this node in the list", - default: "LND Wrapper", + type: 'string', + name: 'Node Name', + description: 'Name of this node in the list', + default: 'LND Wrapper', nullable: false, }, }, @@ -57,262 +57,262 @@ oldSpecToBuilder( }, }, rpc: { - type: "object", - name: "RPC Settings", - description: "RPC configuration options.", + type: 'object', + name: 'RPC Settings', + description: 'RPC configuration options.', spec: { enable: { - type: "boolean", - name: "Enable", - description: "Allow remote RPC requests.", + type: 'boolean', + name: 'Enable', + description: 'Allow remote RPC requests.', default: true, }, username: { - type: "string", + type: 'string', nullable: false, - name: "Username", - description: "The username for connecting to Bitcoin over RPC.", - default: "bitcoin", + name: 'Username', + description: 'The username for connecting to Bitcoin over RPC.', + default: 'bitcoin', masked: true, - pattern: "^[a-zA-Z0-9_]+$", - "pattern-description": - "Must be alphanumeric (can contain underscore).", + pattern: '^[a-zA-Z0-9_]+$', + 'pattern-description': + 'Must be alphanumeric (can contain underscore).', }, password: { - type: "string", + type: 'string', nullable: false, - name: "RPC Password", - description: "The password for connecting to Bitcoin over RPC.", + name: 'RPC Password', + description: 'The password for connecting to Bitcoin over RPC.', default: { - charset: "a-z,2-7", + charset: 'a-z,2-7', len: 20, }, pattern: '^[^\\n"]*$', - "pattern-description": - "Must not contain newline or quote characters.", + 'pattern-description': + 'Must not contain newline or quote characters.', copyable: true, masked: true, }, bio: { - type: "string", + type: 'string', nullable: false, - name: "Username", - description: "The username for connecting to Bitcoin over RPC.", - default: "bitcoin", + name: 'Username', + description: 'The username for connecting to Bitcoin over RPC.', + default: 'bitcoin', masked: true, - pattern: "^[a-zA-Z0-9_]+$", - "pattern-description": - "Must be alphanumeric (can contain underscore).", + pattern: '^[a-zA-Z0-9_]+$', + 'pattern-description': + 'Must be alphanumeric (can contain underscore).', textarea: true, }, advanced: { - type: "object", - name: "Advanced", - description: "Advanced RPC Settings", + type: 'object', + name: 'Advanced', + description: 'Advanced RPC Settings', spec: { auth: { - name: "Authorization", + name: 'Authorization', description: - "Username and hashed password for JSON-RPC connections. RPC clients connect using the usual http basic authentication.", - type: "list", - subtype: "string", + 'Username and hashed password for JSON-RPC connections. RPC clients connect using the usual http basic authentication.', + type: 'list', + subtype: 'string', default: [], spec: { pattern: - "^[a-zA-Z0-9_-]+:([0-9a-fA-F]{2})+\\$([0-9a-fA-F]{2})+$", - "pattern-description": + '^[a-zA-Z0-9_-]+:([0-9a-fA-F]{2})+\\$([0-9a-fA-F]{2})+$', + 'pattern-description': 'Each item must be of the form ":$".', masked: false, }, - range: "[0,*)", + range: '[0,*)', }, serialversion: { - name: "Serialization Version", + name: 'Serialization Version', description: - "Return raw transaction or block hex with Segwit or non-SegWit serialization.", - type: "enum", - values: ["non-segwit", "segwit"], - "value-names": {}, - default: "segwit", + 'Return raw transaction or block hex with Segwit or non-SegWit serialization.', + type: 'enum', + values: ['non-segwit', 'segwit'], + 'value-names': {}, + default: 'segwit', }, servertimeout: { - name: "Rpc Server Timeout", + name: 'Rpc Server Timeout', description: - "Number of seconds after which an uncompleted RPC call will time out.", - type: "number", + 'Number of seconds after which an uncompleted RPC call will time out.', + type: 'number', nullable: false, - range: "[5,300]", + range: '[5,300]', integral: true, - units: "seconds", + units: 'seconds', default: 30, }, threads: { - name: "Threads", + name: 'Threads', description: - "Set the number of threads for handling RPC calls. You may wish to increase this if you are making lots of calls via an integration.", - type: "number", + 'Set the number of threads for handling RPC calls. You may wish to increase this if you are making lots of calls via an integration.', + type: 'number', nullable: false, default: 16, - range: "[1,64]", + range: '[1,64]', integral: true, }, workqueue: { - name: "Work Queue", + name: 'Work Queue', description: - "Set the depth of the work queue to service RPC calls. Determines how long the backlog of RPC requests can get before it just rejects new ones.", - type: "number", + 'Set the depth of the work queue to service RPC calls. Determines how long the backlog of RPC requests can get before it just rejects new ones.', + type: 'number', nullable: false, default: 128, - range: "[8,256]", + range: '[8,256]', integral: true, - units: "requests", + units: 'requests', }, }, }, }, }, - "zmq-enabled": { - type: "boolean", - name: "ZeroMQ Enabled", - description: "Enable the ZeroMQ interface", + 'zmq-enabled': { + type: 'boolean', + name: 'ZeroMQ Enabled', + description: 'Enable the ZeroMQ interface', default: true, }, txindex: { - type: "boolean", - name: "Transaction Index", - description: "Enable the Transaction Index (txindex)", + type: 'boolean', + name: 'Transaction Index', + description: 'Enable the Transaction Index (txindex)', default: true, }, wallet: { - type: "object", - name: "Wallet", - description: "Wallet Settings", + type: 'object', + name: 'Wallet', + description: 'Wallet Settings', spec: { enable: { - name: "Enable Wallet", - description: "Load the wallet and enable wallet RPC calls.", - type: "boolean", + name: 'Enable Wallet', + description: 'Load the wallet and enable wallet RPC calls.', + type: 'boolean', default: true, }, avoidpartialspends: { - name: "Avoid Partial Spends", + name: 'Avoid Partial Spends', description: - "Group outputs by address, selecting all or none, instead of selecting on a per-output basis. This improves privacy at the expense of higher transaction fees.", - type: "boolean", + 'Group outputs by address, selecting all or none, instead of selecting on a per-output basis. This improves privacy at the expense of higher transaction fees.', + type: 'boolean', default: true, }, discardfee: { - name: "Discard Change Tolerance", + name: 'Discard Change Tolerance', description: - "The fee rate (in BTC/kB) that indicates your tolerance for discarding change by adding it to the fee.", - type: "number", + 'The fee rate (in BTC/kB) that indicates your tolerance for discarding change by adding it to the fee.', + type: 'number', nullable: false, default: 0.0001, - range: "[0,.01]", + range: '[0,.01]', integral: false, - units: "BTC/kB", + units: 'BTC/kB', }, }, }, advanced: { - type: "object", - name: "Advanced", - description: "Advanced Settings", + type: 'object', + name: 'Advanced', + description: 'Advanced Settings', spec: { mempool: { - type: "object", - name: "Mempool", - description: "Mempool Settings", + type: 'object', + name: 'Mempool', + description: 'Mempool Settings', spec: { mempoolfullrbf: { - name: "Enable Full RBF", + name: 'Enable Full RBF', description: - "Policy for your node to use for relaying and mining unconfirmed transactions. For details, see https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-24.0.md#notice-of-new-option-for-transaction-replacement-policies", - type: "boolean", + 'Policy for your node to use for relaying and mining unconfirmed transactions. For details, see https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-24.0.md#notice-of-new-option-for-transaction-replacement-policies', + type: 'boolean', default: false, }, persistmempool: { - type: "boolean", - name: "Persist Mempool", - description: "Save the mempool on shutdown and load on restart.", + type: 'boolean', + name: 'Persist Mempool', + description: 'Save the mempool on shutdown and load on restart.', default: true, }, maxmempool: { - type: "number", + type: 'number', nullable: false, - name: "Max Mempool Size", + name: 'Max Mempool Size', description: - "Keep the transaction memory pool below megabytes.", - range: "[1,*)", + 'Keep the transaction memory pool below megabytes.', + range: '[1,*)', integral: true, - units: "MiB", + units: 'MiB', default: 300, }, mempoolexpiry: { - type: "number", + type: 'number', nullable: false, - name: "Mempool Expiration", + name: 'Mempool Expiration', description: - "Do not keep transactions in the mempool longer than hours.", - range: "[1,*)", + 'Do not keep transactions in the mempool longer than hours.', + range: '[1,*)', integral: true, - units: "Hr", + units: 'Hr', default: 336, }, }, }, peers: { - type: "object", - name: "Peers", - description: "Peer Connection Settings", + type: 'object', + name: 'Peers', + description: 'Peer Connection Settings', spec: { listen: { - type: "boolean", - name: "Make Public", + type: 'boolean', + name: 'Make Public', description: - "Allow other nodes to find your server on the network.", + 'Allow other nodes to find your server on the network.', default: true, }, onlyconnect: { - type: "boolean", - name: "Disable Peer Discovery", - description: "Only connect to specified peers.", + type: 'boolean', + name: 'Disable Peer Discovery', + description: 'Only connect to specified peers.', default: false, }, onlyonion: { - type: "boolean", - name: "Disable Clearnet", - description: "Only connect to peers over Tor.", + type: 'boolean', + name: 'Disable Clearnet', + description: 'Only connect to peers over Tor.', default: false, }, addnode: { - name: "Add Nodes", - description: "Add addresses of nodes to connect to.", - type: "list", - subtype: "object", - range: "[0,*)", + name: 'Add Nodes', + description: 'Add addresses of nodes to connect to.', + type: 'list', + subtype: 'object', + range: '[0,*)', default: [], spec: { - "unique-by": null, + 'unique-by': null, spec: { hostname: { - type: "string", + type: 'string', nullable: true, - name: "Hostname", - description: "Domain or IP address of bitcoin peer", + name: 'Hostname', + description: 'Domain or IP address of bitcoin peer', pattern: - "(^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$)|((^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$)|(^[a-z2-7]{16}\\.onion$)|(^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$))", - "pattern-description": + '(^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$)|((^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$)|(^[a-z2-7]{16}\\.onion$)|(^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$))', + 'pattern-description': "Must be either a domain name, or an IPv4 or IPv6 address. Do not include protocol scheme (eg 'http://') or port.", masked: false, }, port: { - type: "number", + type: 'number', nullable: true, - name: "Port", + name: 'Port', description: - "Port that peer is listening on for inbound p2p connections", - range: "[0,65535]", + 'Port that peer is listening on for inbound p2p connections', + range: '[0,65535]', integral: true, }, }, @@ -321,81 +321,81 @@ oldSpecToBuilder( }, }, dbcache: { - type: "number", + type: 'number', nullable: true, - name: "Database Cache", + name: 'Database Cache', description: "How much RAM to allocate for caching the TXO set. Higher values improve syncing performance, but increase your chance of using up all your system's memory or corrupting your database in the event of an ungraceful shutdown. Set this high but comfortably below your system's total RAM during IBD, then turn down to 450 (or leave blank) once the sync completes.", warning: - "WARNING: Increasing this value results in a higher chance of ungraceful shutdowns, which can leave your node unusable if it happens during the initial block download. Use this setting with caution. Be sure to set this back to the default (450 or leave blank) once your node is synced. DO NOT press the STOP button if your dbcache is large. Instead, set this number back to the default, hit save, and wait for bitcoind to restart on its own.", - range: "(0,*)", + 'WARNING: Increasing this value results in a higher chance of ungraceful shutdowns, which can leave your node unusable if it happens during the initial block download. Use this setting with caution. Be sure to set this back to the default (450 or leave blank) once your node is synced. DO NOT press the STOP button if your dbcache is large. Instead, set this number back to the default, hit save, and wait for bitcoind to restart on its own.', + range: '(0,*)', integral: true, - units: "MiB", + units: 'MiB', }, pruning: { - type: "union", - name: "Pruning Settings", + type: 'union', + name: 'Pruning Settings', description: - "Blockchain Pruning Options\nReduce the blockchain size on disk\n", + 'Blockchain Pruning Options\nReduce the blockchain size on disk\n', warning: - "If you set pruning to Manual and your disk is smaller than the total size of the blockchain, you MUST have something running that prunes these blocks or you may overfill your disk!\nDisabling pruning will convert your node into a full archival node. This requires a resync of the entire blockchain, a process that may take several days. Make sure you have enough free disk space or you may fill up your disk.\n", + 'If you set pruning to Manual and your disk is smaller than the total size of the blockchain, you MUST have something running that prunes these blocks or you may overfill your disk!\nDisabling pruning will convert your node into a full archival node. This requires a resync of the entire blockchain, a process that may take several days. Make sure you have enough free disk space or you may fill up your disk.\n', tag: { - id: "mode", - name: "Pruning Mode", + id: 'mode', + name: 'Pruning Mode', description: '- Disabled: Disable pruning\n- Automatic: Limit blockchain size on disk to a certain number of megabytes\n- Manual: Prune blockchain with the "pruneblockchain" RPC\n', - "variant-names": { - disabled: "Disabled", - automatic: "Automatic", - manual: "Manual", + 'variant-names': { + disabled: 'Disabled', + automatic: 'Automatic', + manual: 'Manual', }, }, variants: { disabled: {}, automatic: { size: { - type: "number", + type: 'number', nullable: false, - name: "Max Chain Size", - description: "Limit of blockchain size on disk.", + name: 'Max Chain Size', + description: 'Limit of blockchain size on disk.', warning: - "Increasing this value will require re-syncing your node.", + 'Increasing this value will require re-syncing your node.', default: 550, - range: "[550,1000000)", + range: '[550,1000000)', integral: true, - units: "MiB", + units: 'MiB', }, }, manual: { size: { - type: "number", + type: 'number', nullable: false, - name: "Failsafe Chain Size", - description: "Prune blockchain if size expands beyond this.", + name: 'Failsafe Chain Size', + description: 'Prune blockchain if size expands beyond this.', default: 65536, - range: "[550,1000000)", + range: '[550,1000000)', integral: true, - units: "MiB", + units: 'MiB', }, }, }, - default: "disabled", + default: 'disabled', }, blockfilters: { - type: "object", - name: "Block Filters", - description: "Settings for storing and serving compact block filters", + type: 'object', + name: 'Block Filters', + description: 'Settings for storing and serving compact block filters', spec: { blockfilterindex: { - type: "boolean", - name: "Compute Compact Block Filters (BIP158)", + type: 'boolean', + name: 'Compute Compact Block Filters (BIP158)', description: "Generate Compact Block Filters during initial sync (IBD) to enable 'getblockfilter' RPC. This is useful if dependent services need block filters to efficiently scan for addresses/transactions etc.", default: true, }, peerblockfilters: { - type: "boolean", - name: "Serve Compact Block Filters to Peers (BIP157)", + type: 'boolean', + name: 'Serve Compact Block Filters to Peers (BIP157)', description: "Serve Compact Block Filters as a peer service to other nodes on the network. This is useful if you wish to connect an SPV client to your node to make it efficient to scan transactions without having to download all block data. 'Compute Compact Block Filters (BIP158)' is required.", default: false, @@ -403,17 +403,17 @@ oldSpecToBuilder( }, }, bloomfilters: { - type: "object", - name: "Bloom Filters (BIP37)", - description: "Setting for serving Bloom Filters", + type: 'object', + name: 'Bloom Filters (BIP37)', + description: 'Setting for serving Bloom Filters', spec: { peerbloomfilters: { - type: "boolean", - name: "Serve Bloom Filters to Peers", + type: 'boolean', + name: 'Serve Bloom Filters to Peers', description: - "Peers have the option of setting filters on each connection they make after the version handshake has completed. Bloom filters are for clients implementing SPV (Simplified Payment Verification) that want to check that block headers connect together correctly, without needing to verify the full blockchain. The client must trust that the transactions in the chain are in fact valid. It is highly recommended AGAINST using for anything except Bisq integration.", + 'Peers have the option of setting filters on each connection they make after the version handshake has completed. Bloom filters are for clients implementing SPV (Simplified Payment Verification) that want to check that block headers connect together correctly, without needing to verify the full blockchain. The client must trust that the transactions in the chain are in fact valid. It is highly recommended AGAINST using for anything except Bisq integration.', warning: - "This is ONLY for use with Bisq integration, please use Block Filters for all other applications.", + 'This is ONLY for use with Bisq integration, please use Block Filters for all other applications.', default: false, }, }, @@ -423,6 +423,6 @@ oldSpecToBuilder( }, { // convert this to `start-sdk/lib` for conversions - StartSdk: "./output.sdk", + StartSdk: './output.sdk', }, ) diff --git a/sdk/package/lib/test/output.sdk.ts b/sdk/package/lib/test/output.sdk.ts index bafcc30ae..17e462c81 100644 --- a/sdk/package/lib/test/output.sdk.ts +++ b/sdk/package/lib/test/output.sdk.ts @@ -1,31 +1,31 @@ -import { StartSdk } from "../StartSdk" -import { setupManifest } from "../manifest/setupManifest" -import { VersionGraph } from "../version/VersionGraph" +import { StartSdk } from '../StartSdk' +import { setupManifest } from '../manifest/setupManifest' +import { VersionGraph } from '../version/VersionGraph' export type Manifest = any export const sdk = StartSdk.of() .withManifest( setupManifest({ - id: "testOutput", - title: "", - license: "", - wrapperRepo: "", - upstreamRepo: "", - supportSite: "", - marketingSite: "", + id: 'testOutput', + title: '', + license: '', + wrapperRepo: '', + upstreamRepo: '', + supportSite: '', + marketingSite: '', donationUrl: null, - docsUrl: "", + docsUrl: '', description: { - short: "", - long: "", + short: '', + long: '', }, images: { main: { source: { - dockerTag: "start9/hello-world", + dockerTag: 'start9/hello-world', }, - arch: ["aarch64", "x86_64"], - emulateMissingAs: "aarch64", + arch: ['aarch64', 'x86_64'], + emulateMissingAs: 'aarch64', }, }, volumes: [], @@ -38,10 +38,10 @@ export const sdk = StartSdk.of() stop: null, }, dependencies: { - "remote-test": { - description: "", + 'remote-test': { + description: '', optional: false, - s9pk: "https://example.com/remote-test.s9pk", + s9pk: 'https://example.com/remote-test.s9pk', }, }, }), diff --git a/sdk/package/lib/test/output.test.ts b/sdk/package/lib/test/output.test.ts index 4f1321484..146092075 100644 --- a/sdk/package/lib/test/output.test.ts +++ b/sdk/package/lib/test/output.test.ts @@ -1,7 +1,7 @@ -import { inputSpecSpec, InputSpecSpec } from "./output" -import * as _I from "../index" -import { camelCase } from "../../scripts/oldSpecToBuilder" -import { deepMerge } from "../../../base/lib/util" +import { inputSpecSpec, InputSpecSpec } from './output' +import * as _I from '../index' +import { camelCase } from '../../scripts/oldSpecToBuilder' +import { deepMerge } from '../../../base/lib/util' export type IfEquals = (() => G extends T ? 1 : 2) extends () => G extends U ? 1 : 2 ? Y : N @@ -10,60 +10,60 @@ export function testOutput(): (c: IfEquals) => null { } /// Testing the types of the input spec -testOutput()(null) -testOutput()(null) -testOutput()(null) +testOutput()(null) +testOutput()(null) +testOutput()(null) -testOutput()(null) +testOutput()(null) testOutput< - InputSpecSpec["rpc"]["advanced"]["serialversion"], - "segwit" | "non-segwit" + InputSpecSpec['rpc']['advanced']['serialversion'], + 'segwit' | 'non-segwit' >()(null) -testOutput()(null) +testOutput()(null) testOutput< - InputSpecSpec["advanced"]["peers"]["addnode"][0]["hostname"], + InputSpecSpec['advanced']['peers']['addnode'][0]['hostname'], string | null >()(null) testOutput< - InputSpecSpec["testListUnion"][0]["union"]["value"]["name"], + InputSpecSpec['testListUnion'][0]['union']['value']['name'], string >()(null) -testOutput()( +testOutput()( null, ) -testOutput>()( +testOutput>()( null, ) // @ts-expect-error Because enable should be a boolean -testOutput()(null) +testOutput()(null) // prettier-ignore // @ts-expect-error Expect that the string is the one above testOutput()(null); /// Here we test the output of the matchInputSpecSpec function -describe("Inputs", () => { +describe('Inputs', () => { const validInput: InputSpecSpec = { - mediasources: ["filebrowser"], + mediasources: ['filebrowser'], testListUnion: [ { - union: { selection: "lnd", value: { name: "string" } }, + union: { selection: 'lnd', value: { name: 'string' } }, }, ], rpc: { enable: true, - bio: "This is a bio", - username: "test", - password: "test", + bio: 'This is a bio', + username: 'test', + password: 'test', advanced: { - auth: ["test"], - serialversion: "segwit", + auth: ['test'], + serialversion: 'segwit', servertimeout: 6, threads: 3, workqueue: 9, }, }, - "zmq-enabled": false, + 'zmq-enabled': false, txindex: false, wallet: { enable: false, avoidpartialspends: false, discardfee: 0.0001 }, advanced: { @@ -79,14 +79,14 @@ describe("Inputs", () => { onlyonion: true, addnode: [ { - hostname: "test", + hostname: 'test', port: 1, }, ], }, dbcache: 5, pruning: { - selection: "disabled", + selection: 'disabled', value: { disabled: {} }, }, blockfilters: { @@ -97,52 +97,52 @@ describe("Inputs", () => { }, } - test("test valid input", async () => { + test('test valid input', async () => { const { validator } = await inputSpecSpec.build({} as any) const output = validator.unsafeCast(validInput) expect(output).toEqual(validInput) }) - test("test no longer care about the conversion of min/max and validating", async () => { + test('test no longer care about the conversion of min/max and validating', async () => { const { validator } = await inputSpecSpec.build({} as any) validator.unsafeCast( deepMerge({}, validInput, { rpc: { advanced: { threads: 0 } } }), ) }) - test("test errors should throw for number in string", async () => { + test('test errors should throw for number in string', async () => { const { validator } = await inputSpecSpec.build({} as any) expect(() => validator.unsafeCast(deepMerge({}, validInput, { rpc: { enable: 2 } })), ).toThrowError() }) - test("Test that we set serialversion to something not segwit or non-segwit", async () => { + test('Test that we set serialversion to something not segwit or non-segwit', async () => { const { validator } = await inputSpecSpec.build({} as any) expect(() => validator.unsafeCast( deepMerge({}, validInput, { - rpc: { advanced: { serialversion: "testing" } }, + rpc: { advanced: { serialversion: 'testing' } }, }), ), ).toThrowError() }) }) -describe("camelCase", () => { +describe('camelCase', () => { test("'EquipmentClass name'", () => { - expect(camelCase("EquipmentClass name")).toEqual("equipmentClassName") + expect(camelCase('EquipmentClass name')).toEqual('equipmentClassName') }) test("'Equipment className'", () => { - expect(camelCase("Equipment className")).toEqual("equipmentClassName") + expect(camelCase('Equipment className')).toEqual('equipmentClassName') }) test("'equipment class name'", () => { - expect(camelCase("equipment class name")).toEqual("equipmentClassName") + expect(camelCase('equipment class name')).toEqual('equipmentClassName') }) test("'Equipment Class Name'", () => { - expect(camelCase("Equipment Class Name")).toEqual("equipmentClassName") + expect(camelCase('Equipment Class Name')).toEqual('equipmentClassName') }) test("'hyphen-name-format'", () => { - expect(camelCase("hyphen-name-format")).toEqual("hyphenNameFormat") + expect(camelCase('hyphen-name-format')).toEqual('hyphenNameFormat') }) test("'underscore_name_format'", () => { - expect(camelCase("underscore_name_format")).toEqual("underscoreNameFormat") + expect(camelCase('underscore_name_format')).toEqual('underscoreNameFormat') }) }) diff --git a/sdk/package/lib/trigger/TriggerInput.ts b/sdk/package/lib/trigger/TriggerInput.ts index e15cca9b7..f8ed1c136 100644 --- a/sdk/package/lib/trigger/TriggerInput.ts +++ b/sdk/package/lib/trigger/TriggerInput.ts @@ -1,4 +1,4 @@ -import { HealthStatus } from "../../../base/lib/types" +import { HealthStatus } from '../../../base/lib/types' export type TriggerInput = { lastResult?: HealthStatus diff --git a/sdk/package/lib/trigger/changeOnFirstSuccess.ts b/sdk/package/lib/trigger/changeOnFirstSuccess.ts index 3da7284df..f4eab90c7 100644 --- a/sdk/package/lib/trigger/changeOnFirstSuccess.ts +++ b/sdk/package/lib/trigger/changeOnFirstSuccess.ts @@ -1,4 +1,4 @@ -import { Trigger } from "./index" +import { Trigger } from './index' export function changeOnFirstSuccess(o: { beforeFirstSuccess: Trigger @@ -13,7 +13,7 @@ export function changeOnFirstSuccess(o: { const beforeFirstSuccess = o.beforeFirstSuccess(getInput) for ( let res = await beforeFirstSuccess.next(); - currentValue?.lastResult !== "success" && !res.done; + currentValue?.lastResult !== 'success' && !res.done; res = await beforeFirstSuccess.next() ) { yield diff --git a/sdk/package/lib/trigger/defaultTrigger.ts b/sdk/package/lib/trigger/defaultTrigger.ts index 647695fb2..0473a25a8 100644 --- a/sdk/package/lib/trigger/defaultTrigger.ts +++ b/sdk/package/lib/trigger/defaultTrigger.ts @@ -1,5 +1,5 @@ -import { cooldownTrigger } from "./cooldownTrigger" -import { changeOnFirstSuccess } from "./changeOnFirstSuccess" +import { cooldownTrigger } from './cooldownTrigger' +import { changeOnFirstSuccess } from './changeOnFirstSuccess' export const defaultTrigger = changeOnFirstSuccess({ beforeFirstSuccess: cooldownTrigger(1000), diff --git a/sdk/package/lib/trigger/index.ts b/sdk/package/lib/trigger/index.ts index 6da034262..ecd5819b1 100644 --- a/sdk/package/lib/trigger/index.ts +++ b/sdk/package/lib/trigger/index.ts @@ -1,6 +1,6 @@ -import { TriggerInput } from "./TriggerInput" -export { changeOnFirstSuccess } from "./changeOnFirstSuccess" -export { cooldownTrigger } from "./cooldownTrigger" +import { TriggerInput } from './TriggerInput' +export { changeOnFirstSuccess } from './changeOnFirstSuccess' +export { cooldownTrigger } from './cooldownTrigger' export type Trigger = ( getInput: () => TriggerInput, diff --git a/sdk/package/lib/trigger/lastStatus.ts b/sdk/package/lib/trigger/lastStatus.ts index 01e737314..7bc275671 100644 --- a/sdk/package/lib/trigger/lastStatus.ts +++ b/sdk/package/lib/trigger/lastStatus.ts @@ -1,5 +1,5 @@ -import { Trigger } from "." -import { HealthStatus } from "../../../base/lib/types" +import { Trigger } from '.' +import { HealthStatus } from '../../../base/lib/types' export type LastStatusTriggerParams = { [k in HealthStatus]?: Trigger } & { default: Trigger @@ -15,13 +15,13 @@ export function lastStatus(o: LastStatusTriggerParams): Trigger { } while (true) { let currentValue = getInput() - let prev: HealthStatus | "default" | undefined = currentValue.lastResult + let prev: HealthStatus | 'default' | undefined = currentValue.lastResult if (!prev) { yield continue } if (!(prev in o)) { - prev = "default" + prev = 'default' } if (!triggers[prev]) { triggers[prev] = o[prev]!(getInput) diff --git a/sdk/package/lib/trigger/successFailure.ts b/sdk/package/lib/trigger/successFailure.ts index 7febcd356..77920e95f 100644 --- a/sdk/package/lib/trigger/successFailure.ts +++ b/sdk/package/lib/trigger/successFailure.ts @@ -1,5 +1,5 @@ -import { Trigger } from "." -import { lastStatus } from "./lastStatus" +import { Trigger } from '.' +import { lastStatus } from './lastStatus' export const successFailure = (o: { duringSuccess: Trigger diff --git a/sdk/package/lib/types.ts b/sdk/package/lib/types.ts index 0453a0681..75a9c1db8 100644 --- a/sdk/package/lib/types.ts +++ b/sdk/package/lib/types.ts @@ -1,2 +1,2 @@ -export * from "../../base/lib/types" -export { HealthCheck } from "./health" +export * from '../../base/lib/types' +export { HealthCheck } from './health' diff --git a/sdk/package/lib/util/GetServiceManifest.ts b/sdk/package/lib/util/GetServiceManifest.ts index 5965721bf..87b7ea5da 100644 --- a/sdk/package/lib/util/GetServiceManifest.ts +++ b/sdk/package/lib/util/GetServiceManifest.ts @@ -1,7 +1,7 @@ -import { Effects } from "../../../base/lib/Effects" -import { Manifest, PackageId } from "../../../base/lib/osBindings" -import { DropGenerator, DropPromise } from "../../../base/lib/util/Drop" -import { deepEqual } from "../../../base/lib/util/deepEqual" +import { Effects } from '../../../base/lib/Effects' +import { Manifest, PackageId } from '../../../base/lib/osBindings' +import { DropGenerator, DropPromise } from '../../../base/lib/util/Drop' +import { deepEqual } from '../../../base/lib/util/deepEqual' export class GetServiceManifest { constructor( @@ -45,7 +45,7 @@ export class GetServiceManifest { this.effects.onLeaveContext(() => { resolveCell.resolve() }) - abort?.addEventListener("abort", () => resolveCell.resolve()) + abort?.addEventListener('abort', () => resolveCell.resolve()) while (this.effects.isInContext && !abort?.aborted) { let callback: () => void = () => {} const waitForNext = new Promise((resolve) => { @@ -64,7 +64,7 @@ export class GetServiceManifest { } await waitForNext } - return new Promise((_, rej) => rej(new Error("aborted"))) + return new Promise((_, rej) => rej(new Error('aborted'))) } /** @@ -72,7 +72,7 @@ export class GetServiceManifest { */ watch(abort?: AbortSignal): AsyncGenerator { const ctrl = new AbortController() - abort?.addEventListener("abort", () => ctrl.abort()) + abort?.addEventListener('abort', () => ctrl.abort()) return DropGenerator.of(this.watchGen(ctrl.signal), () => ctrl.abort()) } @@ -96,7 +96,7 @@ export class GetServiceManifest { } } catch (e) { console.error( - "callback function threw an error @ GetServiceManifest.onChange", + 'callback function threw an error @ GetServiceManifest.onChange', e, ) } @@ -105,7 +105,7 @@ export class GetServiceManifest { .catch((e) => callback(null, e)) .catch((e) => console.error( - "callback function threw an error @ GetServiceManifest.onChange", + 'callback function threw an error @ GetServiceManifest.onChange', e, ), ) @@ -123,7 +123,7 @@ export class GetServiceManifest { return next } } - throw new Error("context left before predicate passed") + throw new Error('context left before predicate passed') }), () => ctrl.abort(), ) diff --git a/sdk/package/lib/util/GetSslCertificate.ts b/sdk/package/lib/util/GetSslCertificate.ts index 6839a99f0..df60b3b1f 100644 --- a/sdk/package/lib/util/GetSslCertificate.ts +++ b/sdk/package/lib/util/GetSslCertificate.ts @@ -1,6 +1,6 @@ -import { T } from ".." -import { Effects } from "../../../base/lib/Effects" -import { DropGenerator, DropPromise } from "../../../base/lib/util/Drop" +import { T } from '..' +import { Effects } from '../../../base/lib/Effects' +import { DropGenerator, DropPromise } from '../../../base/lib/util/Drop' export class GetSslCertificate { constructor( @@ -36,7 +36,7 @@ export class GetSslCertificate { this.effects.onLeaveContext(() => { resolveCell.resolve() }) - abort?.addEventListener("abort", () => resolveCell.resolve()) + abort?.addEventListener('abort', () => resolveCell.resolve()) while (this.effects.isInContext && !abort?.aborted) { let callback: () => void = () => {} const waitForNext = new Promise((resolve) => { @@ -50,7 +50,7 @@ export class GetSslCertificate { }) await waitForNext } - return new Promise((_, rej) => rej(new Error("aborted"))) + return new Promise((_, rej) => rej(new Error('aborted'))) } /** @@ -60,7 +60,7 @@ export class GetSslCertificate { abort?: AbortSignal, ): AsyncGenerator<[string, string, string], never, unknown> { const ctrl = new AbortController() - abort?.addEventListener("abort", () => ctrl.abort()) + abort?.addEventListener('abort', () => ctrl.abort()) return DropGenerator.of(this.watchGen(ctrl.signal), () => ctrl.abort()) } @@ -84,7 +84,7 @@ export class GetSslCertificate { } } catch (e) { console.error( - "callback function threw an error @ GetSslCertificate.onChange", + 'callback function threw an error @ GetSslCertificate.onChange', e, ) } @@ -93,7 +93,7 @@ export class GetSslCertificate { .catch((e) => callback(null, e)) .catch((e) => console.error( - "callback function threw an error @ GetSslCertificate.onChange", + 'callback function threw an error @ GetSslCertificate.onChange', e, ), ) diff --git a/sdk/package/lib/util/SubContainer.ts b/sdk/package/lib/util/SubContainer.ts index 842ef43d9..41b70f0c5 100644 --- a/sdk/package/lib/util/SubContainer.ts +++ b/sdk/package/lib/util/SubContainer.ts @@ -1,13 +1,13 @@ -import * as fs from "fs/promises" -import * as T from "../../../base/lib/types" -import * as cp from "child_process" -import { promisify } from "util" -import { Buffer } from "node:buffer" -import { once } from "../../../base/lib/util/once" -import { Drop } from "../../../base/lib/util/Drop" -import { Mounts } from "../mainFn/Mounts" -import { BackupEffects } from "../backup/Backups" -import { PathBase } from "./Volume" +import * as fs from 'fs/promises' +import * as T from '../../../base/lib/types' +import * as cp from 'child_process' +import { promisify } from 'util' +import { Buffer } from 'node:buffer' +import { once } from '../../../base/lib/util/once' +import { Drop } from '../../../base/lib/util/Drop' +import { Mounts } from '../mainFn/Mounts' +import { BackupEffects } from '../backup/Backups' +import { PathBase } from './Volume' export const execFile = promisify(cp.execFile) const False = () => false @@ -28,20 +28,20 @@ const TIMES_TO_WAIT_FOR_PROC = 100 async function prepBind( from: string | null, to: string, - type: "file" | "directory" | "infer", + type: 'file' | 'directory' | 'infer', ) { const fromMeta = from ? await fs.stat(from).catch((_) => null) : null const toMeta = await fs.stat(to).catch((_) => null) - if (type === "file" || (type === "infer" && from && fromMeta?.isFile())) { + if (type === 'file' || (type === 'infer' && from && fromMeta?.isFile())) { if (toMeta && toMeta.isDirectory()) await fs.rmdir(to, { recursive: false }) if (from && !fromMeta) { - await fs.mkdir(from.replace(/\/[^\/]*\/?$/, ""), { recursive: true }) - await fs.writeFile(from, "") + await fs.mkdir(from.replace(/\/[^\/]*\/?$/, ''), { recursive: true }) + await fs.writeFile(from, '') } if (!toMeta) { - await fs.mkdir(to.replace(/\/[^\/]*\/?$/, ""), { recursive: true }) - await fs.writeFile(to, "") + await fs.mkdir(to.replace(/\/[^\/]*\/?$/, ''), { recursive: true }) + await fs.writeFile(to, '') } } else { if (toMeta && toMeta.isFile() && !toMeta.size) await fs.rm(to) @@ -53,20 +53,20 @@ async function prepBind( async function bind( from: string, to: string, - type: "file" | "directory" | "infer", + type: 'file' | 'directory' | 'infer', idmap: IdMap[], ) { await prepBind(from, to, type) - const args = ["--bind"] + const args = ['--bind'] if (idmap.length) { args.push( - `-oX-mount.idmap=${idmap.map((i) => `b:${i.fromId}:${i.toId}:${i.range}`).join(" ")}`, + `-oX-mount.idmap=${idmap.map((i) => `b:${i.fromId}:${i.toId}:${i.range}`).join(' ')}`, ) } - await execFile("mount", [...args, from, to]) + await execFile('mount', [...args, from, to]) } export interface SubContainer< @@ -74,7 +74,7 @@ export interface SubContainer< Effects extends T.Effects = T.Effects, > extends Drop, PathBase { - readonly imageId: keyof Manifest["images"] & T.ImageId + readonly imageId: keyof Manifest['images'] & T.ImageId readonly rootfs: string readonly guid: T.Guid @@ -185,21 +185,21 @@ export class SubContainerOwned< private waitProc: () => Promise private constructor( readonly effects: Effects, - readonly imageId: keyof Manifest["images"] & T.ImageId, + readonly imageId: keyof Manifest['images'] & T.ImageId, readonly rootfs: string, readonly guid: T.Guid, ) { super() this.leaderExited = false this.leader = cp.spawn( - "start-container", - ["subcontainer", "launch", rootfs], + 'start-container', + ['subcontainer', 'launch', rootfs], { - killSignal: "SIGKILL", - stdio: "inherit", + killSignal: 'SIGKILL', + stdio: 'inherit', }, ) - this.leader.on("exit", () => { + this.leader.on('exit', () => { this.leaderExited = true }) this.waitProc = once( @@ -210,7 +210,7 @@ export class SubContainerOwned< !(await fs.stat(`${this.rootfs}/proc/1`).then((x) => !!x, False)) ) { if (count++ > TIMES_TO_WAIT_FOR_PROC) { - console.debug("Failed to start subcontainer", { + console.debug('Failed to start subcontainer', { guid: this.guid, imageId: this.imageId, rootfs: this.rootfs, @@ -228,7 +228,7 @@ export class SubContainerOwned< static async of( effects: Effects, image: { - imageId: keyof Manifest["images"] & T.ImageId + imageId: keyof Manifest['images'] & T.ImageId sharedRun?: boolean }, mounts: @@ -256,20 +256,20 @@ export class SubContainerOwned< if (mounts) { await res.mount(mounts) } - const shared = ["dev", "sys"] + const shared = ['dev', 'sys'] if (!!sharedRun) { - shared.push("run") + shared.push('run') } await fs.mkdir(`${rootfs}/etc`, { recursive: true }) - await fs.copyFile("/etc/resolv.conf", `${rootfs}/etc/resolv.conf`) + await fs.copyFile('/etc/resolv.conf', `${rootfs}/etc/resolv.conf`) for (const dirPart of shared) { const from = `/${dirPart}` const to = `${rootfs}/${dirPart}` await fs.mkdir(from, { recursive: true }) await fs.mkdir(to, { recursive: true }) - await execFile("mount", ["--rbind", from, to]) + await execFile('mount', ['--rbind', from, to]) } return res @@ -286,7 +286,7 @@ export class SubContainerOwned< >( effects: Effects, image: { - imageId: keyof Manifest["images"] & T.ImageId + imageId: keyof Manifest['images'] & T.ImageId sharedRun?: boolean }, mounts: @@ -317,7 +317,7 @@ export class SubContainerOwned< } subpath(path: string): string { - return path.startsWith("/") + return path.startsWith('/') ? `${this.rootfs}${path}` : `${this.rootfs}/${path}` } @@ -335,36 +335,36 @@ export class SubContainerOwned< ): Promise { for (let mount of mounts.build()) { let { options, mountpoint } = mount - const path = mountpoint.startsWith("/") + const path = mountpoint.startsWith('/') ? `${this.rootfs}${mountpoint}` : `${this.rootfs}/${mountpoint}` - if (options.type === "volume") { + if (options.type === 'volume') { const subpath = options.subpath - ? options.subpath.startsWith("/") + ? options.subpath.startsWith('/') ? options.subpath : `/${options.subpath}` - : "/" + : '/' const from = `/media/startos/volumes/${options.volumeId}${subpath}` await bind(from, path, options.filetype, options.idmap) - } else if (options.type === "assets") { + } else if (options.type === 'assets') { const subpath = options.subpath - ? options.subpath.startsWith("/") + ? options.subpath.startsWith('/') ? options.subpath : `/${options.subpath}` - : "/" + : '/' const from = `/media/startos/assets/${subpath}` await bind(from, path, options.filetype, options.idmap) - } else if (options.type === "pointer") { - await prepBind(null, path, "directory") + } else if (options.type === 'pointer') { + await prepBind(null, path, 'directory') await this.effects.mount({ location: path, target: options }) - } else if (options.type === "backup") { + } else if (options.type === 'backup') { const subpath = options.subpath - ? options.subpath.startsWith("/") + ? options.subpath.startsWith('/') ? options.subpath : `/${options.subpath}` - : "/" + : '/' const from = `/media/startos/backup${subpath}` await bind(from, path, options.filetype, options.idmap) @@ -381,13 +381,13 @@ export class SubContainerOwned< } return new Promise((resolve, reject) => { try { - let timeout = setTimeout(() => this.leader.kill("SIGKILL"), 30000) - this.leader.on("exit", () => { + let timeout = setTimeout(() => this.leader.kill('SIGKILL'), 30000) + this.leader.on('exit', () => { clearTimeout(timeout) resolve(null) }) - if (!this.leader.kill("SIGTERM")) { - reject(new Error("kill(2) failed")) + if (!this.leader.kill('SIGTERM')) { + reject(new Error('kill(2) failed')) } } catch (e) { reject(e) @@ -435,17 +435,17 @@ export class SubContainerOwned< await this.waitProc() const imageMeta: T.ImageMetadata = await fs .readFile(`/media/startos/images/${this.imageId}.json`, { - encoding: "utf8", + encoding: 'utf8', }) - .catch(() => "{}") + .catch(() => '{}') .then(JSON.parse) let extra: string[] = [] - let user = imageMeta.user || "root" + let user = imageMeta.user || 'root' if (options?.user) { user = options.user delete options.user } - let workdir = imageMeta.workdir || "/" + let workdir = imageMeta.workdir || '/' if (options?.cwd) { workdir = options.cwd delete options.cwd @@ -456,10 +456,10 @@ export class SubContainerOwned< } } const child = cp.spawn( - "start-container", + 'start-container', [ - "subcontainer", - "exec", + 'subcontainer', + 'exec', `--env-file=/media/startos/images/${this.imageId}.env`, `--user=${user}`, `--workdir=${workdir}`, @@ -469,11 +469,11 @@ export class SubContainerOwned< ], options || {}, ) - abort?.signal.addEventListener("abort", () => child.kill("SIGKILL")) + abort?.signal.addEventListener('abort', () => child.kill('SIGKILL')) if (options?.input) { await new Promise((resolve, reject) => { try { - child.stdin.on("error", (e) => reject(e)) + child.stdin.on('error', (e) => reject(e)) child.stdin.write(options.input, (e) => { if (e) { reject(e) @@ -493,25 +493,25 @@ export class SubContainerOwned< } }) } - const stdout = { data: "" as string } - const stderr = { data: "" as string } + const stdout = { data: '' as string } + const stderr = { data: '' as string } const appendData = (appendTo: { data: string }) => (chunk: string | Buffer | any) => { - if (typeof chunk === "string" || chunk instanceof Buffer) { + if (typeof chunk === 'string' || chunk instanceof Buffer) { appendTo.data += chunk.toString() } else { - console.error("received unexpected chunk", chunk) + console.error('received unexpected chunk', chunk) } } return new Promise((resolve, reject) => { - child.on("error", reject) + child.on('error', reject) let killTimeout: NodeJS.Timeout | undefined if (timeoutMs !== null && child.pid) { - killTimeout = setTimeout(() => child.kill("SIGKILL"), timeoutMs) + killTimeout = setTimeout(() => child.kill('SIGKILL'), timeoutMs) } - child.stdout.on("data", appendData(stdout)) - child.stderr.on("data", appendData(stderr)) - child.on("exit", (code, signal) => { + child.stdout.on('data', appendData(stdout)) + child.stderr.on('data', appendData(stderr)) + child.on('exit', (code, signal) => { clearTimeout(killTimeout) const result = { exitCode: code, @@ -560,17 +560,17 @@ export class SubContainerOwned< await this.waitProc() const imageMeta: T.ImageMetadata = await fs .readFile(`/media/startos/images/${this.imageId}.json`, { - encoding: "utf8", + encoding: 'utf8', }) - .catch(() => "{}") + .catch(() => '{}') .then(JSON.parse) let extra: string[] = [] - let user = imageMeta.user || "root" + let user = imageMeta.user || 'root' if (options?.user) { user = options.user delete options.user } - let workdir = imageMeta.workdir || "/" + let workdir = imageMeta.workdir || '/' if (options?.cwd) { workdir = options.cwd delete options.cwd @@ -585,10 +585,10 @@ export class SubContainerOwned< await this.killLeader() this.leaderExited = false this.leader = cp.spawn( - "start-container", + 'start-container', [ - "subcontainer", - "launch", + 'subcontainer', + 'launch', `--env-file=/media/startos/images/${this.imageId}.env`, `--user=${user}`, `--workdir=${workdir}`, @@ -596,9 +596,9 @@ export class SubContainerOwned< this.rootfs, ...command, ], - { ...options, stdio: "inherit" }, + { ...options, stdio: 'inherit' }, ) - this.leader.on("exit", () => { + this.leader.on('exit', () => { this.leaderExited = true }) return this.leader as cp.ChildProcessWithoutNullStreams @@ -606,22 +606,22 @@ export class SubContainerOwned< async spawn( command: string[], - options: CommandOptions & StdioOptions = { stdio: "inherit" }, + options: CommandOptions & StdioOptions = { stdio: 'inherit' }, ): Promise { await this.waitProc() const imageMeta: T.ImageMetadata = await fs .readFile(`/media/startos/images/${this.imageId}.json`, { - encoding: "utf8", + encoding: 'utf8', }) - .catch(() => "{}") + .catch(() => '{}') .then(JSON.parse) let extra: string[] = [] - let user = imageMeta.user || "root" + let user = imageMeta.user || 'root' if (options?.user) { user = options.user delete options.user } - let workdir = imageMeta.workdir || "/" + let workdir = imageMeta.workdir || '/' if (options.cwd) { workdir = options.cwd delete options.cwd @@ -634,10 +634,10 @@ export class SubContainerOwned< } } return cp.spawn( - "start-container", + 'start-container', [ - "subcontainer", - "exec", + 'subcontainer', + 'exec', `--env-file=/media/startos/images/${this.imageId}.env`, `--user=${user}`, `--workdir=${workdir}`, @@ -665,7 +665,7 @@ export class SubContainerOwned< options?: Parameters[2], ): Promise { const fullPath = this.subpath(path) - const dir = fullPath.replace(/\/[^/]*\/?$/, "") + const dir = fullPath.replace(/\/[^/]*\/?$/, '') await fs.mkdir(dir, { recursive: true }) return fs.writeFile(fullPath, data, options) } @@ -709,7 +709,7 @@ export class SubContainerRc< static async of( effects: Effects, image: { - imageId: keyof Manifest["images"] & T.ImageId + imageId: keyof Manifest['images'] & T.ImageId sharedRun?: boolean }, mounts: @@ -737,7 +737,7 @@ export class SubContainerRc< >( effects: Effects, image: { - imageId: keyof Manifest["images"] & T.ImageId + imageId: keyof Manifest['images'] & T.ImageId sharedRun?: boolean }, mounts: @@ -783,7 +783,7 @@ export class SubContainerRc< const rcs = --this.subcontainer.rcs if (rcs <= 0) { this.destroying = this.subcontainer.destroy() - if (rcs < 0) console.error(new Error("UNREACHABLE: rcs < 0").stack) + if (rcs < 0) console.error(new Error('UNREACHABLE: rcs < 0').stack) } } if (this.destroying) { @@ -850,7 +850,7 @@ export class SubContainerRc< async spawn( command: string[], - options: CommandOptions & StdioOptions = { stdio: "inherit" }, + options: CommandOptions & StdioOptions = { stdio: 'inherit' }, ): Promise { return this.subcontainer.spawn(command, options) } @@ -910,23 +910,23 @@ export type MountOptions = | MountOptionsBackup export type MountOptionsVolume = { - type: "volume" + type: 'volume' volumeId: string subpath: string | null readonly: boolean - filetype: "file" | "directory" | "infer" + filetype: 'file' | 'directory' | 'infer' idmap: IdMap[] } export type MountOptionsAssets = { - type: "assets" + type: 'assets' subpath: string | null - filetype: "file" | "directory" | "infer" + filetype: 'file' | 'directory' | 'infer' idmap: { fromId: number; toId: number; range: number }[] } export type MountOptionsPointer = { - type: "pointer" + type: 'pointer' packageId: string volumeId: string subpath: string | null @@ -935,9 +935,9 @@ export type MountOptionsPointer = { } export type MountOptionsBackup = { - type: "backup" + type: 'backup' subpath: string | null - filetype: "file" | "directory" | "infer" + filetype: 'file' | 'directory' | 'infer' idmap: { fromId: number; toId: number; range: number }[] } function wait(time: number) { diff --git a/sdk/package/lib/util/Volume.ts b/sdk/package/lib/util/Volume.ts index 0d6937565..3e7c2c6ea 100644 --- a/sdk/package/lib/util/Volume.ts +++ b/sdk/package/lib/util/Volume.ts @@ -1,5 +1,5 @@ -import * as fs from "node:fs/promises" -import * as T from "../../../base/lib/types" +import * as fs from 'node:fs/promises' +import * as T from '../../../base/lib/types' /** * Common interface for objects that have a subpath method (Volume, SubContainer, etc.) @@ -27,7 +27,7 @@ export class Volume implements PathBase { * @param subpath Path relative to the volume root */ subpath(subpath: string): string { - return subpath.startsWith("/") + return subpath.startsWith('/') ? `${this.path}${subpath}` : `${this.path}/${subpath}` } @@ -61,7 +61,7 @@ export class Volume implements PathBase { options?: Parameters[2], ): Promise { const fullPath = this.subpath(subpath) - const dir = fullPath.replace(/\/[^/]*\/?$/, "") + const dir = fullPath.replace(/\/[^/]*\/?$/, '') await fs.mkdir(dir, { recursive: true }) return fs.writeFile(fullPath, data, options) } @@ -71,7 +71,7 @@ export class Volume implements PathBase { * Type-safe volumes object that provides Volume instances for each volume defined in the manifest */ export type Volumes = { - [K in Manifest["volumes"][number]]: Volume + [K in Manifest['volumes'][number]]: Volume } /** diff --git a/sdk/package/lib/util/fileHelper.ts b/sdk/package/lib/util/fileHelper.ts index e7a4c0341..33d3504ad 100644 --- a/sdk/package/lib/util/fileHelper.ts +++ b/sdk/package/lib/util/fileHelper.ts @@ -1,12 +1,12 @@ -import * as matches from "ts-matches" -import * as YAML from "yaml" -import * as TOML from "@iarna/toml" -import * as INI from "ini" -import * as T from "../../../base/lib/types" -import * as fs from "node:fs/promises" -import { asError, deepEqual } from "../../../base/lib/util" -import { DropGenerator, DropPromise } from "../../../base/lib/util/Drop" -import { PathBase } from "./Volume" +import * as matches from 'ts-matches' +import * as YAML from 'yaml' +import * as TOML from '@iarna/toml' +import * as INI from 'ini' +import * as T from '../../../base/lib/types' +import * as fs from 'node:fs/promises' +import { asError, deepEqual } from '../../../base/lib/util' +import { DropGenerator, DropPromise } from '../../../base/lib/util/Drop' +import { PathBase } from './Volume' const previousPath = /(.+?)\/([^/]*)$/ @@ -17,14 +17,14 @@ const exists = (path: string) => ) async function onCreated(path: string) { - if (path === "/") return - if (!path.startsWith("/")) path = `${process.cwd()}/${path}` + if (path === '/') return + if (!path.startsWith('/')) path = `${process.cwd()}/${path}` if (await exists(path)) { return } - const split = path.split("/") + const split = path.split('/') const filename = split.pop() - const parent = split.join("/") + const parent = split.join('/') await onCreated(parent) const ctrl = new AbortController() const watch = fs.watch(parent, { persistent: false, signal: ctrl.signal }) @@ -43,7 +43,7 @@ async function onCreated(path: string) { } for await (let event of watch) { if (event.filename === filename) { - ctrl.abort("finished") + ctrl.abort('finished') return } } @@ -56,8 +56,8 @@ function fileMerge(...args: any[]): any { else if ( res && arg && - typeof res === "object" && - typeof arg === "object" && + typeof res === 'object' && + typeof arg === 'object' && !Array.isArray(res) && !Array.isArray(arg) ) { @@ -70,7 +70,7 @@ function fileMerge(...args: any[]): any { } function filterUndefined(a: A): A { - if (a && typeof a === "object") { + if (a && typeof a === 'object') { if (Array.isArray(a)) { return a.map(filterUndefined) as A } @@ -91,7 +91,7 @@ export type Transformers = { type ToPath = string | { base: PathBase; subpath: string } function toPath(path: ToPath): string { - if (typeof path === "string") { + if (typeof path === 'string') { return path } return path.base.subpath(path.subpath) @@ -195,7 +195,7 @@ export class FileHelper { if (!(await exists(this.path))) { return null } - return await fs.readFile(this.path).then((data) => data.toString("utf-8")) + return await fs.readFile(this.path).then((data) => data.toString('utf-8')) } private async readFile(): Promise { @@ -251,7 +251,7 @@ export class FileHelper { while (effects.isInContext && !abort?.aborted) { if (await exists(this.path)) { const ctrl = new AbortController() - abort?.addEventListener("abort", () => ctrl.abort()) + abort?.addEventListener('abort', () => ctrl.abort()) const watch = fs.watch(this.path, { persistent: false, signal: ctrl.signal, @@ -266,7 +266,7 @@ export class FileHelper { }) .catch((e) => console.error(asError(e))) if (!prev || !eq(prev.value, newRes)) { - console.error("yielding", JSON.stringify({ prev: prev, newRes })) + console.error('yielding', JSON.stringify({ prev: prev, newRes })) yield newRes } prev = { value: newRes } @@ -276,7 +276,7 @@ export class FileHelper { await onCreated(this.path).catch((e) => console.error(asError(e))) } } - return new Promise((_, rej) => rej(new Error("aborted"))) + return new Promise((_, rej) => rej(new Error('aborted'))) } private readOnChange( @@ -296,7 +296,7 @@ export class FileHelper { if (res.cancel) ctrl.abort() } catch (e) { console.error( - "callback function threw an error @ FileHelper.read.onChange", + 'callback function threw an error @ FileHelper.read.onChange', e, ) } @@ -305,7 +305,7 @@ export class FileHelper { .catch((e) => callback(null, e)) .catch((e) => console.error( - "callback function threw an error @ FileHelper.read.onChange", + 'callback function threw an error @ FileHelper.read.onChange', e, ), ) @@ -359,7 +359,7 @@ export class FileHelper { const: (effects: T.Effects) => this.readConst(effects, map, eq), watch: (effects: T.Effects, abort?: AbortSignal) => { const ctrl = new AbortController() - abort?.addEventListener("abort", () => ctrl.abort()) + abort?.addEventListener('abort', () => ctrl.abort()) return DropGenerator.of( this.readWatch(effects, map, eq, ctrl.signal), () => ctrl.abort(), @@ -620,15 +620,15 @@ export class FileHelper { (inData) => Object.entries(inData) .map(([k, v]) => `${k}=${v}`) - .join("\n"), + .join('\n'), (inString) => Object.fromEntries( inString - .split("\n") + .split('\n') .map((line) => line.trim()) - .filter((line) => !line.startsWith("#") && line.includes("=")) + .filter((line) => !line.startsWith('#') && line.includes('=')) .map((line) => { - const pos = line.indexOf("=") + const pos = line.indexOf('=') return [line.slice(0, pos), line.slice(pos + 1)] }), ), diff --git a/sdk/package/lib/util/index.ts b/sdk/package/lib/util/index.ts index 8c332e44a..5facab2f8 100644 --- a/sdk/package/lib/util/index.ts +++ b/sdk/package/lib/util/index.ts @@ -1,6 +1,6 @@ -export * from "../../../base/lib/util" -export { GetSslCertificate } from "./GetSslCertificate" -export { GetServiceManifest, getServiceManifest } from "./GetServiceManifest" +export * from '../../../base/lib/util' +export { GetSslCertificate } from './GetSslCertificate' +export { GetServiceManifest, getServiceManifest } from './GetServiceManifest' -export { Drop } from "../../../base/lib/util/Drop" -export { Volume, Volumes } from "./Volume" +export { Drop } from '../../../base/lib/util/Drop' +export { Volume, Volumes } from './Volume' diff --git a/sdk/package/lib/version/VersionGraph.ts b/sdk/package/lib/version/VersionGraph.ts index 840421a3b..396497de5 100644 --- a/sdk/package/lib/version/VersionGraph.ts +++ b/sdk/package/lib/version/VersionGraph.ts @@ -1,5 +1,5 @@ -import { ExtendedVersion, VersionRange } from "../../../base/lib/exver" -import * as T from "../../../base/lib/types" +import { ExtendedVersion, VersionRange } from '../../../base/lib/exver' +import * as T from '../../../base/lib/types' import { InitFn, InitKind, @@ -8,9 +8,9 @@ import { UninitFn, UninitScript, UninitScriptOrFn, -} from "../../../base/lib/inits" -import { Graph, Vertex, once } from "../util" -import { IMPOSSIBLE, VersionInfo } from "./VersionInfo" +} from '../../../base/lib/inits' +import { Graph, Vertex, once } from '../util' +import { IMPOSSIBLE, VersionInfo } from './VersionInfo' export async function getDataVersion(effects: T.Effects) { const versionStr = await effects.getDataVersion() @@ -30,11 +30,11 @@ export async function setDataVersion( } function isExver(v: ExtendedVersion | VersionRange): v is ExtendedVersion { - return "satisfies" in v + return 'satisfies' in v } function isRange(v: ExtendedVersion | VersionRange): v is VersionRange { - return "satisfiedBy" in v + return 'satisfiedBy' in v } export function overlaps( @@ -64,7 +64,7 @@ export class VersionGraph private constructor( readonly current: VersionInfo, versions: Array>, - private readonly preInstall?: InitScriptOrFn<"install">, + private readonly preInstall?: InitScriptOrFn<'install'>, private readonly uninstall?: UninitScript | UninitFn, ) { this.graph = once(() => { @@ -86,7 +86,7 @@ export class VersionGraph for (let version of [current, ...versions]) { const v = ExtendedVersion.parse(version.options.version) const vertex = graph.addVertex(v, [], []) - const flavor = v.flavor || "" + const flavor = v.flavor || '' if (!flavorMap[flavor]) { flavorMap[flavor] = [] } @@ -109,11 +109,11 @@ export class VersionGraph let range if (prev) { graph.addEdge(version.options.migrations.up, prev[2], vertex) - range = VersionRange.anchor(">=", prev[0]).and( - VersionRange.anchor("<", v), + range = VersionRange.anchor('>=', prev[0]).and( + VersionRange.anchor('<', v), ) } else { - range = VersionRange.anchor("<", v) + range = VersionRange.anchor('<', v) } const vRange = graph.addVertex(range, [], []) graph.addEdge(version.options.migrations.up, vRange, vertex) @@ -123,11 +123,11 @@ export class VersionGraph let range if (prev) { graph.addEdge(version.options.migrations.down, vertex, prev[2]) - range = VersionRange.anchor(">=", prev[0]).and( - VersionRange.anchor("<", v), + range = VersionRange.anchor('>=', prev[0]).and( + VersionRange.anchor('<', v), ) } else { - range = VersionRange.anchor("<", v) + range = VersionRange.anchor('<', v) } const vRange = graph.addVertex(range, [], []) graph.addEdge(version.options.migrations.down, vertex, vRange) @@ -173,7 +173,7 @@ export class VersionGraph /** * A script to run only on fresh install */ - preInstall?: InitScriptOrFn<"install"> + preInstall?: InitScriptOrFn<'install'> /** * A script to run only on uninstall */ @@ -211,8 +211,8 @@ export class VersionGraph acc + (prev && prev != x.from.metadata.toString() ? ` (as ${prev})` - : "") + - " -> " + + : '') + + ' -> ' + x.to.metadata.toString(), prev: x.to.metadata.toString(), }), @@ -246,7 +246,7 @@ export class VersionGraph acc.or( isRange(x.metadata) ? x.metadata - : VersionRange.anchor("=", x.metadata), + : VersionRange.anchor('=', x.metadata), ), VersionRange.none(), ) @@ -263,7 +263,7 @@ export class VersionGraph acc.or( isRange(x.metadata) ? x.metadata - : VersionRange.anchor("=", x.metadata), + : VersionRange.anchor('=', x.metadata), ), VersionRange.none(), ) @@ -279,9 +279,9 @@ export class VersionGraph to: this.currentVersion(), }) } else { - kind = "install" // implied by !dataVersion + kind = 'install' // implied by !dataVersion if (this.preInstall) - if ("init" in this.preInstall) await this.preInstall.init(effects, kind) + if ('init' in this.preInstall) await this.preInstall.init(effects, kind) else await this.preInstall(effects, kind) await effects.setDataVersion({ version: this.current.options.version }) } @@ -302,7 +302,7 @@ export class VersionGraph } } else { if (this.uninstall) - if ("uninit" in this.uninstall) + if ('uninit' in this.uninstall) await this.uninstall.uninit(effects, target) else await this.uninstall(effects, target) } diff --git a/sdk/package/lib/version/VersionInfo.ts b/sdk/package/lib/version/VersionInfo.ts index 35d6c0544..9a6cb4e78 100644 --- a/sdk/package/lib/version/VersionInfo.ts +++ b/sdk/package/lib/version/VersionInfo.ts @@ -1,7 +1,7 @@ -import { ValidateExVer } from "../../../base/lib/exver" -import * as T from "../../../base/lib/types" +import { ValidateExVer } from '../../../base/lib/exver' +import * as T from '../../../base/lib/types' -export const IMPOSSIBLE: unique symbol = Symbol("IMPOSSIBLE") +export const IMPOSSIBLE: unique symbol = Symbol('IMPOSSIBLE') export type VersionOptions = { /** The exver-compliant version number */ @@ -60,30 +60,30 @@ export class VersionInfo { } function __type_tests() { - const version: VersionInfo<"1.0.0:0"> = VersionInfo.of({ - version: "1.0.0:0", - releaseNotes: "", + const version: VersionInfo<'1.0.0:0'> = VersionInfo.of({ + version: '1.0.0:0', + releaseNotes: '', migrations: {}, }) - .satisfies("#other:1.0.0:0") - .satisfies("#other:2.0.0:0") + .satisfies('#other:1.0.0:0') + .satisfies('#other:2.0.0:0') // @ts-expect-error - .satisfies("#other:2.f.0:0") + .satisfies('#other:2.f.0:0') - let a: VersionInfo<"1.0.0:0"> = version + let a: VersionInfo<'1.0.0:0'> = version // @ts-expect-error - let b: VersionInfo<"1.0.0:3"> = version + let b: VersionInfo<'1.0.0:3'> = version VersionInfo.of({ // @ts-expect-error - version: "test", - releaseNotes: "", + version: 'test', + releaseNotes: '', migrations: {}, }) VersionInfo.of({ // @ts-expect-error - version: "test" as string, - releaseNotes: "", + version: 'test' as string, + releaseNotes: '', migrations: {}, }) } diff --git a/sdk/package/lib/version/index.ts b/sdk/package/lib/version/index.ts index c7a47fc38..e242562f0 100644 --- a/sdk/package/lib/version/index.ts +++ b/sdk/package/lib/version/index.ts @@ -1,2 +1,2 @@ -export * from "./VersionGraph" -export * from "./VersionInfo" +export * from './VersionGraph' +export * from './VersionInfo' diff --git a/sdk/package/package.json b/sdk/package/package.json index ffeb9f7c2..d7c5a8b7e 100644 --- a/sdk/package/package.json +++ b/sdk/package/package.json @@ -46,7 +46,7 @@ "trailingComma": "all", "tabWidth": 2, "semi": false, - "singleQuote": false + "singleQuote": true }, "devDependencies": { "@types/jest": "^29.4.0", diff --git a/web/package.json b/web/package.json index 8c1974088..49fc3a76d 100644 --- a/web/package.json +++ b/web/package.json @@ -28,7 +28,9 @@ "start:ui": "npm run-script build-config && ng serve --project ui --host 0.0.0.0", "start:tunnel": "ng serve --project start-tunnel --host 0.0.0.0", "start:ui:proxy": "npm run-script build-config && ng serve --project ui --host 0.0.0.0 --proxy-config proxy.conf.json", - "build-config": "node build-config.js" + "build-config": "node build-config.js", + "format": "prettier --write projects/", + "format:check": "prettier --check projects/" }, "dependencies": { "@angular/animations": "^20.3.0",