diff --git a/bin/wit/deps/spin-postgres@3.0.0/postgres.wit b/bin/wit/deps/spin-postgres@3.0.0/postgres.wit new file mode 100644 index 00000000..df9565b1 --- /dev/null +++ b/bin/wit/deps/spin-postgres@3.0.0/postgres.wit @@ -0,0 +1,100 @@ +package spin:postgres@3.0.0; + +interface postgres { + /// Errors related to interacting with a database. + variant error { + connection-failed(string), + bad-parameter(string), + query-failed(string), + value-conversion-failed(string), + other(string) + } + + /// Data types for a database column + enum db-data-type { + boolean, + int8, + int16, + int32, + int64, + floating32, + floating64, + str, + binary, + date, + time, + datetime, + timestamp, + other, + } + + /// Database values + variant db-value { + boolean(bool), + int8(s8), + int16(s16), + int32(s32), + int64(s64), + floating32(f32), + floating64(f64), + str(string), + binary(list), + date(tuple), // (year, month, day) + time(tuple), // (hour, minute, second, nanosecond) + /// Date-time types are always treated as UTC (without timezone info). + /// The instant is represented as a (year, month, day, hour, minute, second, nanosecond) tuple. + datetime(tuple), + /// Unix timestamp (seconds since epoch) + timestamp(s64), + db-null, + unsupported, + } + + /// Values used in parameterized queries + variant parameter-value { + boolean(bool), + int8(s8), + int16(s16), + int32(s32), + int64(s64), + floating32(f32), + floating64(f64), + str(string), + binary(list), + date(tuple), // (year, month, day) + time(tuple), // (hour, minute, second, nanosecond) + /// Date-time types are always treated as UTC (without timezone info). + /// The instant is represented as a (year, month, day, hour, minute, second, nanosecond) tuple. + datetime(tuple), + /// Unix timestamp (seconds since epoch) + timestamp(s64), + db-null, + } + + /// A database column + record column { + name: string, + data-type: db-data-type, + } + + /// A database row + type row = list; + + /// A set of database rows + record row-set { + columns: list, + rows: list, + } + + /// A connection to a postgres database. + resource connection { + /// Open a connection to the Postgres instance at `address`. + open: static func(address: string) -> result; + + /// Query the database. + query: func(statement: string, params: list) -> result; + + /// Execute command to the database. + execute: func(statement: string, params: list) -> result; + } +} \ No newline at end of file diff --git a/bin/wit/key-value.wit b/bin/wit/deps/spin@2.0.0/key-value.wit similarity index 100% rename from bin/wit/key-value.wit rename to bin/wit/deps/spin@2.0.0/key-value.wit diff --git a/bin/wit/llm.wit b/bin/wit/deps/spin@2.0.0/llm.wit similarity index 95% rename from bin/wit/llm.wit rename to bin/wit/deps/spin@2.0.0/llm.wit index ffed09cc..bcb59b86 100644 --- a/bin/wit/llm.wit +++ b/bin/wit/deps/spin@2.0.0/llm.wit @@ -10,15 +10,15 @@ interface llm { /// Note: the backing implementation may return less tokens. max-tokens: u32, /// The amount the model should avoid repeating tokens. - repeat-penalty: float32, + repeat-penalty: f32, /// The number of tokens the model should apply the repeat penalty to. repeat-penalty-last-n-token-count: u32, /// The randomness with which the next token is selected. - temperature: float32, + temperature: f32, /// The number of possible next tokens the model will choose from. top-k: u32, /// The probability total of next tokens the model will choose from. - top-p: float32 + top-p: f32 } /// The set of errors which may be raised by functions in this interface @@ -57,7 +57,7 @@ interface llm { /// Result of generating embeddings record embeddings-result { /// The embeddings generated by the request - embeddings: list>, + embeddings: list>, /// Usage related to the embeddings generation request usage: embeddings-usage } diff --git a/bin/wit/mqtt.wit b/bin/wit/deps/spin@2.0.0/mqtt.wit similarity index 100% rename from bin/wit/mqtt.wit rename to bin/wit/deps/spin@2.0.0/mqtt.wit diff --git a/bin/wit/mysql.wit b/bin/wit/deps/spin@2.0.0/mysql.wit similarity index 100% rename from bin/wit/mysql.wit rename to bin/wit/deps/spin@2.0.0/mysql.wit diff --git a/bin/wit/postgres.wit b/bin/wit/deps/spin@2.0.0/postgres.wit similarity index 100% rename from bin/wit/postgres.wit rename to bin/wit/deps/spin@2.0.0/postgres.wit diff --git a/bin/wit/rdbms-types.wit b/bin/wit/deps/spin@2.0.0/rdbms-types.wit similarity index 92% rename from bin/wit/rdbms-types.wit rename to bin/wit/deps/spin@2.0.0/rdbms-types.wit index 64f3e59a..aff2e960 100644 --- a/bin/wit/rdbms-types.wit +++ b/bin/wit/deps/spin@2.0.0/rdbms-types.wit @@ -37,8 +37,8 @@ interface rdbms-types { uint16(u16), uint32(u32), uint64(u64), - floating32(float32), - floating64(float64), + floating32(f32), + floating64(f64), str(string), binary(list), db-null, @@ -56,8 +56,8 @@ interface rdbms-types { uint16(u16), uint32(u32), uint64(u64), - floating32(float32), - floating64(float64), + floating32(f32), + floating64(f64), str(string), binary(list), db-null, diff --git a/bin/wit/redis.wit b/bin/wit/deps/spin@2.0.0/redis.wit similarity index 100% rename from bin/wit/redis.wit rename to bin/wit/deps/spin@2.0.0/redis.wit diff --git a/bin/wit/spin.wit b/bin/wit/deps/spin@2.0.0/spin.wit similarity index 100% rename from bin/wit/spin.wit rename to bin/wit/deps/spin@2.0.0/spin.wit diff --git a/bin/wit/sqlite.wit b/bin/wit/deps/spin@2.0.0/sqlite.wit similarity index 98% rename from bin/wit/sqlite.wit rename to bin/wit/deps/spin@2.0.0/sqlite.wit index 8a5ab2de..d82f2d90 100644 --- a/bin/wit/sqlite.wit +++ b/bin/wit/deps/spin@2.0.0/sqlite.wit @@ -42,7 +42,7 @@ interface sqlite { /// A single column's result from a database query variant value { integer(s64), - real(float64), + real(f64), text(string), blob(list), null diff --git a/bin/wit/variables.wit b/bin/wit/deps/spin@2.0.0/variables.wit similarity index 100% rename from bin/wit/variables.wit rename to bin/wit/deps/spin@2.0.0/variables.wit diff --git a/bin/wit/deps/wasi-keyvalue-2024-10-17/atomic.wit b/bin/wit/deps/wasi-keyvalue-2024-10-17/atomic.wit new file mode 100644 index 00000000..2c3e0d04 --- /dev/null +++ b/bin/wit/deps/wasi-keyvalue-2024-10-17/atomic.wit @@ -0,0 +1,46 @@ +/// A keyvalue interface that provides atomic operations. +/// +/// Atomic operations are single, indivisible operations. When a fault causes an atomic operation to +/// fail, it will appear to the invoker of the atomic operation that the action either completed +/// successfully or did nothing at all. +/// +/// Please note that this interface is bare functions that take a reference to a bucket. This is to +/// get around the current lack of a way to "extend" a resource with additional methods inside of +/// wit. Future version of the interface will instead extend these methods on the base `bucket` +/// resource. +interface atomics { + use store.{bucket, error}; + + /// The error returned by a CAS operation + variant cas-error { + /// A store error occurred when performing the operation + store-error(error), + /// The CAS operation failed because the value was too old. This returns a new CAS handle + /// for easy retries. Implementors MUST return a CAS handle that has been updated to the + /// latest version or transaction. + cas-failed(cas), + } + + /// A handle to a CAS (compare-and-swap) operation. + resource cas { + /// Construct a new CAS operation. Implementors can map the underlying functionality + /// (transactions, versions, etc) as desired. + new: static func(bucket: borrow, key: string) -> result; + /// Get the current value of the key (if it exists). This allows for avoiding reads if all + /// that is needed to ensure the atomicity of the operation + current: func() -> result>, error>; + } + + /// Atomically increment the value associated with the key in the store by the given delta. It + /// returns the new value. + /// + /// If the key does not exist in the store, it creates a new key-value pair with the value set + /// to the given delta. + /// + /// If any other error occurs, it returns an `Err(error)`. + increment: func(bucket: borrow, key: string, delta: s64) -> result; + + /// Perform the swap on a CAS operation. This consumes the CAS handle and returns an error if + /// the CAS operation failed. + swap: func(cas: cas, value: list) -> result<_, cas-error>; +} diff --git a/bin/wit/deps/wasi-keyvalue-2024-10-17/batch.wit b/bin/wit/deps/wasi-keyvalue-2024-10-17/batch.wit new file mode 100644 index 00000000..6d6e8735 --- /dev/null +++ b/bin/wit/deps/wasi-keyvalue-2024-10-17/batch.wit @@ -0,0 +1,63 @@ +/// A keyvalue interface that provides batch operations. +/// +/// A batch operation is an operation that operates on multiple keys at once. +/// +/// Batch operations are useful for reducing network round-trip time. For example, if you want to +/// get the values associated with 100 keys, you can either do 100 get operations or you can do 1 +/// batch get operation. The batch operation is faster because it only needs to make 1 network call +/// instead of 100. +/// +/// A batch operation does not guarantee atomicity, meaning that if the batch operation fails, some +/// of the keys may have been modified and some may not. +/// +/// This interface does has the same consistency guarantees as the `store` interface, meaning that +/// you should be able to "read your writes." +/// +/// Please note that this interface is bare functions that take a reference to a bucket. This is to +/// get around the current lack of a way to "extend" a resource with additional methods inside of +/// wit. Future version of the interface will instead extend these methods on the base `bucket` +/// resource. +interface batch { + use store.{bucket, error}; + + /// Get the key-value pairs associated with the keys in the store. It returns a list of + /// key-value pairs. + /// + /// If any of the keys do not exist in the store, it returns a `none` value for that pair in the + /// list. + /// + /// MAY show an out-of-date value if there are concurrent writes to the store. + /// + /// If any other error occurs, it returns an `Err(error)`. + get-many: func(bucket: borrow, keys: list) -> result>>>, error>; + + /// Set the values associated with the keys in the store. If the key already exists in the + /// store, it overwrites the value. + /// + /// Note that the key-value pairs are not guaranteed to be set in the order they are provided. + /// + /// If any of the keys do not exist in the store, it creates a new key-value pair. + /// + /// If any other error occurs, it returns an `Err(error)`. When an error occurs, it does not + /// rollback the key-value pairs that were already set. Thus, this batch operation does not + /// guarantee atomicity, implying that some key-value pairs could be set while others might + /// fail. + /// + /// Other concurrent operations may also be able to see the partial results. + set-many: func(bucket: borrow, key-values: list>>) -> result<_, error>; + + /// Delete the key-value pairs associated with the keys in the store. + /// + /// Note that the key-value pairs are not guaranteed to be deleted in the order they are + /// provided. + /// + /// If any of the keys do not exist in the store, it skips the key. + /// + /// If any other error occurs, it returns an `Err(error)`. When an error occurs, it does not + /// rollback the key-value pairs that were already deleted. Thus, this batch operation does not + /// guarantee atomicity, implying that some key-value pairs could be deleted while others might + /// fail. + /// + /// Other concurrent operations may also be able to see the partial results. + delete-many: func(bucket: borrow, keys: list) -> result<_, error>; +} diff --git a/bin/wit/deps/wasi-keyvalue-2024-10-17/store.wit b/bin/wit/deps/wasi-keyvalue-2024-10-17/store.wit new file mode 100644 index 00000000..c7fef411 --- /dev/null +++ b/bin/wit/deps/wasi-keyvalue-2024-10-17/store.wit @@ -0,0 +1,122 @@ +/// A keyvalue interface that provides eventually consistent key-value operations. +/// +/// Each of these operations acts on a single key-value pair. +/// +/// The value in the key-value pair is defined as a `u8` byte array and the intention is that it is +/// the common denominator for all data types defined by different key-value stores to handle data, +/// ensuring compatibility between different key-value stores. Note: the clients will be expecting +/// serialization/deserialization overhead to be handled by the key-value store. The value could be +/// a serialized object from JSON, HTML or vendor-specific data types like AWS S3 objects. +/// +/// Data consistency in a key value store refers to the guarantee that once a write operation +/// completes, all subsequent read operations will return the value that was written. +/// +/// Any implementation of this interface must have enough consistency to guarantee "reading your +/// writes." In particular, this means that the client should never get a value that is older than +/// the one it wrote, but it MAY get a newer value if one was written around the same time. These +/// guarantees only apply to the same client (which will likely be provided by the host or an +/// external capability of some kind). In this context a "client" is referring to the caller or +/// guest that is consuming this interface. Once a write request is committed by a specific client, +/// all subsequent read requests by the same client will reflect that write or any subsequent +/// writes. Another client running in a different context may or may not immediately see the result +/// due to the replication lag. As an example of all of this, if a value at a given key is A, and +/// the client writes B, then immediately reads, it should get B. If something else writes C in +/// quick succession, then the client may get C. However, a client running in a separate context may +/// still see A or B +interface store { + /// The set of errors which may be raised by functions in this package + variant error { + /// The host does not recognize the store identifier requested. + no-such-store, + + /// The requesting component does not have access to the specified store + /// (which may or may not exist). + access-denied, + + /// Some implementation-specific error has occurred (e.g. I/O) + other(string) + } + + /// A response to a `list-keys` operation. + record key-response { + /// The list of keys returned by the query. + keys: list, + /// The continuation token to use to fetch the next page of keys. If this is `null`, then + /// there are no more keys to fetch. + cursor: option + } + + /// Get the bucket with the specified identifier. + /// + /// `identifier` must refer to a bucket provided by the host. + /// + /// `error::no-such-store` will be raised if the `identifier` is not recognized. + open: func(identifier: string) -> result; + + /// A bucket is a collection of key-value pairs. Each key-value pair is stored as a entry in the + /// bucket, and the bucket itself acts as a collection of all these entries. + /// + /// It is worth noting that the exact terminology for bucket in key-value stores can very + /// depending on the specific implementation. For example: + /// + /// 1. Amazon DynamoDB calls a collection of key-value pairs a table + /// 2. Redis has hashes, sets, and sorted sets as different types of collections + /// 3. Cassandra calls a collection of key-value pairs a column family + /// 4. MongoDB calls a collection of key-value pairs a collection + /// 5. Riak calls a collection of key-value pairs a bucket + /// 6. Memcached calls a collection of key-value pairs a slab + /// 7. Azure Cosmos DB calls a collection of key-value pairs a container + /// + /// In this interface, we use the term `bucket` to refer to a collection of key-value pairs + resource bucket { + /// Get the value associated with the specified `key` + /// + /// The value is returned as an option. If the key-value pair exists in the + /// store, it returns `Ok(value)`. If the key does not exist in the + /// store, it returns `Ok(none)`. + /// + /// If any other error occurs, it returns an `Err(error)`. + get: func(key: string) -> result>, error>; + + /// Set the value associated with the key in the store. If the key already + /// exists in the store, it overwrites the value. + /// + /// If the key does not exist in the store, it creates a new key-value pair. + /// + /// If any other error occurs, it returns an `Err(error)`. + set: func(key: string, value: list) -> result<_, error>; + + /// Delete the key-value pair associated with the key in the store. + /// + /// If the key does not exist in the store, it does nothing. + /// + /// If any other error occurs, it returns an `Err(error)`. + delete: func(key: string) -> result<_, error>; + + /// Check if the key exists in the store. + /// + /// If the key exists in the store, it returns `Ok(true)`. If the key does + /// not exist in the store, it returns `Ok(false)`. + /// + /// If any other error occurs, it returns an `Err(error)`. + exists: func(key: string) -> result; + + /// Get all the keys in the store with an optional cursor (for use in pagination). It + /// returns a list of keys. Please note that for most KeyValue implementations, this is a + /// can be a very expensive operation and so it should be used judiciously. Implementations + /// can return any number of keys in a single response, but they should never attempt to + /// send more data than is reasonable (i.e. on a small edge device, this may only be a few + /// KB, while on a large machine this could be several MB). Any response should also return + /// a cursor that can be used to fetch the next page of keys. See the `key-response` record + /// for more information. + /// + /// Note that the keys are not guaranteed to be returned in any particular order. + /// + /// If the store is empty, it returns an empty list. + /// + /// MAY show an out-of-date list of keys if there are concurrent writes to the store. + /// + /// If any error occurs, it returns an `Err(error)`. + list-keys: func(cursor: option) -> result; + } +} diff --git a/bin/wit/deps/wasi-keyvalue-2024-10-17/watch.wit b/bin/wit/deps/wasi-keyvalue-2024-10-17/watch.wit new file mode 100644 index 00000000..92991196 --- /dev/null +++ b/bin/wit/deps/wasi-keyvalue-2024-10-17/watch.wit @@ -0,0 +1,16 @@ +/// A keyvalue interface that provides watch operations. +/// +/// This interface is used to provide event-driven mechanisms to handle +/// keyvalue changes. +interface watcher { + /// A keyvalue interface that provides handle-watch operations. + use store.{bucket}; + + /// Handle the `set` event for the given bucket and key. It includes a reference to the `bucket` + /// that can be used to interact with the store. + on-set: func(bucket: bucket, key: string, value: list); + + /// Handle the `delete` event for the given bucket and key. It includes a reference to the + /// `bucket` that can be used to interact with the store. + on-delete: func(bucket: bucket, key: string); +} diff --git a/bin/wit/deps/wasi-keyvalue-2024-10-17/world.wit b/bin/wit/deps/wasi-keyvalue-2024-10-17/world.wit new file mode 100644 index 00000000..64eb4e12 --- /dev/null +++ b/bin/wit/deps/wasi-keyvalue-2024-10-17/world.wit @@ -0,0 +1,26 @@ +package wasi: keyvalue@0.2.0-draft2; + +/// The `wasi:keyvalue/imports` world provides common APIs for interacting with key-value stores. +/// Components targeting this world will be able to do: +/// +/// 1. CRUD (create, read, update, delete) operations on key-value stores. +/// 2. Atomic `increment` and CAS (compare-and-swap) operations. +/// 3. Batch operations that can reduce the number of round trips to the network. +world imports { + /// The `store` capability allows the component to perform eventually consistent operations on + /// the key-value store. + import store; + + /// The `atomic` capability allows the component to perform atomic / `increment` and CAS + /// (compare-and-swap) operations. + import atomics; + + /// The `batch` capability allows the component to perform eventually consistent batch + /// operations that can reduce the number of round trips to the network. + import batch; +} + +world watch-service { + include imports; + export watcher; +} diff --git a/bin/wit/deps/wasi-runtime-config-2024-09-27/store.wit b/bin/wit/deps/wasi-runtime-config-2024-09-27/store.wit new file mode 100644 index 00000000..9f1bce2e --- /dev/null +++ b/bin/wit/deps/wasi-runtime-config-2024-09-27/store.wit @@ -0,0 +1,30 @@ +interface store { + /// An error type that encapsulates the different errors that can occur fetching configuration values. + variant error { + /// This indicates an error from an "upstream" config source. + /// As this could be almost _anything_ (such as Vault, Kubernetes ConfigMaps, KeyValue buckets, etc), + /// the error message is a string. + upstream(string), + /// This indicates an error from an I/O operation. + /// As this could be almost _anything_ (such as a file read, network connection, etc), + /// the error message is a string. + /// Depending on how this ends up being consumed, + /// we may consider moving this to use the `wasi:io/error` type instead. + /// For simplicity right now in supporting multiple implementations, it is being left as a string. + io(string), + } + + /// Gets a configuration value of type `string` associated with the `key`. + /// + /// The value is returned as an `option`. If the key is not found, + /// `Ok(none)` is returned. If an error occurs, an `Err(error)` is returned. + get: func( + /// A string key to fetch + key: string + ) -> result, error>; + + /// Gets a list of configuration key-value pairs of type `string`. + /// + /// If an error occurs, an `Err(error)` is returned. + get-all: func() -> result>, error>; +} \ No newline at end of file diff --git a/bin/wit/deps/wasi-runtime-config-2024-09-27/world.wit b/bin/wit/deps/wasi-runtime-config-2024-09-27/world.wit new file mode 100644 index 00000000..e879af51 --- /dev/null +++ b/bin/wit/deps/wasi-runtime-config-2024-09-27/world.wit @@ -0,0 +1,6 @@ +package wasi:config@0.2.0-draft-2024-09-27; + +world imports { + /// The interface for wasi:config/store + import store; +} \ No newline at end of file diff --git a/bin/wit/world.wit b/bin/wit/world.wit new file mode 100644 index 00000000..b6a02870 --- /dev/null +++ b/bin/wit/world.wit @@ -0,0 +1,23 @@ +package fermyon:spin@3.0.0; + +world spin3-imports { + include fermyon:spin/spin-imports@2.0.0; + import spin:postgres/postgres@3.0.0; + include wasi:keyvalue/imports@0.2.0-draft2; + import wasi:config/store@0.2.0-draft-2024-09-27; +} + +world spin3-redis { + include spin3-imports; + export fermyon:spin/inbound-redis; +} + +world spin3-http { + include spin3-imports; + export wasi:http/incoming-handler@0.2.0; +} + +world spin3-all { + include spin3-redis; + include spin3-http; +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 013514aa..ea1a4264 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,8 +10,8 @@ "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@bytecodealliance/componentize-js": "^0.12.0", - "@fermyon/knitwit": "https://github.com/fermyon/knitwit", + "@bytecodealliance/componentize-js": "^0.13.1", + "@fermyon/knitwit": "0.2.0", "itty-router": "^3.0.12", "typedoc-plugin-missing-exports": "^3.0.0", "yargs": "^17.7.2" @@ -26,31 +26,31 @@ } }, "node_modules/@bytecodealliance/componentize-js": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.12.0.tgz", - "integrity": "sha512-IO8MclpnmtP8bkk0NzLZYzsJRn34jCZs5PfI2FwmR2FVzm7Zme0Y4ryz4X6cn75dDKYyAUmm1N3LLlc8qG7OUw==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.13.1.tgz", + "integrity": "sha512-a5kq/iXIgnW0Tws3m/nm9xb7CtcT4jllhmzUDZua3/LGs4ZWGoQQwxfqTHB/r7cL6aXhy0wUoiTNvVJ8sLPzbw==", "workspaces": [ "." ], "dependencies": { - "@bytecodealliance/jco": "1.5.0", + "@bytecodealliance/jco": "^1.7.0", + "@bytecodealliance/weval": "^0.3.2", "@bytecodealliance/wizer": "^7.0.5", - "@cfallin/weval": "^0.2.14", "es-module-lexer": "^1.5.4" } }, "node_modules/@bytecodealliance/jco": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-1.5.0.tgz", - "integrity": "sha512-fTwAWpi6Om4fDILwXDz3da40kvF4weG4l0s7qVCknnz/uKfIn9eaSLBKDTVg1Gx5veqEAG7hb7FXQTWBpeK4mg==", + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-1.7.2.tgz", + "integrity": "sha512-Zxkc0YvIM8iSnye+K3oqgv3UrzObmBffHwbvd+/bsdEJ3TOFlobZSPceAAYLdzGmibrtXlCF40OpOYx5aFM3zA==", "license": "(Apache-2.0 WITH LLVM-exception)", "workspaces": [ "packages/preview2-shim" ], "dependencies": { - "@bytecodealliance/componentize-js": "^0.11.3", - "@bytecodealliance/preview2-shim": "^0.16.5", - "binaryen": "^118.0.0", + "@bytecodealliance/componentize-js": "^0.14.0", + "@bytecodealliance/preview2-shim": "^0.17.1", + "binaryen": "^120.0.0", "chalk-template": "^1", "commander": "^12", "mkdirp": "^3", @@ -62,45 +62,40 @@ } }, "node_modules/@bytecodealliance/jco/node_modules/@bytecodealliance/componentize-js": { - "version": "0.11.4", - "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.11.4.tgz", - "integrity": "sha512-infeu0iVWdUu/cJncWnAahq/jdIVypPUe6K9T6e0xVUGmPm0sVpij86AF0VjgD3y8UBHcE6Hv4e54AuRXe6rTw==", + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.14.0.tgz", + "integrity": "sha512-Y53lxcHEQz5k4PwqBY3+q6Y+TmFSu5mWhd+2dyURE7mk0GDaFYKRDoATCoXxD8Dvq/HgNPrDSE2X7AJIjPMtYQ==", "workspaces": [ "." ], "dependencies": { - "@bytecodealliance/jco": "1.4.4", - "@bytecodealliance/wizer": "^7.0.4", + "@bytecodealliance/jco": "^1.7.1", + "@bytecodealliance/weval": "^0.3.2", + "@bytecodealliance/wizer": "^7.0.5", "es-module-lexer": "^1.5.4" } }, - "node_modules/@bytecodealliance/jco/node_modules/@bytecodealliance/jco": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-1.4.4.tgz", - "integrity": "sha512-Gu9VzU99rptKnRgx1KSMUIy56BoVWy6uKCoKZwLL+nvEM9kSLtvEp2CLSSnpOxXaFIpTLhmNhSu7j8h965C8zw==", - "license": "(Apache-2.0 WITH LLVM-exception)", - "workspaces": [ - "packages/preview2-shim" - ], + "node_modules/@bytecodealliance/preview2-shim": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.17.1.tgz", + "integrity": "sha512-h1qLL0TN5KXk/zagY2BtbZuDX6xYjz4Br9RZXEa0ID4UpiPc0agUMhTdz9r89G4vX5SU/tqBg1A6UNv2+DJ5pg==", + "license": "(Apache-2.0 WITH LLVM-exception)" + }, + "node_modules/@bytecodealliance/weval": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/weval/-/weval-0.3.2.tgz", + "integrity": "sha512-yH28sdq0Y0Oc29LbbWCEx2PvRFi0D7CEhWdNHPovl/L7thzlNlFWCRcOLanB0XgXQ5rygTpVVBFH0/50tWMg2w==", + "license": "Apache-2.0", "dependencies": { - "@bytecodealliance/preview2-shim": "^0.16.5", - "binaryen": "^118.0.0", - "chalk-template": "^1", - "commander": "^12", - "mkdirp": "^3", - "ora": "^8", - "terser": "^5" + "@napi-rs/lzma": "^1.1.2", + "decompress": "^4.2.1", + "decompress-tar": "^4.1.1", + "decompress-unzip": "^4.0.1" }, - "bin": { - "jco": "src/jco.js" + "engines": { + "node": ">=16" } }, - "node_modules/@bytecodealliance/preview2-shim": { - "version": "0.16.5", - "resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.16.5.tgz", - "integrity": "sha512-1YThPyZ/gWZBgmJ3nEsnBXLxgSV3VOW3vLfyxe/RTKk9fWkTKaUouuZHWBvP0aFN7Hnat733rUeSYAUjEUNONQ==", - "license": "(Apache-2.0 WITH LLVM-exception)" - }, "node_modules/@bytecodealliance/wizer": { "version": "7.0.5", "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer/-/wizer-7.0.5.tgz", @@ -217,25 +212,10 @@ "wizer-win32-x64": "wizer" } }, - "node_modules/@cfallin/weval": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/@cfallin/weval/-/weval-0.2.14.tgz", - "integrity": "sha512-MHw8kT7qWH7/budVH/ky9TLnX17GTB7PN15Nnb+IoZFH1outxV9S36gyhcKouI5pGa70FVLbh9A/4WR4znKBIA==", - "license": "Apache-2.0", - "dependencies": { - "@napi-rs/lzma": "^1.1.2", - "decompress": "^4.2.1", - "decompress-tar": "^4.1.1", - "decompress-unzip": "^4.0.1" - }, - "engines": { - "node": ">=16" - } - }, "node_modules/@emnapi/core": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.2.0.tgz", - "integrity": "sha512-E7Vgw78I93we4ZWdYCb4DGAwRROGkMIXk7/y87UmANR+J6qsWusmC3gLt0H+O0KOt5e6O38U8oJamgbudrES/w==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.3.1.tgz", + "integrity": "sha512-pVGjBIt1Y6gg3EJN8jTcfpP/+uuRksIo055oE/OBkDNcjZqVbfkWCksG1Jp4yZnj3iKWyWX8fdG/j6UDYPbFog==", "license": "MIT", "optional": true, "dependencies": { @@ -244,9 +224,9 @@ } }, "node_modules/@emnapi/runtime": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.2.0.tgz", - "integrity": "sha512-bV21/9LQmcQeCPEg3BDFtvwL6cwiTMksYNWQQ4KOxCZikEGalWtenoZ0wCiukJINlGCIi2KXx01g4FoH/LxpzQ==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.3.1.tgz", + "integrity": "sha512-kEBmG8KyqtxJZv+ygbEim+KCGtIq1fC22Ms3S4ziXmYKm8uyoLX0MHONVKwp+9opg390VaKRNt4a7A9NwmpNhw==", "license": "MIT", "optional": true, "dependencies": { @@ -264,8 +244,9 @@ } }, "node_modules/@fermyon/knitwit": { - "version": "0.1.0", - "resolved": "git+ssh://git@github.com/fermyon/knitwit.git#127f09d1f4c5992ee94243583940ef7e28df443e", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@fermyon/knitwit/-/knitwit-0.2.0.tgz", + "integrity": "sha512-5YMBRbn0Sz1UA+pJBoNs/jCwi83cIG/ueEcEUjdv7MbzaaclJVuhRtuhzbu7Vkss9tLZ2TuGSnzPpoPRkSnD6w==", "license": "ISC", "dependencies": { "@bytecodealliance/preview2-shim": "^0.16.4", @@ -278,6 +259,12 @@ "knitwit-postinstall": "bin/knitwit-postinstall.js" } }, + "node_modules/@fermyon/knitwit/node_modules/@bytecodealliance/preview2-shim": { + "version": "0.16.7", + "resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.16.7.tgz", + "integrity": "sha512-YxfbzaykY6iVCSmeHPwOqO4fnWGj6awQ5pCK3UyI0zOg9Okp7pvK4J5BkQUC5QpPdFC9vUmWdqx5QSLt9k3iyQ==", + "license": "(Apache-2.0 WITH LLVM-exception)" + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.5", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", @@ -337,34 +324,41 @@ } }, "node_modules/@napi-rs/lzma": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@napi-rs/lzma/-/lzma-1.3.1.tgz", - "integrity": "sha512-XyZoBlYNMvCulK/RmVK/0nB3j7IdH7HpqcrMMg0U+HqQqKRLOQBwvnKNBocPC1bZQ7iZuKWYTLn1ayZwTyek8w==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma/-/lzma-1.4.1.tgz", + "integrity": "sha512-5f8K9NHjwHjZKGm3SS+7CFxXQhz8rbg2umBm/9g0xQRXBdYEI31N5z1ACuk9bmBQOusXAq9CArGfs/ZQso2rUA==", "license": "MIT", "engines": { "node": ">= 10" }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, "optionalDependencies": { - "@napi-rs/lzma-android-arm-eabi": "1.3.1", - "@napi-rs/lzma-android-arm64": "1.3.1", - "@napi-rs/lzma-darwin-arm64": "1.3.1", - "@napi-rs/lzma-darwin-x64": "1.3.1", - "@napi-rs/lzma-freebsd-x64": "1.3.1", - "@napi-rs/lzma-linux-arm-gnueabihf": "1.3.1", - "@napi-rs/lzma-linux-arm64-gnu": "1.3.1", - "@napi-rs/lzma-linux-arm64-musl": "1.3.1", - "@napi-rs/lzma-linux-x64-gnu": "1.3.1", - "@napi-rs/lzma-linux-x64-musl": "1.3.1", - "@napi-rs/lzma-wasm32-wasi": "1.3.1", - "@napi-rs/lzma-win32-arm64-msvc": "1.3.1", - "@napi-rs/lzma-win32-ia32-msvc": "1.3.1", - "@napi-rs/lzma-win32-x64-msvc": "1.3.1" + "@napi-rs/lzma-android-arm-eabi": "1.4.1", + "@napi-rs/lzma-android-arm64": "1.4.1", + "@napi-rs/lzma-darwin-arm64": "1.4.1", + "@napi-rs/lzma-darwin-x64": "1.4.1", + "@napi-rs/lzma-freebsd-x64": "1.4.1", + "@napi-rs/lzma-linux-arm-gnueabihf": "1.4.1", + "@napi-rs/lzma-linux-arm64-gnu": "1.4.1", + "@napi-rs/lzma-linux-arm64-musl": "1.4.1", + "@napi-rs/lzma-linux-ppc64-gnu": "1.4.1", + "@napi-rs/lzma-linux-riscv64-gnu": "1.4.1", + "@napi-rs/lzma-linux-s390x-gnu": "1.4.1", + "@napi-rs/lzma-linux-x64-gnu": "1.4.1", + "@napi-rs/lzma-linux-x64-musl": "1.4.1", + "@napi-rs/lzma-wasm32-wasi": "1.4.1", + "@napi-rs/lzma-win32-arm64-msvc": "1.4.1", + "@napi-rs/lzma-win32-ia32-msvc": "1.4.1", + "@napi-rs/lzma-win32-x64-msvc": "1.4.1" } }, "node_modules/@napi-rs/lzma-android-arm-eabi": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@napi-rs/lzma-android-arm-eabi/-/lzma-android-arm-eabi-1.3.1.tgz", - "integrity": "sha512-mtGOg8jXlc+pTBI86cqohfndS9UmOAkk9d5CChKMb8btVks70yhUN1e7YYS3QFbmoxbPs2Ee+wmuH1Khdc7B2w==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-android-arm-eabi/-/lzma-android-arm-eabi-1.4.1.tgz", + "integrity": "sha512-yenreSpZ9IrqppJOiWDqWMmja7XtSgio9LhtxYwgdILmy/OJTe/mlTYv+FhJBf7hIV9Razu5eBuEa3zKri81IA==", "cpu": [ "arm" ], @@ -378,9 +372,9 @@ } }, "node_modules/@napi-rs/lzma-android-arm64": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@napi-rs/lzma-android-arm64/-/lzma-android-arm64-1.3.1.tgz", - "integrity": "sha512-4uGkQgAv9Tnc/i0k2eIgbhZgyzs94+iECWxz4MFZNcZ1fNGvGbRL2j+SITE4OmwrUn3TuFK/uYWfgzooq8E1Qg==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-android-arm64/-/lzma-android-arm64-1.4.1.tgz", + "integrity": "sha512-piutVBz5B1TNxXeEjub0n/IKI6dMaXPPRbVSXuc4gnZgzcihNDUh68vcLZgYd+IMiACZvBxvx2O3t5nthtph3A==", "cpu": [ "arm64" ], @@ -394,9 +388,9 @@ } }, "node_modules/@napi-rs/lzma-darwin-arm64": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@napi-rs/lzma-darwin-arm64/-/lzma-darwin-arm64-1.3.1.tgz", - "integrity": "sha512-MZBg4iwHTS8icjTiCMdzh8kYrMmKBCEglFPa+vjI91R2XDwuuwSzqmpATRpmMH8cWUUWtGPF4fnxKzjgkzhd4Q==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-darwin-arm64/-/lzma-darwin-arm64-1.4.1.tgz", + "integrity": "sha512-sDfOhQQFqV8lGbpgJN9DqNLBPR7QOfYjcWUv8FOGPaVP1LPJDnrc5uCpRWWEa2zIKmTiO8P9xzIl0TDzrYmghg==", "cpu": [ "arm64" ], @@ -410,9 +404,9 @@ } }, "node_modules/@napi-rs/lzma-darwin-x64": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@napi-rs/lzma-darwin-x64/-/lzma-darwin-x64-1.3.1.tgz", - "integrity": "sha512-7vte+1lYV7xgZERKH/pjAeh4T16aQASKOzu4op70pK6VP/64Plr5rrvqxQqQmlAIe4pwyo/RkFl1n4LXDod3xg==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-darwin-x64/-/lzma-darwin-x64-1.4.1.tgz", + "integrity": "sha512-S5/RbC6EP4QkYy2xhxbfm48ZD9FkysfpWY4Slve0nj5RGGsHvcJBg2Pi69jrTPB/zLKz2SUa0i+RfUt9zvZNaw==", "cpu": [ "x64" ], @@ -426,9 +420,9 @@ } }, "node_modules/@napi-rs/lzma-freebsd-x64": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@napi-rs/lzma-freebsd-x64/-/lzma-freebsd-x64-1.3.1.tgz", - "integrity": "sha512-uBS74fynTqLUC3catIxyezCafn8UDlr2yxVV47vz1T6Vop2PGDz/cMQdV6rnLSjPE08Rv66ihM36mgf/MmOkOg==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-freebsd-x64/-/lzma-freebsd-x64-1.4.1.tgz", + "integrity": "sha512-4AFnq6aZnclwameSBkDWu5Ftb8y4GwvVXeQXJKbN7hf7O5GG/8QpQB1R1NJw2QORUhpKwjAQUpbkTyhL2GFWWw==", "cpu": [ "x64" ], @@ -442,9 +436,9 @@ } }, "node_modules/@napi-rs/lzma-linux-arm-gnueabihf": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-arm-gnueabihf/-/lzma-linux-arm-gnueabihf-1.3.1.tgz", - "integrity": "sha512-rrVLyqBJeN29gPJCNkPbZ7dAzaseEcERKyhjwM+DfbFrDUvtkEcrYPvo+iwE/NmF+OkZQkzcanrVMGnq/mcJYQ==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-arm-gnueabihf/-/lzma-linux-arm-gnueabihf-1.4.1.tgz", + "integrity": "sha512-j5rL1YRIm6rWmmGAvN6DPX6QuRjvFGB93xJ7DTRB47GXW4zHekXae6ivowjJ95vT4Iz4hSWkZbuwAy95eFrWRA==", "cpu": [ "arm" ], @@ -458,9 +452,9 @@ } }, "node_modules/@napi-rs/lzma-linux-arm64-gnu": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-arm64-gnu/-/lzma-linux-arm64-gnu-1.3.1.tgz", - "integrity": "sha512-vDmVsthRbX2opkgRirJJGKQxUP/spvyVM2Y5CyCWZ7sadSID3hA97r38gf9ISn/sJ8/r93IPWLq+iycudNKi+Q==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-arm64-gnu/-/lzma-linux-arm64-gnu-1.4.1.tgz", + "integrity": "sha512-1XdFGKyTS9m+VrRQYs9uz+ToHf4Jwm0ejHU48k9lT9MPl8jSqzKdVtFzZBPzronHteSynBfKmUq0+HeWmjrsOQ==", "cpu": [ "arm64" ], @@ -474,9 +468,9 @@ } }, "node_modules/@napi-rs/lzma-linux-arm64-musl": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-arm64-musl/-/lzma-linux-arm64-musl-1.3.1.tgz", - "integrity": "sha512-x4m/J3hRdFd3IoqKc+4aBcSUkcuDEP7hH6vdss8bKNLjPfXmnG/lcHJEQX3hNnNOULPP8xVRxgiY8jeL62cnsw==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-arm64-musl/-/lzma-linux-arm64-musl-1.4.1.tgz", + "integrity": "sha512-9d09tYS0/rBwIk1QTcO2hMZEB/ZpsG2+uFW5am1RHElSWMclObirB1An7b6AMDJcRvcomkOg2GZ9COzrvHKwEA==", "cpu": [ "arm64" ], @@ -489,10 +483,58 @@ "node": ">= 10" } }, + "node_modules/@napi-rs/lzma-linux-ppc64-gnu": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-ppc64-gnu/-/lzma-linux-ppc64-gnu-1.4.1.tgz", + "integrity": "sha512-UzEkmsgoJ3IOGIRb6kBzNiw+ThUpiighop7dVYfSqlF5juGzwf7YewC57RGn4FoJCvadOCrSm5VikAcgrwVgAw==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/lzma-linux-riscv64-gnu": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-riscv64-gnu/-/lzma-linux-riscv64-gnu-1.4.1.tgz", + "integrity": "sha512-9dUKlZ1PdwxTaFF+j3oc+xjlk9nqFwo1NWWOH30uwjl4Rm5Gkv+Fx0pHrzu4kR/iVA+oyQqa9/2uDYnGSTijBA==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/lzma-linux-s390x-gnu": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-s390x-gnu/-/lzma-linux-s390x-gnu-1.4.1.tgz", + "integrity": "sha512-MOVXUWJSLLCJDCCAlGa39sh7nv9XjvXzCf7QJus7rD8Ciz0mpXNXF9mg0ji7/MZ7pZlKPlXjXDnpVCfFdSEaFQ==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, "node_modules/@napi-rs/lzma-linux-x64-gnu": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.3.1.tgz", - "integrity": "sha512-riB+Xg72NfH8Kcpq07omshVu0QsLW0v2bhywBNYxvA+t2dGGWSIEN1U/zazUXys+IEA6pBQKqLVseurWE6Cl8g==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.4.1.tgz", + "integrity": "sha512-Sxu7aJxU1sDbUTqjqLVDV3DCOAlbsFKvmuCN/S5uXBJd1IF2wJ9jK3NbFzfqTAo5Hudx8Y7kOb6+3K+fYPI1KQ==", "cpu": [ "x64" ], @@ -506,9 +548,9 @@ } }, "node_modules/@napi-rs/lzma-linux-x64-musl": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-musl/-/lzma-linux-x64-musl-1.3.1.tgz", - "integrity": "sha512-JXLgJFwoeysxdSg7rdVYP8wrliCQVJlU5JcLYjRVSCL4P0mQTjnYi7R7VdaOkDACw/Fvlji7oIJXt0KiaDTcOw==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-musl/-/lzma-linux-x64-musl-1.4.1.tgz", + "integrity": "sha512-4I3BeKBQJSE5gF2/VTEv7wCLLjhapeutbCGpZPmDiLHZ74rm9edmNXAlKpdjADQ4YDLJ2GIBzttvwLXkJ9U+cw==", "cpu": [ "x64" ], @@ -522,25 +564,25 @@ } }, "node_modules/@napi-rs/lzma-wasm32-wasi": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@napi-rs/lzma-wasm32-wasi/-/lzma-wasm32-wasi-1.3.1.tgz", - "integrity": "sha512-XTA9XTUtj0KPKuzNS2oi3bWN6tJodk00wwMd/TiKoEqx9Fe/zu+OfDGuXAn+xs+P7S3YCDHqjYinuTQMZ0ucJw==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-wasm32-wasi/-/lzma-wasm32-wasi-1.4.1.tgz", + "integrity": "sha512-s32HdKqQWbohf6DGWpG9YMODaBdbKJ++JpNr6Ii7821sKf4h/o+p8IRFTOaWdmdJdllEWlRirnd5crA29VivJQ==", "cpu": [ "wasm32" ], "license": "MIT", "optional": true, "dependencies": { - "@napi-rs/wasm-runtime": "^0.2.3" + "@napi-rs/wasm-runtime": "^0.2.4" }, "engines": { "node": ">=14.0.0" } }, "node_modules/@napi-rs/lzma-win32-arm64-msvc": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@napi-rs/lzma-win32-arm64-msvc/-/lzma-win32-arm64-msvc-1.3.1.tgz", - "integrity": "sha512-qLDfs9UEtLPPTN/FdSz3gSdlx86VwFQBuLBrQtaiYQtUTKZCOYV1Z1fXqFt5Zqa1HKV2oyXnwGcTI7RpcyXxtg==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-win32-arm64-msvc/-/lzma-win32-arm64-msvc-1.4.1.tgz", + "integrity": "sha512-ISz+v7ML5mKnjEZ7Kk4Z1BIn411r/fz3tDy9j5yDnwQI0MgTsUQFrIQElGUpULWYs2aYc6EZ9PhECbLBfSjh7A==", "cpu": [ "arm64" ], @@ -554,9 +596,9 @@ } }, "node_modules/@napi-rs/lzma-win32-ia32-msvc": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@napi-rs/lzma-win32-ia32-msvc/-/lzma-win32-ia32-msvc-1.3.1.tgz", - "integrity": "sha512-rWNlxLFMIfvxzfdQCfeQ3D/HEnQG3vfladFYrXUx6ePXO6r+BLCGn6/LWSSuKlw4vKkb1iHEWsAVaRLIcJEMIA==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-win32-ia32-msvc/-/lzma-win32-ia32-msvc-1.4.1.tgz", + "integrity": "sha512-3WKuCpZBrd7Jrw+h1jSu5XAsRWepMJu0sYuRoA4Y4Cwfu9gI7p5Z5Bc510nfjg7M7xvdpkI4UoW2WY7kBFRYrQ==", "cpu": [ "ia32" ], @@ -570,9 +612,9 @@ } }, "node_modules/@napi-rs/lzma-win32-x64-msvc": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@napi-rs/lzma-win32-x64-msvc/-/lzma-win32-x64-msvc-1.3.1.tgz", - "integrity": "sha512-SNfHNqEjabXfTL1+KRi0qiAhwIlZHhQystvfSYX6p1g+2trSC/3WUpUQ4fbbR7KyE31g2AAnwjXivnlQ0af/pg==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-win32-x64-msvc/-/lzma-win32-x64-msvc-1.4.1.tgz", + "integrity": "sha512-0ixRo5z1zFXdh62hlrTV+QCTKHK0te5NHKaExOluhtcc6AdpMmpslvM9JhUxNHI+zM46w/DmmcvcOtqsaTmHgg==", "cpu": [ "x64" ], @@ -586,9 +628,9 @@ } }, "node_modules/@napi-rs/wasm-runtime": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.4.tgz", - "integrity": "sha512-9zESzOO5aDByvhIAsOy9TbpZ0Ur2AJbUI7UT73kcUTS2mxAMHOBaa1st/jAymNoCtvrit99kkzT1FZuXVcgfIQ==", + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.5.tgz", + "integrity": "sha512-kwUxR7J9WLutBbulqg1dfOrMTwhMdXLdcGUhcbCcGwnPLt3gz19uHVdwH1syKVDbE022ZS2vZxOWflFLS0YTjw==", "license": "MIT", "optional": true, "dependencies": { @@ -598,14 +640,56 @@ } }, "node_modules/@shikijs/core": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.14.1.tgz", - "integrity": "sha512-KyHIIpKNaT20FtFPFjCQB5WVSTpLR/n+jQXhWHWVUMm9MaOaG9BGOG0MSyt7yA4+Lm+4c9rTc03tt3nYzeYSfw==", + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.22.2.tgz", + "integrity": "sha512-bvIQcd8BEeR1yFvOYv6HDiyta2FFVePbzeowf5pPS1avczrPK+cjmaxxh0nx5QzbON7+Sv0sQfQVciO7bN72sg==", "license": "MIT", "dependencies": { + "@shikijs/engine-javascript": "1.22.2", + "@shikijs/engine-oniguruma": "1.22.2", + "@shikijs/types": "1.22.2", + "@shikijs/vscode-textmate": "^9.3.0", + "@types/hast": "^3.0.4", + "hast-util-to-html": "^9.0.3" + } + }, + "node_modules/@shikijs/engine-javascript": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-1.22.2.tgz", + "integrity": "sha512-iOvql09ql6m+3d1vtvP8fLCVCK7BQD1pJFmHIECsujB0V32BJ0Ab6hxk1ewVSMFA58FI0pR2Had9BKZdyQrxTw==", + "license": "MIT", + "dependencies": { + "@shikijs/types": "1.22.2", + "@shikijs/vscode-textmate": "^9.3.0", + "oniguruma-to-js": "0.4.3" + } + }, + "node_modules/@shikijs/engine-oniguruma": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.22.2.tgz", + "integrity": "sha512-GIZPAGzQOy56mGvWMoZRPggn0dTlBf1gutV5TdceLCZlFNqWmuc7u+CzD0Gd9vQUTgLbrt0KLzz6FNprqYAxlA==", + "license": "MIT", + "dependencies": { + "@shikijs/types": "1.22.2", + "@shikijs/vscode-textmate": "^9.3.0" + } + }, + "node_modules/@shikijs/types": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.22.2.tgz", + "integrity": "sha512-NCWDa6LGZqTuzjsGfXOBWfjS/fDIbDdmVDug+7ykVe1IKT4c1gakrvlfFYp5NhAXH/lyqLM8wsAPo5wNy73Feg==", + "license": "MIT", + "dependencies": { + "@shikijs/vscode-textmate": "^9.3.0", "@types/hast": "^3.0.4" } }, + "node_modules/@shikijs/vscode-textmate": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-9.3.0.tgz", + "integrity": "sha512-jn7/7ky30idSkd/O5yDBfAnVt+JJpepofP/POZ1iMOxK59cOfqIgg/Dj0eFsjOTMw+4ycJN0uhZH/Eb0bs/EUA==", + "license": "MIT" + }, "node_modules/@tybys/wasm-util": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.9.0.tgz", @@ -625,16 +709,31 @@ "@types/unist": "*" } }, + "node_modules/@types/mdast": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, "node_modules/@types/unist": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", "license": "MIT" }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "license": "ISC" + }, "node_modules/acorn": { - "version": "8.12.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", - "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", "license": "MIT", "bin": { "acorn": "bin/acorn" @@ -644,9 +743,9 @@ } }, "node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", "license": "MIT", "engines": { "node": ">=12" @@ -703,9 +802,9 @@ "license": "MIT" }, "node_modules/binaryen": { - "version": "118.0.0", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-118.0.0.tgz", - "integrity": "sha512-KzekjPjpLE1zk29BKQSHNWLSHPYAfa80lcsIi5bDnev8vyfDyiMCVFPjaplhfXIKs7LI3r1RPyhoAj4qsRQwwg==", + "version": "120.0.0", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-120.0.0.tgz", + "integrity": "sha512-MaNC1qW5ubk5S7MNNxNpAb9ivKp6TAf8CDknRk4XeCC2wkrpdaubK10S1CAwUXaDDF54gZLtk6opzbEA9VTtJw==", "license": "Apache-2.0", "bin": { "wasm-as": "bin/wasm-as", @@ -799,6 +898,16 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "license": "MIT" }, + "node_modules/ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/chalk": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", @@ -826,6 +935,26 @@ "url": "https://github.com/chalk/chalk-template?sponsor=1" } }, + "node_modules/character-entities-html4": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/cli-cursor": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-5.0.0.tgz", @@ -926,6 +1055,16 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "license": "MIT" }, + "node_modules/comma-separated-tokens": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/commander": { "version": "12.1.0", "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", @@ -1037,6 +1176,28 @@ "node": ">=0.10.0" } }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/devlop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "license": "MIT", + "dependencies": { + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/emoji-regex": { "version": "10.4.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.4.0.tgz", @@ -1071,9 +1232,9 @@ "license": "MIT" }, "node_modules/escalade": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", - "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "license": "MIT", "engines": { "node": ">=6" @@ -1113,9 +1274,9 @@ } }, "node_modules/get-east-asian-width": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.2.0.tgz", - "integrity": "sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.3.0.tgz", + "integrity": "sha512-vpeMIQKxczTD/0s2CdEWHcb0eeJe6TFjxb+J5xgX7hScxqrGuyjmv4c1D4A/gelKfyox0gJJwIHF+fLjeaM8kQ==", "license": "MIT", "engines": { "node": ">=18" @@ -1143,6 +1304,52 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "license": "ISC" }, + "node_modules/hast-util-to-html": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.3.tgz", + "integrity": "sha512-M17uBDzMJ9RPCqLMO92gNNUDuBSq10a25SDBI08iCCxmorf4Yy6sYHK57n9WAbRAAaU+DuR4W6GN9K4DFZesYg==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "ccount": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-whitespace": "^3.0.0", + "html-void-elements": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0", + "stringify-entities": "^4.0.0", + "zwitch": "^2.0.4" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-whitespace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", + "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/html-void-elements": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz", + "integrity": "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -1206,9 +1413,9 @@ } }, "node_modules/is-unicode-supported": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-2.0.0.tgz", - "integrity": "sha512-FRdAyx5lusK1iHG0TWpVtk9+1i+GjrzRffhDg4ovQ7mcidMQ6mj+MhKPmvh7Xwyv5gIS06ns49CA7Sqg7lC22Q==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-2.1.0.tgz", + "integrity": "sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ==", "license": "MIT", "engines": { "node": ">=18" @@ -1310,12 +1517,122 @@ "markdown-it": "bin/markdown-it.mjs" } }, + "node_modules/mdast-util-to-hast": { + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz", + "integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@ungap/structured-clone": "^1.0.0", + "devlop": "^1.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "trim-lines": "^3.0.0", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/mdurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", "license": "MIT" }, + "node_modules/micromark-util-character": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.0.tgz", + "integrity": "sha512-KvOVV+X1yLBfs9dCBSopq/+G1PcgT3lAK07mC4BzXi5E7ahzMAF8oIupDDJ6mievI6F+lAATkbQQlQixJfT3aQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-encode": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.0.tgz", + "integrity": "sha512-pS+ROfCXAGLWCOc8egcBvT0kf27GoWMqtdarNfDcjb6YLuV5cM3ioG45Ys2qOVqeqSbjaKg72vU+Wby3eddPsA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.0.tgz", + "integrity": "sha512-WhYv5UEcZrbAtlsnPuChHUAsu/iBPOVaEVsntLBIdpibO0ddy8OzavZz3iL2xVvBZOpolujSliP65Kq0/7KIYw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-symbol": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.0.tgz", + "integrity": "sha512-8JZt9ElZ5kyTnO94muPxIGS8oyElRJaiJO8EzV6ZSyGQ1Is8xwl4Q45qU5UOg+bGH4AikWziz0iN4sFLWs8PGw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-types": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.0.tgz", + "integrity": "sha512-oNh6S2WMHWRZrmutsRmDDfkzKtxF+bc2VxLC9dvtrDIRFln627VsFP6fLMgTryGDljgLPjkrzQSDcPrjPyDJ5w==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, "node_modules/mimic-function": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/mimic-function/-/mimic-function-5.0.1.tgz", @@ -1391,10 +1708,22 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/oniguruma-to-js": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/oniguruma-to-js/-/oniguruma-to-js-0.4.3.tgz", + "integrity": "sha512-X0jWUcAlxORhOqqBREgPMgnshB7ZGYszBNspP+tS9hPD3l13CdaXcHbgImoHUHlrvGx/7AvFEkTRhAGYh+jzjQ==", + "license": "MIT", + "dependencies": { + "regex": "^4.3.2" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, "node_modules/ora": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/ora/-/ora-8.1.0.tgz", - "integrity": "sha512-GQEkNkH/GHOhPFXcqZs3IDahXEQcQxsSjEkK4KvEEST4t7eNzoMjxTzef+EZ+JluDEV+Raoi3WQ2CflnRdSVnQ==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-8.1.1.tgz", + "integrity": "sha512-YWielGi1XzG1UTvOaCFaNgEnuhZVMSHYkW/FQ7UX8O26PtlpdM84c0f7wLPlkvx2RfiQmnzd61d/MGxmpQeJPw==", "license": "MIT", "dependencies": { "chalk": "^5.3.0", @@ -1489,6 +1818,16 @@ "integrity": "sha512-SVtmxhRE/CGkn3eZY1T6pC8Nln6Fr/lu1mKSgRud0eC73whjGfoAogbn78LkD8aFL0zz3bAFerKSnOl7NlErBA==", "license": "MIT" }, + "node_modules/property-information": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-6.5.0.tgz", + "integrity": "sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/punycode.js": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", @@ -1519,6 +1858,12 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "license": "MIT" }, + "node_modules/regex": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/regex/-/regex-4.4.0.tgz", + "integrity": "sha512-uCUSuobNVeqUupowbdZub6ggI5/JZkYyJdDogddJr60L764oxC2pMZov1fQ3wM9bdyzUILDG+Sqx6NAKAz9rKQ==", + "license": "MIT" + }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -1605,12 +1950,16 @@ "license": "MIT" }, "node_modules/shiki": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.14.1.tgz", - "integrity": "sha512-FujAN40NEejeXdzPt+3sZ3F2dx1U24BY2XTY01+MG8mbxCiA2XukXdcbyMyLAHJ/1AUUnQd1tZlvIjefWWEJeA==", + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.22.2.tgz", + "integrity": "sha512-3IZau0NdGKXhH2bBlUk4w1IHNxPh6A5B2sUpyY+8utLu2j/h1QpFkAaUA1bAMxOWWGtTWcAh531vnS4NJKS/lA==", "license": "MIT", "dependencies": { - "@shikijs/core": "1.14.1", + "@shikijs/core": "1.22.2", + "@shikijs/engine-javascript": "1.22.2", + "@shikijs/engine-oniguruma": "1.22.2", + "@shikijs/types": "1.22.2", + "@shikijs/vscode-textmate": "^9.3.0", "@types/hast": "^3.0.4" } }, @@ -1639,6 +1988,16 @@ "source-map": "^0.6.0" } }, + "node_modules/space-separated-tokens": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/stdin-discarder": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.2.2.tgz", @@ -1683,6 +2042,20 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/stringify-entities": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", + "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "license": "MIT", + "dependencies": { + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/strip-ansi": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", @@ -1726,9 +2099,9 @@ } }, "node_modules/terser": { - "version": "5.31.6", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.31.6.tgz", - "integrity": "sha512-PQ4DAriWzKj+qgehQ7LK5bQqCFNMmlhjR2PFFLuqGCpuCAauxemVBWwWOxo3UIwWQx8+Pr61Df++r76wDmkQBg==", + "version": "5.36.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.36.0.tgz", + "integrity": "sha512-IYV9eNMuFAV4THUspIRXkLakHnV6XO7FEdtKjf/mDyrnqUg9LnlOn6/RwRvM9SZjR4GUq8Nk8zj67FzVARr74w==", "license": "BSD-2-Clause", "dependencies": { "@jridgewell/source-map": "^0.3.3", @@ -1773,10 +2146,20 @@ "integrity": "sha512-0a5EOkAUp8D4moMi2W8ZF8jcga7BgZd91O/yabJCFY8az+XSzeGyTKs0Aoo897iV1Nj6guFq8orWDS96z91oGg==", "license": "MIT" }, + "node_modules/trim-lines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/tslib": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", - "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "license": "0BSD", "optional": true }, @@ -1793,16 +2176,16 @@ } }, "node_modules/typedoc": { - "version": "0.26.6", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.26.6.tgz", - "integrity": "sha512-SfEU3SH3wHNaxhFPjaZE2kNl/NFtLNW5c1oHsg7mti7GjmUj1Roq6osBQeMd+F4kL0BoRBBr8gQAuqBlfFu8LA==", + "version": "0.26.11", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.26.11.tgz", + "integrity": "sha512-sFEgRRtrcDl2FxVP58Ze++ZK2UQAEvtvvH8rRlig1Ja3o7dDaMHmaBfvJmdGnNEFaLTpQsN8dpvZaTqJSu/Ugw==", "license": "Apache-2.0", "dependencies": { "lunr": "^2.3.9", "markdown-it": "^14.1.0", "minimatch": "^9.0.5", - "shiki": "^1.9.1", - "yaml": "^2.4.5" + "shiki": "^1.16.2", + "yaml": "^2.5.1" }, "bin": { "typedoc": "bin/typedoc" @@ -1811,7 +2194,7 @@ "node": ">= 18" }, "peerDependencies": { - "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x" + "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x" } }, "node_modules/typedoc-plugin-missing-exports": { @@ -1824,9 +2207,9 @@ } }, "node_modules/typescript": { - "version": "5.5.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", - "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", + "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", @@ -1852,12 +2235,108 @@ "through": "^2.3.8" } }, + "node_modules/unist-util-is": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", + "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-position": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz", + "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz", + "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "license": "MIT" }, + "node_modules/vfile": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.2.tgz", + "integrity": "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -1941,9 +2420,9 @@ } }, "node_modules/yaml": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.0.tgz", - "integrity": "sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.0.tgz", + "integrity": "sha512-a6ae//JvKDEra2kdi1qzCyrJW/WZCgFi8ydDV+eXExl95t+5R+ijnqHJbz9tmMh8FUjx3iv2fCQ4dclAQlO2UQ==", "license": "ISC", "bin": { "yaml": "bin.mjs" @@ -2041,6 +2520,16 @@ "toposort": "^2.0.2", "type-fest": "^2.19.0" } + }, + "node_modules/zwitch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } } } } diff --git a/package.json b/package.json index 6a2412f9..2c6760a6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fermyon/spin-sdk", - "version": "2.2.0", + "version": "2.3.0-rc1", "description": "", "main": "lib/index.js", "typings": "lib/index.d.ts", @@ -13,7 +13,7 @@ "fmt-check": "prettier --check \"src/**/*.{ts,tsx,js,jsx}\"", "build": "tsc && cp -r src/types ./lib/", "build-docs": "typedoc --plugin typedoc-plugin-missing-exports src/index.ts --out ./docs --excludeExternals --readme none", - "postinstall": "knitwit-postinstall --wit-path ../../bin/wit --world spin-imports", + "postinstall": "knitwit-postinstall --wit-path ../../bin/wit --world spin3-imports", "fmt-examples": "prettier --write \"examples/**/*.{ts,tsx,js,jsx}\" --ignore-patterm \"node_modules\"" }, "sideEffects": false, @@ -25,11 +25,11 @@ "typescript": "^5.4.3" }, "dependencies": { - "@bytecodealliance/componentize-js": "^0.12.0", + "@bytecodealliance/componentize-js": "^0.13.1", "itty-router": "^3.0.12", "yargs": "^17.7.2", "typedoc-plugin-missing-exports": "^3.0.0", - "@fermyon/knitwit": "https://github.com/fermyon/knitwit" + "@fermyon/knitwit": "0.2.0" }, "files": [ "lib", @@ -39,7 +39,7 @@ "config": { "knitwit": { "witPath": "../../bin/wit", - "world": "spin-imports" + "world": "spin3-imports" } } } \ No newline at end of file diff --git a/plugins/webpack/index.js b/plugins/webpack/index.js index 02cb062b..880e4add 100644 --- a/plugins/webpack/index.js +++ b/plugins/webpack/index.js @@ -11,7 +11,9 @@ class SpinSdkPlugin { "fermyon:spin/sqlite@2.0.0": "fermyon:spin/sqlite@2.0.0", "fermyon:spin/postgres@2.0.0": "fermyon:spin/postgres@2.0.0", "fermyon:spin/mysql@2.0.0": "fermyon:spin/mysql@2.0.0", - "fermyon:spin/mqtt@2.0.0": "fermyon:spin/mqtt@2.0.0" + "fermyon:spin/mqtt@2.0.0": "fermyon:spin/mqtt@2.0.0", + "wasi:config/store@0.2.0-draft-2024-09-27": "wasi:config/store@0.2.0-draft-2024-09-27", + "spin:postgres/postgres@3.0.0": "spin:postgres/postgres@3.0.0", }; } diff --git a/src/index.ts b/src/index.ts index 2d5d5e3d..e7727296 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,7 +9,7 @@ import * as Postgres from './postgres'; import * as Mysql from './mysql'; import * as Mqtt from './mqtt'; import { Router } from './router'; - +import * as PostgresV3 from './postgresv3'; export { Router, Llm, @@ -20,6 +20,7 @@ export { Postgres, Mysql, Mqtt, + PostgresV3, RedisHandler, ResponseBuilder, }; diff --git a/src/postgresv3.ts b/src/postgresv3.ts new file mode 100644 index 00000000..b4dde8fb --- /dev/null +++ b/src/postgresv3.ts @@ -0,0 +1,252 @@ +//@ts-ignore +import * as spinPg from 'spin:postgres/postgres@3.0.0'; + +export type SpinPostgresV3ValueBoolean = { tag: 'boolean'; val: boolean }; +export type SpinPostgresV3ValueInt8 = { tag: 'int8'; val: number }; +export type SpinPostgresV3ValueInt16 = { tag: 'int16'; val: number }; +export type SpinPostgresV3ValueInt32 = { tag: 'int32'; val: number }; +export type SpinPostgresV3ValueInt64 = { tag: 'int64'; val: bigint }; +export type SpinPostgresV3ValueFloating32 = { tag: 'floating32'; val: number }; +export type SpinPostgresV3ValueFloating64 = { tag: 'floating64'; val: number }; +export type SpinPostgresV3ValueStr = { tag: 'str'; val: string }; +export type SpinPostgresV3ValueBinary = { tag: 'binary'; val: Uint8Array }; +export type SpinPostgresV3ValueDate = { tag: 'date'; val: [number, number, number] }; +export type SpinPostgresV3ValueTime = { tag: 'time'; val: [number, number, number, number] }; +export type SpinPostgresV3ValueDateTime = { tag: 'datetime'; val: [number, number, number, number, number, number, number] }; +export type SpinPostgresV3ValueTimeStamp = { tag: 'timestamp'; val: bigint }; +export type SpinPostgresV3ValueDbNull = { tag: 'db-null' }; + +export type SpinPostgresV3ParameterValue = + | SpinPostgresV3ValueBoolean + | SpinPostgresV3ValueInt8 + | SpinPostgresV3ValueInt16 + | SpinPostgresV3ValueInt32 + | SpinPostgresV3ValueInt64 + | SpinPostgresV3ValueFloating32 + | SpinPostgresV3ValueFloating64 + | SpinPostgresV3ValueStr + | SpinPostgresV3ValueBinary + | SpinPostgresV3ValueDate + | SpinPostgresV3ValueTime + | SpinPostgresV3ValueDateTime + | SpinPostgresV3ValueTimeStamp + | SpinPostgresV3ValueDbNull; + +export type PostgresV3ParameterValue = + | SpinPostgresV3ParameterValue + | number + | bigint + | boolean + | null + | Uint8Array + | string; + +export enum PostgresV3DataType { + PostgresV3Boolean = 'boolean', + PostgresV3Int8 = 'int8', + PostgresV3Int16 = 'int16', + PostgresV3Int32 = 'int32', + PostgresV3Int64 = 'int64', + PostgresV3Floating32 = 'floating32', + PostgresV3Floating64 = 'floating64', + PostgresV3Str = 'str', + PostgresV3Binary = 'binary', + PostgresV3Date = 'date', + PostgresV3Time = 'time', + PostgresV3DateTime = 'datetime', + PostgresV3TimeStamp = 'timestamp', + PostgresV3Other = 'other', +} + +export interface PostgresV3Column { + name: string; + dataType: PostgresV3DataType; +} + + +export interface PostgresV3RowSet { + columns: PostgresV3Column[]; + rows: { + [key: string]: number | boolean | bigint | null | string | Uint8Array | Date; + }[]; +} + +export type PostgresV3DbBoolean = { tag: 'boolean'; val: boolean }; +export type PostgresV3DbInt8 = { tag: 'int8'; val: number }; +export type PostgresV3DbInt16 = { tag: 'int16'; val: number }; +export type PostgresV3DbInt32 = { tag: 'int32'; val: number }; +export type PostgresV3DbInt64 = { tag: 'int64'; val: number }; +export type PostgresV3DbFloating32 = { tag: 'floating32'; val: number }; +export type PostgresV3DbFloating64 = { tag: 'floating64'; val: number }; +export type PostgresV3DbStr = { tag: 'str'; val: string }; +export type PostgresV3DbBinary = { tag: 'binary'; val: Uint8Array }; +export type PostgresV3DbDate = { tag: 'date'; val: [number, number, number] }; +export type PostgresV3DbTime = { tag: 'time'; val: [number, number, number, number] }; +export type PostgresV3DbDateTime = { tag: 'datetime'; val: [number, number, number, number, number, number, number] }; +export type PostgresV3DbTimeastamp = { tag: 'timestamp'; val: bigint }; +export type PostgresV3DbNull = { tag: 'db-null' }; +export type PostgresV3DbUnsupported = { tag: 'unsupported' }; + +export type RdbmsDbValue = + | PostgresV3DbBoolean + | PostgresV3DbInt8 + | PostgresV3DbInt16 + | PostgresV3DbInt32 + | PostgresV3DbInt64 + | PostgresV3DbFloating32 + | PostgresV3DbFloating64 + | PostgresV3DbStr + | PostgresV3DbBinary + | PostgresV3DbDate + | PostgresV3DbTime + | PostgresV3DbDateTime + | PostgresV3DbTimeastamp + | PostgresV3DbNull + | PostgresV3DbUnsupported; + +export type RdbmsRow = RdbmsDbValue[]; + +export interface SpinRdbmsRowSet { + columns: PostgresV3Column[]; + rows: RdbmsRow[]; +} + +/** + * Interface representing a PostgreSQL connection with methods for querying and executing statements. + * @interface PostgresConnection + */ +export interface PostgresConnection { + /** + * Queries the database with the specified statement and parameters. + * @param {string} statement - The SQL statement to execute. + * @param {PostgresV3Value[]} params - The parameters for the SQL statement. + * @returns {RdbmsRowSet} The result set of the query. + */ + query: (statement: string, params: PostgresV3ParameterValue[]) => PostgresV3RowSet; + /** + * Executes a statement on the database with the specified parameters. + * @param {string} statement - The SQL statement to execute. + * @param {PostgresV3Value[]} params - The parameters for the SQL statement. + * @returns {number} The number of rows affected by the execution. + */ + execute: (statement: string, params: PostgresV3ParameterValue[]) => number; +} + +function createPostgresConnection( + connection: spinPg.Connection, +): PostgresConnection { + return { + query: (statement: string, params: PostgresV3ParameterValue[]) => { + let santizedParams = convertRdbmsToWitTypes(params); + let ret = connection.query(statement, santizedParams) as SpinRdbmsRowSet; + let results: PostgresV3RowSet = { + columns: ret.columns, + rows: [], + }; + ret.rows.map((k: RdbmsRow, rowIndex: number) => { + results.rows.push({}); + k.map((val, valIndex: number) => { + switch (val.tag) { + case "date": { + // Date (year, month, day) + const [year, month, day] = val.val; + results.rows[rowIndex][results.columns[valIndex].name] = new Date(Date.UTC(year, month - 1, day)); // UTC Date object + break; + } + + case "time": { + // Time (hour, minute, second, nanosecond) + const [hour, minute, second, nanosecond] = val.val; + const date = new Date(Date.UTC(1970, 0, 1, hour, minute, second)); // Using an arbitrary date + date.setMilliseconds(nanosecond / 1_000_000); // Convert nanoseconds to milliseconds + results.rows[rowIndex][results.columns[valIndex].name] = date; // UTC Date object with only time set + break; + } + + case "datetime": { + // DateTime (year, month, day, hour, minute, second, nanosecond) + const [year, month, day, hour, minute, second, nanosecond] = val.val; + const date = new Date(Date.UTC(year, month - 1, day, hour, minute, second)); + date.setMilliseconds(nanosecond / 1_000_000); // Convert nanoseconds to milliseconds + results.rows[rowIndex][results.columns[valIndex].name] = date; // Complete UTC Date object + break; + } + + case "timestamp": { + // Timestamp (seconds since epoch) + const seconds = val.val as unknown as number; + results.rows[rowIndex][results.columns[valIndex].name] = new Date(seconds * 1000); // Convert seconds to milliseconds + break; + } + + default: { + results.rows[rowIndex][results.columns[valIndex].name] = + val.tag == 'db-null' || val.tag == 'unsupported' ? null : val.val; + break; + + } + } + }); + }); + return results; + }, + execute: (statement: string, params: PostgresV3ParameterValue[]) => { + let santizedParams = convertRdbmsToWitTypes(params); + let ret = connection.execute(statement, santizedParams) as number; + return ret; + }, + }; +} + +/** + * Opens a PostgreSQL connection to the specified address. + * @param {string} address - The address of the PostgreSQL server. + * @returns {PostgresConnection} The PostgreSQL connection object. + */ +export function open(address: string): PostgresConnection { + return createPostgresConnection(spinPg.Connection.open(address)); +} + + +function convertRdbmsToWitTypes( + parameters: PostgresV3ParameterValue[], +): SpinPostgresV3ParameterValue[] { + let sanitized: SpinPostgresV3ParameterValue[] = []; + for (let k of parameters) { + if (typeof k === 'object') { + sanitized.push(k as SpinPostgresV3ParameterValue); + continue; + } + if (typeof k === 'string') { + sanitized.push({ tag: 'str', val: k }); + continue; + } + if (typeof k === null) { + sanitized.push({ tag: 'db-null' }); + continue; + } + if (typeof k === 'boolean') { + sanitized.push({ tag: 'boolean', val: k }); + continue; + } + if (typeof k === 'bigint') { + sanitized.push({ tag: 'int64', val: k }); + continue; + } + if (typeof k === 'number') { + isFloat(k) + ? sanitized.push({ tag: 'floating64', val: k }) + : sanitized.push({ tag: 'int32', val: k }); + continue; + } + if ((k as any) instanceof Uint8Array) { + sanitized.push({ tag: 'binary', val: k }); + continue; + } + } + return sanitized; +} + +function isFloat(number: number) { + return number % 1 !== 0; +}