diff --git a/CHANGELOG.md b/CHANGELOG.md index 5260097502..e26ba9c62b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ +# Polywrap Origin (0.7.0) +## Bugs +* [PR-1158](https://github.com/polywrap/toolchain/pull/1158) `@polywrap/client-config-builder-js`: The following plugins have been removed from the default config, and replaced with their WebAssembly wrapper equivalents available at the same URIs: + * `wrap://ens/uts46.polywrap.eth` + * `wrap://ens/sha3.polywrap.eth` + * `wrap://ens/graph-node.polywrap.eth` +* [PR-1213](https://github.com/polywrap/toolchain/pull/1213) `@polywrap/schema-bind`: Nested map types (i.e. `Map>`) are now properly supported for `wasm/rust` and `wasm/assemblyscript`. +* [PR-1213](https://github.com/polywrap/toolchain/pull/1213) `@polywrap/wasm-as`: Nested map types (i.e. `Map>`) are now properly msgpack encoded. +* [PR-1212](https://github.com/polywrap/toolchain/pull/1212) `polywrap` CLI: `wasm/rust` build image now uses the `build-deps` cargo extension to properly build dependencies in a seperate Dockerfile layer, enabling the caching of compiled artifacts. + +## Breaking Changes +* [PR-1217](https://github.com/polywrap/toolchain/pull/1217) `@polywrap/schema-bind`: `plugin/typescript` and `app/typescript` bindings have been updated to improve type safety, and no longer accept generic properties for all method argument types. +* [PR-1051](https://github.com/polywrap/toolchain/pull/1051) `polywrap` CLI: `polywrap plugin codegen` and `polywrap app codegen` commands have been moved into the `polywrap codegen`, which can now generate types for any Polywrap project (wasm, plugin, app). +* [PR-1154](https://github.com/polywrap/toolchain/pull/1154) `@polywrap/schema-bind`: The `wasm/assemblyscript` bindings have been updated to use `Box | null` for all optional scalar types, instead of the `Option` class used before. +* [PR-1154](https://github.com/polywrap/toolchain/pull/1154) `@polywrap/ws-plugin-js`: The WebSocket plugin's schema has been updated to use `UInt32` for socket IDs, instead of `Int32`. + # Polywrap Origin (0.6.0) ## Features * [PR-1100](https://github.com/polywrap/toolchain/pull/1100) `polywrap` CLI: A new manifest named `polywrap.test.yaml` has been added, which encapsulates workflows and validation scripts. diff --git a/VERSION b/VERSION index a918a2aa18..faef31a435 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.6.0 +0.7.0 diff --git a/packages/cli/lang/en.json b/packages/cli/lang/en.json index f67d4e6f8b..08fb4df202 100644 --- a/packages/cli/lang/en.json +++ b/packages/cli/lang/en.json @@ -1,7 +1,7 @@ { "commands_common_options_configPath": "config-path", "commands_common_options_config": "Add custom configuration to the PolywrapClient", - "commands_build_description": "Builds a wrapper", + "commands_build_description": "Build Polywrap Projects (type: interface, wasm)", "commands_build_error_manifestPathMissing": "{option} option missing {argument} argument", "commands_build_error_manifestNotFound": "Manifest not found. Search paths used: {paths}", "commands_build_error_outputDirMissingPath": "{option} option missing {argument} argument", @@ -15,7 +15,7 @@ "commands_build_options_t": "Use the development server's ENS instance", "commands_build_options_w": "Automatically rebuild when changes are made (default: false)", "commands_build_options_v": "Verbose output (default: false)", - "commands_infra_description": "Manage infrastructure for your wrapper", + "commands_infra_description": "Modular Infrastructure-As-Code Orchestrator", "commands_infra_actions_subtitle": "Infra allows you to execute the following commands:", "commands_infra_options_options": "options", "commands_infra_options_manifest": "manifest", @@ -54,7 +54,7 @@ "commands_infra_manifest_warning": "Warning aggregating manifest", "commands_infra_manifest_error": "Error aggregating manifest", "commands_build_uriViewers": "URI Viewers", - "commands_deploy_description": "Deploys/Publishes a Polywrap", + "commands_deploy_description": "Deploys Polywrap Projects", "commands_deploy_options_options": "options", "commands_deploy_options_o_path": "path", "commands_deploy_options_o_string": "string", @@ -69,7 +69,7 @@ "commands_deploy_error_pathMissing": "{option} option missing {argument} argument", "commands_deploy_error_nameMissing": "{option} option missing {argument} argument", "commands_deploy_error_cidMissing": "{option} option missing {argument} argument", - "commands_codegen_description": "Auto-generate Wrapper Types", + "commands_codegen_description": "Generate Code For Polywrap Projects", "commands_codegen_error_domain": "domain", "commands_codegen_error_optionMissingArgument": "{option} option missing {argument} argument", "commands_codegen_options_codegen": "Output directory for the generated code (default: {default})", @@ -83,6 +83,7 @@ "commands_codegen_options_o": "Output directory for custom generated types (default: 'types/')", "commands_codegen_options_o_path": "path", "commands_codegen_success": "Types were generated successfully", + "commands_codegen_options_publish": "Output path for the built schema and manifest (default: {default})", "commands_docgen_description": "Generate wrapper documentation", "commands_docgen_success": "Docs were generated successfully", "commands_docgen_default": "default", @@ -91,7 +92,8 @@ "commands_docgen_options_schema": "Generate GraphQL schema", "commands_docgen_options_markdown": "Generate {framework} markdown", "commands_docgen_options_i": "Also generate docs for dependencies", - "commands_create_description": "Create a new project with polywrap CLI", + "commands_docgen_error_manifestNotFound": "Manifest not found. Search paths used: {paths}", + "commands_create_description": "Create New Projects", "commands_create_directoryExists": "Directory with name {dir} already exists", "commands_create_error_commandFail": "Command failed: {error}", "commands_create_error_noCommand": "Please provide a command", @@ -117,37 +119,6 @@ "commands_create_readyPlugin": "You are ready to build a plugin into a Polywrap", "commands_create_readyProtocol": "You are ready to turn your protocol into a Polywrap", "commands_create_settingUp": "Setting everything up...", - "commands_app_description": "Build/generate types for your app", - "commands_app_codegen": "Generate code for the app", - "commands_app_options_command": "command", - "commands_app_options_codegen": "Output directory for the generated code (default: {default})", - "commands_app_options_m": "Path to the Polywrap App manifest file (default: {default})", - "commands_app_success": "Code was generated successfully", - "commands_app_namespace_success": "Generated {content} for namespace {namespace}", - "commands_app_topLevel_success": "Generated top-level code for app", - "commands_app_error_optionMissingArgument": "{option} option missing {argument} argument", - "commands_app_error_manifestNotFound": "Manifest not found. Search paths used: {paths}", - "commands_app_error_unknownCommand": "Unrecognized command: {command}", - "commands_app_error_duplicateNs": "Duplicate namespace in app manifest", - "commands_app_error_noCommand": "Please provide a command", - "commands_plugin_description": "Build/generate types for the plugin", - "commands_plugin_error_domain": "domain", - "commands_plugin_error_noCommand": "Please provide a command", - "commands_plugin_error_unknownCommand": "Unrecognized command: {command}", - "commands_plugin_error_optionMissingArgument": "{option} option missing {argument} argument", - "commands_plugin_commands_codegen": "Generate code for the plugin", - "commands_plugin_options_command": "command", - "commands_plugin_options_e": "ENS address to lookup external schemas (default: 0x0000...2e1e)", - "commands_plugin_options_e_address": "address", - "commands_plugin_options_h": "Show usage information", - "commands_plugin_options_i": "IPFS node to load external schemas (default: dev-server's node)", - "commands_plugin_options_i_node": "node", - "commands_plugin_options_lang": "lang", - "commands_plugin_options_langs": "langs", - "commands_plugin_options_m": "Path to the Polywrap Plugin manifest file (default: {default})", - "commands_plugin_options_path": "path", - "commands_plugin_options_publish": "Output path for the built schema and manifest (default: {default})", - "commands_plugin_options_codegen": "Output directory for the generated types (default: {default})", "commands_run_options_workflow": "workflow", "commands_run_options_workflowScript": "Path to workflow script", "commands_run_options_outputFilePath": "output-file-path", @@ -186,7 +157,7 @@ "commands_run_error_envsItemNotObject": "Env at index {index} must be an object with properties 'uri'", "commands_run_error_envsItemUriNotString": "Env property 'uri' at index {index} must be a valid wrap:// URI string", "commands_run_error_envsItemModuleNotObject": "Env property 'env' at index {index} must be an object", - "commands_run_description": "Runs workflow script", + "commands_run_description": "Runs Workflows", "commands_run_error_missingScript": "Required argument {script} is missing", "commands_run_error_noApi": "API needs to be initialized", "commands_run_error_readFail": "Failed to read query {query}", @@ -194,19 +165,6 @@ "commands_run_error_cueDoesNotExist": "Require cue to run validator, checkout https://cuelang.org/ for more information", "commands_run_error_noWorkflowScriptFound": "Workflow script not found at path: {path}", "commands_run_error_noTestEnvFound": "polywrap test-env not found, please run 'polywrap infra up --modules=eth-ens-ipfs'", - "commands_testEnv_description": "Manage a test environment for Polywrap", - "commands_testEnv_error_never": "This should never happen...", - "commands_testEnv_error_noCommand": "No command given", - "commands_testEnv_error_unrecognizedCommand": "Unrecognized command: {command}", - "commands_testEnv_options_command": "command", - "commands_testEnv_options_start": "Startup the test env", - "commands_testEnv_options_stop": "Shutdown the test env", - "commands_testEnv_shutdown_error": "Failed to shutdown test environment", - "commands_testEnv_shutdown_text": "Shutting down test environment...", - "commands_testEnv_shutdown_warning": "Warning shutting down test environment", - "commands_testEnv_startup_error": "Failed to start test environment", - "commands_testEnv_startup_text": "Starting test environment...", - "commands_testEnv_startup_warning": "Warning starting test environment", "commands_polywrap_error_notACommand": "is not a command", "commands_polywrap_helpPrompt": "Type {command} to view common commands", "lib_codeGenerator_genCodeError": "Failed to generate types", diff --git a/packages/cli/lang/es.json b/packages/cli/lang/es.json index 1d507593d3..94cdce5c82 100644 --- a/packages/cli/lang/es.json +++ b/packages/cli/lang/es.json @@ -1,7 +1,7 @@ { "commands_common_options_configPath": "config-path", "commands_common_options_config": "Add custom configuration to the PolywrapClient", - "commands_build_description": "Builds a wrapper", + "commands_build_description": "Build Polywrap Projects (type: interface, wasm)", "commands_build_error_manifestPathMissing": "{option} option missing {argument} argument", "commands_build_error_manifestNotFound": "Manifest not found. Search paths used: {paths}", "commands_build_error_outputDirMissingPath": "{option} option missing {argument} argument", @@ -15,8 +15,7 @@ "commands_build_options_t": "Use the development server's ENS instance", "commands_build_options_w": "Automatically rebuild when changes are made (default: false)", "commands_build_options_v": "Verbose output (default: false)", - "commands_build_uriViewers": "URI Viewers", - "commands_infra_description": "Manage infrastructure for your wrapper", + "commands_infra_description": "Modular Infrastructure-As-Code Orchestrator", "commands_infra_actions_subtitle": "Infra allows you to execute the following commands:", "commands_infra_options_options": "options", "commands_infra_options_manifest": "manifest", @@ -54,7 +53,8 @@ "commands_infra_manifest_text": "Aggregating manifest", "commands_infra_manifest_warning": "Warning aggregating manifest", "commands_infra_manifest_error": "Error aggregating manifest", - "commands_deploy_description": "Deploys/Publishes a Polywrap", + "commands_build_uriViewers": "URI Viewers", + "commands_deploy_description": "Deploys Polywrap Projects", "commands_deploy_options_options": "options", "commands_deploy_options_o_path": "path", "commands_deploy_options_o_string": "string", @@ -69,7 +69,7 @@ "commands_deploy_error_pathMissing": "{option} option missing {argument} argument", "commands_deploy_error_nameMissing": "{option} option missing {argument} argument", "commands_deploy_error_cidMissing": "{option} option missing {argument} argument", - "commands_codegen_description": "Auto-generate Wrapper Types", + "commands_codegen_description": "Generate Code For Polywrap Projects", "commands_codegen_error_domain": "domain", "commands_codegen_error_optionMissingArgument": "{option} option missing {argument} argument", "commands_codegen_options_codegen": "Output directory for the generated code (default: {default})", @@ -83,6 +83,7 @@ "commands_codegen_options_o": "Output directory for custom generated types (default: 'types/')", "commands_codegen_options_o_path": "path", "commands_codegen_success": "Types were generated successfully", + "commands_codegen_options_publish": "Output path for the built schema and manifest (default: {default})", "commands_docgen_description": "Generate wrapper documentation", "commands_docgen_success": "Docs were generated successfully", "commands_docgen_default": "default", @@ -91,7 +92,8 @@ "commands_docgen_options_schema": "Generate GraphQL schema", "commands_docgen_options_markdown": "Generate {framework} markdown", "commands_docgen_options_i": "Also generate docs for dependencies", - "commands_create_description": "Create a new project with polywrap CLI", + "commands_docgen_error_manifestNotFound": "Manifest not found. Search paths used: {paths}", + "commands_create_description": "Create New Projects", "commands_create_directoryExists": "Directory with name {dir} already exists", "commands_create_error_commandFail": "Command failed: {error}", "commands_create_error_noCommand": "Please provide a command", @@ -117,37 +119,6 @@ "commands_create_readyPlugin": "You are ready to build a plugin into a Polywrap", "commands_create_readyProtocol": "You are ready to turn your protocol into a Polywrap", "commands_create_settingUp": "Setting everything up...", - "commands_app_description": "Build/generate types for your app", - "commands_app_codegen": "Generate code for the app", - "commands_app_options_command": "command", - "commands_app_options_codegen": "Output directory for the generated code (default: {default})", - "commands_app_options_m": "Path to the Polywrap App manifest file (default: {default})", - "commands_app_success": "Code was generated successfully", - "commands_app_namespace_success": "Generated {content} for namespace {namespace}", - "commands_app_topLevel_success": "Generated top-level code for app", - "commands_app_error_optionMissingArgument": "{option} option missing {argument} argument", - "commands_app_error_manifestNotFound": "Manifest not found. Search paths used: {paths}", - "commands_app_error_unknownCommand": "Unrecognized command: {command}", - "commands_app_error_duplicateNs": "Duplicate namespace in app manifest", - "commands_app_error_noCommand": "Please provide a command", - "commands_plugin_description": "Build/generate types for the plugin", - "commands_plugin_error_domain": "domain", - "commands_plugin_error_noCommand": "Please provide a command", - "commands_plugin_error_unknownCommand": "Unrecognized command: {command}", - "commands_plugin_error_optionMissingArgument": "{option} option missing {argument} argument", - "commands_plugin_commands_codegen": "Generate code for the plugin", - "commands_plugin_options_command": "command", - "commands_plugin_options_e": "ENS address to lookup external schemas (default: 0x0000...2e1e)", - "commands_plugin_options_e_address": "address", - "commands_plugin_options_h": "Show usage information", - "commands_plugin_options_i": "IPFS node to load external schemas (default: dev-server's node)", - "commands_plugin_options_i_node": "node", - "commands_plugin_options_lang": "lang", - "commands_plugin_options_langs": "langs", - "commands_plugin_options_m": "Path to the Polywrap Plugin manifest file (default: {default})", - "commands_plugin_options_path": "path", - "commands_plugin_options_publish": "Output path for the built schema and manifest (default: {default})", - "commands_plugin_options_codegen": "Output directory for the generated types (default: {default})", "commands_run_options_workflow": "workflow", "commands_run_options_workflowScript": "Path to workflow script", "commands_run_options_outputFilePath": "output-file-path", @@ -186,7 +157,7 @@ "commands_run_error_envsItemNotObject": "Env at index {index} must be an object with properties 'uri'", "commands_run_error_envsItemUriNotString": "Env property 'uri' at index {index} must be a valid wrap:// URI string", "commands_run_error_envsItemModuleNotObject": "Env property 'env' at index {index} must be an object", - "commands_run_description": "Runs workflow script", + "commands_run_description": "Runs Workflows", "commands_run_error_missingScript": "Required argument {script} is missing", "commands_run_error_noApi": "API needs to be initialized", "commands_run_error_readFail": "Failed to read query {query}", @@ -194,19 +165,6 @@ "commands_run_error_cueDoesNotExist": "Require cue to run validator, checkout https://cuelang.org/ for more information", "commands_run_error_noWorkflowScriptFound": "Workflow script not found at path: {path}", "commands_run_error_noTestEnvFound": "polywrap test-env not found, please run 'polywrap infra up --modules=eth-ens-ipfs'", - "commands_testEnv_description": "Manage a test environment for Polywrap", - "commands_testEnv_error_never": "This should never happen...", - "commands_testEnv_error_noCommand": "No command given", - "commands_testEnv_error_unrecognizedCommand": "Unrecognized command: {command}", - "commands_testEnv_options_command": "command", - "commands_testEnv_options_start": "Startup the test env", - "commands_testEnv_options_stop": "Shutdown the test env", - "commands_testEnv_shutdown_error": "Failed to shutdown test environment", - "commands_testEnv_shutdown_text": "Shutting down test environment...", - "commands_testEnv_shutdown_warning": "Warning shutting down test environment", - "commands_testEnv_startup_error": "Failed to start test environment", - "commands_testEnv_startup_text": "Starting test environment...", - "commands_testEnv_startup_warning": "Warning starting test environment", "commands_polywrap_error_notACommand": "is not a command", "commands_polywrap_helpPrompt": "Type {command} to view common commands", "lib_codeGenerator_genCodeError": "Failed to generate types", diff --git a/packages/cli/src/__tests__/e2e/app.spec.ts b/packages/cli/src/__tests__/e2e/app.spec.ts deleted file mode 100644 index 5eb599f5d8..0000000000 --- a/packages/cli/src/__tests__/e2e/app.spec.ts +++ /dev/null @@ -1,217 +0,0 @@ -import { clearStyle, polywrapCli } from "./utils"; - -import { runCLI } from "@polywrap/test-env-js"; -import { GetPathToCliTestFiles } from "@polywrap/test-cases"; -import path from "path"; -import fs from "fs"; -import os from "os"; -import rimraf from "rimraf"; -import { compareSync } from "dir-compare"; - -const HELP = `Usage: polywrap app|a [options] [command] - -Build/generate types for your app - -Options: - -h, --help display help for command - -Commands: - codegen [options] Generate code for the app - help [command] display help for command -`; - -const CODEGEN_SUCCESS = `- Manifest loaded from ./polywrap.app.yaml -✔ Manifest loaded from ./polywrap.app.yaml -- Generate types -✔ Generate types -🔥 Code was generated successfully 🔥 -`; - -describe("e2e tests for app command", () => { - const testCaseRoot = path.join(GetPathToCliTestFiles(), "app", "codegen"); - const testCases = fs - .readdirSync(testCaseRoot, { withFileTypes: true }) - .filter((dirent) => dirent.isDirectory()) - .map((dirent) => dirent.name); - const getTestCaseDir = (index: number) => - path.join(testCaseRoot, testCases[index]); - - const testCliOutput = ( - testCaseDir: string, - exitCode: number, - stdout: string, - stder: string - ) => { - const output = clearStyle(stdout); - const error = clearStyle(stder); - - const expected = JSON.parse( - fs.readFileSync( - path.join(testCaseDir, "expected", "stdout.json"), - "utf-8" - ) - ); - - if (expected.stdout) { - if (Array.isArray(expected.stdout)) { - for (const line of expected.stdout) { - expect(output).toContain(line); - } - } else { - expect(output).toContain(expected.stdout); - } - } - - if (expected.stderr) { - if (Array.isArray(expected.stderr)) { - for (const line of expected.stderr) { - expect(error).toContain(line); - } - } else { - expect(error).toContain(expected.stderr); - } - } - - if (expected.exitCode) { - expect(exitCode).toEqual(expected.exitCode); - } - - if (expected.files) { - for (const file of expected.files) { - expect(fs.existsSync(path.join(testCaseDir, file))).toBeTruthy(); - } - } - }; - - const testCodegenOutput = (testCaseDir: string, codegenDir: string) => { - if (fs.existsSync(path.join(testCaseDir, "expected", "wrap"))) { - const expectedTypesResult = compareSync( - codegenDir, - path.join(testCaseDir, "expected", "wrap"), - { compareContent: true } - ); - expect(expectedTypesResult.differences).toBe(0); - } - }; - - it("Should show help text", async () => { - const { exitCode: code, stdout: output, stderr: error } = await runCLI({ - args: ["app", "--help"], - cwd: getTestCaseDir(0), - cli: polywrapCli, - }); - - expect(code).toEqual(0); - expect(error).toBe(""); - expect(clearStyle(output)).toEqual(HELP); - }); - - it("Should show help for no command", async () => { - const { exitCode: code, stdout: output, stderr: error } = await runCLI({ - args: ["app"], - cwd: getTestCaseDir(0), - cli: polywrapCli, - }); - - expect(code).toEqual(1); - expect(error).toBe(HELP); - expect(output).toBe(""); - }); - - it("Should throw error for invalid command", async () => { - const { exitCode: code, stdout: output, stderr: error } = await runCLI({ - args: ["app", "invalid"], - cwd: getTestCaseDir(0), - cli: polywrapCli, - }); - - expect(code).toEqual(1); - expect(error).toBe("error: unknown command 'invalid'\n"); - expect(output).toEqual(``); - }); - - it("Should throw error for unknown option --output-dir", async () => { - const { exitCode: code, stdout: output, stderr: error } = await runCLI({ - args: ["app", "--output-dir"], - cwd: getTestCaseDir(0), - cli: polywrapCli, - }); - - expect(code).toEqual(1); - expect(error).toBe("error: unknown option '--output-dir'\n"); - expect(output).toEqual(``); - }); - - describe("missing option arguments", () => { - const missingOptionArgs = { - "--manifest-file": "-m, --manifest-file ", - "--codegen-dir": "-g, --codegen-dir ", - "--client-config": "-c, --client-config " - } - - for (const [option, errorMessage] of Object.entries(missingOptionArgs)) { - it(`Should throw error if params not specified for ${option} option`, async () => { - const { exitCode: code, stdout: output, stderr: error } = await runCLI({ - args: ["app", "codegen", option], - cwd: getTestCaseDir(0), - cli: polywrapCli, - }); - - expect(code).toEqual(1); - expect(error).toBe( - `error: option '${errorMessage}' argument missing\n` - ); - expect(output).toEqual(``); - }); - } - }); - - it("Should store generated files to specified codegen dir", async () => { - const testCaseDir = getTestCaseDir(0); - const codegenDir = fs.mkdtempSync( - path.join(os.tmpdir(), `polywrap-cli-tests`) - ); - const { exitCode: code, stdout: output, stderr: error } = await runCLI({ - args: ["app", "codegen", "--codegen-dir", codegenDir], - cwd: getTestCaseDir(0), - cli: polywrapCli, - }); - - expect(error).toBe(""); - expect(code).toEqual(0); - expect(clearStyle(output)).toEqual(CODEGEN_SUCCESS); - - testCodegenOutput(testCaseDir, codegenDir); - - rimraf.sync(codegenDir); - }); - - describe("test-cases", () => { - for (let i = 0; i < testCases.length; ++i) { - const testCaseName = testCases[i]; - const testCaseDir = getTestCaseDir(i); - - let cmdArgs: string[] = []; - let cmdFile = path.join(testCaseDir, "cmd.json"); - if (fs.existsSync(cmdFile)) { - const cmdConfig = JSON.parse(fs.readFileSync(cmdFile, "utf-8")); - if (cmdConfig.args) { - cmdArgs.push(...cmdConfig.args); - } - } - - test(testCaseName, async () => { - const { exitCode: code, stdout: output, stderr: error } = await runCLI({ - args: ["app", "codegen", ...cmdArgs], - cwd: testCaseDir, - cli: polywrapCli, - }); - - const codegenDir = path.resolve(testCaseDir, "src", "wrap"); - - testCliOutput(testCaseDir, code, output, error); - testCodegenOutput(testCaseDir, codegenDir); - }); - } - }); -}); diff --git a/packages/cli/src/__tests__/e2e/build.spec.ts b/packages/cli/src/__tests__/e2e/build.spec.ts index a8f35e0862..5179d691c0 100644 --- a/packages/cli/src/__tests__/e2e/build.spec.ts +++ b/packages/cli/src/__tests__/e2e/build.spec.ts @@ -9,7 +9,7 @@ import path from "path"; const HELP = `Usage: polywrap build|b [options] -Builds a wrapper +Build Polywrap Projects (type: interface, wasm) Options: -m, --manifest-file Path to the Polywrap Build manifest file diff --git a/packages/cli/src/__tests__/e2e/codegen.app.spec.ts b/packages/cli/src/__tests__/e2e/codegen.app.spec.ts new file mode 100644 index 0000000000..ed0d8d334d --- /dev/null +++ b/packages/cli/src/__tests__/e2e/codegen.app.spec.ts @@ -0,0 +1,47 @@ +import { polywrapCli } from "./utils"; + +import { runCLI } from "@polywrap/test-env-js"; +import { GetPathToCliTestFiles } from "@polywrap/test-cases"; +import path from "path"; +import fs from "fs"; +import { testCliOutput } from "./helpers/testCliOutput"; +import { testCodegenOutput } from "./helpers/testCodegenOutput"; + +describe("e2e tests for codegen command - app project", () => { + const testCaseRoot = path.join(GetPathToCliTestFiles(), "app", "codegen"); + const testCases = fs + .readdirSync(testCaseRoot, { withFileTypes: true }) + .filter((dirent) => dirent.isDirectory()) + .map((dirent) => dirent.name); + const getTestCaseDir = (index: number) => + path.join(testCaseRoot, testCases[index]); + + describe("test-cases", () => { + for (let i = 0; i < testCases.length; ++i) { + const testCaseName = testCases[i]; + const testCaseDir = getTestCaseDir(i); + + let cmdArgs: string[] = []; + let cmdFile = path.join(testCaseDir, "cmd.json"); + if (fs.existsSync(cmdFile)) { + const cmdConfig = JSON.parse(fs.readFileSync(cmdFile, "utf-8")); + if (cmdConfig.args) { + cmdArgs.push(...cmdConfig.args); + } + } + + test(testCaseName, async () => { + const { exitCode: code, stdout: output, stderr: error } = await runCLI({ + args: ["codegen", ...cmdArgs], + cwd: testCaseDir, + cli: polywrapCli, + }); + + const codegenDir = path.resolve(testCaseDir, "src", "wrap"); + + testCliOutput(testCaseDir, code, output, error); + testCodegenOutput(testCaseDir, codegenDir); + }); + } + }); +}); diff --git a/packages/cli/src/__tests__/e2e/codegen.plugin.spec.ts b/packages/cli/src/__tests__/e2e/codegen.plugin.spec.ts new file mode 100644 index 0000000000..e9db04942a --- /dev/null +++ b/packages/cli/src/__tests__/e2e/codegen.plugin.spec.ts @@ -0,0 +1,51 @@ +import { runCLI } from "@polywrap/test-env-js"; +import { GetPathToCliTestFiles } from "@polywrap/test-cases"; +import path from "path"; +import fs from "fs"; +import { testCliOutput } from "./helpers/testCliOutput"; +import { testCodegenOutput } from "./helpers/testCodegenOutput"; + +describe("e2e tests for codegen command - plugin project", () => { + const testCaseRoot = path.join(GetPathToCliTestFiles(), "plugin/codegen"); + const testCases = fs + .readdirSync(testCaseRoot, { withFileTypes: true }) + .filter((dirent) => dirent.isDirectory()) + .map((dirent) => dirent.name); + const getTestCaseDir = (index: number) => + path.join(testCaseRoot, testCases[index]); + + describe("test-cases", () => { + for (let i = 0; i < testCases.length; ++i) { + const testCaseName = testCases[i]; + const testCaseDir = getTestCaseDir(i); + + let codegenDir = path.join(testCaseDir, "src", "wrap"); + let buildDir = path.join(testCaseDir, "build"); + let cmdArgs: string[] = []; + let cmdFile = path.join(testCaseDir, "cmd.json"); + if (fs.existsSync(cmdFile)) { + const cmdConfig = JSON.parse(fs.readFileSync(cmdFile, "utf-8")); + if (cmdConfig.args) { + cmdArgs.push(...cmdConfig.args); + } + + if (cmdConfig.codegenDir) { + codegenDir = path.join(testCaseDir, cmdConfig.codegenDir); + } + + if (cmdConfig.buildDir) { + buildDir = path.join(testCaseDir, cmdConfig.buildDir); + } + } + + test(testCaseName, async () => { + const { exitCode: code, stdout: output, stderr: error } = await runCLI({ + args: ["codegen", ...cmdArgs], + cwd: testCaseDir, + }); + testCliOutput(testCaseDir, code, output, error); + testCodegenOutput(testCaseDir, codegenDir, buildDir); + }); + } + }); +}); diff --git a/packages/cli/src/__tests__/e2e/codegen.spec.ts b/packages/cli/src/__tests__/e2e/codegen.spec.ts index de85762fd6..a0ae99810c 100644 --- a/packages/cli/src/__tests__/e2e/codegen.spec.ts +++ b/packages/cli/src/__tests__/e2e/codegen.spec.ts @@ -6,17 +6,18 @@ import path from "path"; import fs from "fs"; import os from "os"; import rimraf from "rimraf"; -import { compareSync } from "dir-compare"; const HELP = `Usage: polywrap codegen|g [options] -Auto-generate Wrapper Types +Generate Code For Polywrap Projects Options: -m, --manifest-file Path to the Polywrap manifest file (default: polywrap.yaml | polywrap.yml) -g, --codegen-dir Output directory for the generated code - (default: ./wrap) + (default: ./src/wrap) + -p, --publish-dir Output path for the built schema and + manifest (default: ./build) -s, --script Path to a custom generation script (JavaScript | TypeScript) -c, --client-config Add custom configuration to the @@ -33,64 +34,6 @@ describe("e2e tests for codegen command", () => { const getTestCaseDir = (index: number) => path.join(testCaseRoot, testCases[index]); - const testCliOutput = ( - testCaseDir: string, - exitCode: number, - stdout: string, - stder: string - ) => { - const output = clearStyle(stdout); - const error = clearStyle(stder); - - const expected = JSON.parse( - fs.readFileSync( - path.join(testCaseDir, "expected", "stdout.json"), - "utf-8" - ) - ); - - if (expected.stdout) { - if (Array.isArray(expected.stdout)) { - for (const line of expected.stdout) { - expect(output).toContain(line); - } - } else { - expect(output).toContain(expected.stdout); - } - } - - if (expected.stderr) { - if (Array.isArray(expected.stderr)) { - for (const line of expected.stderr) { - expect(error).toContain(line); - } - } else { - expect(error).toContain(expected.stderr); - } - } - - if (expected.exitCode) { - expect(exitCode).toEqual(expected.exitCode); - } - - if (expected.files) { - for (const file of expected.files) { - expect(fs.existsSync(path.join(testCaseDir, file))).toBeTruthy(); - } - } - }; - - const testCodegenOutput = (testCaseDir: string, codegenDir: string) => { - if (fs.existsSync(path.join(testCaseDir, "expected", "wrap"))) { - const expectedTypesResult = compareSync( - codegenDir, - path.join(testCaseDir, "expected", "wrap"), - { compareContent: true } - ); - expect(expectedTypesResult.differences).toBe(0); - } - }; - test("Should show help text", async () => { const { exitCode: code, stdout: output, stderr: error } = await runCLI({ args: ["codegen", "--help"], @@ -207,36 +150,4 @@ describe("e2e tests for codegen command", () => { rimraf.sync(`${getTestCaseDir(0)}/types`); }); - - describe("test-cases", () => { - for (let i = 0; i < testCases.length; ++i) { - const testCaseName = testCases[i]; - const testCaseDir = getTestCaseDir(i); - - let codegenDir = path.join(testCaseDir, "src", "wrap"); - let cmdArgs: string[] = []; - let cmdFile = path.join(testCaseDir, "cmd.json"); - if (fs.existsSync(cmdFile)) { - const cmdConfig = JSON.parse(fs.readFileSync(cmdFile, "utf-8")); - if (cmdConfig.args) { - cmdArgs.push(...cmdConfig.args); - } - - if(cmdConfig.codegenDir) { - codegenDir = path.join(testCaseDir, cmdConfig.codegenDir); - } - } - - test(testCaseName, async () => { - let { exitCode, stdout, stderr } = await runCLI({ - args: ["codegen", ...cmdArgs], - cwd: testCaseDir, - cli: polywrapCli, - }); - - testCliOutput(testCaseDir, exitCode, stdout, stderr); - testCodegenOutput(testCaseDir, codegenDir); - }); - } - }); }); diff --git a/packages/cli/src/__tests__/e2e/codegen.wasm.spec.ts b/packages/cli/src/__tests__/e2e/codegen.wasm.spec.ts new file mode 100644 index 0000000000..600af4af76 --- /dev/null +++ b/packages/cli/src/__tests__/e2e/codegen.wasm.spec.ts @@ -0,0 +1,50 @@ +import { polywrapCli } from "./utils"; + +import { runCLI } from "@polywrap/test-env-js"; +import { GetPathToCliTestFiles } from "@polywrap/test-cases"; +import path from "path"; +import fs from "fs"; +import { testCliOutput } from "./helpers/testCliOutput"; +import { testCodegenOutput } from "./helpers/testCodegenOutput"; + +describe("e2e tests for codegen command - wasm/interface project", () => { + const testCaseRoot = path.join(GetPathToCliTestFiles(), "wasm/codegen"); + const testCases = fs + .readdirSync(testCaseRoot, { withFileTypes: true }) + .filter((dirent) => dirent.isDirectory()) + .map((dirent) => dirent.name); + const getTestCaseDir = (index: number) => + path.join(testCaseRoot, testCases[index]); + + describe("test-cases", () => { + for (let i = 0; i < testCases.length; ++i) { + const testCaseName = testCases[i]; + const testCaseDir = getTestCaseDir(i); + + let codegenDir = path.join(testCaseDir, "src", "wrap"); + let cmdArgs: string[] = []; + let cmdFile = path.join(testCaseDir, "cmd.json"); + if (fs.existsSync(cmdFile)) { + const cmdConfig = JSON.parse(fs.readFileSync(cmdFile, "utf-8")); + if (cmdConfig.args) { + cmdArgs.push(...cmdConfig.args); + } + + if (cmdConfig.codegenDir) { + codegenDir = path.join(testCaseDir, cmdConfig.codegenDir); + } + } + + test(testCaseName, async () => { + let { exitCode, stdout, stderr } = await runCLI({ + args: ["codegen", ...cmdArgs], + cwd: testCaseDir, + cli: polywrapCli, + }); + + testCliOutput(testCaseDir, exitCode, stdout, stderr); + testCodegenOutput(testCaseDir, codegenDir); + }); + } + }); +}); diff --git a/packages/cli/src/__tests__/e2e/create.spec.ts b/packages/cli/src/__tests__/e2e/create.spec.ts index 7f9fe23dd4..b93dcba5f7 100644 --- a/packages/cli/src/__tests__/e2e/create.spec.ts +++ b/packages/cli/src/__tests__/e2e/create.spec.ts @@ -6,7 +6,7 @@ import { ProjectType, supportedLangs } from "../../commands"; const HELP = `Usage: polywrap create|c [options] [command] -Create a new project with polywrap CLI +Create New Projects Options: -h, --help display help for command diff --git a/packages/cli/src/__tests__/e2e/deploy.spec.ts b/packages/cli/src/__tests__/e2e/deploy.spec.ts index e1bbaae1b1..9c561370df 100644 --- a/packages/cli/src/__tests__/e2e/deploy.spec.ts +++ b/packages/cli/src/__tests__/e2e/deploy.spec.ts @@ -17,7 +17,7 @@ import yaml from "js-yaml"; const HELP = `Usage: polywrap deploy|d [options] -Deploys/Publishes a Polywrap +Deploys Polywrap Projects Options: -m, --manifest-file Path to the Polywrap Deploy manifest file diff --git a/packages/cli/src/__tests__/e2e/help.spec.ts b/packages/cli/src/__tests__/e2e/help.spec.ts index f271e15f2a..db82baad9b 100644 --- a/packages/cli/src/__tests__/e2e/help.spec.ts +++ b/packages/cli/src/__tests__/e2e/help.spec.ts @@ -9,14 +9,12 @@ Options: -h, --help display help for command Commands: - app|a Build/generate types for your app - build|b [options] Builds a wrapper - codegen|g [options] Auto-generate Wrapper Types - create|c Create a new project with polywrap CLI - deploy|d [options] Deploys/Publishes a Polywrap - plugin|p Build/generate types for the plugin - infra|i [options] Manage infrastructure for your wrapper - run|r [options] Runs workflow script + build|b [options] Build Polywrap Projects (type: interface, wasm) + codegen|g [options] Generate Code For Polywrap Projects + create|c Create New Projects + deploy|d [options] Deploys Polywrap Projects + infra|i [options] Modular Infrastructure-As-Code Orchestrator + run|r [options] Runs Workflows docgen|o [options] Generate wrapper documentation help [command] display help for command `; diff --git a/packages/cli/src/__tests__/e2e/helpers/testCliOutput.ts b/packages/cli/src/__tests__/e2e/helpers/testCliOutput.ts new file mode 100644 index 0000000000..72b72310ed --- /dev/null +++ b/packages/cli/src/__tests__/e2e/helpers/testCliOutput.ts @@ -0,0 +1,51 @@ +import { clearStyle } from "../utils"; + +import fs from "fs"; +import path from "path"; + +export const testCliOutput = ( + testCaseDir: string, + exitCode: number, + stdout: string, + stder: string +) => { + const output = clearStyle(stdout); + const error = clearStyle(stder); + + const expected = JSON.parse( + fs.readFileSync( + path.join(testCaseDir, "expected", "stdout.json"), + "utf-8" + ) + ); + + if (expected.stdout) { + if (Array.isArray(expected.stdout)) { + for (const line of expected.stdout) { + expect(output).toContain(line); + } + } else { + expect(output).toContain(expected.stdout); + } + } + + if (expected.stderr) { + if (Array.isArray(expected.stderr)) { + for (const line of expected.stderr) { + expect(error).toContain(line); + } + } else { + expect(error).toContain(expected.stderr); + } + } + + if (expected.exitCode) { + expect(exitCode).toEqual(expected.exitCode); + } + + if (expected.files) { + for (const file of expected.files) { + expect(fs.existsSync(path.join(testCaseDir, file))).toBeTruthy(); + } + } +}; \ No newline at end of file diff --git a/packages/cli/src/__tests__/e2e/helpers/testCodegenOutput.ts b/packages/cli/src/__tests__/e2e/helpers/testCodegenOutput.ts new file mode 100644 index 0000000000..4b2caed433 --- /dev/null +++ b/packages/cli/src/__tests__/e2e/helpers/testCodegenOutput.ts @@ -0,0 +1,30 @@ +import fs from "fs"; +import path from "path"; +import { compareSync } from "dir-compare"; + +export const testCodegenOutput = ( + testCaseDir: string, + codegenDir: string, + buildDir?: string +) => { + if (fs.existsSync(path.join(testCaseDir, "expected", "wrap"))) { + const expectedCodegenResult = compareSync( + codegenDir, + path.join(testCaseDir, "expected", "wrap"), + { compareContent: true } + ); + expect(expectedCodegenResult.differences).toBe(0); + } + + // HACK for testing plugin codegen output, as it outputs ABI to a build folder + if (buildDir) { + if (fs.existsSync(path.join(testCaseDir, "expected", "build-artifacts"))) { + const expectedBuildResult = compareSync( + buildDir, + path.join(testCaseDir, "expected", "build-artifacts"), + { compareContent: true } + ); + expect(expectedBuildResult.differences).toBe(0); + } + } +}; diff --git a/packages/cli/src/__tests__/e2e/infra.spec.ts b/packages/cli/src/__tests__/e2e/infra.spec.ts index 93151060a1..eb3e2d9c12 100644 --- a/packages/cli/src/__tests__/e2e/infra.spec.ts +++ b/packages/cli/src/__tests__/e2e/infra.spec.ts @@ -16,7 +16,7 @@ const testCaseRoot = path.join(GetPathToCliTestFiles(), "infra"); const HELP = `Usage: polywrap infra|i [options] -Manage infrastructure for your wrapper +Modular Infrastructure-As-Code Orchestrator Arguments: action diff --git a/packages/cli/src/__tests__/e2e/no-command.spec.ts b/packages/cli/src/__tests__/e2e/no-command.spec.ts index e301896d1a..ceae614773 100644 --- a/packages/cli/src/__tests__/e2e/no-command.spec.ts +++ b/packages/cli/src/__tests__/e2e/no-command.spec.ts @@ -9,14 +9,12 @@ Options: -h, --help display help for command Commands: - app|a Build/generate types for your app - build|b [options] Builds a wrapper - codegen|g [options] Auto-generate Wrapper Types - create|c Create a new project with polywrap CLI - deploy|d [options] Deploys/Publishes a Polywrap - plugin|p Build/generate types for the plugin - infra|i [options] Manage infrastructure for your wrapper - run|r [options] Runs workflow script + build|b [options] Build Polywrap Projects (type: interface, wasm) + codegen|g [options] Generate Code For Polywrap Projects + create|c Create New Projects + deploy|d [options] Deploys Polywrap Projects + infra|i [options] Modular Infrastructure-As-Code Orchestrator + run|r [options] Runs Workflows docgen|o [options] Generate wrapper documentation help [command] display help for command `; diff --git a/packages/cli/src/__tests__/e2e/plugin.spec.ts b/packages/cli/src/__tests__/e2e/plugin.spec.ts deleted file mode 100644 index b03588c5d0..0000000000 --- a/packages/cli/src/__tests__/e2e/plugin.spec.ts +++ /dev/null @@ -1,185 +0,0 @@ -import { clearStyle, polywrapCli } from "./utils"; - -import { runCLI } from "@polywrap/test-env-js"; -import { GetPathToCliTestFiles } from "@polywrap/test-cases"; -import { compareSync } from "dir-compare"; -import path from "path"; -import fs from "fs"; - -const HELP = `Usage: polywrap plugin|p [options] [command] - -Build/generate types for the plugin - -Options: - -h, --help display help for command - -Commands: - codegen [options] - help [command] display help for command -`; - -describe("e2e tests for plugin command", () => { - const testCaseRoot = path.join(GetPathToCliTestFiles(), "plugin/codegen"); - const testCases = - fs.readdirSync(testCaseRoot, { withFileTypes: true }) - .filter((dirent) => dirent.isDirectory()) - .map((dirent) => dirent.name); - const getTestCaseDir = (index: number) => - path.join(testCaseRoot, testCases[index]); - - const testCliOutput = ( - testCaseDir: string, - exitCode: number, - stdout: string, - stder: string - ) => { - const output = clearStyle(stdout); - const error = clearStyle(stder); - - const expected = JSON.parse( - fs.readFileSync( - path.join(testCaseDir, "expected", "stdout.json"), - "utf-8" - ) - ); - - if (expected.stdout) { - if (Array.isArray(expected.stdout)) { - for (const line of expected.stdout) { - expect(output).toContain(line); - } - } else { - expect(output).toContain(expected.stdout); - } - } - - if (expected.stderr) { - if (Array.isArray(expected.stderr)) { - for (const line of expected.stderr) { - expect(error).toContain(line); - } - } else { - expect(error).toContain(expected.stderr); - } - } - - if (expected.exitCode) { - expect(exitCode).toEqual(expected.exitCode); - } - - if (expected.files) { - for (const file of expected.files) { - expect(fs.existsSync(path.join(testCaseDir, file))).toBeTruthy(); - } - } - }; - - const testCodegenOutput = (testCaseDir: string, codegenDir: string, buildDir: string) => { - if (fs.existsSync(path.join(testCaseDir, "expected", "wrap"))) { - const expectedCodegenResult = compareSync( - codegenDir, - path.join(testCaseDir, "expected", "wrap"), - { compareContent: true } - ); - expect(expectedCodegenResult.differences).toBe(0); - } - - if (fs.existsSync(path.join(testCaseDir, "expected", "build-artifacts"))) { - const expectedBuildResult = compareSync( - buildDir, - path.join(testCaseDir, "expected", "build-artifacts"), - { compareContent: true } - ); - expect(expectedBuildResult.differences).toBe(0); - } - }; - - test("Should show help text", async () => { - const { exitCode: code, stdout: output, stderr: error } = await runCLI( - { - args: ["plugin", "--help"], - cwd: getTestCaseDir(0), - } - ); - - expect(code).toEqual(0); - expect(error).toBe(""); - expect(clearStyle(output)).toEqual(HELP); - }); - - test("Should throw error for invalid params - no command", async () => { - const { exitCode: code, stderr: error, stdout: output } = await runCLI( - { - args: ["plugin", "--codegen-dir"], - cwd: getTestCaseDir(0), - } - ); - - expect(code).toEqual(1); - expect(error).toContain("error: unknown option '--codegen-dir'"); - expect(output).toBe(""); - }); - - describe("missing option arguments", () => { - const missingOptionArgs = { - "--manifest-file": "-m, --manifest-file ", - "--publish-dir": "-p, --publish-dir ", - "--codegen-dir": "-g, --codegen-dir ", - "--client-config": "-c, --client-config " - }; - - for (const [option, errorMessage] of Object.entries(missingOptionArgs)) { - it(`Should throw error if params not specified for ${option} option`, async () => { - const { exitCode: code, stdout: output, stderr: error } = await runCLI({ - args: ["plugin", "codegen", option], - cwd: getTestCaseDir(0), - cli: polywrapCli, - }); - - expect(code).toEqual(1); - expect(error).toBe( - `error: option '${errorMessage}' argument missing\n` - ); - expect(output).toEqual(``); - }); - } - }); - - describe("test-cases", () => { - for (let i = 0; i < testCases.length; ++i) { - const testCaseName = testCases[i]; - const testCaseDir = getTestCaseDir(i); - - let codegenDir = path.join(testCaseDir, "src", "wrap"); - let buildDir = path.join(testCaseDir, "build"); - let cmdArgs: string[] = []; - let cmdFile = path.join(testCaseDir, "cmd.json"); - if (fs.existsSync(cmdFile)) { - const cmdConfig = JSON.parse(fs.readFileSync(cmdFile, "utf-8")); - if (cmdConfig.args) { - cmdArgs.push(...cmdConfig.args); - } - - if(cmdConfig.codegenDir) { - codegenDir = path.join(testCaseDir, cmdConfig.codegenDir); - } - - if(cmdConfig.buildDir) { - buildDir = path.join(testCaseDir, cmdConfig.buildDir); - } - } - - test(testCaseName, async () => { - const { exitCode: code, stdout: output, stderr: error } = await runCLI( - { - args: ["plugin", "codegen", ...cmdArgs], - cwd: testCaseDir, - } - ); - - testCliOutput(testCaseDir, code, output, error); - testCodegenOutput(testCaseDir, codegenDir, buildDir); - }); - } - }); -}); diff --git a/packages/cli/src/__tests__/e2e/run.spec.ts b/packages/cli/src/__tests__/e2e/run.spec.ts index 954bf509b3..224eef4cb5 100644 --- a/packages/cli/src/__tests__/e2e/run.spec.ts +++ b/packages/cli/src/__tests__/e2e/run.spec.ts @@ -15,7 +15,7 @@ jest.setTimeout(200000); const HELP = `Usage: polywrap run|r [options] -Runs workflow script +Runs Workflows Options: -m, --manifest Workflow Manifest path (default: diff --git a/packages/cli/src/commands/app.ts b/packages/cli/src/commands/app.ts deleted file mode 100644 index 1f391e5841..0000000000 --- a/packages/cli/src/commands/app.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { Command, Program } from "./types"; -import { - AppProject, - CodeGenerator, - SchemaComposer, - intlMsg, - parseAppManifestFileOption, - parseClientConfigOption, - parseDirOption, -} from "../lib"; - -import { PolywrapClient, PolywrapClientConfig } from "@polywrap/client-js"; -import * as path from "path"; - -const defaultOutputTypesDir = "./src/wrap"; - -type AppCommandOptions = { - manifestFile: string; - codegenDir: string; - clientConfig: Partial; -}; - -export const app: Command = { - setup: (program: Program) => { - const appCommand = program - .command("app") - .alias("a") - .description(intlMsg.commands_app_description()); - - appCommand - .command("codegen") - .description(intlMsg.commands_app_codegen()) - .option( - `-m, --manifest-file <${intlMsg.commands_codegen_options_o_path()}>`, - intlMsg.commands_app_options_codegen({ - default: defaultOutputTypesDir, - }) - ) - .option( - `-g, --codegen-dir <${intlMsg.commands_codegen_options_o_path()}>`, - `${intlMsg.commands_app_options_codegen({ - default: defaultOutputTypesDir, - })}` - ) - .option( - `-c, --client-config <${intlMsg.commands_common_options_configPath()}>`, - `${intlMsg.commands_common_options_config()}` - ) - .action(async (options) => { - await run({ - ...options, - manifestFile: parseAppManifestFileOption(options.manifestFile), - clientConfig: await parseClientConfigOption(options.clientConfig), - codegenDir: parseDirOption(options.codegenDir, defaultOutputTypesDir), - }); - }); - }, -}; - -async function run(options: AppCommandOptions) { - const { manifestFile, codegenDir, clientConfig } = options; - - // Get client - const client = new PolywrapClient(clientConfig); - - // App project - const project = new AppProject({ - rootDir: path.dirname(manifestFile), - appManifestPath: manifestFile, - client, - }); - await project.validate(); - - const schemaComposer = new SchemaComposer({ - project, - client, - }); - const codeGenerator = new CodeGenerator({ - project, - schemaComposer, - codegenDirAbs: codegenDir, - }); - - if (await codeGenerator.generate()) { - console.log(`🔥 ${intlMsg.commands_app_success()} 🔥`); - process.exitCode = 0; - } else { - process.exitCode = 1; - } -} diff --git a/packages/cli/src/commands/build.ts b/packages/cli/src/commands/build.ts index e6c5a34750..8b75064024 100644 --- a/packages/cli/src/commands/build.ts +++ b/packages/cli/src/commands/build.ts @@ -10,7 +10,7 @@ import { defaultPolywrapManifest, isDockerInstalled, FileLock, - parseWasmManifestFileOption, + parseManifestFileOption, parseDirOption, parseClientConfigOption, } from "../lib"; @@ -59,7 +59,7 @@ export const build: Command = { .action(async (options) => { await run({ ...options, - manifestFile: parseWasmManifestFileOption(options.manifestFile), + manifestFile: parseManifestFileOption(options.manifestFile), clientConfig: await parseClientConfigOption(options.clientConfig), outputDir: parseDirOption(options.outputDir, defaultOutputDir), }); diff --git a/packages/cli/src/commands/codegen.ts b/packages/cli/src/commands/codegen.ts index 5796dc87be..1247cd1472 100644 --- a/packages/cli/src/commands/codegen.ts +++ b/packages/cli/src/commands/codegen.ts @@ -1,28 +1,33 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { Command, Program } from "./types"; import { CodeGenerator, - Compiler, - PolywrapProject, SchemaComposer, intlMsg, defaultPolywrapManifest, parseDirOption, parseCodegenScriptOption, - parseWasmManifestFileOption, + parseManifestFileOption, parseClientConfigOption, + getProjectFromManifest, + isPluginManifestLanguage, + generateWrapFile, } from "../lib"; -import path from "path"; -import { filesystem } from "gluegun"; import { PolywrapClient, PolywrapClientConfig } from "@polywrap/client-js"; +import path from "path"; +import fs from "fs"; + +const defaultCodegenDir = "./src/wrap"; +const defaultPublishDir = "./build"; -const defaultCodegenDir = "./wrap"; const pathStr = intlMsg.commands_codegen_options_o_path(); const defaultManifestStr = defaultPolywrapManifest.join(" | "); type CodegenCommandOptions = { manifestFile: string; codegenDir: string; + publishDir: string; script?: string; clientConfig: Partial; }; @@ -45,6 +50,12 @@ export const codegen: Command = { default: defaultCodegenDir, })}` ) + .option( + `-p, --publish-dir <${pathStr}>`, + `${intlMsg.commands_codegen_options_publish({ + default: defaultPublishDir, + })}` + ) .option( `-s, --script <${pathStr}>`, `${intlMsg.commands_codegen_options_s()}` @@ -59,47 +70,63 @@ export const codegen: Command = { clientConfig: await parseClientConfigOption(options.clientConfig), codegenDir: parseDirOption(options.codegenDir, defaultCodegenDir), script: parseCodegenScriptOption(options.script), - manifestFile: parseWasmManifestFileOption(options.manifestFile), + manifestFile: parseManifestFileOption(options.manifestFile), + publishDir: parseDirOption(options.publishDir, defaultPublishDir), }); }); }, }; async function run(options: CodegenCommandOptions) { - const { manifestFile, codegenDir, script, clientConfig } = options; + const { + manifestFile, + codegenDir, + script, + clientConfig, + publishDir, + } = options; // Get Client const client = new PolywrapClient(clientConfig); - // Polywrap Project - const project = new PolywrapProject({ - rootDir: path.dirname(manifestFile), - polywrapManifestPath: manifestFile, - }); - await project.validate(); + const project = await getProjectFromManifest(manifestFile); + + if (!project) { + return; + } + + const projectType = await project.getManifestLanguage(); + + let result = false; + const schemaComposer = new SchemaComposer({ project, client, }); + const codeGenerator = new CodeGenerator({ + project, + schemaComposer, + codegenDirAbs: codegenDir, + customScript: script, + }); - let result = false; - if (script) { - const codeGenerator = new CodeGenerator({ - project, - schemaComposer, - customScript: script, - codegenDirAbs: codegenDir, - }); - - result = await codeGenerator.generate(); - } else { - const compiler = new Compiler({ - project, - outputDir: filesystem.path("build"), - schemaComposer, - }); + result = await codeGenerator.generate(); + + // HACK: Codegen outputs wrap.info into a build directory for plugins, needs to be moved into a build command? + if (isPluginManifestLanguage(projectType)) { + // Output the built manifest + const manifestPath = path.join(publishDir, "wrap.info"); + + if (!fs.existsSync(publishDir)) { + fs.mkdirSync(publishDir); + } - result = await compiler.codegen(); + await generateWrapFile( + await schemaComposer.getComposedAbis(), + await project.getName(), + "plugin", + manifestPath + ); } if (result) { diff --git a/packages/cli/src/commands/deploy.ts b/packages/cli/src/commands/deploy.ts index 59df5b8b6d..a438bc7b35 100644 --- a/packages/cli/src/commands/deploy.ts +++ b/packages/cli/src/commands/deploy.ts @@ -5,7 +5,7 @@ import { DeployerHandler, DeployPackage, intlMsg, - parseWasmManifestFileOption, + parseManifestFileOption, PolywrapProject, ResultList, } from "../lib"; @@ -47,7 +47,7 @@ export const deploy: Command = { .action(async (options) => { await run({ ...options, - manifestFile: parseWasmManifestFileOption(options.manifestFile), + manifestFile: parseManifestFileOption(options.manifestFile), }); }); }, diff --git a/packages/cli/src/commands/docgen.ts b/packages/cli/src/commands/docgen.ts index 0214d72471..97d0d2cfbc 100644 --- a/packages/cli/src/commands/docgen.ts +++ b/packages/cli/src/commands/docgen.ts @@ -132,7 +132,6 @@ async function run(command: DocType, options: DocgenCommandOptions) { project = new AppProject({ rootDir: path.dirname(manifestFile), appManifestPath: manifestFile, - client, quiet: true, }); } else if (isPluginManifest) { diff --git a/packages/cli/src/commands/index.ts b/packages/cli/src/commands/index.ts index a95a003d35..b161ea24ea 100644 --- a/packages/cli/src/commands/index.ts +++ b/packages/cli/src/commands/index.ts @@ -1,9 +1,7 @@ -export * from "./app"; export * from "./build"; export * from "./codegen"; export * from "./create"; export * from "./deploy"; -export * from "./plugin"; export * from "./infra"; export * from "./run"; export * from "./docgen"; diff --git a/packages/cli/src/commands/plugin.ts b/packages/cli/src/commands/plugin.ts deleted file mode 100644 index 9e5f95d391..0000000000 --- a/packages/cli/src/commands/plugin.ts +++ /dev/null @@ -1,115 +0,0 @@ -import { Command, Program } from "./types"; -import { - CodeGenerator, - PluginProject, - SchemaComposer, - defaultPluginManifest, - intlMsg, - parseDirOption, - parsePluginManifestFileOption, - parseClientConfigOption, - generateWrapFile, -} from "../lib"; - -import path from "path"; -import { PolywrapClient, PolywrapClientConfig } from "@polywrap/client-js"; -import fs from "fs"; - -const defaultPublishDir = "./build"; -const defaultCodegenDir = "./wrap"; -const pathStr = intlMsg.commands_plugin_options_path(); -const defaultManifestStr = defaultPluginManifest.join(" | "); - -type PluginCommandOptions = { - manifestFile: string; - publishDir: string; - codegenDir: string; - clientConfig: Partial; -}; - -export const plugin: Command = { - setup: (program: Program) => { - const pluginCommand = program - .command("plugin") - .alias("p") - .description(intlMsg.commands_plugin_description()); - - pluginCommand - .command("codegen") - .option( - `-m, --manifest-file <${pathStr}>`, - `${intlMsg.commands_plugin_options_m({ - default: defaultManifestStr, - })}` - ) - .option( - `-p, --publish-dir <${pathStr}>`, - `${intlMsg.commands_plugin_options_publish({ - default: defaultPublishDir, - })}` - ) - .option( - `-g, --codegen-dir <${pathStr}>`, - `${intlMsg.commands_plugin_options_codegen({ - default: defaultCodegenDir, - })}` - ) - .option( - `-c, --client-config <${intlMsg.commands_common_options_configPath()}>`, - `${intlMsg.commands_common_options_config()}` - ) - .action(async (options) => { - await run({ - ...options, - clientConfig: await parseClientConfigOption(options.clientConfig), - manifestFile: parsePluginManifestFileOption( - options.manifestFile, - undefined - ), - publishDir: parseDirOption(options.publishDir, defaultPublishDir), - codegenDir: parseDirOption(options.codegenDir, defaultCodegenDir), - }); - }); - }, -}; -async function run(options: PluginCommandOptions) { - const { manifestFile, codegenDir, publishDir, clientConfig } = options; - - // Get Client - const client = new PolywrapClient(clientConfig); - - // Plugin project - const project = new PluginProject({ - rootDir: path.dirname(manifestFile), - pluginManifestPath: manifestFile, - }); - await project.validate(); - const manifest = await project.getManifest(); - const schemaComposer = new SchemaComposer({ - project, - client, - }); - - const codeGenerator = new CodeGenerator({ - project, - schemaComposer, - codegenDirAbs: codegenDir, - }); - - const result = await codeGenerator.generate(); - process.exitCode = result ? 0 : 1; - - // Output the built manifest - const manifestPath = path.join(publishDir, "wrap.info"); - - if (!fs.existsSync(publishDir)) { - fs.mkdirSync(publishDir); - } - - await generateWrapFile( - await schemaComposer.getComposedAbis(), - manifest.project.name, - "plugin", - manifestPath - ); -} diff --git a/packages/cli/src/lib/defaults/build-images/wasm/rust/Dockerfile.mustache b/packages/cli/src/lib/defaults/build-images/wasm/rust/Dockerfile.mustache index 8cc17a2c28..3e031dd235 100644 --- a/packages/cli/src/lib/defaults/build-images/wasm/rust/Dockerfile.mustache +++ b/packages/cli/src/lib/defaults/build-images/wasm/rust/Dockerfile.mustache @@ -24,6 +24,9 @@ RUN cargo install -f wasm-snip # Install wasm-bindgen RUN cargo install -f wasm-bindgen-cli +# Install cargo-build-deps +RUN cargo install -f cargo-build-deps + {{#polywrap_linked_packages.length}} WORKDIR /linked-packages {{/polywrap_linked_packages.length}} @@ -75,7 +78,8 @@ RUN toml set ./{{dir}}/Cargo.toml package.name "module" > ./{{dir}}/Cargo-local. mv ./{{dir}}/Cargo-local.toml ./{{dir}}/Cargo.toml && \ true -RUN cargo build --manifest-path ./{{dir}}/Cargo.toml --release +# Prebuild all project dependencies, adding them to the cache +RUN cd ./{{dir}} && cargo build-deps --release && cd /project # Copy all source files {{#include}} @@ -83,7 +87,7 @@ COPY {{.}} {{.}} {{/include}} RUN mv ./{{dir}}/Cargo.toml ./{{dir}}/Cargo-deps.toml COPY {{dir}} {{dir}} -RUN mv ./{{dir}}/Cargo-deps.toml ./{{dir}}/Cargo.toml && rm ./target/release/deps/module* +RUN mv ./{{dir}}/Cargo-deps.toml ./{{dir}}/Cargo.toml # Actual build: diff --git a/packages/cli/src/lib/defaults/deploy-modules/ens/index.ts b/packages/cli/src/lib/defaults/deploy-modules/ens/index.ts index ccf6e1e920..9bfdfa350b 100644 --- a/packages/cli/src/lib/defaults/deploy-modules/ens/index.ts +++ b/packages/cli/src/lib/defaults/deploy-modules/ens/index.ts @@ -52,20 +52,21 @@ class ENSPublisher implements Deployer { "ens" )}`; + const connections = new Connections({ + networks: { + [network]: new Connection({ + provider: config.provider, + signer, + }), + }, + defaultNetwork: network, + }); const client = new PolywrapClient({ plugins: [ { uri: ethereumPluginUri, plugin: ethereumPlugin({ - connections: new Connections({ - networks: { - [network]: new Connection({ - provider: config.provider, - signer, - }), - }, - defaultNetwork: network, - }), + connections, }), }, ], diff --git a/packages/cli/src/lib/option-parsers/docgen.ts b/packages/cli/src/lib/option-parsers/docgen.ts index 1501ff9185..805bc1b142 100644 --- a/packages/cli/src/lib/option-parsers/docgen.ts +++ b/packages/cli/src/lib/option-parsers/docgen.ts @@ -18,7 +18,7 @@ export function parseDocgenManifestFileOption( if (!manifestFile) { console.error( - intlMsg.commands_app_error_manifestNotFound({ + intlMsg.commands_docgen_error_manifestNotFound({ paths: manifestPaths.join(", "), }) ); diff --git a/packages/cli/src/lib/option-parsers/index.ts b/packages/cli/src/lib/option-parsers/index.ts index a91c77adce..785058b5b2 100644 --- a/packages/cli/src/lib/option-parsers/index.ts +++ b/packages/cli/src/lib/option-parsers/index.ts @@ -1,8 +1,6 @@ -export * from "./app"; export * from "./client-config"; export * from "./codegen"; export * from "./dir"; export * from "./docgen"; -export * from "./plugin"; export * from "./run"; -export * from "./wasm"; +export * from "./manifestFile"; diff --git a/packages/cli/src/lib/option-parsers/app.ts b/packages/cli/src/lib/option-parsers/manifestFile.ts similarity index 52% rename from packages/cli/src/lib/option-parsers/app.ts rename to packages/cli/src/lib/option-parsers/manifestFile.ts index c1658b3f91..6c58a0158c 100644 --- a/packages/cli/src/lib/option-parsers/app.ts +++ b/packages/cli/src/lib/option-parsers/manifestFile.ts @@ -1,13 +1,26 @@ import { intlMsg } from "../intl"; -import { defaultAppManifest } from "../"; +import { + defaultPolywrapManifest, + defaultAppManifest, + defaultPluginManifest, +} from ".."; import { resolvePathIfExists } from "../system"; -export function parseAppManifestFileOption( +const filterUniqueFn = (value: string, index: number, self: Array) => + self.indexOf(value) === index; + +export function parseManifestFileOption( manifestFile: string | undefined ): string { + const defaultManifests = [ + ...defaultPolywrapManifest, + ...defaultAppManifest, + ...defaultPluginManifest, + ].filter(filterUniqueFn); + const manifestPaths = manifestFile ? [manifestFile as string] - : defaultAppManifest; + : defaultManifests; manifestFile = resolvePathIfExists(manifestPaths); diff --git a/packages/cli/src/lib/option-parsers/plugin.ts b/packages/cli/src/lib/option-parsers/plugin.ts deleted file mode 100644 index 202e437224..0000000000 --- a/packages/cli/src/lib/option-parsers/plugin.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { intlMsg } from "../intl"; -import { defaultPluginManifest } from "../"; -import { resolvePathIfExists } from "../system"; - -export function parsePluginManifestFileOption( - manifestFile: string | undefined, - _: unknown -): string { - const manifestPaths = manifestFile - ? [manifestFile as string] - : defaultPluginManifest; - manifestFile = resolvePathIfExists(manifestPaths); - - if (!manifestFile) { - console.error( - intlMsg.commands_build_error_manifestNotFound({ - paths: manifestPaths.join(", "), - }) - ); - process.exit(1); - } - - return manifestFile; -} - -export function defaultPluginManifestFileOption(): string { - return parsePluginManifestFileOption(undefined, undefined); -} diff --git a/packages/cli/src/lib/option-parsers/wasm.ts b/packages/cli/src/lib/option-parsers/wasm.ts deleted file mode 100644 index 4746796494..0000000000 --- a/packages/cli/src/lib/option-parsers/wasm.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { intlMsg } from "../intl"; -import { defaultPolywrapManifest } from "../"; -import { resolvePathIfExists } from "../system"; - -export function parseWasmManifestFileOption( - manifestFile: string | undefined -): string { - const manifestPaths = manifestFile - ? [manifestFile as string] - : defaultPolywrapManifest; - - manifestFile = resolvePathIfExists(manifestPaths); - - if (!manifestFile) { - console.error( - intlMsg.commands_build_error_manifestNotFound({ - paths: manifestPaths.join(", "), - }) - ); - process.exit(1); - } - - return manifestFile; -} diff --git a/packages/cli/src/lib/project/AppProject.ts b/packages/cli/src/lib/project/AppProject.ts index 76406313e9..b29b67e19c 100644 --- a/packages/cli/src/lib/project/AppProject.ts +++ b/packages/cli/src/lib/project/AppProject.ts @@ -8,14 +8,12 @@ import { } from "./manifests"; import { AppManifest } from "@polywrap/polywrap-manifest-types-js"; -import { Client } from "@polywrap/core-js"; import { bindSchema, BindOutput } from "@polywrap/schema-bind"; import path from "path"; import { WrapAbi } from "@polywrap/wrap-manifest-types-js"; export interface AppProjectConfig extends ProjectConfig { appManifestPath: string; - client: Client; } export class AppProject extends Project { diff --git a/packages/cli/src/lib/project/PluginProject.ts b/packages/cli/src/lib/project/PluginProject.ts index 193fc76492..6a3dd9a33b 100644 --- a/packages/cli/src/lib/project/PluginProject.ts +++ b/packages/cli/src/lib/project/PluginProject.ts @@ -106,11 +106,7 @@ export class PluginProject extends Project { generationSubPath?: string ): Promise { const manifest = await this.getManifest(); - const module = manifest.source.module as string; - const moduleDirectory = this._getGenerationDirectory( - module, - generationSubPath - ); + const moduleDirectory = this._getGenerationDirectory(generationSubPath); // Clean the code generation resetDir(moduleDirectory); @@ -128,13 +124,7 @@ export class PluginProject extends Project { return bindSchema(options); } - private _getGenerationDirectory( - entryPoint: string, - generationSubPath = "wrap" - ): string { - const absolute = path.isAbsolute(entryPoint) - ? entryPoint - : path.join(this.getManifestDir(), entryPoint); - return path.join(path.dirname(absolute), generationSubPath); + private _getGenerationDirectory(generationSubPath = "src/wrap"): string { + return path.join(this.getManifestDir(), generationSubPath); } } diff --git a/packages/cli/src/lib/project/PolywrapProject.ts b/packages/cli/src/lib/project/PolywrapProject.ts index ddddb4e71b..f6567761dc 100644 --- a/packages/cli/src/lib/project/PolywrapProject.ts +++ b/packages/cli/src/lib/project/PolywrapProject.ts @@ -147,14 +147,10 @@ export class PolywrapProject extends Project { generationSubPath?: string ): Promise { const manifest = await this.getManifest(); - const module = manifest.source.module as string; - const moduleDirectory = this._getGenerationDirectory( - module, - generationSubPath - ); + const codegenDirectory = this._getGenerationDirectory(generationSubPath); // Clean the code generation - resetDir(moduleDirectory); + resetDir(codegenDirectory); const bindLanguage = polywrapManifestLanguageToBindLanguage( await this.getManifestLanguage() @@ -163,7 +159,7 @@ export class PolywrapProject extends Project { const options: BindOptions = { projectName: manifest.project.name, abi, - outputDirAbs: moduleDirectory, + outputDirAbs: codegenDirectory, bindLanguage, }; @@ -535,13 +531,7 @@ export class PolywrapProject extends Project { return undefined; } - private _getGenerationDirectory( - entryPoint: string, - generationSubPath = "wrap" - ): string { - const absolute = path.isAbsolute(entryPoint) - ? entryPoint - : path.join(this.getManifestDir(), entryPoint); - return path.join(path.dirname(absolute), generationSubPath); + private _getGenerationDirectory(generationSubPath = "src/wrap"): string { + return path.join(this.getManifestDir(), generationSubPath); } } diff --git a/packages/cli/src/lib/project/helpers/getProjectFromManifest.ts b/packages/cli/src/lib/project/helpers/getProjectFromManifest.ts new file mode 100644 index 0000000000..6cf1f33127 --- /dev/null +++ b/packages/cli/src/lib/project/helpers/getProjectFromManifest.ts @@ -0,0 +1,75 @@ +import { + AnyProjectManifest, + AnyProjectManifestLanguage, + isAppManifestLanguage, + isPluginManifestLanguage, + isPolywrapManifestLanguage, +} from "../manifests"; +import { Project } from "../Project"; +import { PolywrapProject } from "../PolywrapProject"; +import { AppProject } from "../AppProject"; +import { PluginProject } from "../PluginProject"; + +import { filesystem } from "gluegun"; +import YAML from "js-yaml"; +import path from "path"; + +type ManifestProjectTypeProps = { + // >= 0.2 + project?: { + type: AnyProjectManifestLanguage; + }; + // legacy + language?: AnyProjectManifestLanguage; +}; + +export async function getProjectFromManifest( + manifestFile: string +): Promise | undefined> { + const manifest = filesystem.read(manifestFile) as string; + const type = getProjectManifestLanguage(manifest); + if (!type) { + return undefined; + } + + let project: Project | undefined = undefined; + + if (isPolywrapManifestLanguage(type)) { + project = new PolywrapProject({ + rootDir: path.dirname(manifestFile), + polywrapManifestPath: manifestFile, + }); + } else if (isPluginManifestLanguage(type)) { + project = new PluginProject({ + rootDir: path.dirname(manifestFile), + pluginManifestPath: manifestFile, + }); + } else if (isAppManifestLanguage(type)) { + project = new AppProject({ + rootDir: path.dirname(manifestFile), + appManifestPath: manifestFile, + }); + } else { + return undefined; + } + + await project.validate(); + + return project; +} + +function getProjectManifestLanguage( + manifestStr: string +): AnyProjectManifestLanguage | undefined { + let manifest: ManifestProjectTypeProps | undefined; + + try { + manifest = JSON.parse(manifestStr) as ManifestProjectTypeProps; + } catch (e) { + manifest = YAML.safeLoad(manifestStr) as + | ManifestProjectTypeProps + | undefined; + } + + return manifest?.project?.type ?? manifest?.language; +} diff --git a/packages/cli/src/lib/project/index.ts b/packages/cli/src/lib/project/index.ts index 892a39206e..44e0986424 100644 --- a/packages/cli/src/lib/project/index.ts +++ b/packages/cli/src/lib/project/index.ts @@ -4,3 +4,4 @@ export * from "./PluginProject"; export * from "./AppProject"; export * from "./templates"; export * from "./manifests"; +export * from "./helpers/getProjectFromManifest"; diff --git a/packages/js/client-config-builder/package.json b/packages/js/client-config-builder/package.json index 3f491a0b34..98d4f1757a 100644 --- a/packages/js/client-config-builder/package.json +++ b/packages/js/client-config-builder/package.json @@ -24,14 +24,11 @@ "@polywrap/ethereum-plugin-js": "0.6.0", "@polywrap/fs-plugin-js": "0.6.0", "@polywrap/fs-resolver-plugin-js": "0.6.0", - "@polywrap/graph-node-plugin-js": "0.6.0", "@polywrap/http-plugin-js": "0.6.0", "@polywrap/ipfs-plugin-js": "0.6.0", "@polywrap/ipfs-resolver-plugin-js": "0.6.0", "@polywrap/logger-plugin-js": "0.6.0", - "@polywrap/sha3-plugin-js": "0.6.0", "@polywrap/tracing-js": "0.6.0", - "@polywrap/uts46-plugin-js": "0.6.0", "@polywrap/wrap-manifest-types-js": "0.6.0" }, "devDependencies": { diff --git a/packages/js/client-config-builder/src/bundles/default-client-config.ts b/packages/js/client-config-builder/src/bundles/default-client-config.ts index 55970320c1..0e5071ccb6 100644 --- a/packages/js/client-config-builder/src/bundles/default-client-config.ts +++ b/packages/js/client-config-builder/src/bundles/default-client-config.ts @@ -19,18 +19,35 @@ import { Connections, } from "@polywrap/ethereum-plugin-js"; import { ensResolverPlugin } from "@polywrap/ens-resolver-plugin-js"; -import { graphNodePlugin } from "@polywrap/graph-node-plugin-js"; import { httpPlugin } from "@polywrap/http-plugin-js"; import { fileSystemPlugin } from "@polywrap/fs-plugin-js"; -import { uts46Plugin } from "@polywrap/uts46-plugin-js"; -import { sha3Plugin } from "@polywrap/sha3-plugin-js"; import { loggerPlugin } from "@polywrap/logger-plugin-js"; import { fileSystemResolverPlugin } from "@polywrap/fs-resolver-plugin-js"; export const getDefaultClientConfig = (): ClientConfig => { return { - envs: [], - redirects: [], + envs: [ + { + uri: new Uri(defaultWrappers.graphNode), + env: { + provider: "https://api.thegraph.com", + }, + }, + ], + redirects: [ + { + from: new Uri("wrap://ens/sha3.polywrap.eth"), + to: new Uri(defaultWrappers.sha3), + }, + { + from: new Uri("wrap://ens/uts46.polywrap.eth"), + to: new Uri(defaultWrappers.uts46), + }, + { + from: new Uri("wrap://ens/graph-node.polywrap.eth"), + to: new Uri(defaultWrappers.graphNode), + }, + ], plugins: [ // IPFS is required for downloading Polywrap packages { @@ -54,6 +71,10 @@ export const getDefaultClientConfig = (): ClientConfig => { provider: "https://mainnet.infura.io/v3/b00b2c2cc09c487685e9fb061256d6a6", }), + goerli: new Connection({ + provider: + "https://goerli.infura.io/v3/b00b2c2cc09c487685e9fb061256d6a6", + }), }, }), }), @@ -66,20 +87,6 @@ export const getDefaultClientConfig = (): ClientConfig => { uri: new Uri("wrap://ens/js-logger.polywrap.eth"), plugin: loggerPlugin({}), }, - { - uri: new Uri("wrap://ens/uts46.polywrap.eth"), - plugin: uts46Plugin({}), - }, - { - uri: new Uri("wrap://ens/sha3.polywrap.eth"), - plugin: sha3Plugin({}), - }, - { - uri: new Uri("wrap://ens/graph-node.polywrap.eth"), - plugin: graphNodePlugin({ - provider: "https://api.thegraph.com", - }), - }, { uri: new Uri("wrap://ens/fs.polywrap.eth"), plugin: fileSystemPlugin({}), @@ -133,3 +140,9 @@ export const defaultIpfsProviders = [ "https://ipfs.wrappers.io", "https://ipfs.io", ]; + +export const defaultWrappers = { + sha3: "wrap://ens/goerli/sha3.wrappers.eth", + uts46: "wrap://ens/goerli/uts46-lite.wrappers.eth", + graphNode: "wrap://ens/goerli/graph-node.wrappers.eth", +}; diff --git a/packages/js/client/package.json b/packages/js/client/package.json index 95fab36ba9..46b2ae3af0 100644 --- a/packages/js/client/package.json +++ b/packages/js/client/package.json @@ -28,16 +28,13 @@ "@polywrap/ethereum-plugin-js": "0.6.0", "@polywrap/fs-plugin-js": "0.6.0", "@polywrap/fs-resolver-plugin-js": "0.6.0", - "@polywrap/graph-node-plugin-js": "0.6.0", "@polywrap/http-plugin-js": "0.6.0", "@polywrap/ipfs-plugin-js": "0.6.0", "@polywrap/ipfs-resolver-plugin-js": "0.6.0", "@polywrap/logger-plugin-js": "0.6.0", "@polywrap/msgpack-js": "0.6.0", "@polywrap/schema-parse": "0.6.0", - "@polywrap/sha3-plugin-js": "0.6.0", "@polywrap/tracing-js": "0.6.0", - "@polywrap/uts46-plugin-js": "0.6.0", "@polywrap/wrap-manifest-types-js": "0.6.0", "graphql": "15.5.0", "js-yaml": "3.14.0", diff --git a/packages/js/client/src/__tests__/core/plugin-wrapper.spec.ts b/packages/js/client/src/__tests__/core/plugin-wrapper.spec.ts index e8924f873a..a9200e350b 100644 --- a/packages/js/client/src/__tests__/core/plugin-wrapper.spec.ts +++ b/packages/js/client/src/__tests__/core/plugin-wrapper.spec.ts @@ -11,9 +11,6 @@ const defaultPlugins = [ "wrap://ens/ethereum.polywrap.eth", "wrap://ens/http.polywrap.eth", "wrap://ens/js-logger.polywrap.eth", - "wrap://ens/uts46.polywrap.eth", - "wrap://ens/sha3.polywrap.eth", - "wrap://ens/graph-node.polywrap.eth", "wrap://ens/fs.polywrap.eth", "wrap://ens/fs-resolver.polywrap.eth", "wrap://ens/ipfs-resolver.polywrap.eth", diff --git a/packages/js/client/src/__tests__/core/sanity.spec.ts b/packages/js/client/src/__tests__/core/sanity.spec.ts index 47df97dea7..62d0c57dca 100644 --- a/packages/js/client/src/__tests__/core/sanity.spec.ts +++ b/packages/js/client/src/__tests__/core/sanity.spec.ts @@ -1,28 +1,41 @@ import { coreInterfaceUris } from "@polywrap/core-js"; import { Uri, PolywrapClient } from "../.."; +import { defaultWrappers } from "@polywrap/client-config-builder-js"; jest.setTimeout(200000); describe("sanity", () => { test("default client config", () => { const client = new PolywrapClient(); + + expect(client.getRedirects()).toStrictEqual([ + { + from: new Uri("wrap://ens/sha3.polywrap.eth"), + to: new Uri(defaultWrappers.sha3), + }, + { + from: new Uri("wrap://ens/uts46.polywrap.eth"), + to: new Uri(defaultWrappers.uts46), + }, + { + from: new Uri("wrap://ens/graph-node.polywrap.eth"), + to: new Uri(defaultWrappers.graphNode), + }, + ]); + const expectedPlugins = [ new Uri("wrap://ens/ipfs.polywrap.eth"), new Uri("wrap://ens/ens-resolver.polywrap.eth"), new Uri("wrap://ens/ethereum.polywrap.eth"), new Uri("wrap://ens/http.polywrap.eth"), new Uri("wrap://ens/js-logger.polywrap.eth"), - new Uri("wrap://ens/uts46.polywrap.eth"), - new Uri("wrap://ens/sha3.polywrap.eth"), - new Uri("wrap://ens/graph-node.polywrap.eth"), new Uri("wrap://ens/fs.polywrap.eth"), new Uri("wrap://ens/fs-resolver.polywrap.eth"), new Uri("wrap://ens/ipfs-resolver.polywrap.eth"), ]; const actualPlugins = client.getPlugins().map(x => x.uri); - - expect(client.getRedirects()).toStrictEqual([]); expect(expectedPlugins).toStrictEqual(actualPlugins); + expect(client.getInterfaces()).toStrictEqual([ { interface: coreInterfaceUris.uriResolver, @@ -69,6 +82,18 @@ describe("sanity", () => { const redirects = client.getRedirects(); expect(redirects).toEqual([ + { + from: new Uri("wrap://ens/sha3.polywrap.eth"), + to: new Uri(defaultWrappers.sha3), + }, + { + from: new Uri("wrap://ens/uts46.polywrap.eth"), + to: new Uri(defaultWrappers.uts46), + }, + { + from: new Uri("wrap://ens/graph-node.polywrap.eth"), + to: new Uri(defaultWrappers.graphNode), + }, { from: new Uri(implementation1Uri), to: new Uri(implementation2Uri), diff --git a/packages/js/client/src/__tests__/e2e/test-cases.ts b/packages/js/client/src/__tests__/e2e/test-cases.ts index 19361878a6..db945853e0 100644 --- a/packages/js/client/src/__tests__/e2e/test-cases.ts +++ b/packages/js/client/src/__tests__/e2e/test-cases.ts @@ -755,10 +755,14 @@ export const runObjectTypesTest = async ( export const runMapTypeTest = async (client: PolywrapClient, uri: string) => { const mapClass = new Map().set("Hello", 1).set("Heyo", 50); + const nestedMapClass = new Map>().set("Nested", mapClass); const mapRecord: Record = { Hello: 1, Heyo: 50, }; + const nestedMapRecord: Record> = { + Nested: mapRecord + }; const returnMapResponse1 = await client.invoke>({ uri, @@ -785,7 +789,8 @@ export const runMapTypeTest = async (client: PolywrapClient, uri: string) => { method: "getKey", args: { foo: { - map: mapClass + map: mapClass, + nestedMap: nestedMapClass }, key: "Hello", }, @@ -798,7 +803,8 @@ export const runMapTypeTest = async (client: PolywrapClient, uri: string) => { method: "getKey", args: { foo: { - map: mapRecord + map: mapRecord, + nestedMap: nestedMapRecord }, key: "Heyo", }, @@ -806,17 +812,31 @@ export const runMapTypeTest = async (client: PolywrapClient, uri: string) => { expect(getKeyResponse2.error).toBeUndefined(); expect(getKeyResponse2.data).toEqual(mapRecord.Heyo); - const returnCustomMap = await client.invoke({ + const returnCustomMap = await client.invoke<{ + map: Map, + nestedMap: Map> + }>({ uri, method: "returnCustomMap", args: { foo: { - map: mapRecord + map: mapRecord, + nestedMap: nestedMapClass } }, }); expect(returnCustomMap.error).toBeUndefined(); - expect(returnCustomMap.data).toEqual({ map: mapClass }); + expect(returnCustomMap.data).toEqual({ map: mapClass, nestedMap: nestedMapClass }); + + const returnNestedMap = await client.invoke>>({ + uri, + method: "returnNestedMap", + args: { + foo: nestedMapClass + }, + }); + expect(returnNestedMap.error).toBeUndefined(); + expect(returnNestedMap.data).toEqual(nestedMapClass); }; export const runSimpleStorageTest = async ( diff --git a/packages/js/plugins/ethereum/src/Connections.ts b/packages/js/plugins/ethereum/src/Connections.ts index bdf3986ddf..730210af1a 100644 --- a/packages/js/plugins/ethereum/src/Connections.ts +++ b/packages/js/plugins/ethereum/src/Connections.ts @@ -28,6 +28,17 @@ export class Connections { } else { this.setDefaultNetwork("mainnet", Connection.fromNetwork("mainnet")); } + + // @TODO(cbrzn): Remove this once the Sha3 & Uts46 wrappers ENS has been moved to mainnet + const lacksGoerliConnection = !Object.keys(this._connections).find( + (k) => k === "goerli" + ); + if (lacksGoerliConnection) { + this.set( + "goerli", + "https://goerli.infura.io/v3/d119148113c047ca90f0311ed729c466" + ); + } } /** Returns Connection indexed by network name, or by default network if key is undefined */ diff --git a/packages/js/plugins/graph-node/README.md b/packages/js/plugins/graph-node/README.md deleted file mode 100644 index 1f66eb5b03..0000000000 --- a/packages/js/plugins/graph-node/README.md +++ /dev/null @@ -1,84 +0,0 @@ -# @polywrap/graph-node-plugin-js - -Graph Node Plugin allows the Polywrap JS Client to send queries to the [Graph Node](https://github.com/graphprotocol/graph-node). - -## Usage - -``` typescript -import { graphNodePlugin } from "@polywrap/graph-node-plugin-js"; -import { PolywrapClient } from "@polywrap/client-js"; - -export async function foo({ - - const graphNodePluginURI = "ens/graph-node.polywrap.eth"; - const provider = "https://api.thegraph.com"; - - // initialize client with the graph node plugin - const client = new PolywrapClient({ - plugins: [{ - uri, - plugin: graphNodePlugin({ - provider - }) - }] - }); - - // and send invocations to the subgraph - const response = await client.invoke({ - uri: graphNodePluginURI, - method: "querySubgraph", - args: { - subgraphAuthor: "ensdomains", - subgraphName: "ens", - query: `{ - domains(first: 5) { - id - name - labelName - labelhash - } - transfers(first: 5) { - id - domain { - id - } - blockNumber - transactionID - } - }` - } - }); - - // or instantiate the plugin - const plugin = graphNodePlugin({ - provider - }); - - // and send invocations to the subgraph - const response' = await plugin.querySubgraph({ - subgraphAuthor: "ensdomains", - subgraphName: "ens", - query: `{ - domains(first: 5) { - id - name - labelName - labelhash - } - transfers(first: 5) { - id - domain { - id - } - blockNumber - transactionID - } - }`, - }, client) -}); -``` -For more usage examples see `src/__tests__`. - -## API - -Full API in `src/schema.graphql` diff --git a/packages/js/plugins/graph-node/jest.config.js b/packages/js/plugins/graph-node/jest.config.js deleted file mode 100644 index 1ed528c8ac..0000000000 --- a/packages/js/plugins/graph-node/jest.config.js +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = { - "roots": [ - "/src" - ], - "testMatch": [ - "**/?(*.)+(spec|test).+(ts|tsx|js)" - ], - "transform": { - "^.+\\.(ts|tsx)$": "ts-jest" - }, - testEnvironment: 'node' -} diff --git a/packages/js/plugins/graph-node/package.json b/packages/js/plugins/graph-node/package.json deleted file mode 100644 index 7447d56617..0000000000 --- a/packages/js/plugins/graph-node/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "@polywrap/graph-node-plugin-js", - "description": "Polywrap Graph Node Javascript Plugin", - "version": "0.6.0", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/polywrap/monorepo.git" - }, - "main": "build/index.js", - "files": [ - "build" - ], - "scripts": { - "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", - "codegen": "node ../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", - "lint": "eslint --color -c ../../../../.eslintrc.js src/", - "test": "jest --passWithNoTests --runInBand --verbose", - "test:ci": "jest --passWithNoTests --runInBand --verbose", - "test:watch": "jest --watch --passWithNoTests --verbose" - }, - "dependencies": { - "@polywrap/core-js": "0.6.0", - "@polywrap/http-plugin-js": "0.6.0", - "apollo-link": "1.2.14", - "apollo-link-http": "1.5.17", - "cross-fetch": "3.0.5", - "graphql-tag": "2.10.4" - }, - "devDependencies": { - "@polywrap/client-js": "0.6.0", - "@types/jest": "26.0.8", - "@types/prettier": "2.6.0", - "jest": "26.6.3", - "rimraf": "3.0.2", - "ts-jest": "26.5.4", - "ts-node": "8.10.2", - "typescript": "4.0.7" - }, - "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", - "publishConfig": { - "access": "public" - } -} diff --git a/packages/js/plugins/graph-node/polywrap.plugin.yaml b/packages/js/plugins/graph-node/polywrap.plugin.yaml deleted file mode 100644 index d159679e7a..0000000000 --- a/packages/js/plugins/graph-node/polywrap.plugin.yaml +++ /dev/null @@ -1,10 +0,0 @@ -format: 0.2.0 -project: - type: plugin/typescript - name: GraphNode -source: - module: ./src/index.ts - schema: ./src/schema.graphql - import_abis: - - uri: "ens/http.polywrap.eth" - abi: ../http/build/wrap.info diff --git a/packages/js/plugins/graph-node/src/__tests__/e2e.spec.ts b/packages/js/plugins/graph-node/src/__tests__/e2e.spec.ts deleted file mode 100644 index 03d3f113b5..0000000000 --- a/packages/js/plugins/graph-node/src/__tests__/e2e.spec.ts +++ /dev/null @@ -1,179 +0,0 @@ -import { GraphNodePlugin, plugin } from ".."; -import { PolywrapClient } from "@polywrap/client-js"; - -const uri = "ens/graph-node.polywrap.eth"; -const provider = "https://api.thegraph.com"; - -jest.setTimeout(30000); - -describe("Graph Node Plugin", () => { - const client = new PolywrapClient({ - plugins: [{ - uri, - plugin: plugin({ - provider - }) - }] - }); - - const graphNode = new GraphNodePlugin({ - provider - }); - - it("Query works", async () => { - const { data, errors } = await client.query({ - uri, - query: `query { - querySubgraph( - subgraphAuthor: "ensdomains", - subgraphName: "ens", - query: $query - ) - }`, - variables: { - query: `{ - domains(first: 5) { - id - name - labelName - labelhash - } - transfers(first: 5) { - id - domain { - id - } - blockNumber - transactionID - } - }` - } - }); - - expect(errors).toBeUndefined(); - expect(data).toBeDefined(); - expect(data?.querySubgraph).toBeDefined(); - - const result = JSON.parse(data?.querySubgraph as string); - - expect(result.data).toBeDefined(); - expect(result.data.domains).toBeDefined(); - expect(result.data.transfers).toBeDefined(); - }); - - it("Throws if errors in querystring", async () => { - await expect( - graphNode.querySubgraph({ - subgraphAuthor: "ensdomains", - subgraphName: "ens", - query: `{ - domains(first: 5) { - ids - names - labelNames - labelhash - } - transfers(first: 5) { - id - domain { - id - } - blockNumber - transactionID - } - }`, - }, client) - ).rejects.toThrowError(); - - try { - await graphNode.querySubgraph({ - subgraphAuthor: "ensdomains", - subgraphName: "ens", - query: `{ - domains(first: 5) { - ids - names - labelNames - labelhash - } - transfers(first: 5) { - id - domain { - id - } - blockNumber - transactionID - } - }`, - }, client); - } catch (e) { - expect(e.message).toContain( - `Message: Type \`Domain\` has no field \`ids\`` - ); - expect(e.message).toContain( - `Message: Type \`Domain\` has no field \`names\`` - ); - expect(e.message).toContain( - `Message: Type \`Domain\` has no field \`labelNames\`` - ); - } - }); - - it("Throws if wrong subgraph name/author", async () => { - await expect( - graphNode.querySubgraph({ - subgraphAuthor: "ens", - subgraphName: "ens", - query: `{ - domains(first: 5) { - id - name - labelName - labelhash - } - transfers(first: 5) { - id - domain { - id - } - blockNumber - transactionID - } - }`, - }, client) - ).rejects.toThrowError( - new RegExp( - "`ens/ens` does not exist", - "g" - ) - ); - - await expect( - graphNode.querySubgraph({ - subgraphAuthor: "ensdomains", - subgraphName: "foo", - query: `{ - domains(first: 5) { - id - name - labelName - labelhash - } - transfers(first: 5) { - id - domain { - id - } - blockNumber - transactionID - } - }`, - }, client) - ).rejects.toThrowError( - new RegExp( - "`ensdomains/foo` does not exist", - "g" - ) - ); - }); -}); diff --git a/packages/js/plugins/graph-node/src/index.ts b/packages/js/plugins/graph-node/src/index.ts deleted file mode 100644 index 97fb020fb6..0000000000 --- a/packages/js/plugins/graph-node/src/index.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { - Client, - Module, - Args_querySubgraph, - HTTP_Module, - manifest, -} from "./wrap"; - -import { PluginFactory } from "@polywrap/core-js"; - -export interface RequestError { - errors: { - locations: { column: number; line: number }[]; - message: string; - }[]; -} - -export interface RequestData { - data: Record; -} - -export interface GraphNodePluginConfig { - provider: string; -} - -export class GraphNodePlugin extends Module { - constructor(config: GraphNodePluginConfig) { - super(config); - } - - public async querySubgraph( - args: Args_querySubgraph, - client: Client - ): Promise { - const { subgraphAuthor, subgraphName, query } = args; - const { data, error } = await HTTP_Module.post( - { - url: `${this.config.provider}/subgraphs/name/${subgraphAuthor}/${subgraphName}`, - request: { - body: JSON.stringify({ - query, - }), - responseType: "TEXT", - }, - }, - client - ); - - if (error) { - throw new Error(`GraphNodePlugin: errors encountered. Error: ${error}`); - } - - if (!data) { - throw new Error(`GraphNodePlugin: data is undefined.`); - } - - if (!data.body) { - throw Error(`GraphNodePlugin: body is undefined.`); - } - - const responseJson = JSON.parse(data.body) as RequestError | RequestData; - - const responseErrors = (responseJson as RequestError).errors; - - if (responseErrors) { - throw new Error(`GraphNodePlugin: errors in query string. Errors: - ${responseErrors - .map((err) => - err.locations - ? `\n -Locations: ${err.locations - .map((loc) => `(col: ${loc.column}, line: ${loc.line})`) - .join(", ")} \n-Message: ${err.message}` - : `\n-Message: ${err.message}` - ) - .join("\n")} - `); - } - - return JSON.stringify(responseJson); - } -} - -export const graphNodePlugin: PluginFactory = ( - config: GraphNodePluginConfig -) => { - return { - factory: () => new GraphNodePlugin(config), - manifest, - }; -}; - -export const plugin = graphNodePlugin; diff --git a/packages/js/plugins/graph-node/src/schema.graphql b/packages/js/plugins/graph-node/src/schema.graphql deleted file mode 100644 index faf378dfee..0000000000 --- a/packages/js/plugins/graph-node/src/schema.graphql +++ /dev/null @@ -1,9 +0,0 @@ -#import { Module } into HTTP from "ens/http.polywrap.eth" - -type Module { - querySubgraph( - subgraphAuthor: String! - subgraphName: String! - query: String! - ): String! -} diff --git a/packages/js/plugins/graph-node/tsconfig.build.json b/packages/js/plugins/graph-node/tsconfig.build.json deleted file mode 100644 index 77aadfdd2f..0000000000 --- a/packages/js/plugins/graph-node/tsconfig.build.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": [ - "./src/**/*.ts" - ], - "exclude": [ - "./src/**/__tests__" - ] -} diff --git a/packages/js/plugins/graph-node/tsconfig.json b/packages/js/plugins/graph-node/tsconfig.json deleted file mode 100644 index 85d516ce30..0000000000 --- a/packages/js/plugins/graph-node/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "../../../../tsconfig", - "compilerOptions": { - "outDir": "build" - }, - "include": [ - "./src/**/*.ts" - ], - "exclude": [] -} diff --git a/packages/js/plugins/sha3/README.md b/packages/js/plugins/sha3/README.md deleted file mode 100644 index ebeb95cb7c..0000000000 --- a/packages/js/plugins/sha3/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# @polywrap/sha3-plugin-js - -SHA3 Plugin provides the Polywrap JS Client with SHA-3 / Keccak / Shake hash functions. - -## Usage - -``` typescript -import { PolywrapClient } from "@polywrap/client-js" -import { sha3Plugin } from "@polywrap/sha3-plugin-js"; - -export async function foo({ - - const sha3PluginUri = "wrap://ens/sha3.polywrap.eth"; - - const client = new PolywrapClient({ - plugins: [ - { - uri: sha3PluginUri, - plugin: sha3Plugin({}), - }, - ] - }); - - const response = await client.invoke({ - uri: sha3PluginUri, - method: "sha3_512", - args: { - message: "test message to hash" - } - }) -}) -``` - -## API - -Full API in `src/schema.graphql` diff --git a/packages/js/plugins/sha3/jest.config.js b/packages/js/plugins/sha3/jest.config.js deleted file mode 100644 index 38888109ca..0000000000 --- a/packages/js/plugins/sha3/jest.config.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = { - "roots": [ - "/src" - ], - "testMatch": [ - "**/__tests__/**/*.+(ts|tsx|js)", - "**/?(*.)+(spec|test).+(ts|tsx|js)" - ], - "transform": { - "^.+\\.(ts|tsx)$": "ts-jest" - }, - testEnvironment: 'node' -} diff --git a/packages/js/plugins/sha3/package.json b/packages/js/plugins/sha3/package.json deleted file mode 100644 index ed5fbf3c17..0000000000 --- a/packages/js/plugins/sha3/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "@polywrap/sha3-plugin-js", - "description": "Polywrap SHA3 Javascript Plugin", - "version": "0.6.0", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/polywrap/monorepo.git" - }, - "main": "build/index.js", - "files": [ - "build" - ], - "scripts": { - "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", - "codegen": "node ../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", - "lint": "eslint --color -c ../../../../.eslintrc.js src/", - "test": "jest --passWithNoTests --runInBand --verbose", - "test:ci": "jest --passWithNoTests --runInBand --verbose", - "test:watch": "jest --watch --passWithNoTests --verbose" - }, - "dependencies": { - "@polywrap/core-js": "0.6.0", - "js-sha3": "0.8.0" - }, - "devDependencies": { - "@types/jest": "26.0.8", - "@types/prettier": "2.6.0", - "jest": "26.2.2", - "rimraf": "3.0.2", - "ts-jest": "26.1.4", - "ts-node": "8.10.2", - "typescript": "4.0.7" - }, - "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", - "publishConfig": { - "access": "public" - } -} diff --git a/packages/js/plugins/sha3/polywrap.plugin.yaml b/packages/js/plugins/sha3/polywrap.plugin.yaml deleted file mode 100644 index 51687cc481..0000000000 --- a/packages/js/plugins/sha3/polywrap.plugin.yaml +++ /dev/null @@ -1,7 +0,0 @@ -format: 0.2.0 -project: - name: Sha3 - type: plugin/typescript -source: - module: ./src/index.ts - schema: ./src/schema.graphql diff --git a/packages/js/plugins/sha3/src/__tests__/index.test.ts b/packages/js/plugins/sha3/src/__tests__/index.test.ts deleted file mode 100644 index 1612299747..0000000000 --- a/packages/js/plugins/sha3/src/__tests__/index.test.ts +++ /dev/null @@ -1,212 +0,0 @@ -import { PolywrapClient } from "@polywrap/client-js" -import { - sha3_512, - sha3_384, - sha3_256, - sha3_224, - keccak512, - keccak384, - keccak256, - keccak224, - shake128, - shake256, -} from "js-sha3"; -import { sha3Plugin } from ".."; - -const testMessage = "test message to hash" - -describe("js-sha3 algorithms returned values match the plugin's", () => { - let client: PolywrapClient - - beforeAll(() => { - client = new PolywrapClient({ - plugins: [ - { - uri: "wrap://ens/sha3.polywrap.eth", - plugin: sha3Plugin({ }), - }, - ] - }) - }) - - it("sha3_512 matches", async () => { - const expected = sha3_512(testMessage) - const response = await client.query<{ sha3_512: string }>({ - uri: "wrap://ens/sha3.polywrap.eth", - query: ` - query { - sha3_512(message: "${testMessage}") - } - `, - }) - - expect(response.data).toBeDefined() - expect(response.errors).toBeUndefined() - expect(response.data?.sha3_512).toBe(expected) - }) - - it("sha3_384 matches", async () => { - const expected = sha3_384(testMessage) - const response = await client.query<{ sha3_384: string }>({ - uri: "wrap://ens/sha3.polywrap.eth", - query: ` - query { - sha3_384(message: "${testMessage}") - } - `, - }) - - expect(response.data).toBeDefined() - expect(response.errors).toBeUndefined() - expect(response.data?.sha3_384).toBe(expected) - }) - - it("sha3_256 matches", async () => { - const expected = sha3_256(testMessage) - const response = await client.query<{ sha3_256: string }>({ - uri: "wrap://ens/sha3.polywrap.eth", - query: ` - query { - sha3_256(message: "${testMessage}") - } - `, - }) - - expect(response.data).toBeDefined() - expect(response.errors).toBeUndefined() - expect(response.data?.sha3_256).toBe(expected) - }) - - it("sha3_224 matches", async () => { - const expected = sha3_224(testMessage) - const response = await client.query<{ sha3_224: string }>({ - uri: "wrap://ens/sha3.polywrap.eth", - query: ` - query { - sha3_224(message: "${testMessage}") - } - `, - }) - - expect(response.data).toBeDefined() - expect(response.errors).toBeUndefined() - expect(response.data?.sha3_224).toBe(expected) - }) - - it("keccak512 matches", async () => { - const expected = keccak512(testMessage) - const response = await client.query<{ keccak_512: string }>({ - uri: "wrap://ens/sha3.polywrap.eth", - query: ` - query { - keccak_512(message: "${testMessage}") - } - `, - }) - - expect(response.data).toBeDefined() - expect(response.errors).toBeUndefined() - expect(response.data?.keccak_512).toBe(expected) - }) - - it("keccak384 matches", async () => { - const expected = keccak384(testMessage) - const response = await client.query<{ keccak_384: string }>({ - uri: "wrap://ens/sha3.polywrap.eth", - query: ` - query { - keccak_384(message: "${testMessage}") - } - `, - }) - - expect(response.data).toBeDefined() - expect(response.errors).toBeUndefined() - expect(response.data?.keccak_384).toBe(expected) - }) - - it("keccak256 matches", async () => { - const expected = keccak256(testMessage) - const response = await client.query<{ keccak_256: string }>({ - uri: "wrap://ens/sha3.polywrap.eth", - query: ` - query { - keccak_256(message: "${testMessage}") - } - `, - }) - - expect(response.data).toBeDefined() - expect(response.errors).toBeUndefined() - expect(response.data?.keccak_256).toBe(expected) - }) - - it("keccak256 buffer matches", async () => { - const encoder = new TextEncoder(); - const testMessageBuffer = encoder.encode(testMessage); - const expected = keccak256(testMessageBuffer) - const response = await client.query<{ buffer_keccak_256: Uint8Array }>({ - uri: "wrap://ens/sha3.polywrap.eth", - query: ` - query { - buffer_keccak_256(message: $message) - } - `, - variables: { - message: testMessageBuffer - } - }) - - expect(response.data).toBeDefined() - expect(response.errors).toBeUndefined() - expect(response.data?.buffer_keccak_256).toMatch(expected) - }) - - it("keccak224 matches", async () => { - const expected = keccak224(testMessage) - const response = await client.query<{ keccak_224: string }>({ - uri: "wrap://ens/sha3.polywrap.eth", - query: ` - query { - keccak_224(message: "${testMessage}") - } - `, - }) - - expect(response.data).toBeDefined() - expect(response.errors).toBeUndefined() - expect(response.data?.keccak_224).toBe(expected) - }) - - it("shake128 matches", async () => { - const expected = shake128(testMessage, 256) - const response = await client.query<{ shake_128: string }>({ - uri: "wrap://ens/sha3.polywrap.eth", - query: ` - query { - shake_128(message: "${testMessage}", outputBits: 256) - } - `, - }) - - expect(response.data).toBeDefined() - expect(response.errors).toBeUndefined() - expect(response.data?.shake_128).toBe(expected) - }) - - it("shake256 matches", async () => { - const expected = shake256(testMessage, 512) - const response = await client.query<{ shake_256: string }>({ - uri: "wrap://ens/sha3.polywrap.eth", - query: ` - query { - shake_256(message: "${testMessage}", outputBits: 512) - } - `, - }) - - expect(response.data).toBeDefined() - expect(response.errors).toBeUndefined() - expect(response.data?.shake_256).toBe(expected) - }) -}) \ No newline at end of file diff --git a/packages/js/plugins/sha3/src/index.ts b/packages/js/plugins/sha3/src/index.ts deleted file mode 100644 index 508686dcd5..0000000000 --- a/packages/js/plugins/sha3/src/index.ts +++ /dev/null @@ -1,122 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ -/* eslint-disable @typescript-eslint/naming-convention */ - -import { - Module, - Args_sha3_512, - Args_sha3_384, - Args_sha3_256, - Args_sha3_224, - Args_keccak_512, - Args_keccak_384, - Args_keccak_256, - Args_keccak_224, - Args_hex_keccak_256, - Args_buffer_keccak_256, - Args_shake_128, - Args_shake_256, - manifest, -} from "./wrap"; - -import { - sha3_512, - sha3_384, - sha3_256, - sha3_224, - keccak_512, - keccak_384, - keccak_256, - keccak_224, - shake_128, - shake_256, -} from "js-sha3"; -import { PluginFactory } from "@polywrap/core-js"; - -type NoConfig = Record; - -export class Sha3Plugin extends Module { - public sha3_512(args: Args_sha3_512): string { - return sha3_512(args.message); - } - - public sha3_384(args: Args_sha3_384): string { - return sha3_384(args.message); - } - - public sha3_256(args: Args_sha3_256): string { - return sha3_256(args.message); - } - - public sha3_224(args: Args_sha3_224): string { - return sha3_224(args.message); - } - - public keccak_512(args: Args_keccak_512): string { - return keccak_512(args.message); - } - - public keccak_384(args: Args_keccak_384): string { - return keccak_384(args.message); - } - - public keccak_256(args: Args_keccak_256): string { - return keccak_256(args.message); - } - - public hex_keccak_256(args: Args_hex_keccak_256): string { - // remove the leading 0x - const hexString = args.message.replace(/^0x/, ""); - - // ensure even number of characters - if (hexString.length % 2 != 0) { - throw Error( - `expecting an even number of characters in the hexString: ${hexString.length}` - ); - } - - // check for some non-hex characters - const bad = hexString.match(/[G-Z\s]/i); - if (bad) { - throw Error(`found non-hex characters: ${bad}`); - } - - // split the string into pairs of octets - const pairs = hexString.match(/[\dA-F]{2}/gi); - - if (!pairs) { - throw Error("Invalid hexString, unable to split into octets"); - } - - // convert the octets to integers - const integers = pairs.map((p) => { - return parseInt(p, 16); - }); - - return keccak_256(new Uint8Array(integers)); - } - - public buffer_keccak_256(args: Args_buffer_keccak_256): string { - return keccak_256(args.message); - } - - public keccak_224(args: Args_keccak_224): string { - return keccak_224(args.message); - } - - public shake_128(args: Args_shake_128): string { - return shake_128(args.message, args.outputBits); - } - - public shake_256(args: Args_shake_256): string { - return shake_256(args.message, args.outputBits); - } -} - -export const sha3Plugin: PluginFactory = () => { - return { - factory: () => new Sha3Plugin({}), - manifest, - }; -}; - -export const plugin = sha3Plugin; diff --git a/packages/js/plugins/sha3/src/schema.graphql b/packages/js/plugins/sha3/src/schema.graphql deleted file mode 100644 index 19ec276ccc..0000000000 --- a/packages/js/plugins/sha3/src/schema.graphql +++ /dev/null @@ -1,17 +0,0 @@ -type Module { - sha3_512(message: String!): String! - sha3_384(message: String!): String! - sha3_256(message: String!): String! - sha3_224(message: String!): String! - - keccak_512(message: String!): String! - keccak_384(message: String!): String! - keccak_256(message: String!): String! - keccak_224(message: String!): String! - - hex_keccak_256(message: String!): String! - buffer_keccak_256(message: Bytes!): String! - - shake_128(message: String!, outputBits: Int!): String! - shake_256(message: String!, outputBits: Int!): String! -} diff --git a/packages/js/plugins/sha3/tsconfig.build.json b/packages/js/plugins/sha3/tsconfig.build.json deleted file mode 100644 index 77aadfdd2f..0000000000 --- a/packages/js/plugins/sha3/tsconfig.build.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": [ - "./src/**/*.ts" - ], - "exclude": [ - "./src/**/__tests__" - ] -} diff --git a/packages/js/plugins/sha3/tsconfig.json b/packages/js/plugins/sha3/tsconfig.json deleted file mode 100644 index 85d516ce30..0000000000 --- a/packages/js/plugins/sha3/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "../../../../tsconfig", - "compilerOptions": { - "outDir": "build" - }, - "include": [ - "./src/**/*.ts" - ], - "exclude": [] -} diff --git a/packages/js/plugins/uri-resolvers/ens-resolver/src/__tests__/e2e.spec.ts b/packages/js/plugins/uri-resolvers/ens-resolver/src/__tests__/e2e.spec.ts index 83cae1d0e9..4a34e13b05 100644 --- a/packages/js/plugins/uri-resolvers/ens-resolver/src/__tests__/e2e.spec.ts +++ b/packages/js/plugins/uri-resolvers/ens-resolver/src/__tests__/e2e.spec.ts @@ -49,7 +49,7 @@ describe("ENS Resolver Plugin", () => { networks: { testnet: new Connection({ provider: providers.ethereum - }) + }), }, defaultNetwork: "testnet" }) diff --git a/packages/js/plugins/uts46/README.md b/packages/js/plugins/uts46/README.md deleted file mode 100644 index ed8fd960ad..0000000000 --- a/packages/js/plugins/uts46/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# @polywrap/uts46-plugin-js - -UTS46 Plugin allows Polywrap JS Client to handle internationalized domain names (IDNA), with a full mapping between Unicode and Punycode defined by [UTS #46](https://unicode.org/reports/tr46/). - -## Usage - -``` typescript -import { PolywrapClient } from "@polywrap/client-js"; -import { uts46Plugin } from "@polywrap/uts46-plugin-js"; - -export async function foo({ - - const uts46PluginUri = "wrap://ens/uts46.polywrap.eth"; - - const client = new PolywrapClient({ - plugins: [ - { - uri: uts46PluginUri, - plugin: uts46Plugin({}), - }, - ] - }); - - const response = await client.invoke({ - uri: uts46PluginUri, - method: 'toAscii', - args: { - value: "xn-bb-eka.at" - } - }); -}) -``` - -## API - -Full API in `src/schema.graphql` diff --git a/packages/js/plugins/uts46/jest.config.js b/packages/js/plugins/uts46/jest.config.js deleted file mode 100644 index 38888109ca..0000000000 --- a/packages/js/plugins/uts46/jest.config.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = { - "roots": [ - "/src" - ], - "testMatch": [ - "**/__tests__/**/*.+(ts|tsx|js)", - "**/?(*.)+(spec|test).+(ts|tsx|js)" - ], - "transform": { - "^.+\\.(ts|tsx)$": "ts-jest" - }, - testEnvironment: 'node' -} diff --git a/packages/js/plugins/uts46/package.json b/packages/js/plugins/uts46/package.json deleted file mode 100644 index 8d24ea4f85..0000000000 --- a/packages/js/plugins/uts46/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "@polywrap/uts46-plugin-js", - "description": "Polywrap IDNA-UTS #46 Javascript Plugin", - "version": "0.6.0", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/polywrap/monorepo.git" - }, - "main": "build/index.js", - "files": [ - "build" - ], - "scripts": { - "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", - "codegen": "node ../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", - "lint": "eslint --color -c ../../../../.eslintrc.js src/", - "test": "jest --passWithNoTests --runInBand --verbose", - "test:ci": "jest --passWithNoTests --runInBand --verbose", - "test:watch": "jest --watch --passWithNoTests --verbose" - }, - "dependencies": { - "@polywrap/core-js": "0.6.0", - "idna-uts46-hx": "3.4.0" - }, - "devDependencies": { - "@types/jest": "26.0.8", - "@types/prettier": "2.6.0", - "jest": "26.2.2", - "rimraf": "3.0.2", - "ts-jest": "26.1.4", - "ts-node": "8.10.2", - "typescript": "4.0.7" - }, - "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", - "publishConfig": { - "access": "public" - } -} diff --git a/packages/js/plugins/uts46/polywrap.plugin.yaml b/packages/js/plugins/uts46/polywrap.plugin.yaml deleted file mode 100644 index cb12c029f1..0000000000 --- a/packages/js/plugins/uts46/polywrap.plugin.yaml +++ /dev/null @@ -1,7 +0,0 @@ -format: 0.2.0 -project: - name: Uts46 - type: plugin/typescript -source: - module: ./src/index.ts - schema: ./src/schema.graphql diff --git a/packages/js/plugins/uts46/src/__tests__/index.test.ts b/packages/js/plugins/uts46/src/__tests__/index.test.ts deleted file mode 100644 index eefa95f67e..0000000000 --- a/packages/js/plugins/uts46/src/__tests__/index.test.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { PolywrapClient } from "@polywrap/client-js"; -import { uts46Plugin } from ".."; -const uts46 = require("idna-uts46-hx/uts46bundle.js"); - -const textToConvert = "xn-bb-eka.at"; - -describe("IDNA UTS #46", () => { - let client: PolywrapClient; - - beforeAll(() => { - client = new PolywrapClient({ - plugins: [ - { - uri: "wrap://ens/uts46.polywrap.eth", - plugin: uts46Plugin({ }), - }, - ], - }); - }); - - describe("Returned values match the plugin's", () => { - it("ToAscii matches", async () => { - const expected = uts46.toAscii(textToConvert); - const response = await client.query<{ toAscii: string }>({ - uri: "wrap://ens/uts46.polywrap.eth", - query: ` - query { - toAscii(value: "${textToConvert}") - } - `, - }); - - expect(response.data).toBeDefined(); - expect(response.errors).toBeUndefined(); - expect(response.data?.toAscii).toBe(expected); - }); - - it("ToAscii with options matches", async () => { - const expected = uts46.toAscii(textToConvert, { - transitional: false, - useStd3ASCII: true, - verifyDnsLength: false, - }); - const response = uts46.toAscii(textToConvert) - - expect(response).toBe(expected); - }); - - it("ToUnicode matches", async () => { - const expected = uts46.toUnicode(textToConvert); - const response = await client.query<{ toUnicode: string }>({ - uri: "wrap://ens/uts46.polywrap.eth", - query: ` - query { - toUnicode(value: "${textToConvert}") - } - `, - }); - - expect(response.data).toBeDefined(); - expect(response.errors).toBeUndefined(); - expect(response.data?.toUnicode).toBe(expected); - }); - - it("Convert matches", async () => { - const expected = uts46.convert(textToConvert); - const response = await client.query<{ convert: string }>({ - uri: "wrap://ens/uts46.polywrap.eth", - query: ` - query { - convert(value: "${textToConvert}") - } - `, - }); - - expect(response.data).toBeDefined(); - expect(response.errors).toBeUndefined(); - expect(response.data?.convert).toEqual(expected); - }); - }); -}); diff --git a/packages/js/plugins/uts46/src/index.ts b/packages/js/plugins/uts46/src/index.ts deleted file mode 100644 index bd751e4a66..0000000000 --- a/packages/js/plugins/uts46/src/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { - Module, - Args_toAscii, - Args_toUnicode, - Args_convert, - ConvertResult, - manifest, -} from "./wrap"; - -import { PluginFactory } from "@polywrap/core-js"; - -// eslint-disable-next-line @typescript-eslint/no-require-imports,@typescript-eslint/no-var-requires -const uts46 = require("idna-uts46-hx/uts46bundle.js"); - -type NoConfig = Record; - -export class Uts46Plugin extends Module { - public toAscii(args: Args_toAscii): string { - return uts46.toAscii(args.value); - } - - public toUnicode(args: Args_toUnicode): string { - return uts46.toUnicode(args.value); - } - - public convert(args: Args_convert): ConvertResult { - return uts46.convert(args.value); - } -} - -export const uts46Plugin: PluginFactory = () => { - return { - factory: () => new Uts46Plugin({}), - manifest, - }; -}; - -export const plugin = uts46Plugin; diff --git a/packages/js/plugins/uts46/src/schema.graphql b/packages/js/plugins/uts46/src/schema.graphql deleted file mode 100644 index 057f32cabd..0000000000 --- a/packages/js/plugins/uts46/src/schema.graphql +++ /dev/null @@ -1,10 +0,0 @@ -type Module { - toAscii(value: String!): String! - toUnicode(value: String!): String! - convert(value: String!): ConvertResult! -} - -type ConvertResult { - IDN: String! - PC: String! -} diff --git a/packages/js/plugins/uts46/tsconfig.build.json b/packages/js/plugins/uts46/tsconfig.build.json deleted file mode 100644 index 77aadfdd2f..0000000000 --- a/packages/js/plugins/uts46/tsconfig.build.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": [ - "./src/**/*.ts" - ], - "exclude": [ - "./src/**/__tests__" - ] -} diff --git a/packages/js/plugins/uts46/tsconfig.json b/packages/js/plugins/uts46/tsconfig.json deleted file mode 100644 index 85d516ce30..0000000000 --- a/packages/js/plugins/uts46/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "../../../../tsconfig", - "compilerOptions": { - "outDir": "build" - }, - "include": [ - "./src/**/*.ts" - ], - "exclude": [] -} diff --git a/packages/js/plugins/ws/README.md b/packages/js/plugins/ws/README.md index ced32bc5d3..ea279f8d88 100644 --- a/packages/js/plugins/ws/README.md +++ b/packages/js/plugins/ws/README.md @@ -3,57 +3,9 @@ WebSocket plugin allows Polywrap Client to interact with WebSocket servers. ## interface - -``` typescript -# subset of JS MessageEvent interface -type Message { - data: String! - origin: String! - lastEventId: String! -} - -# path to WRAP method -type Callback { - uri: String!, - method: String! -} - -# optional fields are `Number | null` instead of `Option` -type Number { - value: Int! -} - -type Module { - # create a socket with id - ## can return after `timeout` if the server is not responding - open(url: String!, timeout: Number): Int! - - # close socket `id` - close(id: Int!): Boolean - - # send message via socket `id` - send(id: Int!, message: String!): Boolean - - # pass all messages to callback - addCallback(id: Int!, callback: Callback!): Boolean - - # stop passing messages to callback - removeCallback(id: Int!, callback: Callback!): Boolean - - # save messages to ws plugin cache - addCache(id: Int!): Boolean - - # stop caching messages - removeCache(id: Int!): Boolean - - # get [messages], flush cache - ## can wait until receives `min` events or reaches `timeout` - receive(id: Int!, min: Number, timeout: Number): [Message!]! -} -``` +See [schema.graphql](./src/schema.graphql). ## callback - Every incoming WebSocket message can be passed to a callback function in another wrapper. Use `addCallback` to start passing messages and `removeCallback` to stop. The callback function is expected to have a parameter `data`, i.e. `foo(data: string)`. ``` typescript diff --git a/packages/js/plugins/ws/src/__tests__/e2e/e2e.spec.ts b/packages/js/plugins/ws/src/__tests__/e2e/e2e.spec.ts index b26c36605d..df8e969fd9 100644 --- a/packages/js/plugins/ws/src/__tests__/e2e/e2e.spec.ts +++ b/packages/js/plugins/ws/src/__tests__/e2e/e2e.spec.ts @@ -69,7 +69,7 @@ describe("WebSocket plugin", () => { method: "open", args: { url: "ws://localhost:1235", - timeout: { value: 50 } + timeout: 50 } }) }); @@ -347,7 +347,7 @@ describe("WebSocket plugin", () => { method: "receive", args: { id, - timeout: { value: 250 } + timeout: 250 } }) @@ -378,7 +378,7 @@ describe("WebSocket plugin", () => { method: "receive", args: { id, - min: { value: 2 } + min: 2 } }) @@ -408,8 +408,8 @@ describe("WebSocket plugin", () => { method: "receive", args: { id, - timeout: { value: 110 }, - min: { value: 2 } + timeout: 110, + min: 2 } }) @@ -439,8 +439,8 @@ describe("WebSocket plugin", () => { method: "receive", args: { id, - timeout: { value: 300 }, - min: { value: 1 } + timeout: 300, + min: 1 } }) diff --git a/packages/js/plugins/ws/src/__tests__/e2e/integration.spec.ts b/packages/js/plugins/ws/src/__tests__/e2e/integration.spec.ts index db0292f602..4578dddeda 100644 --- a/packages/js/plugins/ws/src/__tests__/e2e/integration.spec.ts +++ b/packages/js/plugins/ws/src/__tests__/e2e/integration.spec.ts @@ -106,7 +106,7 @@ describe("e2e tests for WsPlugin", () => { class MemoryPlugin extends PluginModule<{}> { set(args: { key: string, value: string }, _client: Client): boolean { value[args.key] = args.value - return true + return true } get(args: { key: string }, _client: Client): string | null { return value[args.key] ?? null @@ -140,7 +140,7 @@ describe("e2e tests for WsPlugin", () => { uri, method: "callback" }, - message: "test" + message: "test" } }); diff --git a/packages/js/plugins/ws/src/__tests__/e2e/integration/schema.graphql b/packages/js/plugins/ws/src/__tests__/e2e/integration/schema.graphql index 5ac685e4e5..1b1a3d2e74 100644 --- a/packages/js/plugins/ws/src/__tests__/e2e/integration/schema.graphql +++ b/packages/js/plugins/ws/src/__tests__/e2e/integration/schema.graphql @@ -24,6 +24,6 @@ type Module { get( url: String!, - timeout: Int! + timeout: UInt32! ): [String!]! } diff --git a/packages/js/plugins/ws/src/__tests__/e2e/integration/src/index.ts b/packages/js/plugins/ws/src/__tests__/e2e/integration/src/index.ts index e213428d5e..7345e8c726 100644 --- a/packages/js/plugins/ws/src/__tests__/e2e/integration/src/index.ts +++ b/packages/js/plugins/ws/src/__tests__/e2e/integration/src/index.ts @@ -7,6 +7,7 @@ import { Args_subscribeAndSend, Args_get } from "./wrap"; +import { Box } from "@polywrap/wasm-as"; export function send(args: Args_send): boolean { const id = WS_Module.open({ @@ -68,9 +69,9 @@ export function get(args: Args_get): string[] { WS_Module.addCache({ id - }).unwrap().unwrap() + }).unwrap() - const messages = WS_Module.receive({ id, timeout: { value: args.timeout } }).unwrap(); + const messages = WS_Module.receive({ id, timeout: Box.from(args.timeout) }).unwrap(); const data: string[] = messages.map((msg) => msg.data); diff --git a/packages/js/plugins/ws/src/index.ts b/packages/js/plugins/ws/src/index.ts index e68e56851e..8f1a930018 100644 --- a/packages/js/plugins/ws/src/index.ts +++ b/packages/js/plugins/ws/src/index.ts @@ -32,7 +32,7 @@ export class WsPlugin extends Module { if (args.timeout) { setTimeout(() => { reject(new Error("timeout reached")); - }, args.timeout.value); + }, args.timeout); } this._sockets[id].onopen = () => { resolve(id); @@ -40,10 +40,7 @@ export class WsPlugin extends Module { }); } - public async close( - args: Args_close, - _client: Client - ): Promise { + public async close(args: Args_close, _client: Client): Promise { this._sockets[args.id].close(); return await new Promise((resolve) => { this._sockets[args.id].onclose = () => { @@ -52,12 +49,12 @@ export class WsPlugin extends Module { }); } - public send(args: Args_send, _client: Client): boolean | null { + public send(args: Args_send, _client: Client): boolean { this._sockets[args.id].send(args.message); return true; } - public addCallback(args: Args_addCallback, _client: Client): boolean | null { + public addCallback(args: Args_addCallback, _client: Client): boolean { const callbackId = this._callbackId(args.callback); this._callbacks[callbackId] = async (msg) => { await _client.invoke<{ callback: boolean }>({ @@ -73,10 +70,7 @@ export class WsPlugin extends Module { return true; } - public removeCallback( - args: Args_removeCallback, - _client: Client - ): boolean | null { + public removeCallback(args: Args_removeCallback, _client: Client): boolean { const callbackId = this._callbackId(args.callback); this._sockets[args.id].removeEventListener( "message", @@ -85,7 +79,7 @@ export class WsPlugin extends Module { return true; } - public addCache(args: Args_addCache, _client: Client): boolean | null { + public addCache(args: Args_addCache, _client: Client): boolean { const callback = { uri: args.id.toString(), method: "cache" }; const callbackId = this._callbackId(callback); this._caches[args.id] = []; @@ -109,7 +103,7 @@ export class WsPlugin extends Module { return true; } - public removeCache(args: Args_removeCache, _client: Client): boolean | null { + public removeCache(args: Args_removeCache, _client: Client): boolean { const callback = { uri: args.id.toString(), method: "cache" }; const callbackId = this._callbackId(callback); this._sockets[args.id].removeEventListener( @@ -135,7 +129,7 @@ export class WsPlugin extends Module { if (args.min) { interval = setInterval(() => { if (args.min) { - if (this._caches[args.id].length >= args.min.value) { + if (this._caches[args.id].length >= args.min) { clearInterval(interval); clear(); } @@ -146,7 +140,7 @@ export class WsPlugin extends Module { setTimeout(() => { clearInterval(interval); clear(); - }, args.timeout.value); + }, args.timeout); } if (!args.timeout && !args.min) { clear(); diff --git a/packages/js/plugins/ws/src/schema.graphql b/packages/js/plugins/ws/src/schema.graphql index 1f5f375777..d35469f91c 100644 --- a/packages/js/plugins/ws/src/schema.graphql +++ b/packages/js/plugins/ws/src/schema.graphql @@ -1,25 +1,57 @@ +"""Subset of JS MessageEvent interface""" type Message { - data: String! - origin: String! - lastEventId: String! + data: String! + origin: String! + lastEventId: String! } type Callback { - uri: String!, - method: String! -} - -type Number { - value: Int! + """WRAP Module URI""" + uri: String! + """WRAP Module Method""" + method: String! } type Module { - open(url: String!, timeout: Number): Int! - close(id: Int!): Boolean - send(id: Int!, message: String!): Boolean - addCallback(id: Int!, callback: Callback!): Boolean - removeCallback(id: Int!, callback: Callback!): Boolean - addCache(id: Int!): Boolean - removeCache(id: Int!): Boolean - receive(id: Int!, min: Number, timeout: Number): [Message!]! + """ + create a socket with id, can return after `timeout` + if the server is not responding. Returns the socket `id` + """ + open(url: String!, timeout: UInt32): UInt32! + + """ + close socket `id` + """ + close(id: UInt32!): Boolean! + + """ + send message via socket `id` + """ + send(id: UInt32!, message: String!): Boolean! + + """ + send all messages to callback for socket `id` + """ + addCallback(id: UInt32!, callback: Callback!): Boolean! + + """ + stop sending messages to callback for socket `id` + """ + removeCallback(id: UInt32!, callback: Callback!): Boolean! + + """ + save messages to ws plugin cache for socket `id` + """ + addCache(id: UInt32!): Boolean! + + """ + stop caching messages for socket `id` + """ + removeCache(id: UInt32!): Boolean! + + """ + get messages and flush cache, + can wait until receives `min` events or reaches `timeout` + """ + receive(id: UInt32!, min: UInt32, timeout: UInt32): [Message!]! } diff --git a/packages/js/test-env/src/index.ts b/packages/js/test-env/src/index.ts index 603d23631f..b4ba6325ae 100644 --- a/packages/js/test-env/src/index.ts +++ b/packages/js/test-env/src/index.ts @@ -259,19 +259,22 @@ export async function buildAndDeployWrapper({ const ethereumPluginUri = "wrap://ens/ethereum.polywrap.eth"; + const testnetConnection = { + networks: { + testnet: new Connection({ + provider: ethereumProvider, + }), + }, + defaultNetwork: "testnet", + }; + + const connections = new Connections(testnetConnection); const client = new PolywrapClient({ plugins: [ { uri: ethereumPluginUri, plugin: ethereumPlugin({ - connections: new Connections({ - networks: { - testnet: new Connection({ - provider: ethereumProvider, - }), - }, - defaultNetwork: "testnet", - }), + connections, }), }, ], @@ -328,7 +331,6 @@ export async function buildAndDeployWrapper({ }); // manually configure manifests - const { __type, ...polywrapManifest } = deserializePolywrapManifest( fs.readFileSync(manifestPath, "utf-8") ); diff --git a/packages/js/test-env/src/wrappers/ens/schema.graphql b/packages/js/test-env/src/wrappers/ens/schema.graphql deleted file mode 100644 index 1b939e94f5..0000000000 --- a/packages/js/test-env/src/wrappers/ens/schema.graphql +++ /dev/null @@ -1,729 +0,0 @@ -### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @capability( - type: String! - uri: String! - namespace: String! -) repeatable on OBJECT - -directive @enabled_interface on OBJECT - -directive @annotate(type: String!) on FIELD - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type Module @imports( - types: [ - "Ethereum_Module", - "Ethereum_Connection", - "Ethereum_TxOverrides", - "Ethereum_StaticTxResult", - "Ethereum_TxRequest", - "Ethereum_TxReceipt", - "Ethereum_Log", - "Ethereum_EventNotification", - "Ethereum_Network", - "Ethereum_TxResponse", - "Ethereum_Access", - "UTS46_Module", - "UTS46_ConvertResult", - "SHA3_Module" - ] -) { - getResolver( - registryAddress: String! - domain: String! - connection: Ethereum_Connection - ): String! - - getOwner( - domain: String! - registryAddress: String! - connection: Ethereum_Connection - ): String! - - checkIfRecordExists( - domain: String! - registryAddress: String! - connection: Ethereum_Connection - ): Boolean! - - getAddress( - domain: String! - resolverAddress: String! - connection: Ethereum_Connection - ): String! - - getAddressFromDomain( - domain: String! - registryAddress: String! - connection: Ethereum_Connection - ): String! - - getContentHash( - domain: String! - resolverAddress: String! - connection: Ethereum_Connection - ): String! - - getContentHashFromDomain( - domain: String! - registryAddress: String! - connection: Ethereum_Connection - ): String! - - getExpiryTimes( - domain: String! - registrarAddress: String! - connection: Ethereum_Connection - ): String! - - getReverseResolver( - address: String! - registryAddress: String! - connection: Ethereum_Connection - ): String! - - getNameFromReverseResolver( - address: String! - resolverAddress: String! - connection: Ethereum_Connection - ): String! - - getNameFromAddress( - address: String! - registryAddress: String! - connection: Ethereum_Connection - ): String! - - getTextRecord( - domain: String! - resolverAddress: String! - key: String! - connection: Ethereum_Connection - ): String! - - setResolver( - domain: String! - resolverAddress: String! - registryAddress: String! - connection: Ethereum_Connection - txOverrides: TxOverrides - ): Ethereum_TxResponse! - - registerDomain( - domain: String! - registrarAddress: String! - registryAddress: String! - owner: String! - connection: Ethereum_Connection - txOverrides: TxOverrides - ): Ethereum_TxResponse! - - reverseRegisterDomain( - domain: String! - reverseRegistryAddress: String! - owner: String! - connection: Ethereum_Connection - txOverrides: TxOverrides - ): Ethereum_TxResponse! - - setName( - domain: String! - reverseRegistryAddress: String! - connection: Ethereum_Connection - txOverrides: TxOverrides - ): Ethereum_TxResponse! - - setAddress( - domain: String! - address: String! - resolverAddress: String! - connection: Ethereum_Connection - txOverrides: TxOverrides - ): Ethereum_TxResponse! - - setOwner( - domain: String! - newOwner: String! - registryAddress: String! - connection: Ethereum_Connection - txOverrides: TxOverrides - ): Ethereum_TxResponse! - - setSubdomainOwner( - subdomain: String! - owner: String! - registryAddress: String! - connection: Ethereum_Connection - txOverrides: TxOverrides - ): Ethereum_TxResponse! - - setRecord( - domain: String! - owner: String! - resolverAddress: String! - ttl: String! - registryAddress: String! - connection: Ethereum_Connection - txOverrides: TxOverrides - ): Ethereum_TxResponse! - - setSubdomainRecord( - domain: String! - label: String! - owner: String! - resolverAddress: String! - ttl: String! - registryAddress: String! - connection: Ethereum_Connection - txOverrides: TxOverrides - ): Ethereum_TxResponse! - - registerSubdomainsRecursively( - domain: String! - owner: String! - resolverAddress: String! - ttl: String! - registryAddress: String! - connection: Ethereum_Connection - txOverrides: TxOverrides - ): [RegistrationResult!]! - - registerDomainAndSubdomainsRecursively( - domain: String! - owner: String! - resolverAddress: String! - ttl: String! - registrarAddress: String! - registryAddress: String! - connection: Ethereum_Connection - txOverrides: TxOverrides - ): [RegistrationResult!]! - - setContentHash( - domain: String! - cid: String! - resolverAddress: String! - connection: Ethereum_Connection - txOverrides: TxOverrides - ): Ethereum_TxResponse! - - setAddressFromDomain( - domain: String! - address: String! - registryAddress: String! - connection: Ethereum_Connection - txOverrides: TxOverrides - ): Ethereum_TxResponse! - - setContentHashFromDomain( - domain: String! - cid: String! - registryAddress: String! - connection: Ethereum_Connection - txOverrides: TxOverrides - ): Ethereum_TxResponse! - - deployFIFSRegistrar( - registryAddress: String! - tld: String! - connection: Ethereum_Connection - txOverrides: TxOverrides - ): String! - - registerSubnodeOwnerWithFIFSRegistrar( - label: String! - owner: String! - fifsRegistrarAddress: String! - connection: Ethereum_Connection - txOverrides: TxOverrides - ): Ethereum_TxResponse! - - setTextRecord( - domain: String! - resolverAddress: String! - key: String! - value: String! - connection: Ethereum_Connection - txOverrides: TxOverrides - ): Ethereum_TxResponse! - - configureOpenDomain( - tld: String! - owner: String! - registryAddress: String! - resolverAddress: String! - registrarAddress: String! - connection: Ethereum_Connection - txOverrides: TxOverrides - ): ConfigureOpenDomainResponse! - - createSubdomainInOpenDomain( - label: String! - domain: String! - owner: String! - fifsRegistrarAddress: String! - registryAddress: String! - resolverAddress: String! - connection: Ethereum_Connection - txOverrides: TxOverrides - ): CreateSubdomainInOpenDomainResponse! - - createSubdomainInOpenDomainAndSetContentHash( - label: String! - domain: String! - owner: String! - fifsRegistrarAddress: String! - registryAddress: String! - resolverAddress: String! - cid: String! - connection: Ethereum_Connection - txOverrides: TxOverrides - ): CreateSubdomainInOpenDomainAndSetContentHashResponse -} - -type ConfigureOpenDomainResponse { - fifsRegistrarAddress: String! - registerOpenDomainTxReceipt: Ethereum_TxResponse! - setSubdomainRecordTxReceipt: Ethereum_TxResponse! -} - -type CreateSubdomainInOpenDomainResponse { - registerSubdomainTxReceipt: Ethereum_TxResponse! - setResolverTxReceipt: Ethereum_TxResponse! -} - -type CreateSubdomainInOpenDomainAndSetContentHashResponse implements CreateSubdomainInOpenDomainResponse { - setContentHashReceiptTx: Ethereum_TxResponse! - registerSubdomainTxReceipt: Ethereum_TxResponse! - setResolverTxReceipt: Ethereum_TxResponse! -} - -type RegistrationResult { - name: String! - didRegister: Boolean! - tx: Ethereum_TxResponse -} - -type TxOverrides { - gasPrice: BigInt - gasLimit: BigInt -} - -### Imported Modules START ### - -type Ethereum_Module @imported( - uri: "wrap://ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Module" -) { - callContractView( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - ): String! - - callContractStatic( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_StaticTxResult! - - getBalance( - address: String! - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - encodeParams( - types: [String!]! - values: [String!]! - ): String! - - encodeFunction( - method: String! - args: [String!] - ): String! - - solidityPack( - types: [String!]! - values: [String!]! - ): String! - - solidityKeccak256( - types: [String!]! - values: [String!]! - ): String! - - soliditySha256( - types: [String!]! - values: [String!]! - ): String! - - getSignerAddress( - connection: Ethereum_Connection - ): String! - - getSignerBalance( - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - getSignerTransactionCount( - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - getGasPrice( - connection: Ethereum_Connection - ): BigInt! - - estimateTransactionGas( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): BigInt! - - estimateContractCallGas( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): BigInt! - - checkAddress( - address: String! - ): Boolean! - - toWei( - eth: String! - ): BigInt! - - toEth( - wei: BigInt! - ): String! - - awaitTransaction( - txHash: String! - confirmations: UInt32! - timeout: UInt32! - connection: Ethereum_Connection - ): Ethereum_TxReceipt! - - waitForEvent( - address: String! - event: String! - args: [String!] - timeout: UInt32 - connection: Ethereum_Connection - ): Ethereum_EventNotification! - - getNetwork( - connection: Ethereum_Connection - ): Ethereum_Network! - - callContractMethod( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_TxResponse! - - callContractMethodAndWait( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_TxReceipt! - - sendTransaction( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): Ethereum_TxResponse! - - sendTransactionAndWait( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): Ethereum_TxReceipt! - - deployContract( - abi: String! - bytecode: String! - args: [String!] - connection: Ethereum_Connection - ): String! - - signMessage( - message: String! - connection: Ethereum_Connection - ): String! - - sendRPC( - method: String! - params: [String!]! - connection: Ethereum_Connection - ): String -} - -type UTS46_Module @imported( - uri: "wrap://ens/uts46.polywrap.eth", - namespace: "UTS46", - nativeType: "Module" -) { - toAscii( - value: String! - ): String! - - toUnicode( - value: String! - ): String! - - convert( - value: String! - ): UTS46_ConvertResult! -} - -type SHA3_Module @imported( - uri: "wrap://ens/sha3.polywrap.eth", - namespace: "SHA3", - nativeType: "Module" -) { - sha3_512( - message: String! - ): String! - - sha3_384( - message: String! - ): String! - - sha3_256( - message: String! - ): String! - - sha3_224( - message: String! - ): String! - - keccak_512( - message: String! - ): String! - - keccak_384( - message: String! - ): String! - - keccak_256( - message: String! - ): String! - - keccak_224( - message: String! - ): String! - - hex_keccak_256( - message: String! - ): String! - - buffer_keccak_256( - message: Bytes! - ): String! - - shake_128( - message: String! - outputBits: Int! - ): String! - - shake_256( - message: String! - outputBits: Int! - ): String! -} - -### Imported Modules END ### - -### Imported Objects START ### - -type Ethereum_Connection @imported( - uri: "wrap://ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Connection" -) { - node: String - networkNameOrChainId: String -} - -type Ethereum_TxOverrides @imported( - uri: "wrap://ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxOverrides" -) { - gasLimit: BigInt - gasPrice: BigInt - value: BigInt -} - -type Ethereum_StaticTxResult @imported( - uri: "wrap://ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "StaticTxResult" -) { - result: String! - error: Boolean! -} - -type Ethereum_TxRequest @imported( - uri: "wrap://ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxRequest" -) { - to: String - from: String - nonce: UInt32 - gasLimit: BigInt - gasPrice: BigInt - data: String - value: BigInt - chainId: BigInt - type: UInt32 -} - -type Ethereum_TxReceipt @imported( - uri: "wrap://ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxReceipt" -) { - to: String! - from: String! - contractAddress: String! - transactionIndex: UInt32! - root: String - gasUsed: BigInt! - logsBloom: String! - transactionHash: String! - logs: [Ethereum_Log!]! - blockNumber: BigInt! - blockHash: String! - confirmations: UInt32! - cumulativeGasUsed: BigInt! - effectiveGasPrice: BigInt! - byzantium: Boolean! - type: UInt32! - status: UInt32 -} - -type Ethereum_Log @imported( - uri: "wrap://ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Log" -) { - blockNumber: BigInt! - blockHash: String! - transactionIndex: UInt32! - removed: Boolean! - address: String! - data: String! - topics: [String!]! - transactionHash: String! - logIndex: UInt32! -} - -type Ethereum_EventNotification @imported( - uri: "wrap://ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "EventNotification" -) { - data: String! - address: String! - log: Ethereum_Log! -} - -type Ethereum_Network @imported( - uri: "wrap://ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Network" -) { - name: String! - chainId: BigInt! - ensAddress: String -} - -type Ethereum_TxResponse @imported( - uri: "wrap://ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxResponse" -) { - hash: String! - to: String - from: String! - nonce: UInt32! - gasLimit: BigInt! - gasPrice: BigInt - data: String! - value: BigInt! - chainId: BigInt! - blockNumber: BigInt - blockHash: String - timestamp: UInt32 - confirmations: UInt32! - raw: String - r: String - s: String - v: UInt32 - type: UInt32 - accessList: [Ethereum_Access!] -} - -type Ethereum_Access @imported( - uri: "wrap://ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Access" -) { - address: String! - storageKeys: [String!]! -} - -type UTS46_ConvertResult @imported( - uri: "wrap://ens/uts46.polywrap.eth", - namespace: "UTS46", - nativeType: "ConvertResult" -) { - IDN: String! - PC: String! -} - -### Imported Objects END ### - -### Imported Envs START ### - -### Imported Envs END ### diff --git a/packages/js/test-env/src/wrappers/ens/wrap.info b/packages/js/test-env/src/wrappers/ens/wrap.info index 3ae721c8eb..355a10d536 100644 Binary files a/packages/js/test-env/src/wrappers/ens/wrap.info and b/packages/js/test-env/src/wrappers/ens/wrap.info differ diff --git a/packages/js/test-env/src/wrappers/ens/wrap.wasm b/packages/js/test-env/src/wrappers/ens/wrap.wasm index 4d5cda05db..0af8be234f 100644 Binary files a/packages/js/test-env/src/wrappers/ens/wrap.wasm and b/packages/js/test-env/src/wrappers/ens/wrap.wasm differ diff --git a/packages/schema/bind/src/bindings/assemblyscript/functions.ts b/packages/schema/bind/src/bindings/assemblyscript/functions.ts index 44c34685a7..f58c5d5e12 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/functions.ts +++ b/packages/schema/bind/src/bindings/assemblyscript/functions.ts @@ -51,14 +51,10 @@ export const toWasmInit: MustacheFn = () => { type = type.substring(0, type.length - 1); } else { const nullType = toWasm()(value, render); - const optional = "Option"; const nullOptional = "| null"; if (nullType.endsWith(nullOptional)) { return "null"; - } else if (nullType.startsWith(optional)) { - type = nullType.substring(6); - return `Option.None${type}()`; } } @@ -250,7 +246,7 @@ const applyOptional = ( ) { return `${type} | null`; } else { - return `Option<${type}>`; + return `Box<${type}> | null`; } } else { return type; diff --git a/packages/schema/bind/src/bindings/assemblyscript/types.ts b/packages/schema/bind/src/bindings/assemblyscript/types.ts index 545f4611c1..6961a87298 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/types.ts +++ b/packages/schema/bind/src/bindings/assemblyscript/types.ts @@ -199,6 +199,9 @@ const keywords = { Float64Array: "Float64Array", TemplateStringsArray: "TemplateStringsArray", Error: "Error", + Result: "Result", + Box: "Box", + JSON: "JSON", // runtime abort: "abort", trace: "trace", diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/deserialize_array.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/deserialize_array.mustache index c0ae6f5ec9..5ee4a8a43b 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/deserialize_array.mustache +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/deserialize_array.mustache @@ -10,9 +10,7 @@ return reader.read{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}((reader: Read): return reader.read{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}((reader: Read): {{#key}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/key}} => { return reader.read{{#key}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/key}}(); }, (reader: Read): {{#value}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/value}} => { - {{#value}} {{> deserialize_map_value}} - {{/value}} }); {{/map}} {{#enum}} diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/deserialize_enum.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/deserialize_enum.mustache index e45e533f3c..6702368f21 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/deserialize_enum.mustache +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/deserialize_enum.mustache @@ -8,19 +8,19 @@ if (reader.isNextString()) { } {{/required}} {{^required}} -let value: Option; +let value: Box | null; if (!reader.isNextNil()) { if (reader.isNextString()) { - value = Option.Some( + value = Box.from( Types.get{{type}}Value(reader.readString()) ); } else { - value = Option.Some( + value = Box.from( reader.readInt32() ); Types.sanitize{{type}}Value(value.unwrap()); } } else { - value = Option.None(); + value = null; } {{/required}} diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/env-type/index-ts.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/env-type/index-ts.mustache index 1bd693e9c0..8199149c0d 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/env-type/index-ts.mustache +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/env-type/index-ts.mustache @@ -1,7 +1,7 @@ import { Read, Write, - Option, + Box, BigInt, BigNumber, JSON diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/env-type/serialization-ts.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/env-type/serialization-ts.mustache index 1d4131751a..5b9a53d9b6 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/env-type/serialization-ts.mustache +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/env-type/serialization-ts.mustache @@ -35,9 +35,7 @@ export function write{{type}}(writer: Write, type: {{#detectKeyword}}{{type}}{{/ writer.write{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}(type.{{#detectKeyword}}{{name}}{{/detectKeyword}}, (writer: Write, key: {{#key}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/key}}) => { writer.write{{#key}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/key}}(key); }, (writer: Write, value: {{#value}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/value}}): void => { - {{#value}} {{> serialize_map_value}} - {{/value}} }); {{/map}} {{#object}} diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/imported/env-type/serialization-ts.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/imported/env-type/serialization-ts.mustache index cc755abb7d..9d524437cf 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/imported/env-type/serialization-ts.mustache +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/imported/env-type/serialization-ts.mustache @@ -35,9 +35,7 @@ export function write{{type}}(writer: Write, type: {{#detectKeyword}}{{type}}{{/ writer.write{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}(type.{{#detectKeyword}}{{name}}{{/detectKeyword}}, (writer: Write, key: {{#key}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/key}}) => { writer.write{{#key}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/key}}(key); }, (writer: Write, value: {{#value}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/value}}): void => { - {{#value}} {{> serialize_map_value}} - {{/value}} }); {{/map}} {{#object}} @@ -110,9 +108,7 @@ export function read{{type}}(reader: Read): {{#detectKeyword}}{{type}}{{/detectK _{{name}} = reader.read{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}((reader: Read): {{#key}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/key}} => { return reader.read{{#key}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/key}}(); }, (reader: Read): {{#value}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/value}} => { - {{#value}} {{> deserialize_map_value}} - {{/value}} }); {{/map}} {{#enum}} diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/imported/module-type/index-ts.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/imported/module-type/index-ts.mustache index 46c901b31f..ed45b7686e 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/imported/module-type/index-ts.mustache +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/imported/module-type/index-ts.mustache @@ -1,7 +1,7 @@ import { wrap_subinvoke, wrap_subinvokeImplementation, - Option, + Box, BigInt, BigNumber, JSON, diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/imported/module-type/serialization-ts.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/imported/module-type/serialization-ts.mustache index 0c63322d80..dbf9a3f43e 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/imported/module-type/serialization-ts.mustache +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/imported/module-type/serialization-ts.mustache @@ -45,9 +45,7 @@ export function write{{name}}Args( writer.write{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}(args.{{#detectKeyword}}{{name}}{{/detectKeyword}}, (writer: Write, key: {{#key}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/key}}) => { writer.write{{#key}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/key}}(key); }, (writer: Write, value: {{#value}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/value}}): void => { - {{#value}} {{> serialize_map_value}} - {{/value}} }); {{/map}} {{#enum}} @@ -92,9 +90,7 @@ export function deserialize{{name}}Result(buffer: ArrayBuffer): {{#return}}{{#to const res: {{#toWasm}}{{toGraphQLType}}{{/toWasm}} = reader.read{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}((reader: Read): {{#key}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/key}} => { return reader.read{{#key}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/key}}(); }, (reader: Read): {{#value}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/value}} => { - {{#value}} {{> deserialize_map_value}} - {{/value}} }); {{/map}} {{#enum}} diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/imported/object-type/index-ts.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/imported/object-type/index-ts.mustache index bd6dec16ce..3d914e5ae1 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/imported/object-type/index-ts.mustache +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/imported/object-type/index-ts.mustache @@ -1,7 +1,7 @@ import { Read, Write, - Option, + Box, BigInt, BigNumber, JSON diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/imported/object-type/serialization-ts.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/imported/object-type/serialization-ts.mustache index 6d3f2169e8..c2b2bb40ec 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/imported/object-type/serialization-ts.mustache +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/imported/object-type/serialization-ts.mustache @@ -35,9 +35,7 @@ export function write{{type}}(writer: Write, type: {{#detectKeyword}}{{type}}{{/ writer.write{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}(type.{{#detectKeyword}}{{name}}{{/detectKeyword}}, (writer: Write, key: {{#key}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/key}}) => { writer.write{{#key}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/key}}(key); }, (writer: Write, value: {{#value}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/value}}): void => { - {{#value}} {{> serialize_map_value}} - {{/value}} }); {{/map}} {{#object}} @@ -110,9 +108,7 @@ export function read{{type}}(reader: Read): {{#detectKeyword}}{{type}}{{/detectK _{{name}} = reader.read{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}((reader: Read): {{#key}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/key}} => { return reader.read{{#key}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/key}}(); }, (reader: Read): {{#value}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/value}} => { - {{#value}} {{> deserialize_map_value}} - {{/value}} }); {{/map}} {{#enum}} diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/object-type/index-ts.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/object-type/index-ts.mustache index 1bd693e9c0..8199149c0d 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/object-type/index-ts.mustache +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/object-type/index-ts.mustache @@ -1,7 +1,7 @@ import { Read, Write, - Option, + Box, BigInt, BigNumber, JSON diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/serialization_imports.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/serialization_imports.mustache index 9ded19f5d4..933d73f458 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/serialization_imports.mustache +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/serialization_imports.mustache @@ -4,7 +4,7 @@ import { Write, WriteSizer, WriteEncoder, - Option, + Box, BigInt, BigNumber, JSON, diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/serialize_map_value.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/serialize_map_value.mustache index 54dd0def8c..4dc36f8422 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/serialize_map_value.mustache +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm/templates/serialize_map_value.mustache @@ -8,7 +8,7 @@ writer.write{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}(value, (writer: Write, {{/array}} {{#map}} writer.write{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}(value, (writer: Write, key: {{#key}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/key}}) => { - writer.write{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}(key); + writer.write{{#key}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/key}}(key); }, (writer: Write, value: {{#value}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/value}}): void => { {{> serialize_map_value}} }); diff --git a/packages/schema/bind/src/bindings/rust/wasm/templates/deserialize_array.mustache b/packages/schema/bind/src/bindings/rust/wasm/templates/deserialize_array.mustache index 65340b29ce..677e8785b0 100644 --- a/packages/schema/bind/src/bindings/rust/wasm/templates/deserialize_array.mustache +++ b/packages/schema/bind/src/bindings/rust/wasm/templates/deserialize_array.mustache @@ -10,9 +10,7 @@ reader.read_{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower} reader.read_{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}(|reader| { reader.read_{{#key}}{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}{{/key}}() }, |reader| { - {{#value}} {{> deserialize_map_value}} - {{/value}} }) {{/map}} {{#enum}} diff --git a/packages/schema/bind/src/bindings/rust/wasm/templates/deserialize_array_nobox.mustache b/packages/schema/bind/src/bindings/rust/wasm/templates/deserialize_array_nobox.mustache index bfc08bbb87..3ff7fb4f1b 100644 --- a/packages/schema/bind/src/bindings/rust/wasm/templates/deserialize_array_nobox.mustache +++ b/packages/schema/bind/src/bindings/rust/wasm/templates/deserialize_array_nobox.mustache @@ -10,9 +10,7 @@ reader.read_{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower} reader.read_{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}(|reader| { reader.read_{{#key}}{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}{{/key}}() }, |reader| { - {{#value}} {{> deserialize_map_value_nobox}} - {{/value}} }) {{/map}} {{#enum}} diff --git a/packages/schema/bind/src/bindings/rust/wasm/templates/env-type/serialization-rs.mustache b/packages/schema/bind/src/bindings/rust/wasm/templates/env-type/serialization-rs.mustache index 563467a781..fad845897d 100644 --- a/packages/schema/bind/src/bindings/rust/wasm/templates/env-type/serialization-rs.mustache +++ b/packages/schema/bind/src/bindings/rust/wasm/templates/env-type/serialization-rs.mustache @@ -58,9 +58,7 @@ pub fn write_{{#toLower}}{{type}}{{/toLower}}(args: &{{#detectKeyword} writer.write_{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}(&args.{{#detectKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/detectKeyword}}, |writer, key| { writer.write_{{#key}}{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}{{/key}}(key) }, |writer, value| { - {{#value}} {{> serialize_map_value}} - {{/value}} })?; {{/map}} {{#object}} @@ -135,9 +133,7 @@ pub fn read_{{#toLower}}{{type}}{{/toLower}}(reader: &mut R) -> Result< _{{#toLower}}{{name}}{{/toLower}} = reader.read_{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}(|reader| { reader.read_{{#key}}{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}{{/key}}()? }, |reader| { - {{#value}} {{> deserialize_map_value_nobox}} - {{/value}} })?; {{/map}} {{#enum}} diff --git a/packages/schema/bind/src/bindings/rust/wasm/templates/imported/env-type/serialization-rs.mustache b/packages/schema/bind/src/bindings/rust/wasm/templates/imported/env-type/serialization-rs.mustache index a014c0169f..e451fe9180 100644 --- a/packages/schema/bind/src/bindings/rust/wasm/templates/imported/env-type/serialization-rs.mustache +++ b/packages/schema/bind/src/bindings/rust/wasm/templates/imported/env-type/serialization-rs.mustache @@ -58,9 +58,7 @@ pub fn write_{{#toLower}}{{type}}{{/toLower}}(args: &{{#detectKeyword} writer.write_{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}(&args.{{#detectKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/detectKeyword}}, |writer, key| { writer.write_{{#key}}{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}{{/key}}(key) }, |writer, value| { - {{#value}} {{> serialize_map_value}} - {{/value}} })?; {{/map}} {{#object}} @@ -135,9 +133,7 @@ pub fn read_{{#toLower}}{{type}}{{/toLower}}(reader: &mut R) -> Result< _{{#toLower}}{{name}}{{/toLower}} = reader.read_{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}(|reader| { reader.read_{{#key}}{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}{{/key}}()? }, |reader| { - {{#value}} {{> deserialize_map_value_nobox}} - {{/value}} })?; {{/map}} {{#enum}} diff --git a/packages/schema/bind/src/bindings/rust/wasm/templates/imported/module-type/serialization-rs.mustache b/packages/schema/bind/src/bindings/rust/wasm/templates/imported/module-type/serialization-rs.mustache index 377442a016..a4e5a5cc21 100644 --- a/packages/schema/bind/src/bindings/rust/wasm/templates/imported/module-type/serialization-rs.mustache +++ b/packages/schema/bind/src/bindings/rust/wasm/templates/imported/module-type/serialization-rs.mustache @@ -67,9 +67,7 @@ pub fn write_{{#toLower}}{{name}}{{/toLower}}_args(args: &Args{{#toUpp writer.write_{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}(&args.{{#detectKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/detectKeyword}}, |writer, key| { writer.write_{{#key}}{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}{{/key}}(key) }, |writer, value| { - {{#value}} {{> serialize_map_value}} - {{/value}} })?; {{/map}} {{#enum}} @@ -116,9 +114,7 @@ pub fn deserialize_{{#toLower}}{{name}}{{/toLower}}_result(result: &[u8]) -> Res let res = reader.read_{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}(|reader| { reader.read_{{#key}}{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}{{/key}}() }, |reader| { - {{#value}} {{> deserialize_map_value_nobox}} - {{/value}} })?; {{/map}} {{#enum}} diff --git a/packages/schema/bind/src/bindings/rust/wasm/templates/imported/object-type/serialization-rs.mustache b/packages/schema/bind/src/bindings/rust/wasm/templates/imported/object-type/serialization-rs.mustache index 55aa528b90..5c5d2f149a 100644 --- a/packages/schema/bind/src/bindings/rust/wasm/templates/imported/object-type/serialization-rs.mustache +++ b/packages/schema/bind/src/bindings/rust/wasm/templates/imported/object-type/serialization-rs.mustache @@ -58,9 +58,7 @@ pub fn write_{{#toLower}}{{type}}{{/toLower}}(args: &{{#detectKeyword} writer.write_{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}(&args.{{#detectKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/detectKeyword}}, |writer, key| { writer.write_{{#key}}{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}{{/key}}(key) }, |writer, value| { - {{#value}} {{> serialize_map_value}} - {{/value}} })?; {{/map}} {{#object}} @@ -135,9 +133,7 @@ pub fn read_{{#toLower}}{{type}}{{/toLower}}(reader: &mut R) -> Result< _{{#toLower}}{{name}}{{/toLower}} = reader.read_{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}(|reader| { reader.read_{{#key}}{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}{{/key}}() }, |reader| { - {{#value}} {{> deserialize_map_value_nobox}} - {{/value}} })?; {{/map}} {{#enum}} diff --git a/packages/schema/bind/src/bindings/rust/wasm/templates/serialize_array.mustache b/packages/schema/bind/src/bindings/rust/wasm/templates/serialize_array.mustache index 45f0b8a0df..793cd62322 100644 --- a/packages/schema/bind/src/bindings/rust/wasm/templates/serialize_array.mustache +++ b/packages/schema/bind/src/bindings/rust/wasm/templates/serialize_array.mustache @@ -10,9 +10,7 @@ writer.write_{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower writer.write_{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}(item, |writer, key| { writer.write_{{#key}}{{#toLower}}{{#toMsgPack}}{{toGraphQLType}}{{/toMsgPack}}{{/toLower}}{{/key}}(key) }, |writer, value| { - {{#value}} {{> serialize_map_value}} - {{/value}} }) {{/map}} {{#enum}} diff --git a/packages/schema/bind/src/bindings/typescript/app/templates/types-ts.mustache b/packages/schema/bind/src/bindings/typescript/app/templates/types-ts.mustache index 5502866937..f02416fdc8 100644 --- a/packages/schema/bind/src/bindings/typescript/app/templates/types-ts.mustache +++ b/packages/schema/bind/src/bindings/typescript/app/templates/types-ts.mustache @@ -88,7 +88,7 @@ export type {{#detectKeyword}}{{type}}{{/detectKeyword}} = {{type}}Enum | {{type {{#methods}} /* URI: "{{parent.uri}}" */ -interface {{parent.type}}_Args_{{name}} extends Record { +interface {{parent.type}}_Args_{{name}} { {{#arguments}} {{name}}{{^required}}?{{/required}}: {{#toTypescript}}{{toGraphQLType}}{{/toTypescript}}; {{/arguments}} @@ -106,7 +106,7 @@ export const {{type}} = { return client.invoke<{{#return}}{{#toTypescript}}{{toGraphQLType}}{{/toTypescript}}{{/return}}>({ uri, method: "{{name}}", - args + args: args as unknown as Record }); }{{^last}},{{/last}} {{^last}} diff --git a/packages/schema/bind/src/bindings/typescript/plugin/templates/module-ts.mustache b/packages/schema/bind/src/bindings/typescript/plugin/templates/module-ts.mustache index 717bf883ab..2b5ca88c84 100644 --- a/packages/schema/bind/src/bindings/typescript/plugin/templates/module-ts.mustache +++ b/packages/schema/bind/src/bindings/typescript/plugin/templates/module-ts.mustache @@ -11,7 +11,7 @@ import { {{#moduleType}} {{#methods}} -export interface Args_{{name}} extends Record { +export interface Args_{{name}} { {{#arguments}} {{name}}{{^required}}?{{/required}}: {{#toTypescript}}{{toGraphQLType}}{{/toTypescript}}; {{/arguments}} diff --git a/packages/schema/bind/src/bindings/typescript/plugin/templates/types-ts.mustache b/packages/schema/bind/src/bindings/typescript/plugin/templates/types-ts.mustache index 7dd990679c..50875ebe45 100644 --- a/packages/schema/bind/src/bindings/typescript/plugin/templates/types-ts.mustache +++ b/packages/schema/bind/src/bindings/typescript/plugin/templates/types-ts.mustache @@ -98,7 +98,7 @@ export type {{#detectKeyword}}{{type}}{{/detectKeyword}} = {{type}}Enum | {{type {{#importedModuleTypes}} {{#methods}} /* URI: "{{parent.uri}}" */ -interface {{parent.type}}_Args_{{name}} extends Record { +interface {{parent.type}}_Args_{{name}} { {{#arguments}} {{name}}{{^required}}?{{/required}}: {{#toTypescript}}{{toGraphQLType}}{{/toTypescript}}; {{/arguments}} @@ -116,7 +116,7 @@ export const {{type}} = { return client.invoke<{{#return}}{{#toTypescript}}{{toGraphQLType}}{{/toTypescript}}{{/return}}>({ uri: "{{parent.uri}}", method: "{{name}}", - args + args: args as unknown as Record }); }{{^last}},{{/last}} {{^last}} @@ -141,7 +141,7 @@ export class {{#detectKeyword}}{{type}}{{/detectKeyword}} { return client.invoke<{{#return}}{{#toTypescript}}{{toGraphQLType}}{{/toTypescript}}{{/return}}>({ uri: this.uri, method: "{{name}}", - args + args: args as unknown as Record }); } {{^last}} diff --git a/packages/templates/app/typescript-node/package.json b/packages/templates/app/typescript-node/package.json index b44aa7998b..eb1d824e47 100644 --- a/packages/templates/app/typescript-node/package.json +++ b/packages/templates/app/typescript-node/package.json @@ -4,7 +4,7 @@ "private": true, "version": "0.6.0", "scripts": { - "build": "npx polywrap app codegen", + "build": "npx polywrap codegen", "test": "ts-node ./src/index.ts" }, "dependencies": { diff --git a/packages/templates/app/typescript-react/package.json b/packages/templates/app/typescript-react/package.json index 0c7531122a..54cb962050 100644 --- a/packages/templates/app/typescript-react/package.json +++ b/packages/templates/app/typescript-react/package.json @@ -34,7 +34,7 @@ "prestart": "yarn codegen", "build": "react-scripts build", "prebuild": "yarn codegen", - "codegen": "npx polywrap app codegen", + "codegen": "npx polywrap codegen", "test": "react-scripts test", "eject": "react-scripts eject" }, diff --git a/packages/templates/package.json b/packages/templates/package.json index 98c2ddb572..6bc9138bc4 100644 --- a/packages/templates/package.json +++ b/packages/templates/package.json @@ -8,7 +8,9 @@ "url": "https://github.com/polywrap/monorepo.git" }, "scripts": { - "test": "jest --passWithNoTests --runInBand --verbose", + "wasm-linked:up": "cp ./polywrap.wasm-linked* ./wasm/assemblyscript/", + "wasm-linked:down": "rm ./wasm/assemblyscript/polywrap.wasm-linked*", + "test": "yarn wasm-linked:up; jest --passWithNoTests --runInBand --verbose; yarn wasm-linked:down", "test:ci": "yarn test" }, "devDependencies": { diff --git a/packages/templates/plugin/typescript/package.json b/packages/templates/plugin/typescript/package.json index 6d01f971e4..2366700e52 100644 --- a/packages/templates/plugin/typescript/package.json +++ b/packages/templates/plugin/typescript/package.json @@ -6,7 +6,7 @@ "main": "build/index.js", "scripts": { "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.json", - "codegen": "npx polywrap plugin codegen", + "codegen": "npx polywrap codegen", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", "test:watch": "jest --watch --passWithNoTests --verbose" diff --git a/packages/templates/polywrap.wasm-linked.build.yaml b/packages/templates/polywrap.wasm-linked.build.yaml new file mode 100644 index 0000000000..959488ab0c --- /dev/null +++ b/packages/templates/polywrap.wasm-linked.build.yaml @@ -0,0 +1,11 @@ +format: 0.1.0 +docker: + name: template-wasm-as +config: + node_version: "16.13.0" + include: + - ./package.json + - ./src +linked_packages: + - name: "@polywrap/wasm-as" + path: ../../../wasm/as diff --git a/packages/templates/polywrap.wasm-linked.yaml b/packages/templates/polywrap.wasm-linked.yaml new file mode 100644 index 0000000000..294a567ae7 --- /dev/null +++ b/packages/templates/polywrap.wasm-linked.yaml @@ -0,0 +1,9 @@ +format: 0.2.0 +project: + name: template-wasm-as + type: wasm/assemblyscript +source: + module: ./src/index.ts + schema: ./src/schema.graphql +extensions: + build: ./polywrap.wasm-linked.build.yaml diff --git a/packages/templates/tests.spec.ts b/packages/templates/tests.spec.ts index 0285699310..248c72102c 100644 --- a/packages/templates/tests.spec.ts +++ b/packages/templates/tests.spec.ts @@ -21,7 +21,7 @@ describe("Templates", () => { build: "CI=false yarn build", }, assemblyscript: { - build: "yarn build", + build: "npx polywrap build -m ./polywrap.wasm-linked.yaml", test: "yarn test:e2e", }, rust: { diff --git a/packages/templates/wasm/assemblyscript/package.json b/packages/templates/wasm/assemblyscript/package.json index 8347562c25..ea18f8ac28 100644 --- a/packages/templates/wasm/assemblyscript/package.json +++ b/packages/templates/wasm/assemblyscript/package.json @@ -10,7 +10,7 @@ "deploy": "npx polywrap deploy", "test": "yarn test:e2e && yarn test:workflow", "test:e2e": "yarn test:e2e:codegen && jest --passWithNoTests --runInBand --verbose", - "test:e2e:codegen": "npx polywrap app codegen -m ./src/__tests__/types/polywrap.app.yaml -g ./src/__tests__/types/wrap", + "test:e2e:codegen": "npx polywrap codegen -m ./src/__tests__/types/polywrap.app.yaml -g ./src/__tests__/types/wrap", "test:workflow": "npx polywrap run -o ./workflows/output.json" }, "devDependencies": { diff --git a/packages/templates/wasm/rust/package.json b/packages/templates/wasm/rust/package.json index a28a2bd8d0..47762ce19f 100644 --- a/packages/templates/wasm/rust/package.json +++ b/packages/templates/wasm/rust/package.json @@ -10,7 +10,7 @@ "deploy": "npx polywrap deploy", "test": "yarn test:e2e && yarn test:workflow", "test:e2e": "yarn test:e2e:codegen && jest --passWithNoTests --runInBand --verbose", - "test:e2e:codegen": "npx polywrap app codegen -m ./src/__tests__/types/polywrap.app.yaml -g ./src/__tests__/types/wrap", + "test:e2e:codegen": "npx polywrap codegen -m ./src/__tests__/types/polywrap.app.yaml -g ./src/__tests__/types/wrap", "test:workflow": "npx polywrap run -o ./workflows/output.json" }, "devDependencies": { diff --git a/packages/test-cases/cases/bind/sanity/output/app-ts/types.ts b/packages/test-cases/cases/bind/sanity/output/app-ts/types.ts index 367707c37f..7e05acf86d 100644 --- a/packages/test-cases/cases/bind/sanity/output/app-ts/types.ts +++ b/packages/test-cases/cases/bind/sanity/output/app-ts/types.ts @@ -143,7 +143,7 @@ export type TestImport_Enum = TestImport_EnumEnum | TestImport_EnumString; /// Imported Modules START /// /* URI: "testimport.uri.eth" */ -interface TestImport_Module_Args_importedMethod extends Record { +interface TestImport_Module_Args_importedMethod { str: Types.String; optStr?: Types.String | null; u: Types.UInt; @@ -160,7 +160,7 @@ interface TestImport_Module_Args_importedMethod extends Record } /* URI: "testimport.uri.eth" */ -interface TestImport_Module_Args_anotherMethod extends Record { +interface TestImport_Module_Args_anotherMethod { arg: Array; } @@ -174,7 +174,7 @@ export const TestImport_Module = { return client.invoke({ uri, method: "importedMethod", - args + args: args as unknown as Record }); }, @@ -186,7 +186,7 @@ export const TestImport_Module = { return client.invoke({ uri, method: "anotherMethod", - args + args: args as unknown as Record }); } } diff --git a/packages/test-cases/cases/bind/sanity/output/plugin-ts/module.ts b/packages/test-cases/cases/bind/sanity/output/plugin-ts/module.ts index d5f83d6b66..be2a490077 100644 --- a/packages/test-cases/cases/bind/sanity/output/plugin-ts/module.ts +++ b/packages/test-cases/cases/bind/sanity/output/plugin-ts/module.ts @@ -9,7 +9,7 @@ import { MaybeAsync } from "@polywrap/core-js"; -export interface Args_moduleMethod extends Record { +export interface Args_moduleMethod { str: Types.String; optStr?: Types.String | null; en: Types.CustomEnum; @@ -23,21 +23,21 @@ export interface Args_moduleMethod extends Record { mapOfArrOfObj: Map>; } -export interface Args_objectMethod extends Record { +export interface Args_objectMethod { object: Types.AnotherType; optObject?: Types.AnotherType | null; objectArray: Array; optObjectArray?: Array | null; } -export interface Args_optionalEnvMethod extends Record { +export interface Args_optionalEnvMethod { object: Types.AnotherType; optObject?: Types.AnotherType | null; objectArray: Array; optObjectArray?: Array | null; } -export interface Args_if extends Record { +export interface Args_if { if: Types._else; } diff --git a/packages/test-cases/cases/bind/sanity/output/plugin-ts/types.ts b/packages/test-cases/cases/bind/sanity/output/plugin-ts/types.ts index 308ec77eb0..9b0cddff40 100644 --- a/packages/test-cases/cases/bind/sanity/output/plugin-ts/types.ts +++ b/packages/test-cases/cases/bind/sanity/output/plugin-ts/types.ts @@ -156,7 +156,7 @@ export type TestImport_Enum = TestImport_EnumEnum | TestImport_EnumString; /// Imported Modules START /// /* URI: "testimport.uri.eth" */ -interface TestImport_Module_Args_importedMethod extends Record { +interface TestImport_Module_Args_importedMethod { str: Types.String; optStr?: Types.String | null; u: Types.UInt; @@ -173,7 +173,7 @@ interface TestImport_Module_Args_importedMethod extends Record } /* URI: "testimport.uri.eth" */ -interface TestImport_Module_Args_anotherMethod extends Record { +interface TestImport_Module_Args_anotherMethod { arg: Array; } @@ -191,7 +191,7 @@ export class TestImport_Module { return client.invoke({ uri: this.uri, method: "importedMethod", - args + args: args as unknown as Record }); } @@ -202,7 +202,7 @@ export class TestImport_Module { return client.invoke({ uri: this.uri, method: "anotherMethod", - args + args: args as unknown as Record }); } } diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/AnotherType/index.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/AnotherType/index.ts index f0078d83b9..7d2d0c8391 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/AnotherType/index.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/AnotherType/index.ts @@ -1,7 +1,7 @@ import { Read, Write, - Option, + Box, BigInt, BigNumber, JSON diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/AnotherType/serialization.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/AnotherType/serialization.ts index 4bf9c7a830..9ed99bc7a3 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/AnotherType/serialization.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/AnotherType/serialization.ts @@ -4,7 +4,7 @@ import { Write, WriteSizer, WriteEncoder, - Option, + Box, BigInt, BigNumber, JSON, diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomMapValue/index.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomMapValue/index.ts index 16e451dd4e..4162a95785 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomMapValue/index.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomMapValue/index.ts @@ -1,7 +1,7 @@ import { Read, Write, - Option, + Box, BigInt, BigNumber, JSON diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomMapValue/serialization.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomMapValue/serialization.ts index 847dde1269..d3f1ee9fb8 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomMapValue/serialization.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomMapValue/serialization.ts @@ -4,7 +4,7 @@ import { Write, WriteSizer, WriteEncoder, - Option, + Box, BigInt, BigNumber, JSON, diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomType/index.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomType/index.ts index 917c30a1be..64b2cdf31c 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomType/index.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomType/index.ts @@ -1,7 +1,7 @@ import { Read, Write, - Option, + Box, BigInt, BigNumber, JSON @@ -18,7 +18,7 @@ export class CustomType { str: string; optStr: string | null; u: u32; - optU: Option; + optU: Box | null; _u8: u8; _u16: u16; _u32: u32; @@ -35,13 +35,13 @@ export class CustomType { bytes: ArrayBuffer; optBytes: ArrayBuffer | null; _boolean: bool; - optBoolean: Option; + optBoolean: Box | null; uArray: Array; uOptArray: Array | null; - optUOptArray: Array> | null; + optUOptArray: Array | null> | null; optStrOptArray: Array | null; uArrayArray: Array>; - uOptArrayOptArray: Array> | null>; + uOptArrayOptArray: Array | null> | null>; uArrayOptArrayArray: Array> | null>; crazyArray: Array | null>> | null> | null; object: Types.AnotherType; @@ -49,9 +49,9 @@ export class CustomType { objectArray: Array; optObjectArray: Array | null; en: Types.CustomEnum; - optEnum: Option; + optEnum: Box | null; enumArray: Array; - optEnumArray: Array> | null; + optEnumArray: Array | null> | null; map: Map; mapOfArr: Map>; mapOfObj: Map; diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomType/serialization.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomType/serialization.ts index e033193852..b555b83786 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomType/serialization.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomType/serialization.ts @@ -4,7 +4,7 @@ import { Write, WriteSizer, WriteEncoder, - Option, + Box, BigInt, BigNumber, JSON, @@ -38,7 +38,7 @@ export function writeCustomType(writer: Write, type: CustomType): void { writer.writeString("u"); writer.writeUInt32(type.u); writer.context().pop(); - writer.context().push("optU", "Option", "writing property"); + writer.context().push("optU", "Box | null", "writing property"); writer.writeString("optU"); writer.writeOptionalUInt32(type.optU); writer.context().pop(); @@ -106,7 +106,7 @@ export function writeCustomType(writer: Write, type: CustomType): void { writer.writeString("boolean"); writer.writeBool(type._boolean); writer.context().pop(); - writer.context().push("optBoolean", "Option", "writing property"); + writer.context().push("optBoolean", "Box | null", "writing property"); writer.writeString("optBoolean"); writer.writeOptionalBool(type.optBoolean); writer.context().pop(); @@ -122,9 +122,9 @@ export function writeCustomType(writer: Write, type: CustomType): void { writer.writeUInt32(item); }); writer.context().pop(); - writer.context().push("optUOptArray", "Array> | null", "writing property"); + writer.context().push("optUOptArray", "Array | null> | null", "writing property"); writer.writeString("optUOptArray"); - writer.writeOptionalArray(type.optUOptArray, (writer: Write, item: Option): void => { + writer.writeOptionalArray(type.optUOptArray, (writer: Write, item: Box | null): void => { writer.writeOptionalUInt32(item); }); writer.context().pop(); @@ -142,10 +142,10 @@ export function writeCustomType(writer: Write, type: CustomType): void { }); }); writer.context().pop(); - writer.context().push("uOptArrayOptArray", "Array> | null>", "writing property"); + writer.context().push("uOptArrayOptArray", "Array | null> | null>", "writing property"); writer.writeString("uOptArrayOptArray"); - writer.writeArray(type.uOptArrayOptArray, (writer: Write, item: Array> | null): void => { - writer.writeOptionalArray(item, (writer: Write, item: Option): void => { + writer.writeArray(type.uOptArrayOptArray, (writer: Write, item: Array | null> | null): void => { + writer.writeOptionalArray(item, (writer: Write, item: Box | null): void => { writer.writeOptionalUInt32(item); }); }); @@ -204,7 +204,7 @@ export function writeCustomType(writer: Write, type: CustomType): void { writer.writeString("en"); writer.writeInt32(type.en); writer.context().pop(); - writer.context().push("optEnum", "Option", "writing property"); + writer.context().push("optEnum", "Box | null", "writing property"); writer.writeString("optEnum"); writer.writeOptionalInt32(type.optEnum); writer.context().pop(); @@ -214,9 +214,9 @@ export function writeCustomType(writer: Write, type: CustomType): void { writer.writeInt32(item); }); writer.context().pop(); - writer.context().push("optEnumArray", "Array> | null", "writing property"); + writer.context().push("optEnumArray", "Array | null> | null", "writing property"); writer.writeString("optEnumArray"); - writer.writeOptionalArray(type.optEnumArray, (writer: Write, item: Option): void => { + writer.writeOptionalArray(type.optEnumArray, (writer: Write, item: Box | null): void => { writer.writeOptionalInt32(item); }); writer.context().pop(); @@ -284,7 +284,7 @@ export function readCustomType(reader: Read): CustomType { let _optStr: string | null = null; let _u: u32 = 0; let _uSet: bool = false; - let _optU: Option = Option.None(); + let _optU: Box | null = null; let _u8: u8 = 0; let _u8Set: bool = false; let _u16: u16 = 0; @@ -313,15 +313,15 @@ export function readCustomType(reader: Read): CustomType { let _optBytes: ArrayBuffer | null = null; let _boolean: bool = false; let _booleanSet: bool = false; - let _optBoolean: Option = Option.None(); + let _optBoolean: Box | null = null; let _uArray: Array = []; let _uArraySet: bool = false; let _uOptArray: Array | null = null; - let _optUOptArray: Array> | null = null; + let _optUOptArray: Array | null> | null = null; let _optStrOptArray: Array | null = null; let _uArrayArray: Array> = []; let _uArrayArraySet: bool = false; - let _uOptArrayOptArray: Array> | null> = []; + let _uOptArrayOptArray: Array | null> | null> = []; let _uOptArrayOptArraySet: bool = false; let _uArrayOptArrayArray: Array> | null> = []; let _uArrayOptArrayArraySet: bool = false; @@ -334,10 +334,10 @@ export function readCustomType(reader: Read): CustomType { let _optObjectArray: Array | null = null; let _en: Types.CustomEnum = 0; let _enSet: bool = false; - let _optEnum: Option = Option.None(); + let _optEnum: Box | null = null; let _enumArray: Array = []; let _enumArraySet: bool = false; - let _optEnumArray: Array> | null = null; + let _optEnumArray: Array | null> | null = null; let _map: Map = new Map(); let _mapSet: bool = false; let _mapOfArr: Map> = new Map>(); @@ -372,7 +372,7 @@ export function readCustomType(reader: Read): CustomType { reader.context().pop(); } else if (field == "optU") { - reader.context().push(field, "Option", "type found, reading property"); + reader.context().push(field, "Box | null", "type found, reading property"); _optU = reader.readOptionalUInt32(); reader.context().pop(); } @@ -469,7 +469,7 @@ export function readCustomType(reader: Read): CustomType { reader.context().pop(); } else if (field == "optBoolean") { - reader.context().push(field, "Option", "type found, reading property"); + reader.context().push(field, "Box | null", "type found, reading property"); _optBoolean = reader.readOptionalBool(); reader.context().pop(); } @@ -489,8 +489,8 @@ export function readCustomType(reader: Read): CustomType { reader.context().pop(); } else if (field == "optUOptArray") { - reader.context().push(field, "Array> | null", "type found, reading property"); - _optUOptArray = reader.readOptionalArray((reader: Read): Option => { + reader.context().push(field, "Array | null> | null", "type found, reading property"); + _optUOptArray = reader.readOptionalArray((reader: Read): Box | null => { return reader.readOptionalUInt32(); }); reader.context().pop(); @@ -513,9 +513,9 @@ export function readCustomType(reader: Read): CustomType { reader.context().pop(); } else if (field == "uOptArrayOptArray") { - reader.context().push(field, "Array> | null>", "type found, reading property"); - _uOptArrayOptArray = reader.readArray((reader: Read): Array> | null => { - return reader.readOptionalArray((reader: Read): Option => { + reader.context().push(field, "Array | null> | null>", "type found, reading property"); + _uOptArrayOptArray = reader.readArray((reader: Read): Array | null> | null => { + return reader.readOptionalArray((reader: Read): Box | null => { return reader.readOptionalUInt32(); }); }); @@ -597,21 +597,21 @@ export function readCustomType(reader: Read): CustomType { reader.context().pop(); } else if (field == "optEnum") { - reader.context().push(field, "Option", "type found, reading property"); - let value: Option; + reader.context().push(field, "Box | null", "type found, reading property"); + let value: Box | null; if (!reader.isNextNil()) { if (reader.isNextString()) { - value = Option.Some( + value = Box.from( Types.getCustomEnumValue(reader.readString()) ); } else { - value = Option.Some( + value = Box.from( reader.readInt32() ); Types.sanitizeCustomEnumValue(value.unwrap()); } } else { - value = Option.None(); + value = null; } _optEnum = value; reader.context().pop(); @@ -632,22 +632,22 @@ export function readCustomType(reader: Read): CustomType { reader.context().pop(); } else if (field == "optEnumArray") { - reader.context().push(field, "Array> | null", "type found, reading property"); - _optEnumArray = reader.readOptionalArray((reader: Read): Option => { - let value: Option; + reader.context().push(field, "Array | null> | null", "type found, reading property"); + _optEnumArray = reader.readOptionalArray((reader: Read): Box | null => { + let value: Box | null; if (!reader.isNextNil()) { if (reader.isNextString()) { - value = Option.Some( + value = Box.from( Types.getCustomEnumValue(reader.readString()) ); } else { - value = Option.Some( + value = Box.from( reader.readInt32() ); Types.sanitizeCustomEnumValue(value.unwrap()); } } else { - value = Option.None(); + value = null; } return value; }); diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/Env/index.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/Env/index.ts index e23475d9bf..6e9417c587 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/Env/index.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/Env/index.ts @@ -1,7 +1,7 @@ import { Read, Write, - Option, + Box, BigInt, BigNumber, JSON @@ -17,7 +17,7 @@ import * as Types from ".."; export class Env { prop: string; optProp: string | null; - optMap: Map> | null; + optMap: Map | null> | null; static toBuffer(type: Env): ArrayBuffer { return serializeEnv(type); diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/Env/serialization.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/Env/serialization.ts index b6fbadfd37..84186a0ea1 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/Env/serialization.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/Env/serialization.ts @@ -4,7 +4,7 @@ import { Write, WriteSizer, WriteEncoder, - Option, + Box, BigInt, BigNumber, JSON, @@ -34,11 +34,11 @@ export function writeEnv(writer: Write, type: Env): void { writer.writeString("optProp"); writer.writeOptionalString(type.optProp); writer.context().pop(); - writer.context().push("optMap", "Map> | null", "writing property"); + writer.context().push("optMap", "Map | null> | null", "writing property"); writer.writeString("optMap"); writer.writeOptionalExtGenericMap(type.optMap, (writer: Write, key: string) => { writer.writeString(key); - }, (writer: Write, value: Option): void => { + }, (writer: Write, value: Box | null): void => { writer.writeOptionalInt32(value); }); writer.context().pop(); @@ -56,7 +56,7 @@ export function readEnv(reader: Read): Env { let _prop: string = ""; let _propSet: bool = false; let _optProp: string | null = null; - let _optMap: Map> | null = null; + let _optMap: Map | null> | null = null; while (numFields > 0) { numFields--; @@ -75,10 +75,10 @@ export function readEnv(reader: Read): Env { reader.context().pop(); } else if (field == "optMap") { - reader.context().push(field, "Map> | null", "type found, reading property"); + reader.context().push(field, "Map | null> | null", "type found, reading property"); _optMap = reader.readOptionalExtGenericMap((reader: Read): string => { return reader.readString(); - }, (reader: Read): Option => { + }, (reader: Read): Box | null => { return reader.readOptionalInt32(); }); reader.context().pop(); diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/Module/serialization.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/Module/serialization.ts index 4fe8792357..d33172ef42 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/Module/serialization.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/Module/serialization.ts @@ -4,7 +4,7 @@ import { Write, WriteSizer, WriteEncoder, - Option, + Box, BigInt, BigNumber, JSON, @@ -16,9 +16,9 @@ export class Args_moduleMethod { str: string; optStr: string | null; en: Types.CustomEnum; - optEnum: Option; + optEnum: Box | null; enumArray: Array; - optEnumArray: Array> | null; + optEnumArray: Array | null> | null; map: Map; mapOfArr: Map>; mapOfMap: Map>; @@ -36,10 +36,10 @@ export function deserializemoduleMethodArgs(argsBuf: ArrayBuffer): Args_moduleMe let _optStr: string | null = null; let _en: Types.CustomEnum = 0; let _enSet: bool = false; - let _optEnum: Option = Option.None(); + let _optEnum: Box | null = null; let _enumArray: Array = []; let _enumArraySet: bool = false; - let _optEnumArray: Array> | null = null; + let _optEnumArray: Array | null> | null = null; let _map: Map = new Map(); let _mapSet: bool = false; let _mapOfArr: Map> = new Map>(); @@ -81,21 +81,21 @@ export function deserializemoduleMethodArgs(argsBuf: ArrayBuffer): Args_moduleMe reader.context().pop(); } else if (field == "optEnum") { - reader.context().push(field, "Option", "type found, reading property"); - let value: Option; + reader.context().push(field, "Box | null", "type found, reading property"); + let value: Box | null; if (!reader.isNextNil()) { if (reader.isNextString()) { - value = Option.Some( + value = Box.from( Types.getCustomEnumValue(reader.readString()) ); } else { - value = Option.Some( + value = Box.from( reader.readInt32() ); Types.sanitizeCustomEnumValue(value.unwrap()); } } else { - value = Option.None(); + value = null; } _optEnum = value; reader.context().pop(); @@ -116,22 +116,22 @@ export function deserializemoduleMethodArgs(argsBuf: ArrayBuffer): Args_moduleMe reader.context().pop(); } else if (field == "optEnumArray") { - reader.context().push(field, "Array> | null", "type found, reading property"); - _optEnumArray = reader.readOptionalArray((reader: Read): Option => { - let value: Option; + reader.context().push(field, "Array | null> | null", "type found, reading property"); + _optEnumArray = reader.readOptionalArray((reader: Read): Box | null => { + let value: Box | null; if (!reader.isNextNil()) { if (reader.isNextString()) { - value = Option.Some( + value = Box.from( Types.getCustomEnumValue(reader.readString()) ); } else { - value = Option.Some( + value = Box.from( reader.readInt32() ); Types.sanitizeCustomEnumValue(value.unwrap()); } } else { - value = Option.None(); + value = null; } return value; }); diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/else/index.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/else/index.ts index e3b07794d9..48f590f30b 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/else/index.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/else/index.ts @@ -1,7 +1,7 @@ import { Read, Write, - Option, + Box, BigInt, BigNumber, JSON diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/else/serialization.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/else/serialization.ts index f89184e286..08a0df0df3 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/else/serialization.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/else/serialization.ts @@ -4,7 +4,7 @@ import { Write, WriteSizer, WriteEncoder, - Option, + Box, BigInt, BigNumber, JSON, diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_AnotherObject/index.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_AnotherObject/index.ts index 8957633043..54d80f554c 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_AnotherObject/index.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_AnotherObject/index.ts @@ -1,7 +1,7 @@ import { Read, Write, - Option, + Box, BigInt, BigNumber, JSON diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_AnotherObject/serialization.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_AnotherObject/serialization.ts index 98b67d08ff..1835851b49 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_AnotherObject/serialization.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_AnotherObject/serialization.ts @@ -4,7 +4,7 @@ import { Write, WriteSizer, WriteEncoder, - Option, + Box, BigInt, BigNumber, JSON, diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Env/serialization.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Env/serialization.ts index aff902a1bb..48866a4a00 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Env/serialization.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Env/serialization.ts @@ -4,7 +4,7 @@ import { Write, WriteSizer, WriteEncoder, - Option, + Box, BigInt, BigNumber, JSON, diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Module/index.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Module/index.ts index 1f5887a141..86b76df375 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Module/index.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Module/index.ts @@ -1,7 +1,7 @@ import { wrap_subinvoke, wrap_subinvokeImplementation, - Option, + Box, BigInt, BigNumber, JSON, diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Module/serialization.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Module/serialization.ts index c6b5c83eaa..b2efd2df5e 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Module/serialization.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Module/serialization.ts @@ -4,7 +4,7 @@ import { Write, WriteSizer, WriteEncoder, - Option, + Box, BigInt, BigNumber, JSON, @@ -16,16 +16,16 @@ export class Args_importedMethod { str: string; optStr: string | null; u: u32; - optU: Option; - uArrayArray: Array> | null>; + optU: Box | null; + uArrayArray: Array | null> | null>; object: Types.TestImport_Object; optObject: Types.TestImport_Object | null; objectArray: Array; optObjectArray: Array | null; en: Types.TestImport_Enum; - optEnum: Option; + optEnum: Box | null; enumArray: Array; - optEnumArray: Array> | null; + optEnumArray: Array | null> | null; } export function serializeimportedMethodArgs(args: Args_importedMethod): ArrayBuffer { @@ -56,14 +56,14 @@ export function writeimportedMethodArgs( writer.writeString("u"); writer.writeUInt32(args.u); writer.context().pop(); - writer.context().push("optU", "Option", "writing property"); + writer.context().push("optU", "Box | null", "writing property"); writer.writeString("optU"); writer.writeOptionalUInt32(args.optU); writer.context().pop(); - writer.context().push("uArrayArray", "Array> | null>", "writing property"); + writer.context().push("uArrayArray", "Array | null> | null>", "writing property"); writer.writeString("uArrayArray"); - writer.writeArray(args.uArrayArray, (writer: Write, item: Array> | null): void => { - writer.writeOptionalArray(item, (writer: Write, item: Option): void => { + writer.writeArray(args.uArrayArray, (writer: Write, item: Array | null> | null): void => { + writer.writeOptionalArray(item, (writer: Write, item: Box | null): void => { writer.writeOptionalUInt32(item); }); }); @@ -100,7 +100,7 @@ export function writeimportedMethodArgs( writer.writeString("en"); writer.writeInt32(args.en); writer.context().pop(); - writer.context().push("optEnum", "Option", "writing property"); + writer.context().push("optEnum", "Box | null", "writing property"); writer.writeString("optEnum"); writer.writeOptionalInt32(args.optEnum); writer.context().pop(); @@ -110,9 +110,9 @@ export function writeimportedMethodArgs( writer.writeInt32(item); }); writer.context().pop(); - writer.context().push("optEnumArray", "Array> | null", "writing property"); + writer.context().push("optEnumArray", "Array | null> | null", "writing property"); writer.writeString("optEnumArray"); - writer.writeOptionalArray(args.optEnumArray, (writer: Write, item: Option): void => { + writer.writeOptionalArray(args.optEnumArray, (writer: Write, item: Box | null): void => { writer.writeOptionalInt32(item); }); writer.context().pop(); diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Object/index.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Object/index.ts index f15d8a58de..984be2af32 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Object/index.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Object/index.ts @@ -1,7 +1,7 @@ import { Read, Write, - Option, + Box, BigInt, BigNumber, JSON @@ -23,9 +23,9 @@ export class TestImport_Object { objectArray: Array; optObjectArray: Array | null; en: Types.TestImport_Enum; - optEnum: Option; + optEnum: Box | null; enumArray: Array; - optEnumArray: Array> | null; + optEnumArray: Array | null> | null; static toBuffer(type: TestImport_Object): ArrayBuffer { return serializeTestImport_Object(type); diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Object/serialization.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Object/serialization.ts index 423b9b892b..b243ba964a 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Object/serialization.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Object/serialization.ts @@ -4,7 +4,7 @@ import { Write, WriteSizer, WriteEncoder, - Option, + Box, BigInt, BigNumber, JSON, @@ -58,7 +58,7 @@ export function writeTestImport_Object(writer: Write, type: TestImport_Object): writer.writeString("en"); writer.writeInt32(type.en); writer.context().pop(); - writer.context().push("optEnum", "Option", "writing property"); + writer.context().push("optEnum", "Box | null", "writing property"); writer.writeString("optEnum"); writer.writeOptionalInt32(type.optEnum); writer.context().pop(); @@ -68,9 +68,9 @@ export function writeTestImport_Object(writer: Write, type: TestImport_Object): writer.writeInt32(item); }); writer.context().pop(); - writer.context().push("optEnumArray", "Array> | null", "writing property"); + writer.context().push("optEnumArray", "Array | null> | null", "writing property"); writer.writeString("optEnumArray"); - writer.writeOptionalArray(type.optEnumArray, (writer: Write, item: Option): void => { + writer.writeOptionalArray(type.optEnumArray, (writer: Write, item: Box | null): void => { writer.writeOptionalInt32(item); }); writer.context().pop(); @@ -93,10 +93,10 @@ export function readTestImport_Object(reader: Read): TestImport_Object { let _optObjectArray: Array | null = null; let _en: Types.TestImport_Enum = 0; let _enSet: bool = false; - let _optEnum: Option = Option.None(); + let _optEnum: Box | null = null; let _enumArray: Array = []; let _enumArraySet: bool = false; - let _optEnumArray: Array> | null = null; + let _optEnumArray: Array | null> | null = null; while (numFields > 0) { numFields--; @@ -153,21 +153,21 @@ export function readTestImport_Object(reader: Read): TestImport_Object { reader.context().pop(); } else if (field == "optEnum") { - reader.context().push(field, "Option", "type found, reading property"); - let value: Option; + reader.context().push(field, "Box | null", "type found, reading property"); + let value: Box | null; if (!reader.isNextNil()) { if (reader.isNextString()) { - value = Option.Some( + value = Box.from( Types.getTestImport_EnumValue(reader.readString()) ); } else { - value = Option.Some( + value = Box.from( reader.readInt32() ); Types.sanitizeTestImport_EnumValue(value.unwrap()); } } else { - value = Option.None(); + value = null; } _optEnum = value; reader.context().pop(); @@ -188,22 +188,22 @@ export function readTestImport_Object(reader: Read): TestImport_Object { reader.context().pop(); } else if (field == "optEnumArray") { - reader.context().push(field, "Array> | null", "type found, reading property"); - _optEnumArray = reader.readOptionalArray((reader: Read): Option => { - let value: Option; + reader.context().push(field, "Array | null> | null", "type found, reading property"); + _optEnumArray = reader.readOptionalArray((reader: Read): Box | null => { + let value: Box | null; if (!reader.isNextNil()) { if (reader.isNextString()) { - value = Option.Some( + value = Box.from( Types.getTestImport_EnumValue(reader.readString()) ); } else { - value = Option.Some( + value = Box.from( reader.readInt32() ); Types.sanitizeTestImport_EnumValue(value.unwrap()); } } else { - value = Option.None(); + value = null; } return value; }); diff --git a/packages/test-cases/cases/cli/app/codegen/001-sanity/expected/stdout.json b/packages/test-cases/cases/cli/app/codegen/001-sanity/expected/stdout.json index d41100f3b3..eac628d9ba 100644 --- a/packages/test-cases/cases/cli/app/codegen/001-sanity/expected/stdout.json +++ b/packages/test-cases/cases/cli/app/codegen/001-sanity/expected/stdout.json @@ -2,7 +2,7 @@ "stdout": [ "Manifest loaded from ./polywrap.app.yaml", "Generate types", - "Code was generated successfully" + "Types were generated successfully" ], "exitCode": 0 } diff --git a/packages/test-cases/cases/cli/app/codegen/002-with-plugin/expected/stdout.json b/packages/test-cases/cases/cli/app/codegen/002-with-plugin/expected/stdout.json index d41100f3b3..eac628d9ba 100644 --- a/packages/test-cases/cases/cli/app/codegen/002-with-plugin/expected/stdout.json +++ b/packages/test-cases/cases/cli/app/codegen/002-with-plugin/expected/stdout.json @@ -2,7 +2,7 @@ "stdout": [ "Manifest loaded from ./polywrap.app.yaml", "Generate types", - "Code was generated successfully" + "Types were generated successfully" ], "exitCode": 0 } diff --git a/packages/test-cases/cases/cli/app/codegen/003-multi-import/expected/stdout.json b/packages/test-cases/cases/cli/app/codegen/003-multi-import/expected/stdout.json index d41100f3b3..eac628d9ba 100644 --- a/packages/test-cases/cases/cli/app/codegen/003-multi-import/expected/stdout.json +++ b/packages/test-cases/cases/cli/app/codegen/003-multi-import/expected/stdout.json @@ -2,7 +2,7 @@ "stdout": [ "Manifest loaded from ./polywrap.app.yaml", "Generate types", - "Code was generated successfully" + "Types were generated successfully" ], "exitCode": 0 } diff --git a/packages/test-cases/cases/cli/app/codegen/004-custom-config/expected/stdout.json b/packages/test-cases/cases/cli/app/codegen/004-custom-config/expected/stdout.json index d41100f3b3..eac628d9ba 100644 --- a/packages/test-cases/cases/cli/app/codegen/004-custom-config/expected/stdout.json +++ b/packages/test-cases/cases/cli/app/codegen/004-custom-config/expected/stdout.json @@ -2,7 +2,7 @@ "stdout": [ "Manifest loaded from ./polywrap.app.yaml", "Generate types", - "Code was generated successfully" + "Types were generated successfully" ], "exitCode": 0 } diff --git a/packages/test-cases/cases/cli/app/codegen/005-custom-manifest-file/expected/stdout.json b/packages/test-cases/cases/cli/app/codegen/005-custom-manifest-file/expected/stdout.json index 099897d8fb..fcd0b892fe 100644 --- a/packages/test-cases/cases/cli/app/codegen/005-custom-manifest-file/expected/stdout.json +++ b/packages/test-cases/cases/cli/app/codegen/005-custom-manifest-file/expected/stdout.json @@ -2,7 +2,7 @@ "stdout": [ "Manifest loaded from ./polywrap.custom.app.yaml", "Generate types", - "Code was generated successfully" + "Types were generated successfully" ], "exitCode": 0 } diff --git a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/module.ts b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/module.ts index 5d68d6b00e..69fb521c72 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/module.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/module.ts @@ -9,12 +9,12 @@ import { MaybeAsync } from "@polywrap/core-js"; -export interface Args_methodOne extends Record { +export interface Args_methodOne { str: Types.String; optStr?: Types.String | null; } -export interface Args_methodTwo extends Record { +export interface Args_methodTwo { arg: Types.UInt32; } diff --git a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/types.ts b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/types.ts index f503d1720d..3172a4e4b0 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/types.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/types.ts @@ -159,7 +159,7 @@ export interface Ethereum_Access { /// Imported Modules START /// /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractView extends Record { +interface Ethereum_Module_Args_callContractView { address: Types.String; method: Types.String; args?: Array | null; @@ -167,7 +167,7 @@ interface Ethereum_Module_Args_callContractView extends Record } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractStatic extends Record { +interface Ethereum_Module_Args_callContractStatic { address: Types.String; method: Types.String; args?: Array | null; @@ -176,72 +176,72 @@ interface Ethereum_Module_Args_callContractStatic extends Record { +interface Ethereum_Module_Args_getBalance { address: Types.String; blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_encodeParams extends Record { +interface Ethereum_Module_Args_encodeParams { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_encodeFunction extends Record { +interface Ethereum_Module_Args_encodeFunction { method: Types.String; args?: Array | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_solidityPack extends Record { +interface Ethereum_Module_Args_solidityPack { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_solidityKeccak256 extends Record { +interface Ethereum_Module_Args_solidityKeccak256 { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_soliditySha256 extends Record { +interface Ethereum_Module_Args_soliditySha256 { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerAddress extends Record { +interface Ethereum_Module_Args_getSignerAddress { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerBalance extends Record { +interface Ethereum_Module_Args_getSignerBalance { blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerTransactionCount extends Record { +interface Ethereum_Module_Args_getSignerTransactionCount { blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getGasPrice extends Record { +interface Ethereum_Module_Args_getGasPrice { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_estimateTransactionGas extends Record { +interface Ethereum_Module_Args_estimateTransactionGas { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_estimateContractCallGas extends Record { +interface Ethereum_Module_Args_estimateContractCallGas { address: Types.String; method: Types.String; args?: Array | null; @@ -250,22 +250,22 @@ interface Ethereum_Module_Args_estimateContractCallGas extends Record { +interface Ethereum_Module_Args_checkAddress { address: Types.String; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_toWei extends Record { +interface Ethereum_Module_Args_toWei { eth: Types.String; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_toEth extends Record { +interface Ethereum_Module_Args_toEth { wei: Types.BigInt; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_awaitTransaction extends Record { +interface Ethereum_Module_Args_awaitTransaction { txHash: Types.String; confirmations: Types.UInt32; timeout: Types.UInt32; @@ -273,7 +273,7 @@ interface Ethereum_Module_Args_awaitTransaction extends Record } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_waitForEvent extends Record { +interface Ethereum_Module_Args_waitForEvent { address: Types.String; event: Types.String; args?: Array | null; @@ -282,17 +282,17 @@ interface Ethereum_Module_Args_waitForEvent extends Record { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getNetwork extends Record { +interface Ethereum_Module_Args_getNetwork { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_requestAccounts extends Record { +interface Ethereum_Module_Args_requestAccounts { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractMethod extends Record { +interface Ethereum_Module_Args_callContractMethod { address: Types.String; method: Types.String; args?: Array | null; @@ -301,7 +301,7 @@ interface Ethereum_Module_Args_callContractMethod extends Record { +interface Ethereum_Module_Args_callContractMethodAndWait { address: Types.String; method: Types.String; args?: Array | null; @@ -310,19 +310,19 @@ interface Ethereum_Module_Args_callContractMethodAndWait extends Record { +interface Ethereum_Module_Args_sendTransaction { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_sendTransactionAndWait extends Record { +interface Ethereum_Module_Args_sendTransactionAndWait { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_deployContract extends Record { +interface Ethereum_Module_Args_deployContract { abi: Types.String; bytecode: Types.String; args?: Array | null; @@ -330,13 +330,13 @@ interface Ethereum_Module_Args_deployContract extends Record { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_signMessage extends Record { +interface Ethereum_Module_Args_signMessage { message: Types.String; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_sendRPC extends Record { +interface Ethereum_Module_Args_sendRPC { method: Types.String; params: Array; connection?: Types.Ethereum_Connection | null; @@ -351,7 +351,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "callContractView", - args + args: args as unknown as Record }); }, @@ -362,7 +362,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "callContractStatic", - args + args: args as unknown as Record }); }, @@ -373,7 +373,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getBalance", - args + args: args as unknown as Record }); }, @@ -384,7 +384,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "encodeParams", - args + args: args as unknown as Record }); }, @@ -395,7 +395,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "encodeFunction", - args + args: args as unknown as Record }); }, @@ -406,7 +406,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "solidityPack", - args + args: args as unknown as Record }); }, @@ -417,7 +417,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "solidityKeccak256", - args + args: args as unknown as Record }); }, @@ -428,7 +428,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "soliditySha256", - args + args: args as unknown as Record }); }, @@ -439,7 +439,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getSignerAddress", - args + args: args as unknown as Record }); }, @@ -450,7 +450,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getSignerBalance", - args + args: args as unknown as Record }); }, @@ -461,7 +461,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getSignerTransactionCount", - args + args: args as unknown as Record }); }, @@ -472,7 +472,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getGasPrice", - args + args: args as unknown as Record }); }, @@ -483,7 +483,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "estimateTransactionGas", - args + args: args as unknown as Record }); }, @@ -494,7 +494,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "estimateContractCallGas", - args + args: args as unknown as Record }); }, @@ -505,7 +505,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "checkAddress", - args + args: args as unknown as Record }); }, @@ -516,7 +516,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "toWei", - args + args: args as unknown as Record }); }, @@ -527,7 +527,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "toEth", - args + args: args as unknown as Record }); }, @@ -538,7 +538,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "awaitTransaction", - args + args: args as unknown as Record }); }, @@ -549,7 +549,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "waitForEvent", - args + args: args as unknown as Record }); }, @@ -560,7 +560,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getNetwork", - args + args: args as unknown as Record }); }, @@ -571,7 +571,7 @@ export const Ethereum_Module = { return client.invoke>({ uri: "ens/ethereum.polywrap.eth", method: "requestAccounts", - args + args: args as unknown as Record }); }, @@ -582,7 +582,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "callContractMethod", - args + args: args as unknown as Record }); }, @@ -593,7 +593,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "callContractMethodAndWait", - args + args: args as unknown as Record }); }, @@ -604,7 +604,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "sendTransaction", - args + args: args as unknown as Record }); }, @@ -615,7 +615,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "sendTransactionAndWait", - args + args: args as unknown as Record }); }, @@ -626,7 +626,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "deployContract", - args + args: args as unknown as Record }); }, @@ -637,7 +637,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "signMessage", - args + args: args as unknown as Record }); }, @@ -648,7 +648,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "sendRPC", - args + args: args as unknown as Record }); } } diff --git a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/module.ts b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/module.ts index cc9669e5be..d180a0c0e0 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/module.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/module.ts @@ -9,7 +9,7 @@ import { MaybeAsync } from "@polywrap/core-js"; -export interface Args_method extends Record { +export interface Args_method { str: Types.String; optStr?: Types.String | null; } diff --git a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/types.ts b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/types.ts index f503d1720d..3172a4e4b0 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/types.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/types.ts @@ -159,7 +159,7 @@ export interface Ethereum_Access { /// Imported Modules START /// /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractView extends Record { +interface Ethereum_Module_Args_callContractView { address: Types.String; method: Types.String; args?: Array | null; @@ -167,7 +167,7 @@ interface Ethereum_Module_Args_callContractView extends Record } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractStatic extends Record { +interface Ethereum_Module_Args_callContractStatic { address: Types.String; method: Types.String; args?: Array | null; @@ -176,72 +176,72 @@ interface Ethereum_Module_Args_callContractStatic extends Record { +interface Ethereum_Module_Args_getBalance { address: Types.String; blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_encodeParams extends Record { +interface Ethereum_Module_Args_encodeParams { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_encodeFunction extends Record { +interface Ethereum_Module_Args_encodeFunction { method: Types.String; args?: Array | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_solidityPack extends Record { +interface Ethereum_Module_Args_solidityPack { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_solidityKeccak256 extends Record { +interface Ethereum_Module_Args_solidityKeccak256 { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_soliditySha256 extends Record { +interface Ethereum_Module_Args_soliditySha256 { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerAddress extends Record { +interface Ethereum_Module_Args_getSignerAddress { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerBalance extends Record { +interface Ethereum_Module_Args_getSignerBalance { blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerTransactionCount extends Record { +interface Ethereum_Module_Args_getSignerTransactionCount { blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getGasPrice extends Record { +interface Ethereum_Module_Args_getGasPrice { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_estimateTransactionGas extends Record { +interface Ethereum_Module_Args_estimateTransactionGas { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_estimateContractCallGas extends Record { +interface Ethereum_Module_Args_estimateContractCallGas { address: Types.String; method: Types.String; args?: Array | null; @@ -250,22 +250,22 @@ interface Ethereum_Module_Args_estimateContractCallGas extends Record { +interface Ethereum_Module_Args_checkAddress { address: Types.String; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_toWei extends Record { +interface Ethereum_Module_Args_toWei { eth: Types.String; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_toEth extends Record { +interface Ethereum_Module_Args_toEth { wei: Types.BigInt; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_awaitTransaction extends Record { +interface Ethereum_Module_Args_awaitTransaction { txHash: Types.String; confirmations: Types.UInt32; timeout: Types.UInt32; @@ -273,7 +273,7 @@ interface Ethereum_Module_Args_awaitTransaction extends Record } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_waitForEvent extends Record { +interface Ethereum_Module_Args_waitForEvent { address: Types.String; event: Types.String; args?: Array | null; @@ -282,17 +282,17 @@ interface Ethereum_Module_Args_waitForEvent extends Record { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getNetwork extends Record { +interface Ethereum_Module_Args_getNetwork { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_requestAccounts extends Record { +interface Ethereum_Module_Args_requestAccounts { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractMethod extends Record { +interface Ethereum_Module_Args_callContractMethod { address: Types.String; method: Types.String; args?: Array | null; @@ -301,7 +301,7 @@ interface Ethereum_Module_Args_callContractMethod extends Record { +interface Ethereum_Module_Args_callContractMethodAndWait { address: Types.String; method: Types.String; args?: Array | null; @@ -310,19 +310,19 @@ interface Ethereum_Module_Args_callContractMethodAndWait extends Record { +interface Ethereum_Module_Args_sendTransaction { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_sendTransactionAndWait extends Record { +interface Ethereum_Module_Args_sendTransactionAndWait { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_deployContract extends Record { +interface Ethereum_Module_Args_deployContract { abi: Types.String; bytecode: Types.String; args?: Array | null; @@ -330,13 +330,13 @@ interface Ethereum_Module_Args_deployContract extends Record { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_signMessage extends Record { +interface Ethereum_Module_Args_signMessage { message: Types.String; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_sendRPC extends Record { +interface Ethereum_Module_Args_sendRPC { method: Types.String; params: Array; connection?: Types.Ethereum_Connection | null; @@ -351,7 +351,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "callContractView", - args + args: args as unknown as Record }); }, @@ -362,7 +362,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "callContractStatic", - args + args: args as unknown as Record }); }, @@ -373,7 +373,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getBalance", - args + args: args as unknown as Record }); }, @@ -384,7 +384,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "encodeParams", - args + args: args as unknown as Record }); }, @@ -395,7 +395,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "encodeFunction", - args + args: args as unknown as Record }); }, @@ -406,7 +406,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "solidityPack", - args + args: args as unknown as Record }); }, @@ -417,7 +417,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "solidityKeccak256", - args + args: args as unknown as Record }); }, @@ -428,7 +428,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "soliditySha256", - args + args: args as unknown as Record }); }, @@ -439,7 +439,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getSignerAddress", - args + args: args as unknown as Record }); }, @@ -450,7 +450,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getSignerBalance", - args + args: args as unknown as Record }); }, @@ -461,7 +461,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getSignerTransactionCount", - args + args: args as unknown as Record }); }, @@ -472,7 +472,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getGasPrice", - args + args: args as unknown as Record }); }, @@ -483,7 +483,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "estimateTransactionGas", - args + args: args as unknown as Record }); }, @@ -494,7 +494,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "estimateContractCallGas", - args + args: args as unknown as Record }); }, @@ -505,7 +505,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "checkAddress", - args + args: args as unknown as Record }); }, @@ -516,7 +516,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "toWei", - args + args: args as unknown as Record }); }, @@ -527,7 +527,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "toEth", - args + args: args as unknown as Record }); }, @@ -538,7 +538,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "awaitTransaction", - args + args: args as unknown as Record }); }, @@ -549,7 +549,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "waitForEvent", - args + args: args as unknown as Record }); }, @@ -560,7 +560,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getNetwork", - args + args: args as unknown as Record }); }, @@ -571,7 +571,7 @@ export const Ethereum_Module = { return client.invoke>({ uri: "ens/ethereum.polywrap.eth", method: "requestAccounts", - args + args: args as unknown as Record }); }, @@ -582,7 +582,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "callContractMethod", - args + args: args as unknown as Record }); }, @@ -593,7 +593,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "callContractMethodAndWait", - args + args: args as unknown as Record }); }, @@ -604,7 +604,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "sendTransaction", - args + args: args as unknown as Record }); }, @@ -615,7 +615,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "sendTransactionAndWait", - args + args: args as unknown as Record }); }, @@ -626,7 +626,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "deployContract", - args + args: args as unknown as Record }); }, @@ -637,7 +637,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "signMessage", - args + args: args as unknown as Record }); }, @@ -648,7 +648,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "sendRPC", - args + args: args as unknown as Record }); } } diff --git a/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/wrap/module.ts b/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/wrap/module.ts index adb37990bf..9cd107891c 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/wrap/module.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/wrap/module.ts @@ -9,7 +9,7 @@ import { MaybeAsync } from "@polywrap/core-js"; -export interface Args_method extends Record { +export interface Args_method { str: Types.String; } diff --git a/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/wrap/module.ts b/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/wrap/module.ts index adb37990bf..9cd107891c 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/wrap/module.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/wrap/module.ts @@ -9,7 +9,7 @@ import { MaybeAsync } from "@polywrap/core-js"; -export interface Args_method extends Record { +export interface Args_method { str: Types.String; } diff --git a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/module.ts b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/module.ts index 5d68d6b00e..69fb521c72 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/module.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/module.ts @@ -9,12 +9,12 @@ import { MaybeAsync } from "@polywrap/core-js"; -export interface Args_methodOne extends Record { +export interface Args_methodOne { str: Types.String; optStr?: Types.String | null; } -export interface Args_methodTwo extends Record { +export interface Args_methodTwo { arg: Types.UInt32; } diff --git a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/types.ts b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/types.ts index f503d1720d..3172a4e4b0 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/types.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/types.ts @@ -159,7 +159,7 @@ export interface Ethereum_Access { /// Imported Modules START /// /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractView extends Record { +interface Ethereum_Module_Args_callContractView { address: Types.String; method: Types.String; args?: Array | null; @@ -167,7 +167,7 @@ interface Ethereum_Module_Args_callContractView extends Record } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractStatic extends Record { +interface Ethereum_Module_Args_callContractStatic { address: Types.String; method: Types.String; args?: Array | null; @@ -176,72 +176,72 @@ interface Ethereum_Module_Args_callContractStatic extends Record { +interface Ethereum_Module_Args_getBalance { address: Types.String; blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_encodeParams extends Record { +interface Ethereum_Module_Args_encodeParams { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_encodeFunction extends Record { +interface Ethereum_Module_Args_encodeFunction { method: Types.String; args?: Array | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_solidityPack extends Record { +interface Ethereum_Module_Args_solidityPack { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_solidityKeccak256 extends Record { +interface Ethereum_Module_Args_solidityKeccak256 { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_soliditySha256 extends Record { +interface Ethereum_Module_Args_soliditySha256 { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerAddress extends Record { +interface Ethereum_Module_Args_getSignerAddress { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerBalance extends Record { +interface Ethereum_Module_Args_getSignerBalance { blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerTransactionCount extends Record { +interface Ethereum_Module_Args_getSignerTransactionCount { blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getGasPrice extends Record { +interface Ethereum_Module_Args_getGasPrice { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_estimateTransactionGas extends Record { +interface Ethereum_Module_Args_estimateTransactionGas { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_estimateContractCallGas extends Record { +interface Ethereum_Module_Args_estimateContractCallGas { address: Types.String; method: Types.String; args?: Array | null; @@ -250,22 +250,22 @@ interface Ethereum_Module_Args_estimateContractCallGas extends Record { +interface Ethereum_Module_Args_checkAddress { address: Types.String; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_toWei extends Record { +interface Ethereum_Module_Args_toWei { eth: Types.String; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_toEth extends Record { +interface Ethereum_Module_Args_toEth { wei: Types.BigInt; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_awaitTransaction extends Record { +interface Ethereum_Module_Args_awaitTransaction { txHash: Types.String; confirmations: Types.UInt32; timeout: Types.UInt32; @@ -273,7 +273,7 @@ interface Ethereum_Module_Args_awaitTransaction extends Record } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_waitForEvent extends Record { +interface Ethereum_Module_Args_waitForEvent { address: Types.String; event: Types.String; args?: Array | null; @@ -282,17 +282,17 @@ interface Ethereum_Module_Args_waitForEvent extends Record { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getNetwork extends Record { +interface Ethereum_Module_Args_getNetwork { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_requestAccounts extends Record { +interface Ethereum_Module_Args_requestAccounts { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractMethod extends Record { +interface Ethereum_Module_Args_callContractMethod { address: Types.String; method: Types.String; args?: Array | null; @@ -301,7 +301,7 @@ interface Ethereum_Module_Args_callContractMethod extends Record { +interface Ethereum_Module_Args_callContractMethodAndWait { address: Types.String; method: Types.String; args?: Array | null; @@ -310,19 +310,19 @@ interface Ethereum_Module_Args_callContractMethodAndWait extends Record { +interface Ethereum_Module_Args_sendTransaction { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_sendTransactionAndWait extends Record { +interface Ethereum_Module_Args_sendTransactionAndWait { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_deployContract extends Record { +interface Ethereum_Module_Args_deployContract { abi: Types.String; bytecode: Types.String; args?: Array | null; @@ -330,13 +330,13 @@ interface Ethereum_Module_Args_deployContract extends Record { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_signMessage extends Record { +interface Ethereum_Module_Args_signMessage { message: Types.String; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_sendRPC extends Record { +interface Ethereum_Module_Args_sendRPC { method: Types.String; params: Array; connection?: Types.Ethereum_Connection | null; @@ -351,7 +351,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "callContractView", - args + args: args as unknown as Record }); }, @@ -362,7 +362,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "callContractStatic", - args + args: args as unknown as Record }); }, @@ -373,7 +373,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getBalance", - args + args: args as unknown as Record }); }, @@ -384,7 +384,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "encodeParams", - args + args: args as unknown as Record }); }, @@ -395,7 +395,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "encodeFunction", - args + args: args as unknown as Record }); }, @@ -406,7 +406,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "solidityPack", - args + args: args as unknown as Record }); }, @@ -417,7 +417,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "solidityKeccak256", - args + args: args as unknown as Record }); }, @@ -428,7 +428,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "soliditySha256", - args + args: args as unknown as Record }); }, @@ -439,7 +439,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getSignerAddress", - args + args: args as unknown as Record }); }, @@ -450,7 +450,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getSignerBalance", - args + args: args as unknown as Record }); }, @@ -461,7 +461,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getSignerTransactionCount", - args + args: args as unknown as Record }); }, @@ -472,7 +472,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getGasPrice", - args + args: args as unknown as Record }); }, @@ -483,7 +483,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "estimateTransactionGas", - args + args: args as unknown as Record }); }, @@ -494,7 +494,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "estimateContractCallGas", - args + args: args as unknown as Record }); }, @@ -505,7 +505,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "checkAddress", - args + args: args as unknown as Record }); }, @@ -516,7 +516,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "toWei", - args + args: args as unknown as Record }); }, @@ -527,7 +527,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "toEth", - args + args: args as unknown as Record }); }, @@ -538,7 +538,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "awaitTransaction", - args + args: args as unknown as Record }); }, @@ -549,7 +549,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "waitForEvent", - args + args: args as unknown as Record }); }, @@ -560,7 +560,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getNetwork", - args + args: args as unknown as Record }); }, @@ -571,7 +571,7 @@ export const Ethereum_Module = { return client.invoke>({ uri: "ens/ethereum.polywrap.eth", method: "requestAccounts", - args + args: args as unknown as Record }); }, @@ -582,7 +582,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "callContractMethod", - args + args: args as unknown as Record }); }, @@ -593,7 +593,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "callContractMethodAndWait", - args + args: args as unknown as Record }); }, @@ -604,7 +604,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "sendTransaction", - args + args: args as unknown as Record }); }, @@ -615,7 +615,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "sendTransactionAndWait", - args + args: args as unknown as Record }); }, @@ -626,7 +626,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "deployContract", - args + args: args as unknown as Record }); }, @@ -637,7 +637,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "signMessage", - args + args: args as unknown as Record }); }, @@ -648,7 +648,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "sendRPC", - args + args: args as unknown as Record }); } } diff --git a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/module.ts b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/module.ts index 5d68d6b00e..69fb521c72 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/module.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/module.ts @@ -9,12 +9,12 @@ import { MaybeAsync } from "@polywrap/core-js"; -export interface Args_methodOne extends Record { +export interface Args_methodOne { str: Types.String; optStr?: Types.String | null; } -export interface Args_methodTwo extends Record { +export interface Args_methodTwo { arg: Types.UInt32; } diff --git a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/types.ts b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/types.ts index f503d1720d..3172a4e4b0 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/types.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/types.ts @@ -159,7 +159,7 @@ export interface Ethereum_Access { /// Imported Modules START /// /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractView extends Record { +interface Ethereum_Module_Args_callContractView { address: Types.String; method: Types.String; args?: Array | null; @@ -167,7 +167,7 @@ interface Ethereum_Module_Args_callContractView extends Record } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractStatic extends Record { +interface Ethereum_Module_Args_callContractStatic { address: Types.String; method: Types.String; args?: Array | null; @@ -176,72 +176,72 @@ interface Ethereum_Module_Args_callContractStatic extends Record { +interface Ethereum_Module_Args_getBalance { address: Types.String; blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_encodeParams extends Record { +interface Ethereum_Module_Args_encodeParams { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_encodeFunction extends Record { +interface Ethereum_Module_Args_encodeFunction { method: Types.String; args?: Array | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_solidityPack extends Record { +interface Ethereum_Module_Args_solidityPack { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_solidityKeccak256 extends Record { +interface Ethereum_Module_Args_solidityKeccak256 { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_soliditySha256 extends Record { +interface Ethereum_Module_Args_soliditySha256 { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerAddress extends Record { +interface Ethereum_Module_Args_getSignerAddress { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerBalance extends Record { +interface Ethereum_Module_Args_getSignerBalance { blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerTransactionCount extends Record { +interface Ethereum_Module_Args_getSignerTransactionCount { blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getGasPrice extends Record { +interface Ethereum_Module_Args_getGasPrice { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_estimateTransactionGas extends Record { +interface Ethereum_Module_Args_estimateTransactionGas { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_estimateContractCallGas extends Record { +interface Ethereum_Module_Args_estimateContractCallGas { address: Types.String; method: Types.String; args?: Array | null; @@ -250,22 +250,22 @@ interface Ethereum_Module_Args_estimateContractCallGas extends Record { +interface Ethereum_Module_Args_checkAddress { address: Types.String; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_toWei extends Record { +interface Ethereum_Module_Args_toWei { eth: Types.String; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_toEth extends Record { +interface Ethereum_Module_Args_toEth { wei: Types.BigInt; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_awaitTransaction extends Record { +interface Ethereum_Module_Args_awaitTransaction { txHash: Types.String; confirmations: Types.UInt32; timeout: Types.UInt32; @@ -273,7 +273,7 @@ interface Ethereum_Module_Args_awaitTransaction extends Record } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_waitForEvent extends Record { +interface Ethereum_Module_Args_waitForEvent { address: Types.String; event: Types.String; args?: Array | null; @@ -282,17 +282,17 @@ interface Ethereum_Module_Args_waitForEvent extends Record { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getNetwork extends Record { +interface Ethereum_Module_Args_getNetwork { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_requestAccounts extends Record { +interface Ethereum_Module_Args_requestAccounts { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractMethod extends Record { +interface Ethereum_Module_Args_callContractMethod { address: Types.String; method: Types.String; args?: Array | null; @@ -301,7 +301,7 @@ interface Ethereum_Module_Args_callContractMethod extends Record { +interface Ethereum_Module_Args_callContractMethodAndWait { address: Types.String; method: Types.String; args?: Array | null; @@ -310,19 +310,19 @@ interface Ethereum_Module_Args_callContractMethodAndWait extends Record { +interface Ethereum_Module_Args_sendTransaction { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_sendTransactionAndWait extends Record { +interface Ethereum_Module_Args_sendTransactionAndWait { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_deployContract extends Record { +interface Ethereum_Module_Args_deployContract { abi: Types.String; bytecode: Types.String; args?: Array | null; @@ -330,13 +330,13 @@ interface Ethereum_Module_Args_deployContract extends Record { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_signMessage extends Record { +interface Ethereum_Module_Args_signMessage { message: Types.String; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_sendRPC extends Record { +interface Ethereum_Module_Args_sendRPC { method: Types.String; params: Array; connection?: Types.Ethereum_Connection | null; @@ -351,7 +351,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "callContractView", - args + args: args as unknown as Record }); }, @@ -362,7 +362,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "callContractStatic", - args + args: args as unknown as Record }); }, @@ -373,7 +373,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getBalance", - args + args: args as unknown as Record }); }, @@ -384,7 +384,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "encodeParams", - args + args: args as unknown as Record }); }, @@ -395,7 +395,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "encodeFunction", - args + args: args as unknown as Record }); }, @@ -406,7 +406,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "solidityPack", - args + args: args as unknown as Record }); }, @@ -417,7 +417,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "solidityKeccak256", - args + args: args as unknown as Record }); }, @@ -428,7 +428,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "soliditySha256", - args + args: args as unknown as Record }); }, @@ -439,7 +439,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getSignerAddress", - args + args: args as unknown as Record }); }, @@ -450,7 +450,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getSignerBalance", - args + args: args as unknown as Record }); }, @@ -461,7 +461,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getSignerTransactionCount", - args + args: args as unknown as Record }); }, @@ -472,7 +472,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getGasPrice", - args + args: args as unknown as Record }); }, @@ -483,7 +483,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "estimateTransactionGas", - args + args: args as unknown as Record }); }, @@ -494,7 +494,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "estimateContractCallGas", - args + args: args as unknown as Record }); }, @@ -505,7 +505,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "checkAddress", - args + args: args as unknown as Record }); }, @@ -516,7 +516,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "toWei", - args + args: args as unknown as Record }); }, @@ -527,7 +527,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "toEth", - args + args: args as unknown as Record }); }, @@ -538,7 +538,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "awaitTransaction", - args + args: args as unknown as Record }); }, @@ -549,7 +549,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "waitForEvent", - args + args: args as unknown as Record }); }, @@ -560,7 +560,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "getNetwork", - args + args: args as unknown as Record }); }, @@ -571,7 +571,7 @@ export const Ethereum_Module = { return client.invoke>({ uri: "ens/ethereum.polywrap.eth", method: "requestAccounts", - args + args: args as unknown as Record }); }, @@ -582,7 +582,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "callContractMethod", - args + args: args as unknown as Record }); }, @@ -593,7 +593,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "callContractMethodAndWait", - args + args: args as unknown as Record }); }, @@ -604,7 +604,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "sendTransaction", - args + args: args as unknown as Record }); }, @@ -615,7 +615,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "sendTransactionAndWait", - args + args: args as unknown as Record }); }, @@ -626,7 +626,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "deployContract", - args + args: args as unknown as Record }); }, @@ -637,7 +637,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "signMessage", - args + args: args as unknown as Record }); }, @@ -648,7 +648,7 @@ export const Ethereum_Module = { return client.invoke({ uri: "ens/ethereum.polywrap.eth", method: "sendRPC", - args + args: args as unknown as Record }); } } diff --git a/packages/test-cases/cases/wrappers/wasm-as/map-type/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/map-type/polywrap.yaml index beea9be38f..960141af13 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/map-type/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/map-type/polywrap.yaml @@ -1,9 +1,12 @@ format: 0.2.0 project: - name: BytesType + name: MapType type: wasm/assemblyscript source: schema: ./schema.graphql module: ./src/index.ts + import_abis: + - uri: "wrap://ens/imported-map.eth" + abi: ./schema.import.graphql extensions: build: ./polywrap.build.yaml \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/map-type/schema.graphql b/packages/test-cases/cases/wrappers/wasm-as/map-type/schema.graphql index b79ca553c5..7c213e6316 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/map-type/schema.graphql +++ b/packages/test-cases/cases/wrappers/wasm-as/map-type/schema.graphql @@ -1,3 +1,5 @@ +#import { Module, CustomMap } into Imported from "wrap://ens/imported-map.eth" + type Module { getKey( key: String! @@ -11,8 +13,13 @@ type Module { returnCustomMap( foo: CustomMap! ): CustomMap! + + returnNestedMap( + foo: Map! @annotate(type: "Map!>!") + ): Map! @annotate(type: "Map!>!") } type CustomMap { map: Map! @annotate(type: "Map!") + nestedMap: Map! @annotate(type: "Map!>!") } diff --git a/packages/test-cases/cases/wrappers/wasm-as/map-type/schema.import.graphql b/packages/test-cases/cases/wrappers/wasm-as/map-type/schema.import.graphql new file mode 100644 index 0000000000..d44100b46b --- /dev/null +++ b/packages/test-cases/cases/wrappers/wasm-as/map-type/schema.import.graphql @@ -0,0 +1,23 @@ +type Module { + getKey( + key: String! + foo: CustomMap! + ): Int! + + returnMap( + map: Map! @annotate(type: "Map!") + ): Map! @annotate(type: "Map!") + + returnCustomMap( + foo: CustomMap! + ): CustomMap! + + returnNestedMap( + foo: Map! @annotate(type: "Map!>!") + ): Map! @annotate(type: "Map!>!") +} + +type CustomMap { + map: Map! @annotate(type: "Map!") + nestedMap: Map! @annotate(type: "Map!>!") +} \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/map-type/src/index.ts b/packages/test-cases/cases/wrappers/wasm-as/map-type/src/index.ts index 9e6c338962..8262aba7a7 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/map-type/src/index.ts +++ b/packages/test-cases/cases/wrappers/wasm-as/map-type/src/index.ts @@ -2,12 +2,12 @@ import { Args_getKey, Args_returnMap, Args_returnCustomMap, + Args_returnNestedMap, CustomMap } from "./wrap"; export function getKey(args: Args_getKey): i32 { - let result = args.foo.map.get(args.key); - return result; + return args.foo.map.get(args.key); } export function returnMap(args: Args_returnMap): Map { @@ -17,3 +17,7 @@ export function returnMap(args: Args_returnMap): Map { export function returnCustomMap(args: Args_returnCustomMap): CustomMap { return args.foo; } + +export function returnNestedMap(args: Args_returnNestedMap): Map> { + return args.foo; +} diff --git a/packages/test-cases/cases/wrappers/wasm-as/reserved-words/src/index.ts b/packages/test-cases/cases/wrappers/wasm-as/reserved-words/src/index.ts index 6ea15ddd4b..dd620c6443 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/reserved-words/src/index.ts +++ b/packages/test-cases/cases/wrappers/wasm-as/reserved-words/src/index.ts @@ -3,7 +3,7 @@ import { Args__for, _else, _while, - Box, + _Box, getwhileKey } from "./wrap"; @@ -13,7 +13,7 @@ export function _if(args: Args__if): _else { }; } -export function _for(args: Args__for): Box { +export function _for(args: Args__for): _Box { const value: _while = args._in; return { box: getwhileKey(value) diff --git a/packages/test-cases/cases/wrappers/wasm-rs/map-type/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-rs/map-type/polywrap.yaml index 9479041fd7..30e6181628 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/map-type/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-rs/map-type/polywrap.yaml @@ -5,5 +5,8 @@ project: source: schema: ./schema.graphql module: ./Cargo.toml + import_abis: + - uri: "wrap://ens/imported-map.eth" + abi: ./schema.import.graphql extensions: build: ./polywrap.build.yaml \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-rs/map-type/schema.graphql b/packages/test-cases/cases/wrappers/wasm-rs/map-type/schema.graphql index b79ca553c5..7c213e6316 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/map-type/schema.graphql +++ b/packages/test-cases/cases/wrappers/wasm-rs/map-type/schema.graphql @@ -1,3 +1,5 @@ +#import { Module, CustomMap } into Imported from "wrap://ens/imported-map.eth" + type Module { getKey( key: String! @@ -11,8 +13,13 @@ type Module { returnCustomMap( foo: CustomMap! ): CustomMap! + + returnNestedMap( + foo: Map! @annotate(type: "Map!>!") + ): Map! @annotate(type: "Map!>!") } type CustomMap { map: Map! @annotate(type: "Map!") + nestedMap: Map! @annotate(type: "Map!>!") } diff --git a/packages/test-cases/cases/wrappers/wasm-rs/map-type/schema.import.graphql b/packages/test-cases/cases/wrappers/wasm-rs/map-type/schema.import.graphql new file mode 100644 index 0000000000..d44100b46b --- /dev/null +++ b/packages/test-cases/cases/wrappers/wasm-rs/map-type/schema.import.graphql @@ -0,0 +1,23 @@ +type Module { + getKey( + key: String! + foo: CustomMap! + ): Int! + + returnMap( + map: Map! @annotate(type: "Map!") + ): Map! @annotate(type: "Map!") + + returnCustomMap( + foo: CustomMap! + ): CustomMap! + + returnNestedMap( + foo: Map! @annotate(type: "Map!>!") + ): Map! @annotate(type: "Map!>!") +} + +type CustomMap { + map: Map! @annotate(type: "Map!") + nestedMap: Map! @annotate(type: "Map!>!") +} \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-rs/map-type/src/lib.rs b/packages/test-cases/cases/wrappers/wasm-rs/map-type/src/lib.rs index 7b3e7c774a..210df1bf9f 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/map-type/src/lib.rs +++ b/packages/test-cases/cases/wrappers/wasm-rs/map-type/src/lib.rs @@ -13,3 +13,7 @@ pub fn return_map(args: ArgsReturnMap) -> Map { pub fn return_custom_map(args: ArgsReturnCustomMap) -> CustomMap { args.foo } + +pub fn return_nested_map(args: ArgsReturnNestedMap) -> Map> { + args.foo +} diff --git a/packages/wasm/as/assembly/__tests__/msgpack.spec.ts b/packages/wasm/as/assembly/__tests__/msgpack.spec.ts index b464b41c99..76abba7f2c 100644 --- a/packages/wasm/as/assembly/__tests__/msgpack.spec.ts +++ b/packages/wasm/as/assembly/__tests__/msgpack.spec.ts @@ -6,11 +6,11 @@ import { Write, WriteEncoder, WriteSizer, + Box, JSON, BigInt, BigNumber, } from "../"; -import { Option } from "as-container"; class Sanity { nil: string | null = "null"; @@ -21,8 +21,8 @@ class Sanity { uint16: u16; uint32: u32; boolean: bool; - optUint32: Option = Option.None(); - optBool: Option = Option.None(); + optUint32: Box | null = null; + optBool: Box | null = null; float32: f32; float64: f64; str: string = ""; @@ -49,8 +49,8 @@ class Sanity { this.uint16 = 65535; this.uint32 = 4294967295; this.boolean = true; - this.optUint32 = Option.Some(234234234); - this.optBool = Option.Some(true); + this.optUint32 = Box.from(234234234); + this.optBool = Box.from(true); this.float32 = 3.40282344818115234375; this.float64 = 3124124512.598273468017578125; this.str = "Hello, world!"; diff --git a/packages/wasm/as/assembly/__tests__/msgpack_write.spec.ts b/packages/wasm/as/assembly/__tests__/msgpack_write.spec.ts index a24900c449..02f33a2d6a 100644 --- a/packages/wasm/as/assembly/__tests__/msgpack_write.spec.ts +++ b/packages/wasm/as/assembly/__tests__/msgpack_write.spec.ts @@ -407,24 +407,39 @@ describe("WriteEncoder", () => { }); it("TestWriteExtGenericMap", () => { - const map1 = new Map>(); - map1.set("foo", [1, -1, 42]); - map1.set("baz", [12412, -98987]); + const map1 = new Map>(); + map1.set(1, [3, 5, 9]); + map1.set(2, [1, 4, 7]); + const map2 = new Map>(); + for (let i = 0; i < 16; ++i) { + map2.set(i, [i, i + 1, i + 2]); + } const cases = [ - new Case>>( - "Map", map1, - [199, 22, 1, 130, 163, 102, 111, 111, 147, 1, 255, 42, 163, 98, - 97, 122, 146, 209, 48, 124, 210, 255, 254, 125, 85]), + new Case>>( + "map 8", + map1, + [199, 11, 1, 130, 1, 147, 3, 5, 9, 2, 147, 1, 4, 7] + ), + new Case>>( + "map 16", + map2, + [ + 199, 83, 1, 222, 0, 16, 0, 147, 0, 1, 2, 1, 147, 1, 2, 3, 2, 147, 2, 3, 4, 3, 147, + 3, 4, 5, 4, 147, 4, 5, 6, 5, 147, 5, 6, 7, 6, 147, 6, 7, 8, 7, 147, 7, 8, 9, 8, + 147, 8, 9, 10, 9, 147, 9, 10, 11, 10, 147, 10, 11, 12, 11, 147, 11, 12, 13, 12, + 147, 12, 13, 14, 13, 147, 13, 14, 15, 14, 147, 14, 15, 16, 15, 147, 15, 16, 17, + ] + ) ]; for (let i: i32 = 0; i < cases.length; ++i) { const testcase = cases[i]; const sizer = new WriteSizer(); - sizer.writeExtGenericMap>( + sizer.writeExtGenericMap( testcase.input, - (writer: Write, key: string): void => { - writer.writeString(key); + (writer: Write, key: i32): void => { + writer.writeInt32(key); }, (writer: Write, value: Array) => { writer.writeArray(value, (writer: Write, item: i32) => { @@ -434,10 +449,10 @@ describe("WriteEncoder", () => { ); const buffer = new ArrayBuffer(sizer.length); const encoder = new WriteEncoder(buffer, sizer); - encoder.writeExtGenericMap>( + encoder.writeExtGenericMap( testcase.input, - (writer: Write, key: string): void => { - writer.writeString(key); + (writer: Write, key: i32): void => { + writer.writeInt32(key); }, (writer: Write, value: Array) => { writer.writeArray(value, (writer: Write, item: i32) => { @@ -451,4 +466,66 @@ describe("WriteEncoder", () => { expect(actual).toStrictEqual(expected); } }); + + it("TestWriteExtGenericMap Nested Maps", () => { + const rootMap = new Map>(); + const subMap = new Map(); + subMap.set("Hello", 1); + subMap.set("Heyo", 50); + rootMap.set("Nested", subMap); + + const cases = [ + new Case>>( + "nested maps", + rootMap, + [199, 25, 1, 129, 166, 78, 101, 115, 116, 101, 100, 199, 14, 1, 130, + 165, 72, 101, 108, 108, 111, 1, 164, 72, 101, 121, 111, 50] + ), + ]; + + for (let i: i32 = 0; i < cases.length; ++i) { + const testcase = cases[i]; + const sizer = new WriteSizer(); + sizer.writeExtGenericMap( + testcase.input, + (writer: Write, key: string): void => { + writer.writeString(key); + }, + (writer: Write, value: Map) => { + writer.writeExtGenericMap( + value, + (writer: Write, key: string) => { + writer.writeString(key); + }, + (writer: Write, value: u8) => { + writer.writeUInt8(value); + } + ); + } + ); + const buffer = new ArrayBuffer(sizer.length); + const encoder = new WriteEncoder(buffer, sizer); + encoder.writeExtGenericMap( + testcase.input, + (writer: Write, key: string): void => { + writer.writeString(key); + }, + (writer: Write, value: Map) => { + writer.writeExtGenericMap( + value, + (writer: Write, key: string) => { + writer.writeString(key); + }, + (writer: Write, value: u8) => { + writer.writeUInt8(value); + } + ); + } + ); + + const actual = encoder._view.buffer; + const expected = fill(testcase.want); + expect(actual).toStrictEqual(expected); + } + }); }); diff --git a/packages/wasm/as/assembly/__tests__/msgpack_write_option.spec.ts b/packages/wasm/as/assembly/__tests__/msgpack_write_optional.spec.ts similarity index 91% rename from packages/wasm/as/assembly/__tests__/msgpack_write_option.spec.ts rename to packages/wasm/as/assembly/__tests__/msgpack_write_optional.spec.ts index 58ac494560..a866476f93 100644 --- a/packages/wasm/as/assembly/__tests__/msgpack_write_option.spec.ts +++ b/packages/wasm/as/assembly/__tests__/msgpack_write_optional.spec.ts @@ -3,7 +3,7 @@ import { WriteSizer } from "../msgpack/WriteSizer"; import { WriteEncoder } from "../msgpack/WriteEncoder"; import { BigInt, BigNumber } from "../math"; import { JSON } from "../json"; -import { Option } from "../"; +import { Box } from "../containers"; function fill(arr: Array): ArrayBuffer { const buffer = new ArrayBuffer(arr.length); @@ -26,12 +26,12 @@ class Case { } } -describe("WriteEncoder Option types", () => { +describe("WriteEncoder optional types", () => { it("TestWriteOptionalBool", () => { const cases = [ - new Case>("nil", Option.None(), [192]), - new Case>("nil", Option.Some(false), [194]), - new Case>("nil", Option.Some(true), [195]), + new Case | null>("nil", null, [192]), + new Case | null>("nil", Box.from(false), [194]), + new Case | null>("nil", Box.from(true), [195]), ]; for (let i: i32 = 0; i < cases.length; ++i) { @@ -50,10 +50,10 @@ describe("WriteEncoder Option types", () => { it("TestWriteOptionalInt8", () => { const cases = [ - new Case>("none", Option.None(), [192]), - new Case>( + new Case | null>("none", null, [192]), + new Case | null>( "positive fixed int", - Option.Some(-128), + Box.from(-128), [208,128] ), ]; @@ -74,10 +74,10 @@ describe("WriteEncoder Option types", () => { it("TestWriteOptionalInt16", () => { const cases = [ - new Case>("none", Option.None(), [192]), - new Case>( + new Case | null>("none", null, [192]), + new Case | null>( "16-bit signed int (negative)", - Option.Some(-32768), + Box.from(-32768), [209, 128, 0] ), ]; @@ -98,10 +98,10 @@ describe("WriteEncoder Option types", () => { it("TestWriteOptionalInt32", () => { const cases = [ - new Case>("none", Option.None(), [192]), - new Case>( + new Case | null>("none", null, [192]), + new Case | null>( "32-bit signed int (negative)", - Option.Some(-32769), + Box.from(-32769), [210, 255, 255, 127, 255] ), ]; @@ -122,10 +122,10 @@ describe("WriteEncoder Option types", () => { it("TestWriteOptionalUint8", () => { const cases = [ - new Case>("none", Option.None(), [192]), - new Case>( + new Case | null>("none", null, [192]), + new Case | null>( "8-bit unsigned int", - Option.Some(200), + Box.from(200), [204,200] ), ]; @@ -146,10 +146,10 @@ describe("WriteEncoder Option types", () => { it("TestWriteOptionalUint16", () => { const cases = [ - new Case>("none", Option.None(), [192]), - new Case>( + new Case | null>("none", null, [192]), + new Case | null>( "16-bit unsigned int", - Option.Some(256), + Box.from(256), [205,1,0] ), ]; @@ -170,10 +170,10 @@ describe("WriteEncoder Option types", () => { it("TestWriteOptionalUint32", () => { const cases = [ - new Case>("none", Option.None(), [192]), - new Case>( + new Case | null>("none", null, [192]), + new Case | null>( "32-bit unsigned int", - Option.Some(65536), + Box.from(65536), [206,0,1,0,0] ), ]; @@ -194,10 +194,10 @@ describe("WriteEncoder Option types", () => { it("TestWriteOptionalFloat32", () => { const cases = [ - new Case>("none", Option.None(), [192]), - new Case>( + new Case | null>("none", null, [192]), + new Case | null>( "32-bit float", - Option.Some(0.5), + Box.from(0.5), [202,63,0,0,0] ), ]; @@ -218,10 +218,10 @@ describe("WriteEncoder Option types", () => { it("TestWriteOptionalFloat64", () => { const cases = [ - new Case>("none", Option.None(), [192]), - new Case>( + new Case | null>("none", null, [192]), + new Case | null>( "64-bit float", - Option.Some(3.141592653589793), + Box.from(3.141592653589793), [203, 64, 9, 33, 251, 84, 68, 45, 24] ), ]; diff --git a/packages/wasm/as/assembly/containers/index.ts b/packages/wasm/as/assembly/containers/index.ts index 24b9e120e7..219d8c2dff 100644 --- a/packages/wasm/as/assembly/containers/index.ts +++ b/packages/wasm/as/assembly/containers/index.ts @@ -1 +1,2 @@ export * from "./Result"; +export { Box } from "as-container"; diff --git a/packages/wasm/as/assembly/index.ts b/packages/wasm/as/assembly/index.ts index 372b974bd4..38900a8a8d 100644 --- a/packages/wasm/as/assembly/index.ts +++ b/packages/wasm/as/assembly/index.ts @@ -1,4 +1,3 @@ -export { Option } from "as-container"; export { Read, ReadDecoder, Write, WriteEncoder, WriteSizer } from "./msgpack"; export * from "./json"; export * from "./math"; diff --git a/packages/wasm/as/assembly/msgpack/DataView.ts b/packages/wasm/as/assembly/msgpack/DataView.ts index 4efbe83c51..a88f67a3be 100644 --- a/packages/wasm/as/assembly/msgpack/DataView.ts +++ b/packages/wasm/as/assembly/msgpack/DataView.ts @@ -9,20 +9,16 @@ export class DataView { @unsafe readonly dataStart: u32; readonly buffer: ArrayBuffer; - readonly byteLength: i32; - private _byteOffset: i32; + readonly byteLength: u32; + private _index: u32; private _context: Context; constructor( buffer: ArrayBuffer, - byte_offset: i32 = 0, - byte_length: i32 = buffer.byteLength, + byte_length: u32 = buffer.byteLength, context: Context = new Context() ) { - if ( - i32(byte_length > BLOCK_MAXSIZE) | - i32(byte_offset + byte_length > buffer.byteLength) - ) { + if (byte_length > BLOCK_MAXSIZE || byte_length > buffer.byteLength) { throw new RangeError( context.printWithContext( "DataView.constructor" + @@ -32,8 +28,6 @@ export class DataView { byte_length.toString() + " BLOCK_MAXSIZE: " + BLOCK_MAXSIZE.toString() + - " byte_offset: " + - byte_offset.toString() + "buffer.byteLength: " + buffer.byteLength.toString() + "]" @@ -45,180 +39,171 @@ export class DataView { const dataStart = changetype(buffer); this.dataStart = dataStart; this.byteLength = byte_length; - this._byteOffset = byte_offset; + this._index = 0; this._context = context; } - getBytes(length: i32): ArrayBuffer { + getBytes(length: u32): ArrayBuffer { this._checkIndexInRange("getBytes", length); - const result = this.buffer.slice( - this._byteOffset, - this._byteOffset + length - ); - this._byteOffset += length; + const result = this.buffer.slice(this._index, this._index + length); + this._index += length; return result; } setBytes(buf: ArrayBuffer): void { this._checkIndexInRange("setBytes", buf.byteLength); - memory.copy( - changetype(this.dataStart) + this._byteOffset, - changetype(buf), - buf.byteLength - ); - this._byteOffset += buf.byteLength; + memory.copy(this.getMemCursor(), changetype(buf), buf.byteLength); + this._index += buf.byteLength; } peekUint8(): u8 { this._checkIndexInRange("peekUint8", 0); - return bswap(load(this.dataStart + this._byteOffset)); + return bswap(load(this.getMemCursor())); } - discard(length: i32): void { + discard(length: u32): void { this._checkIndexInRange("discard", length); - this._byteOffset += length; + this._index += length; } getFloat32(): f32 { this._checkIndexInRange("getFloat32", 4); - const result = reinterpret( - bswap(load(this.dataStart + this._byteOffset)) - ); - this._byteOffset += 4; + const result = reinterpret(bswap(load(this.getMemCursor()))); + this._index += 4; return result; } getFloat64(): f64 { this._checkIndexInRange("getFloat64", 8); - const result = reinterpret( - bswap(load(this.dataStart + this._byteOffset)) - ); - this._byteOffset += 8; + const result = reinterpret(bswap(load(this.getMemCursor()))); + this._index += 8; return result; } getInt8(): i8 { this._checkIndexInRange("getInt8", 1); - const result = load(this.dataStart + this._byteOffset); - this._byteOffset++; + const result = load(this.getMemCursor()); + this._index++; return bswap(result); } getInt16(): i16 { this._checkIndexInRange("getInt16", 2); - const result = load(this.dataStart + this._byteOffset); - this._byteOffset += 2; + const result = load(this.getMemCursor()); + this._index += 2; return bswap(result); } getInt32(): i32 { this._checkIndexInRange("getInt32", 4); - const result = load(this.dataStart + this._byteOffset); - this._byteOffset += 4; + const result = load(this.getMemCursor()); + this._index += 4; return bswap(result); } getUint8(): u8 { this._checkIndexInRange("getUint8", 1); - const result = load(this.dataStart + this._byteOffset); - this._byteOffset++; + const result = load(this.getMemCursor()); + this._index++; return bswap(result); } getUint16(): u16 { this._checkIndexInRange("getUint16", 2); - const result = load(this.dataStart + this._byteOffset); - this._byteOffset += 2; + const result = load(this.getMemCursor()); + this._index += 2; return bswap(result); } getUint32(): u32 { this._checkIndexInRange("getUint32", 4); - const result = load(this.dataStart + this._byteOffset); - this._byteOffset += 4; + const result = load(this.getMemCursor()); + this._index += 4; return bswap(result); } setFloat32(value: f32): void { this._checkIndexInRange("setFloat32", 4); - store( - this.dataStart + this._byteOffset, - bswap(reinterpret(value)) - ); - this._byteOffset += 4; + store(this.getMemCursor(), bswap(reinterpret(value))); + this._index += 4; } setFloat64(value: f64): void { this._checkIndexInRange("setFloat64", 8); - store( - this.dataStart + this._byteOffset, - bswap(reinterpret(value)) - ); - this._byteOffset += 8; + store(this.getMemCursor(), bswap(reinterpret(value))); + this._index += 8; } setInt8(value: i8): void { this._checkIndexInRange("setInt8", 1); - store(this.dataStart + this._byteOffset, bswap(value)); - this._byteOffset++; + store(this.getMemCursor(), bswap(value)); + this._index++; } setInt16(value: i16): void { this._checkIndexInRange("setInt16", 2); - store(this.dataStart + this._byteOffset, bswap(value)); - this._byteOffset += 2; + store(this.getMemCursor(), bswap(value)); + this._index += 2; } setInt32(value: i32): void { this._checkIndexInRange("setInt32", 4); - store(this.dataStart + this._byteOffset, bswap(value)); - this._byteOffset += 4; + store(this.getMemCursor(), bswap(value)); + this._index += 4; } setUint8(value: u8): void { this._checkIndexInRange("setUint8", 1); - store(this.dataStart + this._byteOffset, bswap(value)); - this._byteOffset++; + store(this.getMemCursor(), bswap(value)); + this._index++; } setUint16(value: u16): void { this._checkIndexInRange("setUint16", 2); - store(this.dataStart + this._byteOffset, bswap(value)); - this._byteOffset += 2; + store(this.getMemCursor(), bswap(value)); + this._index += 2; } setUint32(value: u32): void { this._checkIndexInRange("setUint32", 4); - store(this.dataStart + this._byteOffset, bswap(value)); - this._byteOffset += 4; + store(this.getMemCursor(), bswap(value)); + this._index += 4; } // Non-standard additions that make sense in WebAssembly, but won't work in JS: getInt64(): i64 { this._checkIndexInRange("getInt64", 8); - const result = load(this.dataStart + this._byteOffset); - this._byteOffset += 8; + const result = load(this.getMemCursor()); + this._index += 8; return bswap(result); } getUint64(): u64 { this._checkIndexInRange("getUint64", 8); - const result = load(this.dataStart + this._byteOffset); - this._byteOffset += 8; + const result = load(this.getMemCursor()); + this._index += 8; return bswap(result); } + getIndex(): u32 { + return this._index; + } + + getMemCursor(): u32 { + return this.dataStart + this._index; + } + toString(): string { return "[object DataView]"; } - private _checkIndexInRange(method: string, length: i32): void { - if (this._byteOffset + length > this.byteLength) { + private _checkIndexInRange(method: string, length: u32): void { + if (this._index + length > this.byteLength) { throwByteIndexOutOfRange( this._context, method, length, - this._byteOffset, + this._index, this.byteLength ); } diff --git a/packages/wasm/as/assembly/msgpack/Read.ts b/packages/wasm/as/assembly/msgpack/Read.ts index 6237209a0e..1d3fd77a0f 100644 --- a/packages/wasm/as/assembly/msgpack/Read.ts +++ b/packages/wasm/as/assembly/msgpack/Read.ts @@ -1,8 +1,7 @@ import { BigInt, BigNumber } from "../math"; import { Context } from "../debug"; import { JSON } from "../json"; - -import { Option } from "as-container"; +import { Box } from "../containers"; export abstract class Read { abstract readBool(): bool; @@ -33,15 +32,15 @@ export abstract class Read { value_fn: (reader: Read) => V ): Map; - abstract readOptionalBool(): Option; - abstract readOptionalInt8(): Option; - abstract readOptionalInt16(): Option; - abstract readOptionalInt32(): Option; - abstract readOptionalUInt8(): Option; - abstract readOptionalUInt16(): Option; - abstract readOptionalUInt32(): Option; - abstract readOptionalFloat32(): Option; - abstract readOptionalFloat64(): Option; + abstract readOptionalBool(): Box | null; + abstract readOptionalInt8(): Box | null; + abstract readOptionalInt16(): Box | null; + abstract readOptionalInt32(): Box | null; + abstract readOptionalUInt8(): Box | null; + abstract readOptionalUInt16(): Box | null; + abstract readOptionalUInt32(): Box | null; + abstract readOptionalFloat32(): Box | null; + abstract readOptionalFloat64(): Box | null; abstract readOptionalString(): string | null; abstract readOptionalBytes(): ArrayBuffer | null; abstract readOptionalBigInt(): BigInt | null; diff --git a/packages/wasm/as/assembly/msgpack/ReadDecoder.ts b/packages/wasm/as/assembly/msgpack/ReadDecoder.ts index ecba0a4320..58a3529d1d 100644 --- a/packages/wasm/as/assembly/msgpack/ReadDecoder.ts +++ b/packages/wasm/as/assembly/msgpack/ReadDecoder.ts @@ -14,8 +14,7 @@ import { BigInt, BigNumber } from "../math"; import { Context } from "../debug"; import { JSON } from "../json"; import { ExtensionType } from "./ExtensionType"; - -import { Option } from "as-container"; +import { Box } from "../containers"; export class ReadDecoder extends Read { private readonly _context: Context; @@ -24,7 +23,7 @@ export class ReadDecoder extends Read { constructor(ua: ArrayBuffer, context: Context = new Context()) { super(); this._context = context; - this._view = new DataView(ua, 0, ua.byteLength, context); + this._view = new DataView(ua, ua.byteLength, context); } context(): Context { @@ -364,67 +363,67 @@ export class ReadDecoder extends Read { return this.readMap(key_fn, value_fn); } - readOptionalBool(): Option { + readOptionalBool(): Box | null { if (this.isNextNil()) { - return Option.None(); + return null; } - return Option.Some(this.readBool()); + return Box.from(this.readBool()); } - readOptionalInt8(): Option { + readOptionalInt8(): Box | null { if (this.isNextNil()) { - return Option.None(); + return null; } - return Option.Some(this.readInt8()); + return Box.from(this.readInt8()); } - readOptionalInt16(): Option { + readOptionalInt16(): Box | null { if (this.isNextNil()) { - return Option.None(); + return null; } - return Option.Some(this.readInt16()); + return Box.from(this.readInt16()); } - readOptionalInt32(): Option { + readOptionalInt32(): Box | null { if (this.isNextNil()) { - return Option.None(); + return null; } - return Option.Some(this.readInt32()); + return Box.from(this.readInt32()); } - readOptionalUInt8(): Option { + readOptionalUInt8(): Box | null { if (this.isNextNil()) { - return Option.None(); + return null; } - return Option.Some(this.readUInt8()); + return Box.from(this.readUInt8()); } - readOptionalUInt16(): Option { + readOptionalUInt16(): Box | null { if (this.isNextNil()) { - return Option.None(); + return null; } - return Option.Some(this.readUInt16()); + return Box.from(this.readUInt16()); } - readOptionalUInt32(): Option { + readOptionalUInt32(): Box | null { if (this.isNextNil()) { - return Option.None(); + return null; } - return Option.Some(this.readUInt32()); + return Box.from(this.readUInt32()); } - readOptionalFloat32(): Option { + readOptionalFloat32(): Box | null { if (this.isNextNil()) { - return Option.None(); + return null; } - return Option.Some(this.readFloat32()); + return Box.from(this.readFloat32()); } - readOptionalFloat64(): Option { + readOptionalFloat64(): Box | null { if (this.isNextNil()) { - return Option.None(); + return null; } - return Option.Some(this.readFloat64()); + return Box.from(this.readFloat64()); } readOptionalString(): string | null { diff --git a/packages/wasm/as/assembly/msgpack/Write.ts b/packages/wasm/as/assembly/msgpack/Write.ts index 843a2ead8b..7f6e07d37d 100644 --- a/packages/wasm/as/assembly/msgpack/Write.ts +++ b/packages/wasm/as/assembly/msgpack/Write.ts @@ -1,8 +1,7 @@ import { BigInt, BigNumber } from "../math"; import { Context } from "../debug"; import { JSON } from "../json"; - -import { Option } from "as-container"; +import { Box } from "../containers"; export abstract class Write { abstract writeNil(): void; @@ -39,15 +38,15 @@ export abstract class Write { value_fn: (writer: Write, value: V) => void ): void; - abstract writeOptionalBool(value: Option): void; - abstract writeOptionalInt8(value: Option): void; - abstract writeOptionalInt16(value: Option): void; - abstract writeOptionalInt32(value: Option): void; - abstract writeOptionalUInt8(value: Option): void; - abstract writeOptionalUInt16(value: Option): void; - abstract writeOptionalUInt32(value: Option): void; - abstract writeOptionalFloat32(value: Option): void; - abstract writeOptionalFloat64(value: Option): void; + abstract writeOptionalBool(value: Box | null): void; + abstract writeOptionalInt8(value: Box | null): void; + abstract writeOptionalInt16(value: Box | null): void; + abstract writeOptionalInt32(value: Box | null): void; + abstract writeOptionalUInt8(value: Box | null): void; + abstract writeOptionalUInt16(value: Box | null): void; + abstract writeOptionalUInt32(value: Box | null): void; + abstract writeOptionalFloat32(value: Box | null): void; + abstract writeOptionalFloat64(value: Box | null): void; abstract writeOptionalString(value: string | null): void; abstract writeOptionalBytes(value: ArrayBuffer | null): void; abstract writeOptionalBigInt(value: BigInt | null): void; diff --git a/packages/wasm/as/assembly/msgpack/WriteEncoder.ts b/packages/wasm/as/assembly/msgpack/WriteEncoder.ts index 36b4ff085c..abd58d6bcb 100644 --- a/packages/wasm/as/assembly/msgpack/WriteEncoder.ts +++ b/packages/wasm/as/assembly/msgpack/WriteEncoder.ts @@ -3,12 +3,10 @@ import { WriteSizer } from "./WriteSizer"; import { Format } from "./Format"; import { ExtensionType } from "./ExtensionType"; import { Write } from "./Write"; -import { throwArrayIndexOutOfRange } from "./utils"; import { BigInt, BigNumber } from "../math"; import { Context } from "../debug"; import { JSON } from "../json"; - -import { Option } from "as-container"; +import { Box } from "../containers"; export class WriteEncoder extends Write { private readonly _context: Context; @@ -23,7 +21,7 @@ export class WriteEncoder extends Write { ) { super(); this._context = context; - this._view = new DataView(ua, 0, ua.byteLength, context); + this._view = new DataView(ua, ua.byteLength, context); this._sizer = sizer; this._extCtr = 0; } @@ -207,16 +205,22 @@ export class WriteEncoder extends Write { key_fn: (encoder: Write, key: K) => void, value_fn: (encoder: Write, value: V) => void ): void { - if (this._extCtr >= this._sizer.extByteLengths.length) { - throwArrayIndexOutOfRange( - this._context, - "writeExtGenericMap", - this._sizer.extByteLengths.length, - this._extCtr + const index = this._extCtr; + this._extCtr += 1; + + if (this._extCtr > this._sizer.extByteLengths.length) { + throw new RangeError( + this._context.printWithContext( + "writeExtGenericMap" + + ": Invalid ext index " + + index.toString() + + ", ext cache length" + + this._sizer.extByteLengths.length.toString() + ) ); } - const byteLength = this._sizer.extByteLengths[this._extCtr]; - this._extCtr += 1; + + const byteLength = this._sizer.extByteLengths[index]; // Encode the extension format + bytelength if (byteLength <= u8.MAX_VALUE) { @@ -235,8 +239,8 @@ export class WriteEncoder extends Write { this.writeMap(m, key_fn, value_fn); } - writeOptionalBool(value: Option): void { - if (value.isNone) { + writeOptionalBool(value: Box | null): void { + if (value === null) { this.writeNil(); return; } @@ -244,8 +248,8 @@ export class WriteEncoder extends Write { this.writeBool(value.unwrap()); } - writeOptionalInt8(value: Option): void { - if (value.isNone) { + writeOptionalInt8(value: Box | null): void { + if (value === null) { this.writeNil(); return; } @@ -253,8 +257,8 @@ export class WriteEncoder extends Write { this.writeInt8(value.unwrap()); } - writeOptionalInt16(value: Option): void { - if (value.isNone) { + writeOptionalInt16(value: Box | null): void { + if (value === null) { this.writeNil(); return; } @@ -262,8 +266,8 @@ export class WriteEncoder extends Write { this.writeInt16(value.unwrap()); } - writeOptionalInt32(value: Option): void { - if (value.isNone) { + writeOptionalInt32(value: Box | null): void { + if (value === null) { this.writeNil(); return; } @@ -271,8 +275,8 @@ export class WriteEncoder extends Write { this.writeInt32(value.unwrap()); } - writeOptionalUInt8(value: Option): void { - if (value.isNone) { + writeOptionalUInt8(value: Box | null): void { + if (value === null) { this.writeNil(); return; } @@ -280,8 +284,8 @@ export class WriteEncoder extends Write { this.writeUInt8(value.unwrap()); } - writeOptionalUInt16(value: Option): void { - if (value.isNone) { + writeOptionalUInt16(value: Box | null): void { + if (value === null) { this.writeNil(); return; } @@ -289,8 +293,8 @@ export class WriteEncoder extends Write { this.writeUInt16(value.unwrap()); } - writeOptionalUInt32(value: Option): void { - if (value.isNone) { + writeOptionalUInt32(value: Box | null): void { + if (value === null) { this.writeNil(); return; } @@ -298,8 +302,8 @@ export class WriteEncoder extends Write { this.writeUInt32(value.unwrap()); } - writeOptionalFloat32(value: Option): void { - if (value.isNone) { + writeOptionalFloat32(value: Box | null): void { + if (value === null) { this.writeNil(); return; } @@ -307,8 +311,8 @@ export class WriteEncoder extends Write { this.writeFloat32(value.unwrap()); } - writeOptionalFloat64(value: Option): void { - if (value.isNone) { + writeOptionalFloat64(value: Box | null): void { + if (value === null) { this.writeNil(); return; } diff --git a/packages/wasm/as/assembly/msgpack/WriteSizer.ts b/packages/wasm/as/assembly/msgpack/WriteSizer.ts index 23cc096090..07f2f8fd9e 100644 --- a/packages/wasm/as/assembly/msgpack/WriteSizer.ts +++ b/packages/wasm/as/assembly/msgpack/WriteSizer.ts @@ -2,8 +2,7 @@ import { Write } from "./Write"; import { BigInt, BigNumber } from "../math"; import { Context } from "../debug"; import { JSON } from "../json"; - -import { Option } from "as-container"; +import { Box } from "../containers"; export class WriteSizer extends Write { length: i32; @@ -175,6 +174,10 @@ export class WriteSizer extends Write { key_fn: (encoder: Write, key: K) => void, value_fn: (encoder: Write, value: V) => void ): void { + // create a new slot in the extByteLength cache + const extIdx = this.extByteLengths.length; + this.extByteLengths.push(0); + // type = GENERIC_MAP this.length++; @@ -192,11 +195,11 @@ export class WriteSizer extends Write { this.length += 5; } - this.extByteLengths.push(byteLength); + this.extByteLengths[extIdx] = byteLength; } - writeOptionalBool(value: Option): void { - if (value.isNone) { + writeOptionalBool(value: Box | null): void { + if (value === null) { this.writeNil(); return; } @@ -204,8 +207,8 @@ export class WriteSizer extends Write { this.writeBool(value.unwrap()); } - writeOptionalInt8(value: Option): void { - if (value.isNone) { + writeOptionalInt8(value: Box | null): void { + if (value === null) { this.writeNil(); return; } @@ -213,8 +216,8 @@ export class WriteSizer extends Write { this.writeInt8(value.unwrap()); } - writeOptionalInt16(value: Option): void { - if (value.isNone) { + writeOptionalInt16(value: Box | null): void { + if (value === null) { this.writeNil(); return; } @@ -222,8 +225,8 @@ export class WriteSizer extends Write { this.writeInt16(value.unwrap()); } - writeOptionalInt32(value: Option): void { - if (value.isNone) { + writeOptionalInt32(value: Box | null): void { + if (value === null) { this.writeNil(); return; } @@ -231,8 +234,8 @@ export class WriteSizer extends Write { this.writeInt32(value.unwrap()); } - writeOptionalUInt8(value: Option): void { - if (value.isNone) { + writeOptionalUInt8(value: Box | null): void { + if (value === null) { this.writeNil(); return; } @@ -240,8 +243,8 @@ export class WriteSizer extends Write { this.writeUInt8(value.unwrap()); } - writeOptionalUInt16(value: Option): void { - if (value.isNone) { + writeOptionalUInt16(value: Box | null): void { + if (value === null) { this.writeNil(); return; } @@ -249,8 +252,8 @@ export class WriteSizer extends Write { this.writeUInt16(value.unwrap()); } - writeOptionalUInt32(value: Option): void { - if (value.isNone) { + writeOptionalUInt32(value: Box | null): void { + if (value === null) { this.writeNil(); return; } @@ -258,8 +261,8 @@ export class WriteSizer extends Write { this.writeUInt32(value.unwrap()); } - writeOptionalFloat32(value: Option): void { - if (value.isNone) { + writeOptionalFloat32(value: Box | null): void { + if (value === null) { this.writeNil(); return; } @@ -267,8 +270,8 @@ export class WriteSizer extends Write { this.writeFloat32(value.unwrap()); } - writeOptionalFloat64(value: Option): void { - if (value.isNone) { + writeOptionalFloat64(value: Box | null): void { + if (value === null) { this.writeNil(); return; } diff --git a/packages/wasm/as/assembly/msgpack/utils.ts b/packages/wasm/as/assembly/msgpack/utils.ts index ebb62c37a6..623adea997 100644 --- a/packages/wasm/as/assembly/msgpack/utils.ts +++ b/packages/wasm/as/assembly/msgpack/utils.ts @@ -4,8 +4,8 @@ export class BLOCK { /** Memory manager info. */ mmInfo: u32; } -export const BLOCK_OVERHEAD: usize = offsetof(); -export const BLOCK_MAXSIZE: usize = (1 << 30) - BLOCK_OVERHEAD; +export const BLOCK_OVERHEAD: u32 = offsetof(); +export const BLOCK_MAXSIZE: u32 = (1 << 30) - BLOCK_OVERHEAD; export const E_INDEXOUTOFRANGE = "Index out of range"; export const E_INVALIDLENGTH = "Invalid length"; diff --git a/packages/wasm/rs/tests/test_encode.rs b/packages/wasm/rs/tests/test_encode.rs index b3d0d1c186..b476816dba 100644 --- a/packages/wasm/rs/tests/test_encode.rs +++ b/packages/wasm/rs/tests/test_encode.rs @@ -467,3 +467,36 @@ fn test_write_ext_generic_map() { assert_eq!(case.want, writer.get_buffer().as_slice()); } } + +#[test] +fn test_write_ext_generic_map_nested() { + let mut root_map: BTreeMap> = BTreeMap::new(); + let mut sub_map: BTreeMap = BTreeMap::new(); + sub_map.insert("Hello".to_string(), 1); + sub_map.insert("Heyo".to_string(), 50); + root_map.insert("Nested".to_string(), sub_map); + let cases = [ + Case::new( + "nested maps", + root_map, + &[199, 25, 1, 129, 166, 78, 101, 115, 116, 101, 100, 199, 14, 1, 130, + 165, 72, 101, 108, 108, 111, 1, 164, 72, 101, 121, 111, 50], + ), + ]; + + for case in cases { + let mut writer = WriteEncoder::new(&[], Context::new()); + writer + .write_ext_generic_map( + &case.input, + |writer, key| writer.write_string(key), + |writer, value| writer.write_ext_generic_map( + value, + |writer, key| writer.write_string(key), + |writer, value| writer.write_u8(value), + ), + ) + .unwrap(); + assert_eq!(case.want, writer.get_buffer().as_slice()); + } +} diff --git a/yarn.lock b/yarn.lock index 2cba209db4..d90d71c455 100644 --- a/yarn.lock +++ b/yarn.lock @@ -124,10 +124,10 @@ dependencies: "@babel/highlight" "^7.18.6" -"@babel/compat-data@^7.17.7", "@babel/compat-data@^7.18.8", "@babel/compat-data@^7.9.0": - version "7.18.13" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.18.13.tgz#6aff7b350a1e8c3e40b029e46cbe78e24a913483" - integrity sha512-5yUzC5LqyTFp2HLmDoxGQelcdYgSpP9xsnMWBphAscOdFrHSAVbLNzWiy32sVNDqJRDiJK6klfDnAgu6PAGSHw== +"@babel/compat-data@^7.17.7", "@babel/compat-data@^7.18.8", "@babel/compat-data@^7.19.0", "@babel/compat-data@^7.9.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.19.0.tgz#2a592fd89bacb1fcde68de31bee4f2f2dacb0e86" + integrity sha512-y5rqgTTPTmaF5e2nVhOxw+Ur9HDJLsWb6U/KpgUzRZEdPfE6VOubXBKLdbcUTijzRptednSBDQbYZBOSqJxpJw== "@babel/core@7.9.0": version "7.9.0" @@ -152,32 +152,32 @@ source-map "^0.5.0" "@babel/core@^7.1.0", "@babel/core@^7.12.3", "@babel/core@^7.4.5", "@babel/core@^7.7.5": - version "7.18.13" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.18.13.tgz#9be8c44512751b05094a4d3ab05fc53a47ce00ac" - integrity sha512-ZisbOvRRusFktksHSG6pjj1CSvkPkcZq/KHD45LAkVP/oiHJkNBZWfpvlLmX8OtHDG8IuzsFlVRWo08w7Qxn0A== + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.19.0.tgz#d2f5f4f2033c00de8096be3c9f45772563e150c3" + integrity sha512-reM4+U7B9ss148rh2n1Qs9ASS+w94irYXga7c2jaQv9RVzpS7Mv1a9rnYYwuDa45G+DkORt9g6An2k/V4d9LbQ== dependencies: "@ampproject/remapping" "^2.1.0" "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.18.13" - "@babel/helper-compilation-targets" "^7.18.9" - "@babel/helper-module-transforms" "^7.18.9" - "@babel/helpers" "^7.18.9" - "@babel/parser" "^7.18.13" + "@babel/generator" "^7.19.0" + "@babel/helper-compilation-targets" "^7.19.0" + "@babel/helper-module-transforms" "^7.19.0" + "@babel/helpers" "^7.19.0" + "@babel/parser" "^7.19.0" "@babel/template" "^7.18.10" - "@babel/traverse" "^7.18.13" - "@babel/types" "^7.18.13" + "@babel/traverse" "^7.19.0" + "@babel/types" "^7.19.0" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.2.1" semver "^6.3.0" -"@babel/generator@^7.18.13", "@babel/generator@^7.4.0", "@babel/generator@^7.9.0": - version "7.18.13" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.18.13.tgz#59550cbb9ae79b8def15587bdfbaa388c4abf212" - integrity sha512-CkPg8ySSPuHTYPJYo7IRALdqyjM9HCbt/3uOBEFbzyGVP6Mn8bwFPB0jX6982JVNBlYzM1nnPkfjuXSOPtQeEQ== +"@babel/generator@^7.19.0", "@babel/generator@^7.4.0", "@babel/generator@^7.9.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.19.0.tgz#785596c06425e59334df2ccee63ab166b738419a" + integrity sha512-S1ahxf1gZ2dpoiFgA+ohK9DIpz50bJ0CWs7Zlzb54Z4sG8qmdIrGrVqmy1sAtTVRb+9CU6U8VqT9L0Zj7hxHVg== dependencies: - "@babel/types" "^7.18.13" + "@babel/types" "^7.19.0" "@jridgewell/gen-mapping" "^0.3.2" jsesc "^2.5.1" @@ -196,33 +196,33 @@ "@babel/helper-explode-assignable-expression" "^7.18.6" "@babel/types" "^7.18.9" -"@babel/helper-compilation-targets@^7.17.7", "@babel/helper-compilation-targets@^7.18.9", "@babel/helper-compilation-targets@^7.8.7": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.18.9.tgz#69e64f57b524cde3e5ff6cc5a9f4a387ee5563bf" - integrity sha512-tzLCyVmqUiFlcFoAPLA/gL9TeYrF61VLNtb+hvkuVaB5SUjW7jcfrglBIX1vUIoT7CLP3bBlIMeyEsIl2eFQNg== +"@babel/helper-compilation-targets@^7.17.7", "@babel/helper-compilation-targets@^7.18.9", "@babel/helper-compilation-targets@^7.19.0", "@babel/helper-compilation-targets@^7.8.7": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.0.tgz#537ec8339d53e806ed422f1e06c8f17d55b96bb0" + integrity sha512-Ai5bNWXIvwDvWM7njqsG3feMlL9hCVQsPYXodsZyLwshYkZVJt59Gftau4VrE8S9IT9asd2uSP1hG6wCNw+sXA== dependencies: - "@babel/compat-data" "^7.18.8" + "@babel/compat-data" "^7.19.0" "@babel/helper-validator-option" "^7.18.6" browserslist "^4.20.2" semver "^6.3.0" -"@babel/helper-create-class-features-plugin@^7.18.6", "@babel/helper-create-class-features-plugin@^7.18.9", "@babel/helper-create-class-features-plugin@^7.8.3": - version "7.18.13" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.18.13.tgz#63e771187bd06d234f95fdf8bd5f8b6429de6298" - integrity sha512-hDvXp+QYxSRL+23mpAlSGxHMDyIGChm0/AwTfTAAK5Ufe40nCsyNdaYCGuK91phn/fVu9kqayImRDkvNAgdrsA== +"@babel/helper-create-class-features-plugin@^7.18.6", "@babel/helper-create-class-features-plugin@^7.19.0", "@babel/helper-create-class-features-plugin@^7.8.3": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.19.0.tgz#bfd6904620df4e46470bae4850d66be1054c404b" + integrity sha512-NRz8DwF4jT3UfrmUoZjd0Uph9HQnP30t7Ash+weACcyNkiYTywpIjDBgReJMKgr+n86sn2nPVVmJ28Dm053Kqw== dependencies: "@babel/helper-annotate-as-pure" "^7.18.6" "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-function-name" "^7.18.9" + "@babel/helper-function-name" "^7.19.0" "@babel/helper-member-expression-to-functions" "^7.18.9" "@babel/helper-optimise-call-expression" "^7.18.6" "@babel/helper-replace-supers" "^7.18.9" "@babel/helper-split-export-declaration" "^7.18.6" -"@babel/helper-create-regexp-features-plugin@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.18.6.tgz#3e35f4e04acbbf25f1b3534a657610a000543d3c" - integrity sha512-7LcpH1wnQLGrI+4v+nPp+zUvIkF9x0ddv1Hkdue10tg3gmRnLy97DXh4STiOf1qeIInyD69Qv5kKSZzKD8B/7A== +"@babel/helper-create-regexp-features-plugin@^7.18.6", "@babel/helper-create-regexp-features-plugin@^7.19.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.19.0.tgz#7976aca61c0984202baca73d84e2337a5424a41b" + integrity sha512-htnV+mHX32DF81amCDrwIDr8nrp1PTm+3wfBN9/v8QJOLEioOCOG7qNyq0nHeFiWbT3Eb7gsPwEmV64UCQ1jzw== dependencies: "@babel/helper-annotate-as-pure" "^7.18.6" regexpu-core "^5.1.0" @@ -251,13 +251,13 @@ dependencies: "@babel/types" "^7.18.6" -"@babel/helper-function-name@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.18.9.tgz#940e6084a55dee867d33b4e487da2676365e86b0" - integrity sha512-fJgWlZt7nxGksJS9a0XdSaI4XvpExnNIgRP+rVefWh5U7BL8pPuir6SJUmFKRfjWQ51OtWSzwOxhaH/EBWWc0A== +"@babel/helper-function-name@^7.18.9", "@babel/helper-function-name@^7.19.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz#941574ed5390682e872e52d3f38ce9d1bef4648c" + integrity sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w== dependencies: - "@babel/template" "^7.18.6" - "@babel/types" "^7.18.9" + "@babel/template" "^7.18.10" + "@babel/types" "^7.19.0" "@babel/helper-hoist-variables@^7.18.6": version "7.18.6" @@ -280,19 +280,19 @@ dependencies: "@babel/types" "^7.18.6" -"@babel/helper-module-transforms@^7.18.6", "@babel/helper-module-transforms@^7.18.9", "@babel/helper-module-transforms@^7.9.0": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.18.9.tgz#5a1079c005135ed627442df31a42887e80fcb712" - integrity sha512-KYNqY0ICwfv19b31XzvmI/mfcylOzbLtowkw+mfvGPAQ3kfCnMLYbED3YecL5tPd8nAYFQFAd6JHp2LxZk/J1g== +"@babel/helper-module-transforms@^7.18.6", "@babel/helper-module-transforms@^7.19.0", "@babel/helper-module-transforms@^7.9.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.19.0.tgz#309b230f04e22c58c6a2c0c0c7e50b216d350c30" + integrity sha512-3HBZ377Fe14RbLIA+ac3sY4PTgpxHVkFrESaWhoI5PuyXPBBX8+C34qblV9G89ZtycGJCmCI/Ut+VUDK4bltNQ== dependencies: "@babel/helper-environment-visitor" "^7.18.9" "@babel/helper-module-imports" "^7.18.6" "@babel/helper-simple-access" "^7.18.6" "@babel/helper-split-export-declaration" "^7.18.6" "@babel/helper-validator-identifier" "^7.18.6" - "@babel/template" "^7.18.6" - "@babel/traverse" "^7.18.9" - "@babel/types" "^7.18.9" + "@babel/template" "^7.18.10" + "@babel/traverse" "^7.19.0" + "@babel/types" "^7.19.0" "@babel/helper-optimise-call-expression@^7.18.6": version "7.18.6" @@ -301,10 +301,10 @@ dependencies: "@babel/types" "^7.18.6" -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.16.7", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.18.9", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.18.9.tgz#4b8aea3b069d8cb8a72cdfe28ddf5ceca695ef2f" - integrity sha512-aBXPT3bmtLryXaoJLyYPXPlSD4p1ld9aYeR+sJNOZjJJGiOpb+fKfh3NkcCu7J54nUJwCERPBExCCpyCOHnu/w== +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.16.7", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.18.9", "@babel/helper-plugin-utils@^7.19.0", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.19.0.tgz#4796bb14961521f0f8715990bee2fb6e51ce21bf" + integrity sha512-40Ryx7I8mT+0gaNxm8JGTZFUITNqdLAgdg0hXzeVZxVD6nFsdhQvip6v8dqkRHzsz1VFpFAaOCHNn0vKBL7Czw== "@babel/helper-remap-async-to-generator@^7.18.6", "@babel/helper-remap-async-to-generator@^7.18.9": version "7.18.9" @@ -364,23 +364,23 @@ integrity sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw== "@babel/helper-wrap-function@^7.18.9": - version "7.18.11" - resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.18.11.tgz#bff23ace436e3f6aefb61f85ffae2291c80ed1fb" - integrity sha512-oBUlbv+rjZLh2Ks9SKi4aL7eKaAXBWleHzU89mP0G6BMUlRxSckk9tSIkgDGydhgFxHuGSlBQZfnaD47oBEB7w== + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.19.0.tgz#89f18335cff1152373222f76a4b37799636ae8b1" + integrity sha512-txX8aN8CZyYGTwcLhlk87KRqncAzhh5TpQamZUa0/u3an36NtDpUP6bQgBCBcLeBs09R/OwQu3OjK0k/HwfNDg== dependencies: - "@babel/helper-function-name" "^7.18.9" + "@babel/helper-function-name" "^7.19.0" "@babel/template" "^7.18.10" - "@babel/traverse" "^7.18.11" - "@babel/types" "^7.18.10" + "@babel/traverse" "^7.19.0" + "@babel/types" "^7.19.0" -"@babel/helpers@^7.18.9", "@babel/helpers@^7.9.0": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.18.9.tgz#4bef3b893f253a1eced04516824ede94dcfe7ff9" - integrity sha512-Jf5a+rbrLoR4eNdUmnFu8cN5eNJT6qdTdOg5IHIzq87WwyRw9PwguLFOWYgktN/60IP4fgDUawJvs7PjQIzELQ== +"@babel/helpers@^7.19.0", "@babel/helpers@^7.9.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.19.0.tgz#f30534657faf246ae96551d88dd31e9d1fa1fc18" + integrity sha512-DRBCKGwIEdqY3+rPJgG/dKfQy9+08rHIAJx8q2p+HSWP87s2HCrQmaAMMyMll2kIXKCW0cO1RdQskx15Xakftg== dependencies: - "@babel/template" "^7.18.6" - "@babel/traverse" "^7.18.9" - "@babel/types" "^7.18.9" + "@babel/template" "^7.18.10" + "@babel/traverse" "^7.19.0" + "@babel/types" "^7.19.0" "@babel/highlight@^7.18.6", "@babel/highlight@^7.8.3": version "7.18.6" @@ -391,10 +391,10 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.18.10", "@babel/parser@^7.18.13", "@babel/parser@^7.4.3", "@babel/parser@^7.7.0", "@babel/parser@^7.9.0": - version "7.18.13" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.18.13.tgz#5b2dd21cae4a2c5145f1fbd8ca103f9313d3b7e4" - integrity sha512-dgXcIfMuQ0kgzLB2b9tRZs7TTFFaGM2AbtA4fJgUUYukzGH4jwsS7hzQHEGs67jdehpm22vkgKwvbU+aEflgwg== +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.18.10", "@babel/parser@^7.19.0", "@babel/parser@^7.4.3", "@babel/parser@^7.7.0", "@babel/parser@^7.9.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.19.0.tgz#497fcafb1d5b61376959c1c338745ef0577aa02c" + integrity sha512-74bEXKX2h+8rrfQUfsBfuZZHzsEs6Eql4pqy/T4Nn6Y9wNPggQOqD6z6pn5Bl8ZfysKouFZT/UXEH94ummEeQw== "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.18.6": version "7.18.6" @@ -412,13 +412,13 @@ "@babel/helper-skip-transparent-expression-wrappers" "^7.18.9" "@babel/plugin-proposal-optional-chaining" "^7.18.9" -"@babel/plugin-proposal-async-generator-functions@^7.18.10", "@babel/plugin-proposal-async-generator-functions@^7.8.3": - version "7.18.10" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.18.10.tgz#85ea478c98b0095c3e4102bff3b67d306ed24952" - integrity sha512-1mFuY2TOsR1hxbjCo4QL+qlIjV07p4H4EUYw2J/WCqsvFV6V9X9z9YhXbWndc/4fw+hYGlDT7egYxliMp5O6Ew== +"@babel/plugin-proposal-async-generator-functions@^7.19.0", "@babel/plugin-proposal-async-generator-functions@^7.8.3": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.19.0.tgz#cf5740194f170467df20581712400487efc79ff1" + integrity sha512-nhEByMUTx3uZueJ/QkJuSlCfN4FGg+xy+vRsfGQGzSauq5ks2Deid2+05Q3KhfaUjvec1IGhw/Zm3cFm8JigTQ== dependencies: "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-plugin-utils" "^7.18.9" + "@babel/helper-plugin-utils" "^7.19.0" "@babel/helper-remap-async-to-generator" "^7.18.9" "@babel/plugin-syntax-async-generators" "^7.8.4" @@ -611,11 +611,11 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-decorators@^7.8.3": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.18.6.tgz#2e45af22835d0b0f8665da2bfd4463649ce5dbc1" - integrity sha512-fqyLgjcxf/1yhyZ6A+yo1u9gJ7eleFQod2lkaUsF9DQ7sbbY3Ligym3L0+I2c0WmqNKDpoD9UTb1AKP3qRMOAQ== + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.19.0.tgz#5f13d1d8fce96951bea01a10424463c9a5b3a599" + integrity sha512-xaBZUEDntt4faL1yN8oIFlhfXeQAWJW7CLKYsHTUqriCUbj8xOra8bfxxKGi/UwExPFBuPdH4XfHc9rGQhrVkQ== dependencies: - "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-plugin-utils" "^7.19.0" "@babel/plugin-syntax-dynamic-import@^7.8.0", "@babel/plugin-syntax-dynamic-import@^7.8.3": version "7.8.3" @@ -759,16 +759,17 @@ dependencies: "@babel/helper-plugin-utils" "^7.18.9" -"@babel/plugin-transform-classes@^7.18.9", "@babel/plugin-transform-classes@^7.9.0": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.18.9.tgz#90818efc5b9746879b869d5ce83eb2aa48bbc3da" - integrity sha512-EkRQxsxoytpTlKJmSPYrsOMjCILacAjtSVkd4gChEe2kXjFCun3yohhW5I7plXJhCemM0gKsaGMcO8tinvCA5g== +"@babel/plugin-transform-classes@^7.19.0", "@babel/plugin-transform-classes@^7.9.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.19.0.tgz#0e61ec257fba409c41372175e7c1e606dc79bb20" + integrity sha512-YfeEE9kCjqTS9IitkgfJuxjcEtLUHMqa8yUJ6zdz8vR7hKuo6mOy2C05P0F1tdMmDCeuyidKnlrw/iTppHcr2A== dependencies: "@babel/helper-annotate-as-pure" "^7.18.6" + "@babel/helper-compilation-targets" "^7.19.0" "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-function-name" "^7.18.9" + "@babel/helper-function-name" "^7.19.0" "@babel/helper-optimise-call-expression" "^7.18.6" - "@babel/helper-plugin-utils" "^7.18.9" + "@babel/helper-plugin-utils" "^7.19.0" "@babel/helper-replace-supers" "^7.18.9" "@babel/helper-split-export-declaration" "^7.18.6" globals "^11.1.0" @@ -780,7 +781,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.18.9" -"@babel/plugin-transform-destructuring@^7.18.9", "@babel/plugin-transform-destructuring@^7.8.3": +"@babel/plugin-transform-destructuring@^7.18.13", "@babel/plugin-transform-destructuring@^7.8.3": version "7.18.13" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.18.13.tgz#9e03bc4a94475d62b7f4114938e6c5c33372cbf5" integrity sha512-TodpQ29XekIsex2A+YJPj5ax2plkGa8YYY6mFjCohk/IG9IY42Rtuj1FuDeemfg2ipxIFLzPeA83SIBnlhSIow== @@ -867,14 +868,14 @@ "@babel/helper-simple-access" "^7.18.6" babel-plugin-dynamic-import-node "^2.3.3" -"@babel/plugin-transform-modules-systemjs@^7.18.9", "@babel/plugin-transform-modules-systemjs@^7.9.0": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.18.9.tgz#545df284a7ac6a05125e3e405e536c5853099a06" - integrity sha512-zY/VSIbbqtoRoJKo2cDTewL364jSlZGvn0LKOf9ntbfxOvjfmyrdtEEOAdswOswhZEb8UH3jDkCKHd1sPgsS0A== +"@babel/plugin-transform-modules-systemjs@^7.19.0", "@babel/plugin-transform-modules-systemjs@^7.9.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.19.0.tgz#5f20b471284430f02d9c5059d9b9a16d4b085a1f" + integrity sha512-x9aiR0WXAWmOWsqcsnrzGR+ieaTMVyGyffPVA7F8cXAGt/UxefYv6uSHZLkAFChN5M5Iy1+wjE+xJuPt22H39A== dependencies: "@babel/helper-hoist-variables" "^7.18.6" - "@babel/helper-module-transforms" "^7.18.9" - "@babel/helper-plugin-utils" "^7.18.9" + "@babel/helper-module-transforms" "^7.19.0" + "@babel/helper-plugin-utils" "^7.19.0" "@babel/helper-validator-identifier" "^7.18.6" babel-plugin-dynamic-import-node "^2.3.3" @@ -886,13 +887,13 @@ "@babel/helper-module-transforms" "^7.18.6" "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-named-capturing-groups-regex@^7.18.6", "@babel/plugin-transform-named-capturing-groups-regex@^7.8.3": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.18.6.tgz#c89bfbc7cc6805d692f3a49bc5fc1b630007246d" - integrity sha512-UmEOGF8XgaIqD74bC8g7iV3RYj8lMf0Bw7NJzvnS9qQhM4mg+1WHKotUIdjxgD2RGrgFLZZPCFPFj3P/kVDYhg== +"@babel/plugin-transform-named-capturing-groups-regex@^7.19.0", "@babel/plugin-transform-named-capturing-groups-regex@^7.8.3": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.19.0.tgz#58c52422e4f91a381727faed7d513c89d7f41ada" + integrity sha512-HDSuqOQzkU//kfGdiHBt71/hkDTApw4U/cMVgKgX7PqfB3LOaK+2GtCEsBu1dL9CkswDm0Gwehht1dCr421ULQ== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.18.6" - "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-create-regexp-features-plugin" "^7.19.0" + "@babel/helper-plugin-utils" "^7.19.0" "@babel/plugin-transform-new-target@^7.18.6", "@babel/plugin-transform-new-target@^7.8.3": version "7.18.6" @@ -966,15 +967,15 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-transform-react-jsx@^7.18.6", "@babel/plugin-transform-react-jsx@^7.9.1": - version "7.18.10" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.18.10.tgz#ea47b2c4197102c196cbd10db9b3bb20daa820f1" - integrity sha512-gCy7Iikrpu3IZjYZolFE4M1Sm+nrh1/6za2Ewj77Z+XirT4TsbJcvOFOyF+fRPwU6AKKK136CZxx6L8AbSFG6A== + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.19.0.tgz#b3cbb7c3a00b92ec8ae1027910e331ba5c500eb9" + integrity sha512-UVEvX3tXie3Szm3emi1+G63jyw1w5IcMY0FSKM+CRnKRI5Mr1YbCNgsSTwoTwKphQEG9P+QqmuRFneJPZuHNhg== dependencies: "@babel/helper-annotate-as-pure" "^7.18.6" "@babel/helper-module-imports" "^7.18.6" - "@babel/helper-plugin-utils" "^7.18.9" + "@babel/helper-plugin-utils" "^7.19.0" "@babel/plugin-syntax-jsx" "^7.18.6" - "@babel/types" "^7.18.10" + "@babel/types" "^7.19.0" "@babel/plugin-transform-react-pure-annotations@^7.18.6": version "7.18.6" @@ -1016,12 +1017,12 @@ dependencies: "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-spread@^7.18.9", "@babel/plugin-transform-spread@^7.8.3": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.18.9.tgz#6ea7a6297740f381c540ac56caf75b05b74fb664" - integrity sha512-39Q814wyoOPtIB/qGopNIL9xDChOE1pNU0ZY5dO0owhiVt/5kFm4li+/bBtwc7QotG0u5EPzqhZdjMtmqBqyQA== +"@babel/plugin-transform-spread@^7.19.0", "@babel/plugin-transform-spread@^7.8.3": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.19.0.tgz#dd60b4620c2fec806d60cfaae364ec2188d593b6" + integrity sha512-RsuMk7j6n+r752EtzyScnWkQyuJdli6LdO5Klv8Yx0OfPVTcQkIUfS8clx5e9yHXzlnhOZF3CbQ8C2uP5j074w== dependencies: - "@babel/helper-plugin-utils" "^7.18.9" + "@babel/helper-plugin-utils" "^7.19.0" "@babel/helper-skip-transparent-expression-wrappers" "^7.18.9" "@babel/plugin-transform-sticky-regex@^7.18.6", "@babel/plugin-transform-sticky-regex@^7.8.3": @@ -1046,12 +1047,12 @@ "@babel/helper-plugin-utils" "^7.18.9" "@babel/plugin-transform-typescript@^7.9.0": - version "7.18.12" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.18.12.tgz#712e9a71b9e00fde9f8c0238e0cceee86ab2f8fd" - integrity sha512-2vjjam0cum0miPkenUbQswKowuxs/NjMwIKEq0zwegRxXk12C9YOF9STXnaUptITOtOJHKHpzvvWYOjbm6tc0w== + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.19.0.tgz#50c3a68ec8efd5e040bde2cd764e8e16bc0cbeaf" + integrity sha512-DOOIywxPpkQHXijXv+s9MDAyZcLp12oYRl3CMWZ6u7TjSoCBq/KqHR/nNFR3+i2xqheZxoF0H2XyL7B6xeSRuA== dependencies: - "@babel/helper-create-class-features-plugin" "^7.18.9" - "@babel/helper-plugin-utils" "^7.18.9" + "@babel/helper-create-class-features-plugin" "^7.19.0" + "@babel/helper-plugin-utils" "^7.19.0" "@babel/plugin-syntax-typescript" "^7.18.6" "@babel/plugin-transform-unicode-escapes@^7.18.10": @@ -1136,17 +1137,17 @@ semver "^5.5.0" "@babel/preset-env@^7.4.5": - version "7.18.10" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.18.10.tgz#83b8dfe70d7eea1aae5a10635ab0a5fe60dfc0f4" - integrity sha512-wVxs1yjFdW3Z/XkNfXKoblxoHgbtUF7/l3PvvP4m02Qz9TZ6uZGxRVYjSQeR87oQmHco9zWitW5J82DJ7sCjvA== + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.19.0.tgz#fd18caf499a67d6411b9ded68dc70d01ed1e5da7" + integrity sha512-1YUju1TAFuzjIQqNM9WsF4U6VbD/8t3wEAlw3LFYuuEr+ywqLRcSXxFKz4DCEj+sN94l/XTDiUXYRrsvMpz9WQ== dependencies: - "@babel/compat-data" "^7.18.8" - "@babel/helper-compilation-targets" "^7.18.9" - "@babel/helper-plugin-utils" "^7.18.9" + "@babel/compat-data" "^7.19.0" + "@babel/helper-compilation-targets" "^7.19.0" + "@babel/helper-plugin-utils" "^7.19.0" "@babel/helper-validator-option" "^7.18.6" "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.18.6" "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.18.9" - "@babel/plugin-proposal-async-generator-functions" "^7.18.10" + "@babel/plugin-proposal-async-generator-functions" "^7.19.0" "@babel/plugin-proposal-class-properties" "^7.18.6" "@babel/plugin-proposal-class-static-block" "^7.18.6" "@babel/plugin-proposal-dynamic-import" "^7.18.6" @@ -1180,9 +1181,9 @@ "@babel/plugin-transform-async-to-generator" "^7.18.6" "@babel/plugin-transform-block-scoped-functions" "^7.18.6" "@babel/plugin-transform-block-scoping" "^7.18.9" - "@babel/plugin-transform-classes" "^7.18.9" + "@babel/plugin-transform-classes" "^7.19.0" "@babel/plugin-transform-computed-properties" "^7.18.9" - "@babel/plugin-transform-destructuring" "^7.18.9" + "@babel/plugin-transform-destructuring" "^7.18.13" "@babel/plugin-transform-dotall-regex" "^7.18.6" "@babel/plugin-transform-duplicate-keys" "^7.18.9" "@babel/plugin-transform-exponentiation-operator" "^7.18.6" @@ -1192,9 +1193,9 @@ "@babel/plugin-transform-member-expression-literals" "^7.18.6" "@babel/plugin-transform-modules-amd" "^7.18.6" "@babel/plugin-transform-modules-commonjs" "^7.18.6" - "@babel/plugin-transform-modules-systemjs" "^7.18.9" + "@babel/plugin-transform-modules-systemjs" "^7.19.0" "@babel/plugin-transform-modules-umd" "^7.18.6" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.18.6" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.19.0" "@babel/plugin-transform-new-target" "^7.18.6" "@babel/plugin-transform-object-super" "^7.18.6" "@babel/plugin-transform-parameters" "^7.18.8" @@ -1202,14 +1203,14 @@ "@babel/plugin-transform-regenerator" "^7.18.6" "@babel/plugin-transform-reserved-words" "^7.18.6" "@babel/plugin-transform-shorthand-properties" "^7.18.6" - "@babel/plugin-transform-spread" "^7.18.9" + "@babel/plugin-transform-spread" "^7.19.0" "@babel/plugin-transform-sticky-regex" "^7.18.6" "@babel/plugin-transform-template-literals" "^7.18.9" "@babel/plugin-transform-typeof-symbol" "^7.18.9" "@babel/plugin-transform-unicode-escapes" "^7.18.10" "@babel/plugin-transform-unicode-regex" "^7.18.6" "@babel/preset-modules" "^0.1.5" - "@babel/types" "^7.18.10" + "@babel/types" "^7.19.0" babel-plugin-polyfill-corejs2 "^0.3.2" babel-plugin-polyfill-corejs3 "^0.5.3" babel-plugin-polyfill-regenerator "^0.4.0" @@ -1260,9 +1261,9 @@ "@babel/plugin-transform-typescript" "^7.9.0" "@babel/runtime-corejs3@^7.10.2", "@babel/runtime-corejs3@^7.12.1": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.18.9.tgz#7bacecd1cb2dd694eacd32a91fcf7021c20770ae" - integrity sha512-qZEWeccZCrHA2Au4/X05QW5CMdm4VjUDCrGq5gf1ZDcM4hRqreKrtwAn7yci9zfgAS9apvnsFXiGBHBAxZdK9A== + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.19.0.tgz#0df75cb8e5ecba3ca9e658898694e5326d52397f" + integrity sha512-JyXXoCu1N8GLuKc2ii8y5RGma5FMpFeO2nAQIe0Yzrbq+rQnN+sFj47auLblR5ka6aHNGPDgv8G/iI2Grb0ldQ== dependencies: core-js-pure "^3.20.2" regenerator-runtime "^0.13.4" @@ -1275,13 +1276,13 @@ regenerator-runtime "^0.13.4" "@babel/runtime@^7.0.0", "@babel/runtime@^7.10.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.3.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.18.9.tgz#b4fcfce55db3d2e5e080d2490f608a3b9f407f4a" - integrity sha512-lkqXDcvlFT5rvEjiu6+QYO+1GXrEHRo2LOtS7E4GtX5ESIZOgepqsZBVIj6Pv+a6zqsya9VCgiK1KAK4BvJDAw== + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.19.0.tgz#22b11c037b094d27a8a2504ea4dcff00f50e2259" + integrity sha512-eR8Lo9hnDS7tqkO7NsV+mKvCmv5boaXFSZ70DnfhcgiEne8hv9oCEd36Klw74EtizEqLsy4YnW8UWwpBVolHZA== dependencies: regenerator-runtime "^0.13.4" -"@babel/template@^7.18.10", "@babel/template@^7.18.6", "@babel/template@^7.3.3", "@babel/template@^7.4.0", "@babel/template@^7.8.6": +"@babel/template@^7.18.10", "@babel/template@^7.3.3", "@babel/template@^7.4.0", "@babel/template@^7.8.6": version "7.18.10" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.18.10.tgz#6f9134835970d1dbf0835c0d100c9f38de0c5e71" integrity sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA== @@ -1290,26 +1291,26 @@ "@babel/parser" "^7.18.10" "@babel/types" "^7.18.10" -"@babel/traverse@^7.1.0", "@babel/traverse@^7.18.11", "@babel/traverse@^7.18.13", "@babel/traverse@^7.18.9", "@babel/traverse@^7.4.3", "@babel/traverse@^7.7.0", "@babel/traverse@^7.9.0": - version "7.18.13" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.18.13.tgz#5ab59ef51a997b3f10c4587d648b9696b6cb1a68" - integrity sha512-N6kt9X1jRMLPxxxPYWi7tgvJRH/rtoU+dbKAPDM44RFHiMH8igdsaSBgFeskhSl/kLWLDUvIh1RXCrTmg0/zvA== +"@babel/traverse@^7.1.0", "@babel/traverse@^7.18.9", "@babel/traverse@^7.19.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.7.0", "@babel/traverse@^7.9.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.19.0.tgz#eb9c561c7360005c592cc645abafe0c3c4548eed" + integrity sha512-4pKpFRDh+utd2mbRC8JLnlsMUii3PMHjpL6a0SZ4NMZy7YFP9aXORxEhdMVOc9CpWtDF09IkciQLEhK7Ml7gRA== dependencies: "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.18.13" + "@babel/generator" "^7.19.0" "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-function-name" "^7.18.9" + "@babel/helper-function-name" "^7.19.0" "@babel/helper-hoist-variables" "^7.18.6" "@babel/helper-split-export-declaration" "^7.18.6" - "@babel/parser" "^7.18.13" - "@babel/types" "^7.18.13" + "@babel/parser" "^7.19.0" + "@babel/types" "^7.19.0" debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.18.10", "@babel/types@^7.18.13", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.7.0", "@babel/types@^7.9.0": - version "7.18.13" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.18.13.tgz#30aeb9e514f4100f7c1cb6e5ba472b30e48f519a" - integrity sha512-ePqfTihzW0W6XAU+aMw2ykilisStJfDnsejDCXRchCcMJ4O0+8DhPXf2YUbZ6wjBlsEmZwLK/sPweWtu8hcJYQ== +"@babel/types@^7.0.0", "@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.19.0", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.7.0", "@babel/types@^7.9.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.19.0.tgz#75f21d73d73dc0351f3368d28db73465f4814600" + integrity sha512-YuGopBq3ke25BVSiS6fgF49Ul9gH1x70Bcr6bqRLjWCkcX8Hre1/5+z+IiWOIerRMSSEfGZVB9z9kyq7wVs9YA== dependencies: "@babel/helper-string-parser" "^7.18.10" "@babel/helper-validator-identifier" "^7.18.6" @@ -2012,7 +2013,7 @@ slash "^2.0.0" strip-ansi "^5.0.0" -"@jest/core@^26.2.2", "@jest/core@^26.6.3": +"@jest/core@^26.6.3": version "26.6.3" resolved "https://registry.yarnpkg.com/@jest/core/-/core-26.6.3.tgz#7639fcb3833d748a4656ada54bde193051e45fad" integrity sha512-xvV1kKbhfUqFVuZ8Cyo+JPpipAHHAV3kcDBftiduK8EICXmTFddryy3P7NfZt8Pv37rA9nEJBKCCkglCPt/Xjw== @@ -3368,9 +3369,9 @@ integrity sha512-Hzl8soGpmyzja9w3kiFFcYJ7n5HNETpplY6cb67KR4QPlxp4FTTresO06qXHgHDhyIInmbLJXuwARjjpsKYGuQ== "@sinclair/typebox@^0.24.1": - version "0.24.28" - resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.24.28.tgz#15aa0b416f82c268b1573ab653e4413c965fe794" - integrity sha512-dgJd3HLOkLmz4Bw50eZx/zJwtBq65nms3N9VBYu5LTjJ883oBFkTyXRlCB/ZGGwqYpJJHA5zW2Ibhl5ngITfow== + version "0.24.37" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.24.37.tgz#3ea4cf8f3cf8a943c17baf5bb7b33587afa5f76b" + integrity sha512-8xuD57tNMHs7R0YUzFp0xqIVOTJDbFHnEN/JTej5d5o/dTx4OSsURKTT9dkWl6ghMk4zs3AYe1bi7UK0NnJ4oA== "@sinonjs/commons@^1.7.0": version "1.8.3" @@ -3591,9 +3592,9 @@ "@babel/types" "^7.0.0" "@types/babel__traverse@*", "@types/babel__traverse@^7.0.4", "@types/babel__traverse@^7.0.6": - version "7.18.0" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.18.0.tgz#8134fd78cb39567465be65b9fdc16d378095f41f" - integrity sha512-v4Vwdko+pgymgS+A2UIaJru93zQd85vIGWObM5ekZNdXCKtDYqATlEYnWgfo86Q6I1Lh0oXnksDnMU1cwmlPDw== + version "7.18.1" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.18.1.tgz#ce5e2c8c272b99b7a9fd69fa39f0b4cd85028bd9" + integrity sha512-FSdLaZh2UxaMuLp9lixWaHq/golWTRWOnRsAXzDTDSDOQLuZb1nsdCt6pJSPWSEQt2eFZ2YVk3oYhn+1kLMeMA== dependencies: "@babel/types" "^7.3.0" @@ -3637,7 +3638,15 @@ dependencies: "@types/node" "*" -"@types/glob@*", "@types/glob@^7.1.1", "@types/glob@^7.1.3": +"@types/glob@*": + version "8.0.0" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-8.0.0.tgz#321607e9cbaec54f687a0792b2d1d370739455d2" + integrity sha512-l6NQsDDyQUVeoTynNpC9uRvCUint/gSUXQA2euwmTuWGvPY5LSDUu6tkCtJB2SvGQlJQzLaKqcGZP4//7EDveA== + dependencies: + "@types/minimatch" "*" + "@types/node" "*" + +"@types/glob@^7.1.1", "@types/glob@^7.1.3": version "7.2.0" resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.2.0.tgz#bc1b5bf3aa92f25bd5dd39f35c57361bdce5b2eb" integrity sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA== @@ -3727,7 +3736,12 @@ resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.184.tgz#23f96cd2a21a28e106dc24d825d4aa966de7a9fe" integrity sha512-RoZphVtHbxPZizt4IcILciSWiC6dcn+eZ8oX9IWEYfDMcocdd42f7NPI6fQj+6zI8y4E0L7gu2pcZKLGTRaV9Q== -"@types/minimatch@*", "@types/minimatch@^3.0.3": +"@types/minimatch@*": + version "5.1.2" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" + integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== + +"@types/minimatch@^3.0.3": version "3.0.5" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40" integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ== @@ -3743,9 +3757,9 @@ integrity sha512-wH6Tu9mbiOt0n5EvdoWy0VGQaJMHfLIxY/6wS0xLC7CV1taM6gESEzcYy0ZlWvxxiiljYvfDIvz4hHbUUDRlhw== "@types/node@*": - version "18.7.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.12.tgz#18caab95fbcd03573661d1d0e709093ba8cb7682" - integrity sha512-caqFX7GwvZ4KLnhpI9CfiMkgHKp6kvFAIgpkha0cjO7bAQvB6dWe+q3fTHmm7fQvv59pd4tPj77nriq2M6U2dw== + version "18.7.15" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.15.tgz#20ae1ec80c57ee844b469f968a1cd511d4088b29" + integrity sha512-XnjpaI8Bgc3eBag2Aw4t2Uj/49lLBSStHWfqKvIuXD7FIrZyMLWp8KuAFHAqxMZYTF9l08N1ctUn9YNybZJVmQ== "@types/node@12.12.26": version "12.12.26" @@ -4155,13 +4169,6 @@ "@webassemblyjs/wast-parser" "1.8.5" "@xtuc/long" "4.2.2" -"@wry/equality@^0.1.2": - version "0.1.11" - resolved "https://registry.yarnpkg.com/@wry/equality/-/equality-0.1.11.tgz#35cb156e4a96695aa81a9ecc4d03787bc17f1790" - integrity sha512-mwEVBDUVODlsQQ5dfuLUS5/Tf7jqUKyhKYHmVi4fPB6bDMOfWvUPJmKgS1Z7Za/sOI3vzWt4+O7yCiL/70MogA== - dependencies: - tslib "^1.9.3" - "@xtuc/ieee754@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" @@ -4463,44 +4470,6 @@ apisauce@^2.0.1: dependencies: axios "^0.21.4" -apollo-link-http-common@^0.2.16: - version "0.2.16" - resolved "https://registry.yarnpkg.com/apollo-link-http-common/-/apollo-link-http-common-0.2.16.tgz#756749dafc732792c8ca0923f9a40564b7c59ecc" - integrity sha512-2tIhOIrnaF4UbQHf7kjeQA/EmSorB7+HyJIIrUjJOKBgnXwuexi8aMecRlqTIDWcyVXCeqLhUnztMa6bOH/jTg== - dependencies: - apollo-link "^1.2.14" - ts-invariant "^0.4.0" - tslib "^1.9.3" - -apollo-link-http@1.5.17: - version "1.5.17" - resolved "https://registry.yarnpkg.com/apollo-link-http/-/apollo-link-http-1.5.17.tgz#499e9f1711bf694497f02c51af12d82de5d8d8ba" - integrity sha512-uWcqAotbwDEU/9+Dm9e1/clO7hTB2kQ/94JYcGouBVLjoKmTeJTUPQKcJGpPwUjZcSqgYicbFqQSoJIW0yrFvg== - dependencies: - apollo-link "^1.2.14" - apollo-link-http-common "^0.2.16" - tslib "^1.9.3" - -apollo-link@1.2.14, apollo-link@^1.2.14: - version "1.2.14" - resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.2.14.tgz#3feda4b47f9ebba7f4160bef8b977ba725b684d9" - integrity sha512-p67CMEFP7kOG1JZ0ZkYZwRDa369w5PIjtMjvrQd/HnIV8FRsHRqLqK+oAZQnFa1DDdZtOtHTi+aMIW6EatC2jg== - dependencies: - apollo-utilities "^1.3.0" - ts-invariant "^0.4.0" - tslib "^1.9.3" - zen-observable-ts "^0.8.21" - -apollo-utilities@^1.3.0: - version "1.3.4" - resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.3.4.tgz#6129e438e8be201b6c55b0f13ce49d2c7175c9cf" - integrity sha512-pk2hiWrCXMAy2fRPwEyhvka+mqwzeP60Jr1tRYi5xru+3ko94HI9o6lK0CT33/w4RDlxWchmdhDCrvdr+pHCig== - dependencies: - "@wry/equality" "^0.1.2" - fast-json-stable-stringify "^2.0.0" - ts-invariant "^0.4.0" - tslib "^1.10.0" - app-module-path@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/app-module-path/-/app-module-path-2.2.0.tgz#641aa55dfb7d6a6f0a8141c4b9c0aa50b6c24dd5" @@ -5678,9 +5647,9 @@ caniuse-api@^3.0.0: lodash.uniq "^4.5.0" caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001035, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001370: - version "1.0.30001382" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001382.tgz#4d37f0d0b6fffb826c8e5e1c0f4bf8ce592db949" - integrity sha512-2rtJwDmSZ716Pxm1wCtbPvHtbDWAreTPxXbkc5RkKglow3Ig/4GNGazDI9/BVnXbG/wnv6r3B5FEbkfg9OcTGg== + version "1.0.30001390" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001390.tgz#158a43011e7068ef7fc73590e9fd91a7cece5e7f" + integrity sha512-sS4CaUM+/+vqQUlCvCJ2WtDlV81aWtHhqeEVkLokVJJa3ViN4zDxAGfq9R8i1m90uGHxo99cy10Od+lvn3hf0g== capture-exit@^2.0.0: version "2.0.0" @@ -6398,17 +6367,17 @@ copyfiles@2.4.1: yargs "^16.1.0" core-js-compat@^3.21.0, core-js-compat@^3.22.1, core-js-compat@^3.6.2: - version "3.24.1" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.24.1.tgz#d1af84a17e18dfdd401ee39da9996f9a7ba887de" - integrity sha512-XhdNAGeRnTpp8xbD+sR/HFDK9CbeeeqXT6TuofXh3urqEevzkWmLRgrVoykodsw8okqo2pu1BOmuCKrHx63zdw== + version "3.25.0" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.25.0.tgz#489affbfbf9cb3fa56192fe2dd9ebaee985a66c5" + integrity sha512-extKQM0g8/3GjFx9US12FAgx8KJawB7RCQ5y8ipYLbmfzEzmFRWdDjIlxDx82g7ygcNG85qMVUSRyABouELdow== dependencies: browserslist "^4.21.3" semver "7.0.0" core-js-pure@^3.20.2: - version "3.24.1" - resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.24.1.tgz#8839dde5da545521bf282feb7dc6d0b425f39fd3" - integrity sha512-r1nJk41QLLPyozHUUPmILCEMtMw24NG4oWK6RbsDdjzQgg9ZvrUsPBj1MnG0wXXp1DCDU6j+wUvEmBSrtRbLXg== + version "3.25.0" + resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.25.0.tgz#f8d1f176ff29abbfeb610110de891d5ae5a361d4" + integrity sha512-IeHpLwk3uoci37yoI2Laty59+YqH9x5uR65/yiA0ARAJrTrN4YU0rmauLWfvqOuk77SlNJXj2rM6oT/dBD87+A== core-js@^2.4.0: version "2.6.12" @@ -6416,9 +6385,9 @@ core-js@^2.4.0: integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== core-js@^3.5.0: - version "3.24.1" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.24.1.tgz#cf7724d41724154010a6576b7b57d94c5d66e64f" - integrity sha512-0QTBSYSUZ6Gq21utGzkfITDylE8jWC9Ne1D2MrhvlsZBI1x39OdDIVbzSqtgMndIy6BlHxBXpMGqzZmnztg2rg== + version "3.25.0" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.25.0.tgz#be71d9e0dd648ffd70c44a7ec2319d039357eceb" + integrity sha512-CVU1xvJEfJGhyCpBrzzzU1kjCfgsGUxhEvwUV2e/cOedYWHdmluamx+knDnmhqALddMG16fZvIqvs9aijsHHaA== core-util-is@1.0.2: version "1.0.2" @@ -6505,13 +6474,6 @@ cross-env@7.0.3: dependencies: cross-spawn "^7.0.1" -cross-fetch@3.0.5: - version "3.0.5" - resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.0.5.tgz#2739d2981892e7ab488a7ad03b92df2816e03f4c" - integrity sha512-FFLcLtraisj5eteosnX1gf01qYDCOc4fDy0+euOt8Kn9YBY2NtXL/pCoYPavw24NIQkQqm5ZOLsGD5Zzj0gyew== - dependencies: - node-fetch "2.6.0" - cross-spawn@7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.1.tgz#0ab56286e0f7c24e153d04cc2aa027e43a9a5d14" @@ -7353,9 +7315,9 @@ electron-fetch@^1.7.2: encoding "^0.1.13" electron-to-chromium@^1.3.378, electron-to-chromium@^1.4.202: - version "1.4.228" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.228.tgz#3baff13cf54198c2045f9bdd8b64db93aafd7f33" - integrity sha512-XfDHCvou7CsDMlFwb0WZ1tWmW48e7Sn7VBRyPfZsZZila9esRsJl1trO+OqDNV97GggFSt0ISbWslKXfQkG//g== + version "1.4.242" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.242.tgz#51284820b0e6f6ce6c60d3945a3c4f9e4bd88f5f" + integrity sha512-nPdgMWtjjWGCtreW/2adkrB2jyHjClo9PtVhR6rW+oxa4E4Wom642Tn+5LslHP3XPL5MCpkn5/UEY60EXylNeQ== elliptic@6.5.4, elliptic@^6.5.3: version "6.5.4" @@ -7482,15 +7444,15 @@ error-ex@^1.2.0, error-ex@^1.3.1: is-arrayish "^0.2.1" es-abstract@^1.17.2, es-abstract@^1.19.0, es-abstract@^1.19.1, es-abstract@^1.19.2, es-abstract@^1.19.5, es-abstract@^1.20.0, es-abstract@^1.20.1: - version "1.20.1" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.20.1.tgz#027292cd6ef44bd12b1913b828116f54787d1814" - integrity sha512-WEm2oBhfoI2sImeM4OF2zE2V3BYdSF+KnSi9Sidz51fQHd7+JuF8Xgcj9/0o+OWeIeIS/MiuNnlruQrJf16GQA== + version "1.20.2" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.20.2.tgz#8495a07bc56d342a3b8ea3ab01bd986700c2ccb3" + integrity sha512-XxXQuVNrySBNlEkTYJoDNFe5+s2yIOpzq80sUHEdPdQr0S5nTLz4ZPPPswNIpKseDDUS5yghX1gfLIHQZ1iNuQ== dependencies: call-bind "^1.0.2" es-to-primitive "^1.2.1" function-bind "^1.1.1" function.prototype.name "^1.1.5" - get-intrinsic "^1.1.1" + get-intrinsic "^1.1.2" get-symbol-description "^1.0.0" has "^1.0.3" has-property-descriptors "^1.0.0" @@ -7502,9 +7464,9 @@ es-abstract@^1.17.2, es-abstract@^1.19.0, es-abstract@^1.19.1, es-abstract@^1.19 is-shared-array-buffer "^1.0.2" is-string "^1.0.7" is-weakref "^1.0.2" - object-inspect "^1.12.0" + object-inspect "^1.12.2" object-keys "^1.1.1" - object.assign "^4.1.2" + object.assign "^4.1.4" regexp.prototype.flags "^1.4.3" string.prototype.trimend "^1.0.5" string.prototype.trimstart "^1.0.5" @@ -8170,11 +8132,11 @@ express@^4.17.1: vary "~1.1.2" ext@^1.1.2: - version "1.6.0" - resolved "https://registry.yarnpkg.com/ext/-/ext-1.6.0.tgz#3871d50641e874cc172e2b53f919842d19db4c52" - integrity sha512-sdBImtzkq2HpkdRLtlLWDa6w4DX22ijZLKx8BMPUuKe1c5lbN6xwQDQCxSfxBQnHZ13ls/FH0MQZx/q/gr6FQg== + version "1.7.0" + resolved "https://registry.yarnpkg.com/ext/-/ext-1.7.0.tgz#0ea4383c0103d60e70be99e9a7f11027a33c4f5f" + integrity sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw== dependencies: - type "^2.5.0" + type "^2.7.2" extend-shallow@^2.0.1: version "2.0.1" @@ -8747,7 +8709,7 @@ get-caller-file@^2.0.1, get-caller-file@^2.0.5: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -get-intrinsic@^1.0.2, get-intrinsic@^1.1.0, get-intrinsic@^1.1.1: +get-intrinsic@^1.0.2, get-intrinsic@^1.1.0, get-intrinsic@^1.1.1, get-intrinsic@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.2.tgz#336975123e05ad0b7ba41f152ee4aadbea6cf598" integrity sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA== @@ -9457,13 +9419,6 @@ identity-obj-proxy@3.0.0: dependencies: harmony-reflect "^1.4.6" -idna-uts46-hx@3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/idna-uts46-hx/-/idna-uts46-hx-3.4.0.tgz#aa380e7c04d6bce4f5e26da742c613ea2996f470" - integrity sha512-b1I4qYTcJcX1TANn8OhOGrQUIWOfZUWrLKWDeKbV6posVLjp7OTqFKX3N20efrIMzQM1KhiphOEazBEEUFR9bg== - dependencies: - punycode "^2.1.1" - idna-uts46-hx@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz#a1dc5c4df37eee522bf66d969cc980e00e8711f9" @@ -10575,7 +10530,7 @@ jest-cli@^24.9.0: realpath-native "^1.1.0" yargs "^13.3.0" -jest-cli@^26.2.2, jest-cli@^26.6.3: +jest-cli@^26.6.3: version "26.6.3" resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-26.6.3.tgz#43117cfef24bc4cd691a174a8796a532e135e92a" integrity sha512-GF9noBSa9t08pSyl3CY4frMrqp+aQXFGFkf5hEPbh/pIUFYWMK6ZLTfbmadxJVcJrdRoChlWQsA2VkJcDFK8hg== @@ -11203,18 +11158,6 @@ jest-snapshot@^26.6.2: pretty-format "^26.6.2" semver "^7.3.2" -jest-util@26.x, jest-util@^26.1.0, jest-util@^26.6.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.2.tgz#907535dbe4d5a6cb4c47ac9b926f6af29576cbc1" - integrity sha512-MDW0fKfsn0OI7MS7Euz6h8HNDXVQ0gaM9uW6RjfDmd1DAFcaxX9OqIakHIqhbnmF08Cf2DLDG+ulq8YQQ0Lp0Q== - dependencies: - "@jest/types" "^26.6.2" - "@types/node" "*" - chalk "^4.0.0" - graceful-fs "^4.2.4" - is-ci "^2.0.0" - micromatch "^4.0.2" - jest-util@^24.0.0, jest-util@^24.9.0: version "24.9.0" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.9.0.tgz#7396814e48536d2e85a37de3e4c431d7cb140162" @@ -11233,6 +11176,18 @@ jest-util@^24.0.0, jest-util@^24.9.0: slash "^2.0.0" source-map "^0.6.0" +jest-util@^26.1.0, jest-util@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.2.tgz#907535dbe4d5a6cb4c47ac9b926f6af29576cbc1" + integrity sha512-MDW0fKfsn0OI7MS7Euz6h8HNDXVQ0gaM9uW6RjfDmd1DAFcaxX9OqIakHIqhbnmF08Cf2DLDG+ulq8YQQ0Lp0Q== + dependencies: + "@jest/types" "^26.6.2" + "@types/node" "*" + chalk "^4.0.0" + graceful-fs "^4.2.4" + is-ci "^2.0.0" + micromatch "^4.0.2" + jest-validate@^24.9.0: version "24.9.0" resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.9.0.tgz#0775c55360d173cd854e40180756d4ff52def8ab" @@ -11337,15 +11292,6 @@ jest@24.9.0: import-local "^2.0.0" jest-cli "^24.9.0" -jest@26.2.2: - version "26.2.2" - resolved "https://registry.yarnpkg.com/jest/-/jest-26.2.2.tgz#a022303887b145147204c5f66e6a5c832333c7e7" - integrity sha512-EkJNyHiAG1+A8pqSz7cXttoVa34hOEzN/MrnJhYnfp5VHxflVcf2pu3oJSrhiy6LfIutLdWo+n6q63tjcoIeig== - dependencies: - "@jest/core" "^26.2.2" - import-local "^3.0.2" - jest-cli "^26.2.2" - jest@26.6.3: version "26.6.3" resolved "https://registry.yarnpkg.com/jest/-/jest-26.6.3.tgz#40e8fdbe48f00dfa1f0ce8121ca74b88ac9148ef" @@ -11604,9 +11550,9 @@ json5@^1.0.1: minimist "^1.2.0" jsonc-parser@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.1.0.tgz#73b8f0e5c940b83d03476bc2e51a20ef0932615d" - integrity sha512-DRf0QjnNeCUds3xTjKlQQ3DpJD51GvDjJfnxUVWg6PZTo2otSm+slzNAxU/35hF8/oJIKoG9slq30JYOsF2azg== + version "3.2.0" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.0.tgz#31ff3f4c2b9793f89c67212627c51c6394f88e76" + integrity sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w== jsonfile@^4.0.0: version "4.0.0" @@ -11954,7 +11900,7 @@ lodash.lowerfirst@^4.3.1: resolved "https://registry.yarnpkg.com/lodash.lowerfirst/-/lodash.lowerfirst-4.3.1.tgz#de3c7b12e02c6524a0059c2f6cb7c5c52655a13d" integrity sha512-UUKX7VhP1/JL54NXg2aq/E1Sfnjjes8fNYTNkPU8ZmsaVeBvPHKdbNaN79Re5XRL01u6wbq3j0cbYZj71Fcu5w== -lodash.memoize@4.x, lodash.memoize@^4.1.2: +lodash.memoize@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== @@ -12773,9 +12719,9 @@ multiformats@9.7.0: integrity sha512-uv/tcgwk0yN4DStopnBN4GTgvaAlYdy6KnZpuzEPFOYQd71DYFJjs0MN1ERElAflrZaYyGBWXyGxL5GgrxIx0Q== multiformats@^9.4.2: - version "9.7.1" - resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-9.7.1.tgz#ab348e5fd6f8e7fb3fd56033211bda48854e2173" - integrity sha512-TaVmGEBt0fhxiNJMGphBfB+oGvUxFs8KgGvgl8d3C+GWtrFcvXdJ2196eg+dYhmSFClmgFfSfJEklo+SZzdNuw== + version "9.8.1" + resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-9.8.1.tgz#0e5f2910cf0c34f55adf0602f920775f9622552a" + integrity sha512-Cu7NfUYtCV+WN7w59WsRRF138S+um4tTo11ScYsWbNgWyCEGOu8wID1e5eMJs91gFZ0I7afodkkdxCF8NGkqZQ== multihashes@^0.4.15, multihashes@~0.4.15, multihashes@~0.4.19: version "0.4.21" @@ -12964,11 +12910,6 @@ nock@13.0.7: lodash.set "^4.3.2" propagate "^2.0.0" -node-fetch@2.6.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" - integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== - node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.7: version "2.6.7" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" @@ -13298,9 +13239,9 @@ number-is-nan@^1.0.0: integrity sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ== nwsapi@^2.0.7, nwsapi@^2.1.3, nwsapi@^2.2.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.1.tgz#10a9f268fbf4c461249ebcfe38e359aa36e2577c" - integrity sha512-JYOWTeFoS0Z93587vRJgASD5Ut11fYl5NyihP3KrYBvMe1FRRs6RN7m20SA/16GM4P6hTnZjT+UmDOt38UeXNg== + version "2.2.2" + resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.2.tgz#e5418863e7905df67d51ec95938d67bf801f0bb0" + integrity sha512-90yv+6538zuvUMnN+zCr8LuV6bPFdq50304114vJYJ8RDyK8D5O9Phpbd6SZWgI7PwzmmfN1upeOJlvybDSgCw== oauth-sign@~0.9.0: version "0.9.0" @@ -13326,7 +13267,7 @@ object-hash@^2.0.1: resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-2.2.0.tgz#5ad518581eefc443bd763472b8ff2e9c2c0d54a5" integrity sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw== -object-inspect@^1.12.0, object-inspect@^1.9.0: +object-inspect@^1.12.2, object-inspect@^1.9.0: version "1.12.2" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.2.tgz#c0641f26394532f28ab8d796ab954e43c009a8ea" integrity sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ== @@ -13356,7 +13297,7 @@ object-visit@^1.0.0: dependencies: isobject "^3.0.0" -object.assign@^4.1.0, object.assign@^4.1.2: +object.assign@^4.1.0, object.assign@^4.1.4: version "4.1.4" resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.4.tgz#9673c7c7c351ab8c4d0b516f4343ebf4dfb7799f" integrity sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ== @@ -14850,9 +14791,9 @@ promise-retry@^2.0.1: retry "^0.12.0" promise@^8.0.3: - version "8.1.0" - resolved "https://registry.yarnpkg.com/promise/-/promise-8.1.0.tgz#697c25c3dfe7435dd79fcd58c38a135888eaf05e" - integrity sha512-W04AqnILOL/sPRXziNicCjSNRruLAuIHEOVBazepu0545DDNGYHz7ar9ZgZ1fMU8/MA4mVxp5rkBWRi6OXIy3Q== + version "8.2.0" + resolved "https://registry.yarnpkg.com/promise/-/promise-8.2.0.tgz#a1f6280ab67457fbfc8aad2b198c9497e9e5c806" + integrity sha512-+CMAlLHqwRYwBMXKCP+o8ns7DN+xHDUiI+0nArsiJ9y+kJVPLFxEaSw6Ha9s9H0tftxg2Yzl25wqj9G7m5wLZg== dependencies: asap "~2.0.6" @@ -16879,9 +16820,9 @@ supports-color@^7.0.0, supports-color@^7.1.0: has-flag "^4.0.0" supports-hyperlinks@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.2.0.tgz#4f77b42488765891774b70c79babd87f9bd594bb" - integrity sha512-6sXEzV5+I5j8Bmq9/vUphGRM/RJNT9SCURJLjwfOg51heRtguGWDzcaBlgAzKhQa0EVNpPEKzQuBwZ8S8WaCeQ== + version "2.3.0" + resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz#3943544347c1ff90b15effb03fc14ae45ec10624" + integrity sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA== dependencies: has-flag "^4.0.0" supports-color "^7.0.0" @@ -17208,9 +17149,9 @@ tough-cookie@^2.3.3, tough-cookie@^2.3.4, tough-cookie@^2.5.0, tough-cookie@~2.5 punycode "^2.1.1" tough-cookie@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.0.tgz#039b203b2ad95cd9d2a2aae07b238cb83adc46c7" - integrity sha512-IVX6AagLelGwl6F0E+hoRpXzuD192cZhAcmT7/eoLr0PnsB1wv2E5c+A2O+V8xth9FlL2p0OstFsWn0bZpVn4w== + version "4.1.2" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.2.tgz#e53e84b85f24e0b65dd526f46628db6c85f6b874" + integrity sha512-G9fqXWoYFZgTc2z8Q5zaHy/vJMjm+WV0AkAeHxVCQiEB1b+dGvWzFW6QV07cY5jQ5gRkeid2qIkzkxUnmoQZUQ== dependencies: psl "^1.1.33" punycode "^2.1.1" @@ -17241,29 +17182,6 @@ trim-newlines@^3.0.0: resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144" integrity sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw== -ts-invariant@^0.4.0: - version "0.4.4" - resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.4.4.tgz#97a523518688f93aafad01b0e80eb803eb2abd86" - integrity sha512-uEtWkFM/sdZvRNNDL3Ehu4WVpwaulhwQszV8mrtcdeE8nN00BV9mAmQ88RkrBhFgl9gMgvjJLAQcZbnPXI9mlA== - dependencies: - tslib "^1.9.3" - -ts-jest@26.1.4: - version "26.1.4" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.1.4.tgz#87d41a96016a8efe4b8cc14501d3785459af6fa6" - integrity sha512-Nd7diUX6NZWfWq6FYyvcIPR/c7GbEF75fH1R6coOp3fbNzbRJBZZAn0ueVS0r8r9ral1VcrpneAFAwB3TsVS1Q== - dependencies: - bs-logger "0.x" - buffer-from "1.x" - fast-json-stable-stringify "2.x" - jest-util "26.x" - json5 "2.x" - lodash.memoize "4.x" - make-error "1.x" - mkdirp "1.x" - semver "7.x" - yargs-parser "18.x" - ts-jest@26.5.4: version "26.5.4" resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.5.4.tgz#207f4c114812a9c6d5746dd4d1cdf899eafc9686" @@ -17355,7 +17273,7 @@ tsconfig-paths@^3.9.0: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: +tslib@^1.8.1, tslib@^1.9.0: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== @@ -17446,7 +17364,7 @@ type@^1.0.1: resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== -type@^2.5.0: +type@^2.7.2: version "2.7.2" resolved "https://registry.yarnpkg.com/type/-/type-2.7.2.tgz#2376a15a3a28b1efa0f5350dcf72d24df6ef98d0" integrity sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw== @@ -17469,9 +17387,9 @@ typescript@4.0.7: integrity sha512-yi7M4y74SWvYbnazbn8/bmJmX4Zlej39ZOqwG/8dut/MYoSQ119GY9ZFbbGsD4PFZYWxqik/XsP3vk3+W5H3og== typescript@^4.0: - version "4.7.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" - integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== + version "4.8.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.2.tgz#e3b33d5ccfb5914e4eeab6699cf208adee3fd790" + integrity sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw== uglify-js@^3.1.4: version "3.17.0" @@ -17641,9 +17559,9 @@ upath@^2.0.1: integrity sha512-1uEe95xksV1O0CYKXo8vQvN1JEbtJp7lb7C5U9HMsIp6IVwntkH/oNUzyVNQSd4S1sYk2FpSSW44FqMc8qee5w== update-browserslist-db@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.5.tgz#be06a5eedd62f107b7c19eb5bcefb194411abf38" - integrity sha512-dteFFpCyvuDdr9S/ff1ISkKt/9YZxKjI9WlRR99c180GaztJtRa/fn18FdxGVKVsnPY7/a/FDN68mcvUmP4U7Q== + version "1.0.7" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.7.tgz#16279639cff1d0f800b14792de43d97df2d11b7d" + integrity sha512-iN/XYesmZ2RmmWAiI4Z5rq0YqSiv0brj9Ce9CfhNE4xIW2h+MFxcgkxIzZ+ShkFPUkjU3gQ+3oypadD3RAMtrg== dependencies: escalade "^3.1.1" picocolors "^1.0.0" @@ -17865,9 +17783,9 @@ vscode-json-languageservice@^4.0.2: vscode-uri "^3.0.3" vscode-languageserver-textdocument@^1.0.3: - version "1.0.5" - resolved "https://registry.yarnpkg.com/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.5.tgz#838769940ece626176ec5d5a2aa2d0aa69f5095c" - integrity sha512-1ah7zyQjKBudnMiHbZmxz5bYNM9KKZYz+5VQLj+yr8l+9w3g+WAhCkUkWbhMEdC5u0ub4Ndiye/fDyS8ghIKQg== + version "1.0.7" + resolved "https://registry.yarnpkg.com/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.7.tgz#16df468d5c2606103c90554ae05f9f3d335b771b" + integrity sha512-bFJH7UQxlXT8kKeyiyu41r22jCZXG8kuuVVA33OEJn1diWOZK5n8zBSPZFHVBOu8kXZ6h0LIRhf5UnCo61J4Hg== vscode-languageserver-types@^3.16.0: version "3.17.2" @@ -17875,9 +17793,9 @@ vscode-languageserver-types@^3.16.0: integrity sha512-zHhCWatviizPIq9B7Vh9uvrH6x3sK8itC84HkamnBWoDFJtzBf7SWlpLCZUit72b3os45h6RWQNC9xHRDF8dRA== vscode-nls@^5.0.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4" - integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w== + version "5.2.0" + resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.2.0.tgz#3cb6893dd9bd695244d8a024bdf746eea665cc3f" + integrity sha512-RAaHx7B14ZU04EU31pT+rKz2/zSl7xMsfIZuo8pd+KZO6PXtQmpevpq3vxvWNcrGbdmhM/rr5Uw5Mz+NBfhVng== vscode-uri@^3.0.3: version "3.0.3" @@ -18543,14 +18461,6 @@ yaml@^1.10.0, yaml@^1.10.2, yaml@^1.7.2: resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== -yargs-parser@18.x, yargs-parser@^18.1.2: - version "18.1.3" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" - integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ== - dependencies: - camelcase "^5.0.0" - decamelize "^1.2.0" - yargs-parser@20.2.4: version "20.2.4" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" @@ -18585,6 +18495,14 @@ yargs-parser@^16.1.0: camelcase "^5.0.0" decamelize "^1.2.0" +yargs-parser@^18.1.2: + version "18.1.3" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" + integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + yargs@12.0.5: version "12.0.5" resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13" @@ -18654,19 +18572,6 @@ yn@3.1.1: resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== -zen-observable-ts@^0.8.21: - version "0.8.21" - resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-0.8.21.tgz#85d0031fbbde1eba3cd07d3ba90da241215f421d" - integrity sha512-Yj3yXweRc8LdRMrCC8nIc4kkjWecPAUVh0TI0OUrWXx6aX790vLcDlWca6I4vsyCGH3LpWxq0dJRcMOFoVqmeg== - dependencies: - tslib "^1.9.3" - zen-observable "^0.8.0" - -zen-observable@^0.8.0: - version "0.8.15" - resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.8.15.tgz#96415c512d8e3ffd920afd3889604e30b9eaac15" - integrity sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ== - zone.js@^0.11.0: version "0.11.8" resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.11.8.tgz#40dea9adc1ad007b5effb2bfed17f350f1f46a21"