diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..247c78d --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,46 @@ +name: Pull request checks +on: + push: + branches: + - main + +jobs: + verify_build: + runs-on: ubuntu-latest + permissions: + contents: read + pages: write + id-token: write + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: '18' + cache: 'npm' + + - name: ๐Ÿ“ฅ Install dependencies + run: npm ci + + - name: ๐Ÿ”จ Build projects + run: npm run build + + - name: ๐Ÿงช Run unit tests + run: npm run test + + - name: ๐Ÿ“„ Setup Pages + uses: actions/configure-pages@v3 + + - name: ๐Ÿ“š Create docs + run: npm run docs + + - name: ๐Ÿ†™ Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + path: './docs' + + - name: ๐Ÿ“„ Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 + + diff --git a/.gitignore b/.gitignore index d9c6e5a..1ffd94c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ dist tmp /out-tsc +docs # dependencies node_modules diff --git a/README.md b/README.md index 82b8b43..68e0c75 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

- seda-overlay + seda-sdk

@@ -8,10 +8,98 @@ SEDA SDK +[![Build Status][actions-badge]][actions-url] +[![GitHub Stars][github-stars-badge]](https://github.com/sedaprotocol/seda-sdk) +[![GitHub Contributors][github-contributors-badge]](https://github.com/sedaprotocol/seda-sdk/graphs/contributors) +[![Discord chat][discord-badge]][discord-url] +[![Twitter][twitter-badge]][twitter-url] + +[actions-badge]: https://github.com/sedaprotocol/seda-sdk/actions/workflows/push.yml/badge.svg +[actions-url]: https://github.com/sedaprotocol/seda-sdk/actions/workflows/push.yml+branch%3Amain +[github-stars-badge]: https://img.shields.io/github/stars/sedaprotocol/seda-sdk.svg?style=flat-square&label=github%20stars +[github-contributors-badge]: https://img.shields.io/github/contributors/sedaprotocol/seda-sdk.svg?style=flat-square +[discord-badge]: https://img.shields.io/discord/500028886025895936.svg?logo=discord&style=flat-square +[discord-url]: https://discord.gg/seda +[twitter-badge]: https://img.shields.io/twitter/url/https/twitter.com/SedaProtocol.svg?style=social&label=Follow%20%40SedaProtocol +[twitter-url]: https://twitter.com/SedaProtocol + Collection of packages which allow you to build SEDA Data Requests: -* `vm` - Virtual Machine which can run Data Request WASM binaries -* `as-sdk` - [AssemblyScript](https://www.assemblyscript.org/) SDK +* [vm](./libs/vm/README.md) - Virtual Machine which can run Data Request WASM binaries +* [as-sdk](./libs/as-sdk/README.md) - [AssemblyScript](https://www.assemblyscript.org/) SDK +* [cli](./libs/cli/README.md) - Command Line Interface for uploading and listing Data Request binaries + +# Quick getting started + +The easiest way to get started it by using our [starter kit](https://github.com/sedaprotocol/seda-sdk-starter-template) this has all the tools installed that you need: + +* AssemblyScript +* SEDA SDK +* SEDA CLI +* SEDA VM +* WASI + +In our `assembly/index.ts` we have the following example: + +```TypeScript +import { Process, httpFetch } from "@seda-protocol/as-sdk/assembly"; +import { JSON } from "json-as/assembly"; + +// Our SWAPI JSON schema, since in AssemblyScript we need to define our shape beforehand +// @ts-expect-error +@json +class SwPlanet { + name!: string +} + +function main(): void { + // HTTP Fetch to the SWAPI + const response = httpFetch("https://swapi.dev/api/planets/1/"); + + // Returns either fulfilled or rejected based on the status code + const fulfilled = response.fulfilled; + + if (fulfilled !== null) { + // Converts our buffer to a string + const data = String.UTF8.decode(fulfilled.bytes.buffer); + + // Parses the JSON to our schema + const planet = JSON.parse(data); + + // Exits the program (with an exit code of 0) and sets the Data Request result to the planet name + Process.exit_with_message(0, planet.name); + } else { + Process.exit_with_message(1, "Error while fetching"); + } +} + +main(); +``` + +And in order to test this we have to use a JS testing suite (In our starting kit we use Jest, but any suite should work). We use the `@seda-protocol/vm` package for this. Which runs the binary in the context of a SEDA Data Request: + +```JavaScript +import { callVm } from "@seda-protocol/vm"; +import { readFile } from "node:fs/promises"; + +const WASM_PATH = "build/debug.wasm"; +describe("index.ts", () => { + it("should be able to run", async () => { + const wasmBinary = await readFile(WASM_PATH); + // Calls our SEDA VM + const vmResult = await callVm({ + // Arguments passed to the VM + args: [], + // Environment variables passed to the VM + envs: {}, + // The WASM binary in bytes + binary: new Uint8Array(wasmBinary), + }); + expect(vmResult.exitCode).toBe(0); + expect(vmResult.resultAsString).toBe("Tatooine"); + }); +}); +``` diff --git a/libs/as-sdk-integration-tests/assembly/index.ts b/libs/as-sdk-integration-tests/assembly/index.ts index 7e8c94e..eafc04d 100644 --- a/libs/as-sdk-integration-tests/assembly/index.ts +++ b/libs/as-sdk-integration-tests/assembly/index.ts @@ -1,16 +1,10 @@ import { httpFetch, Process } from '../../as-sdk/assembly/index'; -import { testInvalidUint8JsonArray, testValidUint8JsonArray } from './json-utils-test'; - const args = Process.args()[0]; if (args === 'testHttpRejection') { testHttpRejection(); } else if (args === 'testHttpSuccess') { testHttpSuccess(); -} else if (args === 'testValidUint8JsonArray') { - testValidUint8JsonArray(); -} else if (args === 'testInvalidUint8JsonArray') { - testInvalidUint8JsonArray(); } export function testHttpRejection(): void { diff --git a/libs/as-sdk-integration-tests/assembly/json-utils-test.ts b/libs/as-sdk-integration-tests/assembly/json-utils-test.ts deleted file mode 100644 index f7cdff2..0000000 --- a/libs/as-sdk-integration-tests/assembly/json-utils-test.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { jsonArrToUint8Array, JSON, testutils } from '../../as-sdk/assembly/index'; - -export function testValidUint8JsonArray(): void { - const raw: string = "[0, 23, 254, 88]"; - const json = JSON.parse(raw); - const result = jsonArrToUint8Array(json); - - const expected = new Uint8Array(4); - expected.set([0, 23, 254, 88]); - - testutils.assert(result.byteLength === expected.byteLength, "bytelength is not equal"); - testutils.assert( - String.UTF8.decode(result.buffer) === String.UTF8.decode(expected.buffer), - 'buffers are not equal' - ); - - testutils.ok(); -} - -export function testInvalidUint8JsonArray(): void { - const raw: string = '[0, 23, 299, 88]'; - const json = JSON.parse(raw); - jsonArrToUint8Array(json); - - testutils.error("Test should fail"); -} diff --git a/libs/as-sdk/assembly/test-utils.ts b/libs/as-sdk-integration-tests/assembly/test-utils.ts similarity index 86% rename from libs/as-sdk/assembly/test-utils.ts rename to libs/as-sdk-integration-tests/assembly/test-utils.ts index cfaccad..31772a2 100644 --- a/libs/as-sdk/assembly/test-utils.ts +++ b/libs/as-sdk-integration-tests/assembly/test-utils.ts @@ -1,4 +1,4 @@ -import Process from './process'; +import { Process } from '../../as-sdk/assembly/index'; @inline export function assert(expected: bool, message: string): void { diff --git a/libs/as-sdk-integration-tests/assembly/tsconfig.json b/libs/as-sdk-integration-tests/assembly/tsconfig.json index 0261e7e..bbc6668 100644 --- a/libs/as-sdk-integration-tests/assembly/tsconfig.json +++ b/libs/as-sdk-integration-tests/assembly/tsconfig.json @@ -1,4 +1,4 @@ { "extends": "../../../node_modules/assemblyscript/std/assembly.json", - "include": ["./**/*.ts"] + "include": ["./**/*.ts", "../../as-sdk/assembly/json-utils.ts"] } diff --git a/libs/as-sdk-integration-tests/src/jsonutils.test.ts b/libs/as-sdk-integration-tests/src/jsonutils.test.ts deleted file mode 100644 index b333f39..0000000 --- a/libs/as-sdk-integration-tests/src/jsonutils.test.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { readFile } from "fs/promises"; -import { callVm } from "../../../dist/libs/vm/src"; - -describe('json-utils', () => { - it('should handle valid u8 json arrays', async () => { - const wasmBinary = await readFile( - 'dist/libs/as-sdk-integration-tests/debug.wasm' - ); - const result = await callVm({ - args: ['testValidUint8JsonArray'], - envs: {}, - binary: new Uint8Array(wasmBinary), - }); - - expect(result.resultAsString).toEqual('ok'); - expect(result.exitCode).toBe(0); - }); - - it('should error on invalid u8 json arrays', async () => { - const wasmBinary = await readFile( - 'dist/libs/as-sdk-integration-tests/debug.wasm' - ); - const result = await callVm({ - args: ['testInvalidUint8JsonArray'], - envs: {}, - binary: new Uint8Array(wasmBinary), - }); - - expect(result.stderr).toContain('abort: Invalid u8 299'); - expect(result.exitCode).toBe(255); - }); -}); diff --git a/libs/as-sdk/README.md b/libs/as-sdk/README.md index 16c1d64..c7e2db5 100644 --- a/libs/as-sdk/README.md +++ b/libs/as-sdk/README.md @@ -1,3 +1,34 @@ # AssemblyScript SDK SDK for creating Data Requests on the SEDA chain + +For API documentation please see our docs: https://sedaprotocol.github.io/seda-sdk/ + +## Example + +```ts +import { Process, httpFetch } from "@seda-protocol/as-sdk/assembly"; +import { JSON } from "json-as/assembly"; + +// @ts-expect-error +@json +class SwPlanet { + name!: string +} + +function main(): void { + const response = httpFetch("https://swapi.dev/api/planets/1/"); + const fulfilled = response.fulfilled; + + if (fulfilled !== null) { + const data = String.UTF8.decode(fulfilled.bytes.buffer); + const planet = JSON.parse(data); + + Process.exit_with_message(0, planet.name); + } else { + Process.exit_with_message(1, "Error while fetching"); + } +} + +main(); +``` diff --git a/libs/as-sdk/assembly/http.ts b/libs/as-sdk/assembly/http.ts index 0cdebb9..8f58274 100644 --- a/libs/as-sdk/assembly/http.ts +++ b/libs/as-sdk/assembly/http.ts @@ -3,19 +3,35 @@ import { call_result_write, http_fetch } from './bindings/env'; import { jsonArrToUint8Array } from './json-utils'; import { PromiseStatus, FromBuffer } from './promise'; +/** + * Response of an httpFetch call + */ export class HttpResponse implements FromBuffer { + /** + * Raw result of the HTTP fetch. (usually not used) + */ public result: Uint8Array | null = null; + /** + * The response body result. This can be used to convert to JSON, text, etc. + */ public bytes: Uint8Array = new Uint8Array(0); + /** + * The length of the content + */ public contentLength: i64 = 0; + /** + * The URL that was fetched (when it needs to follow redirects) + */ public url: string = ''; + /** + * The HTTP status code + */ public status: i64 = 0; + /** + * The headers returned + */ public headers: Map = new Map(); - json(): JSON.Value { - const body = String.UTF8.decode(this.bytes.buffer); - return JSON.parse(body); - } - fromBuffer(buffer: Uint8Array): HttpResponse { const response = new HttpResponse(); const value = JSON.parse(buffer); @@ -61,6 +77,19 @@ export type HttpFetchMethod = string; /** * HTTP Fetch options + * @example + * ```ts + * const headers = new Map(); + * headers.set('x-header', 'example'); + * + * const options = new HttpFetchOptions(); + * options.method = "Post"; + * options.headers = headers; + * // Do something with the body + * options.body = new Uint8Array(10); + * + * const response = httpFetch("https://swapi.dev/api/planets/1/", options); + * ``` */ export class HttpFetchOptions { /** @@ -136,6 +165,18 @@ class HttpFetch { * @param {string} url The URL which to call * @param {HttpFetchOptions} options Options to modify the behaviour of the HTTP call * @returns {PromiseStatus} Returns a HttpResponse instance for both fulfilled and rejected case with info about the HTTP call + * @example + * ```ts + * const response = httpFetch("https://swapi.dev/api/planets/1/"); + * const fulfilled = response.fulfilled; + * + * if (fulfilled !== null) { + * const data = String.UTF8.decode(fulfilled.bytes.buffer); + * // Do something with data + * } else { + * // Error occured + * } + * ``` */ export function httpFetch( url: string, diff --git a/libs/as-sdk/assembly/index.ts b/libs/as-sdk/assembly/index.ts index ae8ccf5..36cf575 100644 --- a/libs/as-sdk/assembly/index.ts +++ b/libs/as-sdk/assembly/index.ts @@ -1,8 +1,5 @@ import Process from './process'; -import * as testutils from './test-utils'; -export { JSON, JSONDecoder, JSONEncoder, DecoderState, JSONHandler, ThrowingJSONHandler } from 'assemblyscript-json/assembly'; export { httpFetch, HttpFetchMethod, HttpFetchOptions, HttpResponse } from './http'; export { PromiseStatus } from './promise'; -export { Process, testutils }; -export { jsonArrToUint8Array } from './json-utils'; +export { Process }; diff --git a/libs/as-sdk/assembly/process.ts b/libs/as-sdk/assembly/process.ts index 655e5dc..0a15cdc 100644 --- a/libs/as-sdk/assembly/process.ts +++ b/libs/as-sdk/assembly/process.ts @@ -8,6 +8,10 @@ export default class Process { * Second argument (index: 1) is the input of the Data Request * * @returns {string[]} An array of input arguments + * @example + * ```ts + * const args = Process.args(); + * ``` */ static args(): string[] { return CommandLine.all; @@ -19,6 +23,16 @@ export default class Process { * * @param {u8} code Exit code (POSIX compatible, 0 is success, >= 1 is error) * @param {string} message Message to exit the process with (ex. an error message) + * @example + * ```ts + * const result = true; + * + * if (result) { + * Process.exit_with_message(0, "result was true"); + * } else { + * Process.exit_with_message(1, "result errored"); + * } + * ``` */ static exit_with_message(code: u8, message: string): void { const msg = String.UTF8.encode(message); @@ -28,10 +42,18 @@ export default class Process { } /** - * Exits the process with a bytes encoded result + * Exits the process with a bytes encoded result. + * This sets Data Request execution result to the bytes * * @param {u8} code Exit code (POSIX compatible, 0 is success, >= 1 is error) * @param {Uint8Array} result Bytes encoded result, which will be sent back to the contract + * @example + * ```ts + * const result = String.UTF8.encode("{\"price\": \"10.23\"}"); + * const resultBuffer = Uint8Array.wrap(msg); + * + * Process.exit_with_result(0, resultBuffer); + * ``` */ static exit_with_result(code: u8, result: Uint8Array): void { const buffer = result.buffer; @@ -42,9 +64,13 @@ export default class Process { } /** - * Exits the process + * Exits the process (no result set) * * @param {u8} code Exit code (POSIX compatible, 0 is success, >= 1 is error) + * @example + * ``` + * Process.exit(0); + * ``` */ static exit(code: u8): void { Process.exit_with_result(code, new Uint8Array(0)); diff --git a/libs/as-sdk/assembly/tsconfig.json b/libs/as-sdk/assembly/tsconfig.json index 0261e7e..4f7972c 100644 --- a/libs/as-sdk/assembly/tsconfig.json +++ b/libs/as-sdk/assembly/tsconfig.json @@ -1,4 +1,4 @@ { "extends": "../../../node_modules/assemblyscript/std/assembly.json", - "include": ["./**/*.ts"] + "include": ["./**/*.ts", "json-utils.ts"] } diff --git a/libs/cli/README.md b/libs/cli/README.md index cd95695..b8dae18 100644 --- a/libs/cli/README.md +++ b/libs/cli/README.md @@ -1,3 +1,82 @@ # SEDA SDK CLI -Command Line Interface (CLI) for the SEDA SDK +Command Line Interface (CLI) for the SEDA SDK. Allows you to upload list and show information about Data Request binaries. + +# Getting started + +This guide assumes you have already a package.json in place and a wasm binary. If not you can use our [starter template](https://github.com/sedaprotocol/seda-sdk-starter-template), which already has all dependencies you need. + +First add the SEDA SDK CLI to your `devDependencies`: + +```sh +npm install -D @seda-protocol/cli +``` + +You can verify if the command is working by doing: + +```sh +npx seda-sdk +``` + +## Configuring + +You can configure the CLI through arguments or environment variables. However we require the `MNEMONIC` to be submitted as an environment variable. The CLI does read `.env` files. + +The following environment variables are available: + +```sh +# The URL to the Tendermint/CometBFT server +SEDA_RPC_ENDPOINT = "http://INSERT_TENDERMINT_RPC_URL" +# The Mnemonic that you use on the SEDA chain +SEDA_MNEMONIC = "" +# (optional) The address you want to use for transactions. If not set it will get use the first derived address. +SEDA_ADDRESS = "sedahdgasyu34dyada8sd7983724d8asdsahge" +# (optional) The gas limit you want to attach, (defaults to: 100000) +SEDA_GAS_LIMIT = "100000" +``` + +# WASM commands + +Commands that allow you to interact with the Data Request binaries. + +## Uploading a Data Request binary + +Allows you to upload a Data Request binary to the SEDA chain. + +Example: + +```sh +npx seda-sdk wasm upload --rpc +``` + +This will return the `wasm hash` which you can use for Data Requests. + +You can apply the following options: +* --rpc - The SEDA chain RPC to use +* --gas - The amount of gas to attach to the transaction (default: 100000) + +## Data Request binary details + +Shows all the details of an uploaded Data Request binary. The Data Request binary id is the hash of the WASM binary (which you receive from the upload command). + +Example: + +```sh +npx seda-sdk wasm show --rpc +``` + +You can apply the following options: +* --rpc - The SEDA chain RPC to use + +## List Data Request binaries + +Shows all the WASM binaries to the SEDA chain. + +Example: + +```sh +npx seda-sdk wasm list --rpc +``` + +You can apply the following options: +* --rpc - The SEDA chain RPC to use diff --git a/libs/vm/README.md b/libs/vm/README.md index ba4664c..360d6a2 100644 --- a/libs/vm/README.md +++ b/libs/vm/README.md @@ -1,3 +1,39 @@ # SEDA VM Virtual Machine used for testing your Data Request using JavaScript + +# Getting started + +You need to have the VM installed in your devDependencies: + +```sh +npm i -D @seda-protocol/vm +``` + +You can use any testing framework you prefer. In this example we use Jest: + +```ts +import { callVm } from "@seda-protocol/vm"; +import { readFile } from "node:fs/promises"; + +const WASM_PATH = "build/debug.wasm"; + +describe("index.ts", () => { + it("should be able to run", async () => { + const wasmBinary = await readFile(WASM_PATH); + const vmResult = await callVm({ + // Arguments passed to the VM + args: [], + // Environment variables passed to the VM + envs: {}, + // The WASM binary in bytes + binary: new Uint8Array(wasmBinary), + }); + + expect(vmResult.exitCode).toBe(0); + expect(vmResult.resultAsString).toBe("Tatooine"); + }); +}); +``` + + diff --git a/libs/vm/src/index.ts b/libs/vm/src/index.ts index ae60146..bf24954 100644 --- a/libs/vm/src/index.ts +++ b/libs/vm/src/index.ts @@ -11,6 +11,14 @@ const CURRENT_FILE_PATH = parse(import.meta.url); CURRENT_FILE_PATH.base = 'worker.js'; const DEFAULT_WORKER_PATH = format(CURRENT_FILE_PATH); +/** + * Executes the given WASM binary as if it were a Data Request + * + * @param callData The call data passed to the VM + * @param workerUrl URL of the compiled worker.js + * @param vmAdapter Option to insert a custom VM adapter, can be used to mock + * @returns + */ export function callVm(callData: VmCallData, workerUrl = DEFAULT_WORKER_PATH, vmAdapter: VmAdapter = new DefaultVmAdapter()): Promise { return new Promise((resolve) => { const processId = createProcessId(callData); diff --git a/package-lock.json b/package-lock.json index cdc0ab6..7fa705a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -54,6 +54,7 @@ "prettier": "^2.8.8", "ts-jest": "^29.1.0", "ts-node": "10.9.1", + "typedoc": "^0.25.3", "typescript": "~5.1.3" } }, @@ -7196,6 +7197,12 @@ "node": ">=8" } }, + "node_modules/ansi-sequence-parser": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.1.tgz", + "integrity": "sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==", + "dev": true + }, "node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -12050,6 +12057,12 @@ "yallist": "^3.0.2" } }, + "node_modules/lunr": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", + "dev": true + }, "node_modules/make-dir": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", @@ -12112,6 +12125,18 @@ "tmpl": "1.0.5" } }, + "node_modules/marked": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "dev": true, + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 12" + } + }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -18642,6 +18667,18 @@ "node": ">=8" } }, + "node_modules/shiki": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.5.tgz", + "integrity": "sha512-1gCAYOcmCFONmErGTrS1fjzJLA7MGZmKzrBNX7apqSwhyITJg2O102uFzXUeBxNnEkDA9vHIKLyeKq0V083vIw==", + "dev": true, + "dependencies": { + "ansi-sequence-parser": "^1.1.0", + "jsonc-parser": "^3.2.0", + "vscode-oniguruma": "^1.7.0", + "vscode-textmate": "^8.0.0" + } + }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -19488,6 +19525,51 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/typedoc": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.25.3.tgz", + "integrity": "sha512-Ow8Bo7uY1Lwy7GTmphRIMEo6IOZ+yYUyrc8n5KXIZg1svpqhZSWgni2ZrDhe+wLosFS8yswowUzljTAV/3jmWw==", + "dev": true, + "dependencies": { + "lunr": "^2.3.9", + "marked": "^4.3.0", + "minimatch": "^9.0.3", + "shiki": "^0.14.1" + }, + "bin": { + "typedoc": "bin/typedoc" + }, + "engines": { + "node": ">= 16" + }, + "peerDependencies": { + "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x" + } + }, + "node_modules/typedoc/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/typedoc/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/typescript": { "version": "5.1.6", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", @@ -19663,6 +19745,18 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/vscode-oniguruma": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", + "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", + "dev": true + }, + "node_modules/vscode-textmate": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz", + "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==", + "dev": true + }, "node_modules/w3c-xmlserializer": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", diff --git a/package.json b/package.json index 12c9382..ec6ecaa 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "start": "npm run build && node dist/libs/vm/src/index.js", "build": "nx run-many --all --target=build", "test": "npm run build && NODE_OPTIONS=--experimental-vm-modules nx run-many --all --target=test", + "docs": "typedoc libs/as-sdk/assembly/index.ts --tsconfig ./libs/as-sdk/assembly/tsconfig.json --skipErrorChecking", "cli:generate": "cd libs/cli/proto && npx buf generate" }, "private": true, @@ -38,6 +39,7 @@ "prettier": "^2.8.8", "ts-jest": "^29.1.0", "ts-node": "10.9.1", + "typedoc": "^0.25.3", "typescript": "~5.1.3" }, "dependencies": {