diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e2282c4cbb..eef213ac42 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,5 +1,5 @@ # Default -* @dOrgJelli +* @dOrgJelli @namesty # Wasm Runtime packages/wasm/as @dOrgJelli @krisbitney @namesty @Niraj-Kamdar diff --git a/.github/PUBLISHERS b/.github/PUBLISHERS index 27a9df99d9..6ebbdec920 100644 --- a/.github/PUBLISHERS +++ b/.github/PUBLISHERS @@ -1 +1,2 @@ dOrgJelli +namesty diff --git a/.github/workflows/release-publish.yaml b/.github/workflows/release-publish.yaml index cd12aa7fc8..11100d7918 100644 --- a/.github/workflows/release-publish.yaml +++ b/.github/workflows/release-publish.yaml @@ -132,7 +132,7 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: '**[NPM Release Published](https://www.npmjs.com/search?q=%40polywrap) `${{env.RELEASE_VERSION}}`** 🎉' + body: '**[NPM Release Published](https://www.npmjs.com/search?q=polywrap) `${{env.RELEASE_VERSION}}`** 🎉' }) Publish-Crates-dot-io-Release: diff --git a/CHANGELOG.md b/CHANGELOG.md index 18394bdeff..061f8f7476 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# Polywrap 0.0.1-prealpha.87 +## Features +* [PR-928](https://github.com/polywrap/monorepo/pull/928) `@polywrap/manifest-schemas`: Inline documentation has been added to manifest JSON-schemas. +* [PR-933](https://github.com/polywrap/monorepo/pull/933) Validation package `@polywrap/package-validation` has been implemented to validate WASM wrapper packages. + +## Bugs +* [PR-932](https://github.com/polywrap/monorepo/pull/932) `@polywrap/schema-bind`: Minor fix for JSON type schema bindings +* [PR-935](https://github.com/polywrap/monorepo/pull/935) `@polywrap/test-env-js`: Path fix for `npmCLI` test utility + # Polywrap 0.0.1-prealpha.86 ## Features * [PR-923](https://github.com/polywrap/monorepo/pull/923) The Polywrap brand has been applied to the codebase. diff --git a/VERSION b/VERSION index 17c498b850..bdd8708bf0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.1-prealpha.86 +0.0.1-prealpha.87 diff --git a/package.json b/package.json index df996d957c..bcf270a2b2 100644 --- a/package.json +++ b/package.json @@ -24,13 +24,13 @@ "reset": "yarn clean && yarn && yarn build", "clean": "npx rimraf ./**/node_modules ./**/yarn.lock ./**/build ./**/coverage ./**/.polywrap", "dependencies:install": "cd dependencies && yarn", - "build": "yarn build:core && yarn build:plugins && yarn build:client && yarn build:test-env && yarn build:cli && yarn build:plugins:patch", + "preinstall": "yarn dependencies:install", + "build": "yarn build:core && yarn build:plugins && yarn build:client && yarn build:test-env && yarn build:cli", "build:core": "lerna run build --no-private --ignore @polywrap/*-plugin-js --ignore polywrap --ignore @polywrap/client-js --ignore @polywrap/react --ignore @polywrap/test-env-js", "build:plugins": "lerna run build --scope @polywrap/*-plugin-js --concurrency 1", "build:client": "lerna run build --scope @polywrap/client-js --scope @polywrap/react", "build:test-env": "lerna run build --scope @polywrap/test-env-js", "build:cli": "lerna run build --scope polywrap", - "build:plugins:patch": "lerna run codegen:patch --scope @polywrap/*-plugin-js --concurrency 1", "lint": "lerna run lint", "lint:fix": "lerna run lint -- --fix", "lint:ci": "yarn lint", diff --git a/packages/js/core/src/manifest/formats/polywrap.app/0.0.1-prealpha.1.ts b/packages/js/core/src/manifest/formats/polywrap.app/0.0.1-prealpha.1.ts index 700aed8a30..00c9a05ecf 100644 --- a/packages/js/core/src/manifest/formats/polywrap.app/0.0.1-prealpha.1.ts +++ b/packages/js/core/src/manifest/formats/polywrap.app/0.0.1-prealpha.1.ts @@ -7,11 +7,29 @@ */ export interface AppManifest { + /** + * Polywrap app manifest format version. + */ format: "0.0.1-prealpha.1"; + /** + * Language in which the source code is written. + */ language: string; + /** + * Path to graphql schema. + */ schema: string; + /** + * Redirects for the schema's imports. + */ import_redirects?: { + /** + * Import URI to be redirected. + */ uri: string; + /** + * Path to a graphql schema to be used for the import. + */ schema: string; }[]; __type: "AppManifest"; diff --git a/packages/js/core/src/manifest/formats/polywrap.app/0.0.1-prealpha.2.ts b/packages/js/core/src/manifest/formats/polywrap.app/0.0.1-prealpha.2.ts index 159036fb58..38205e896d 100644 --- a/packages/js/core/src/manifest/formats/polywrap.app/0.0.1-prealpha.2.ts +++ b/packages/js/core/src/manifest/formats/polywrap.app/0.0.1-prealpha.2.ts @@ -7,12 +7,33 @@ */ export interface AppManifest { + /** + * Polywrap app manifest format version. + */ format: "0.0.1-prealpha.2"; + /** + * Name of this wrapper package. + */ name: string; + /** + * Language in which the source code is written. + */ language: string; + /** + * Path to graphql schema. + */ schema: string; + /** + * Redirects for the schema's imports. + */ import_redirects?: { + /** + * Import URI to be redirected. + */ uri: string; + /** + * Path to a graphql schema to be used for the import. + */ schema: string; }[]; __type: "AppManifest"; diff --git a/packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.1.ts b/packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.1.ts index 40d26eb91a..21ff37ce95 100644 --- a/packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.1.ts +++ b/packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.1.ts @@ -7,12 +7,30 @@ */ export interface BuildManifest { + /** + * Polywrap build manifest format version. + */ format: "0.0.1-prealpha.1"; + /** + * Docker build artifact properties. + */ docker?: { + /** + * Docker image name. + */ name?: string; + /** + * Docker image file name. + */ dockerfile?: string; + /** + * Id of the docker image. + */ buildImageId?: string; }; + /** + * Custom configuration. + */ config?: { [k: string]: unknown; }; diff --git a/packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.2.ts b/packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.2.ts index ffa766832a..5f325662bb 100644 --- a/packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.2.ts +++ b/packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.2.ts @@ -7,18 +7,45 @@ */ export interface BuildManifest { + /** + * Polywrap build manifest format version. + */ format: "0.0.1-prealpha.2"; docker?: { + /** + * Docker image name. + */ name?: string; + /** + * Docker image file name. + */ dockerfile?: string; + /** + * Id of the docker image. + */ buildImageId?: string; }; + /** + * Custom configuration. + */ config?: { [k: string]: unknown; }; + /** + * Locally linked packages into docker build image. + */ linked_packages?: { + /** + * Package name + */ name: string; + /** + * Path to linked package directory. + */ path: string; + /** + * Ignore files matching this regex in linked package directory. + */ filter?: string; }[]; __type: "BuildManifest"; diff --git a/packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.3.ts b/packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.3.ts index 9246d18b97..4f4655d5aa 100644 --- a/packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.3.ts +++ b/packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.3.ts @@ -7,26 +7,68 @@ */ export interface BuildManifest { + /** + * Polywrap build manifest format version. + */ format: "0.0.1-prealpha.3"; docker?: { + /** + * Docker image name. + */ name?: string; + /** + * Docker image file name. + */ dockerfile?: string; + /** + * Id of the docker image. + */ buildImageId?: string; + /** + * Configuration options for Docker Buildx, set to true for default value. + */ buildx?: | { + /** + * Path to cache directory, set to true for default value, set to false to disable caching. + */ cache?: string | boolean; + /** + * Path to cache directory, set to true or false for default value. + */ output?: string | boolean; + /** + * Remove the builder instance. + */ removeBuilder?: boolean; } | boolean; + /** + * Remove the image. + */ removeImage?: boolean; }; + /** + * Custom build image configurations. + */ config?: { [k: string]: unknown; }; + /** + * Locally linked packages into docker build image. + */ linked_packages?: { + /** + * Package name. + */ name: string; + /** + * Path to linked package directory. + */ path: string; + /** + * Ignore files matching this regex in linked package directory. + */ filter?: string; }[]; __type: "BuildManifest"; diff --git a/packages/js/core/src/manifest/formats/polywrap.deploy/0.0.1-prealpha.1.ts b/packages/js/core/src/manifest/formats/polywrap.deploy/0.0.1-prealpha.1.ts index c1c7dd7ccc..578e9e6cdd 100644 --- a/packages/js/core/src/manifest/formats/polywrap.deploy/0.0.1-prealpha.1.ts +++ b/packages/js/core/src/manifest/formats/polywrap.deploy/0.0.1-prealpha.1.ts @@ -7,18 +7,35 @@ */ export interface DeployManifest { + /** + * Polywrap deployment manifest format version. + */ format: "0.0.1-prealpha.1"; stages: { /** + * Deployment stage. + * * This interface was referenced by `undefined`'s JSON-Schema definition * via the `patternProperty` "^.*$". */ [k: string]: { + /** + * Name of the deploy stage. + */ package: string; + /** + * Custom configuration. + */ config?: { [k: string]: unknown; }; + /** + * Name of dependent stages. + */ depends_on?: string; + /** + * URI to pass into the deploy stage. + */ uri?: string; }; }; diff --git a/packages/js/core/src/manifest/formats/polywrap.infra/0.0.1-prealpha.1.ts b/packages/js/core/src/manifest/formats/polywrap.infra/0.0.1-prealpha.1.ts index 48eb48ddeb..3be13abb81 100644 --- a/packages/js/core/src/manifest/formats/polywrap.infra/0.0.1-prealpha.1.ts +++ b/packages/js/core/src/manifest/formats/polywrap.infra/0.0.1-prealpha.1.ts @@ -7,7 +7,13 @@ */ export interface InfraManifest { + /** + * Polywrap infra manifest format version. + */ format: "0.0.1-prealpha.1"; + /** + * Path to docker compose manifest. + */ dockerCompose?: string; env?: { /** @@ -25,12 +31,30 @@ export interface InfraManifest { }; __type: "InfraManifest"; } +/** + * A remote docker-compose package. + */ export interface RemoteModule { + /** + * Package name. + */ package: string; + /** + * Package registry name. + */ registry: string; + /** + * Package version. + */ version: string; + /** + * Path to docker-compose file in the package directory. + */ dockerComposePath?: string; } export interface LocalModule { + /** + * Path to the package. + */ path: string; } diff --git a/packages/js/core/src/manifest/formats/polywrap.infra/0.0.1-prealpha.2.ts b/packages/js/core/src/manifest/formats/polywrap.infra/0.0.1-prealpha.2.ts index 46c58ba19c..a56c15cea1 100644 --- a/packages/js/core/src/manifest/formats/polywrap.infra/0.0.1-prealpha.2.ts +++ b/packages/js/core/src/manifest/formats/polywrap.infra/0.0.1-prealpha.2.ts @@ -6,10 +6,19 @@ * and run json-schema-to-typescript to regenerate this file. */ +/** + * A module available by default. + */ export type DefaultModule = "default"; export interface InfraManifest { + /** + * Polywrap infra manifest format version. + */ format: "0.0.1-prealpha.2"; + /** + * Path to docker compose manifest. + */ dockerCompose?: string; env?: { /** @@ -27,12 +36,33 @@ export interface InfraManifest { }; __type: "InfraManifest"; } +/** + * A remote package with a docker-compose file. + */ export interface RemoteModule { + /** + * Package name. + */ package: string; + /** + * Package registry name. + */ registry: string; + /** + * Package version. + */ version: string; + /** + * Path to docker-compose file in the package directory. + */ dockerComposePath?: string; } +/** + * A local package with a docker-compose file. + */ export interface LocalModule { + /** + * Path to the package. + */ path: string; } diff --git a/packages/js/core/src/manifest/formats/polywrap.meta/0.0.1-prealpha.1.ts b/packages/js/core/src/manifest/formats/polywrap.meta/0.0.1-prealpha.1.ts index 873ad6d57e..8f6ed0fd62 100644 --- a/packages/js/core/src/manifest/formats/polywrap.meta/0.0.1-prealpha.1.ts +++ b/packages/js/core/src/manifest/formats/polywrap.meta/0.0.1-prealpha.1.ts @@ -7,21 +7,66 @@ */ export interface MetaManifest { + /** + * Polywrap wrapper metadata manifest format version. + */ format: "0.0.1-prealpha.1"; + /** + * Name of the wrapper. + */ name: string; + /** + * Short or summary description of the wrapper. + */ subtext?: string; + /** + * Long description for the wrapper. + */ description?: string; + /** + * Reference to the repository holding source code. + */ repository?: string; + /** + * Path to wrapper icon. + */ icon?: string; + /** + * Relevant web links. + */ links?: { + /** + * Web link name. + */ name: string; + /** + * Web link icon. + */ icon?: string; + /** + * Url to the web link. + */ url: string; }[]; + /** + * List of example queries. + */ queries?: { + /** + * Query name. + */ name: string; + /** + * Query description. + */ description?: string; + /** + * Path to graph ql file. + */ query: string; + /** + * Query parameters. + */ vars?: string; }[]; __type: "MetaManifest"; diff --git a/packages/js/core/src/manifest/formats/polywrap.meta/0.0.1-prealpha.2.ts b/packages/js/core/src/manifest/formats/polywrap.meta/0.0.1-prealpha.2.ts index ccedb0c8b4..9a81f8d34e 100644 --- a/packages/js/core/src/manifest/formats/polywrap.meta/0.0.1-prealpha.2.ts +++ b/packages/js/core/src/manifest/formats/polywrap.meta/0.0.1-prealpha.2.ts @@ -7,21 +7,66 @@ */ export interface MetaManifest { + /** + * Polywrap wrapper metadata manifest format version. + */ format: "0.0.1-prealpha.2"; + /** + * Name of the wrapper. + */ displayName?: string; + /** + * Short or summary description of the wrapper. + */ subtext?: string; + /** + * Long description for the wrapper. + */ description?: string; + /** + * Reference to the repository holding source code. + */ repository?: string; + /** + * Path to wrapper icon. + */ icon?: string; + /** + * Relevant web links. + */ links?: { + /** + * Web link name. + */ name: string; + /** + * Web link icon. + */ icon?: string; + /** + * Url to the web link. + */ url: string; }[]; + /** + * List of example queries. + */ queries?: { + /** + * Query name. + */ name: string; + /** + * Query description. + */ description?: string; + /** + * Path to graph ql file. + */ query: string; + /** + * Query parameters. + */ vars?: string; }[]; __type: "MetaManifest"; diff --git a/packages/js/core/src/manifest/formats/polywrap.meta/0.0.1-prealpha.3.ts b/packages/js/core/src/manifest/formats/polywrap.meta/0.0.1-prealpha.3.ts index fe3db7dadf..edfdfefe74 100644 --- a/packages/js/core/src/manifest/formats/polywrap.meta/0.0.1-prealpha.3.ts +++ b/packages/js/core/src/manifest/formats/polywrap.meta/0.0.1-prealpha.3.ts @@ -7,22 +7,70 @@ */ export interface MetaManifest { + /** + * Polywrap wrapper metadata manifest format version. + */ format: "0.0.1-prealpha.3"; + /** + * Name of the wrapper. + */ displayName?: string; + /** + * Short or summary description of the wrapper. + */ subtext?: string; + /** + * Long description for the wrapper. + */ description?: string; + /** + * Reference to the repository holding source code. + */ repository?: string; + /** + * List of relevant tag keywords. + */ tags?: string[]; + /** + * Path to wrapper icon. + */ icon?: string; + /** + * Relevant web links. + */ links?: { + /** + * Web link name. + */ name: string; + /** + * Web link icon. + */ icon?: string; + /** + * Url to the web link. + */ url: string; }[]; + /** + * List of example queries. + */ queries?: { + /** + * Query name. + */ name: string; + /** + * Query description. + */ description?: string; + /** + * Path to graph ql file. + */ query: string; + /** + * Query parameters. + */ vars?: string; }[]; __type: "MetaManifest"; diff --git a/packages/js/core/src/manifest/formats/polywrap.plugin/0.0.1-prealpha.1.ts b/packages/js/core/src/manifest/formats/polywrap.plugin/0.0.1-prealpha.1.ts index 3987884f94..8b84cef226 100644 --- a/packages/js/core/src/manifest/formats/polywrap.plugin/0.0.1-prealpha.1.ts +++ b/packages/js/core/src/manifest/formats/polywrap.plugin/0.0.1-prealpha.1.ts @@ -7,11 +7,29 @@ */ export interface PluginManifest { + /** + * Polywrap plugin manifest format version. + */ format: "0.0.1-prealpha.1"; + /** + * Plugin language. + */ language: string; + /** + * Path to graphql schema. + */ schema: string; + /** + * Redirects source URI to local wrapper or plugin. + */ import_redirects?: { + /** + * Source URI that needs to be redirected. + */ uri: string; + /** + * Path to GraphQL schema of the module to which URI will be redirected. + */ schema: string; }[]; __type: "PluginManifest"; diff --git a/packages/js/core/src/manifest/formats/polywrap.plugin/0.0.1-prealpha.2.ts b/packages/js/core/src/manifest/formats/polywrap.plugin/0.0.1-prealpha.2.ts index 74f3b4b64e..88c9a63645 100644 --- a/packages/js/core/src/manifest/formats/polywrap.plugin/0.0.1-prealpha.2.ts +++ b/packages/js/core/src/manifest/formats/polywrap.plugin/0.0.1-prealpha.2.ts @@ -7,21 +7,60 @@ */ export interface PluginManifest { + /** + * Polywrap plugin manifest format version. + */ format: "0.0.1-prealpha.2"; + /** + * Plugin name. + */ name: string; + /** + * Plugin language. + */ language: string; + /** + * Modules of Polywrap schema and implementation. + */ modules: { + /** + * Module for mutation operations. + */ mutation?: { + /** + * Path to graphql schema. + */ schema: string; + /** + * Path to Polywrap implementation. + */ module?: string; }; + /** + * Module for mutation operations. + */ query?: { + /** + * Path to graphql schema. + */ schema: string; + /** + * Path to Polywrap implementation. + */ module?: string; }; }; + /** + * Redirects source URI to local wrapper or plugin. + */ import_redirects?: { + /** + * Source URI that needs to be redirected. + */ uri: string; + /** + * Path to GraphQL schema of the module to which URI will be redirected. + */ schema: string; }[]; __type: "PluginManifest"; diff --git a/packages/js/core/src/manifest/formats/polywrap.plugin/0.0.1-prealpha.3.ts b/packages/js/core/src/manifest/formats/polywrap.plugin/0.0.1-prealpha.3.ts index b4ab49d672..62c7e38594 100644 --- a/packages/js/core/src/manifest/formats/polywrap.plugin/0.0.1-prealpha.3.ts +++ b/packages/js/core/src/manifest/formats/polywrap.plugin/0.0.1-prealpha.3.ts @@ -7,13 +7,37 @@ */ export interface PluginManifest { + /** + * Polywrap plugin manifest format version. + */ format: "0.0.1-prealpha.3"; + /** + * Plugin name. + */ name: string; + /** + * Plugin language. + */ language: string; + /** + * Path to Polywrap implementation. + */ module?: string; + /** + * Path to graphql schema. + */ schema: string; + /** + * Redirects source URI to local wrapper or plugin. + */ import_redirects?: { + /** + * Source URI that needs to be redirected. + */ uri: string; + /** + * Path to GraphQL schema of the module to which URI will be redirected. + */ schema: string; }[]; __type: "PluginManifest"; diff --git a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.1.ts b/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.1.ts index fb0fd37720..6c69bd0f34 100644 --- a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.1.ts +++ b/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.1.ts @@ -7,29 +7,83 @@ */ export interface PolywrapManifest { + /** + * Polywrap manifest format version. + */ format: "0.0.1-prealpha.1"; + /** + * Description about this wrapper. + */ description?: string; + /** + * Reference to the repository holding source code. + */ repository?: string; + /** + * Mutation module metadata. + */ mutation?: { + /** + * The module's graphql schema. + */ schema: { + /** + * Path to graphql schema file. + */ file: string; }; + /** + * Module for mutation operations. + */ module: { + /** + * Language in which the source code is written. + */ language: string; + /** + * Path to Polywrap module implementation file. + */ file: string; }; }; + /** + * Module for query operations. + */ query?: { + /** + * The module's graphql schema. + */ schema: { + /** + * Path to graphql schema file. + */ file: string; }; + /** + * Module for query operations. + */ module: { + /** + * Language in which the source code is written. + */ language: string; + /** + * Path to Polywrap module implementation file. + */ file: string; }; }; + /** + * Redirects for the schema's imports. + */ import_redirects?: { + /** + * Import URI to be redirected. + */ uri: string; + /** + * Path to a graphql schema to be used for the import. + */ schema: string; }[]; __type: "PolywrapManifest"; diff --git a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.2.ts b/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.2.ts index e544c2f433..77c7eddeca 100644 --- a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.2.ts +++ b/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.2.ts @@ -7,22 +7,64 @@ */ export interface PolywrapManifest { + /** + * Polywrap manifest format version + */ format: "0.0.1-prealpha.2"; + /** + * Reference to the repository holding source code. + */ repository?: string; + /** + * Path to the customized build manifest file. + */ build?: string; + /** + * Language in which the source code is written. + */ language: string; + /** + * Modules of Polywrap schema and implementation. + */ modules: { + /** + * Module for mutation operations. + */ mutation?: { + /** + * Path to graphql schema. + */ schema: string; + /** + * Path to Polywrap implementation. + */ module: string; }; + /** + * Module for query operations. + */ query?: { + /** + * Path to graphql schema. + */ schema: string; + /** + * Path to Polywrap implementation. + */ module: string; }; }; + /** + * Redirects for the schema's imports. + */ import_redirects?: { + /** + * Import URI to be redirected. + */ uri: string; + /** + * Path to a graphql schema to be used for the import. + */ schema: string; }[]; __type: "PolywrapManifest"; diff --git a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.3.ts b/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.3.ts index ea5dfc289a..4cf1fa77d6 100644 --- a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.3.ts +++ b/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.3.ts @@ -7,23 +7,68 @@ */ export interface PolywrapManifest { + /** + * Polywrap manifest format version. + */ format: "0.0.1-prealpha.3"; + /** + * Reference to the repository holding source code. + */ repository?: string; + /** + * Path to the customized build manifest file. + */ build?: string; + /** + * Language in which the source code is written. + */ language?: string; + /** + * Wrapper has no Wasm implementation, only the schema. + */ interface?: boolean; + /** + * Modules of Polywrap schema and implementation. + */ modules: { + /** + * Module for mutation operations. + */ mutation?: { + /** + * Path to graphql schema. + */ schema: string; + /** + * Path to Polywrap implementation. + */ module?: string; }; + /** + * Module for query operations. + */ query?: { + /** + * Path to graphql schema. + */ schema: string; + /** + * Path to Polywrap implementation. + */ module?: string; }; }; + /** + * Redirects for the schema's imports. + */ import_redirects?: { + /** + * Import URI to be redirected. + */ uri: string; + /** + * Path to a graphql schema to be used for the import. + */ schema: string; }[]; __type: "PolywrapManifest"; diff --git a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.4.ts b/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.4.ts index 655bbed663..35ba2886b1 100644 --- a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.4.ts +++ b/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.4.ts @@ -7,22 +7,64 @@ */ export interface PolywrapManifest { + /** + * Polywrap manifest format version. + */ format: "0.0.1-prealpha.4"; + /** + * Reference to the repository holding source code. + */ repository?: string; + /** + * Path to the customized build manifest file. + */ build?: string; + /** + * Language in which the source code is written. + */ language: string; + /** + * Modules of Polywrap schema and implementation. + */ modules: { + /** + * Module for mutation operations. + */ mutation?: { + /** + * Path to graphql schema. + */ schema: string; + /** + * Path to Polywrap implementation. + */ module?: string; }; + /** + * Module for query operations. + */ query?: { + /** + * Path to graphql schema. + */ schema: string; + /** + * Path to Polywrap implementation. + */ module?: string; }; }; + /** + * Redirects for the schema's imports. + */ import_redirects?: { + /** + * Import URI to be redirected. + */ uri: string; + /** + * Path to a graphql schema to be used for the import. + */ schema: string; }[]; __type: "PolywrapManifest"; diff --git a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.5.ts b/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.5.ts index b5f086875e..79f19e70f6 100644 --- a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.5.ts +++ b/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.5.ts @@ -7,22 +7,64 @@ */ export interface PolywrapManifest { + /** + * Polywrap manifest format version. + */ format: "0.0.1-prealpha.5"; + /** + * Path to the customized build manifest file. + */ build?: string; + /** + * Path to wrapper metadata manifest file. + */ meta?: string; + /** + * Language in which the source code is written. + */ language: string; + /** + * Modules of Polywrap schema and implementation. + */ modules: { + /** + * Module for mutation operations. + */ mutation?: { + /** + * Path to graphql schema. + */ schema: string; + /** + * Path to Polywrap implementation. + */ module?: string; }; + /** + * Module for query operations. + */ query?: { + /** + * Path to graphql schema. + */ schema: string; + /** + * Path to Polywrap implementation. + */ module?: string; }; }; + /** + * Redirects for the schema's imports. + */ import_redirects?: { + /** + * Import URI to be redirected. + */ uri: string; + /** + * Path to a graphql schema to be used for the import. + */ schema: string; }[]; __type: "PolywrapManifest"; diff --git a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.6.ts b/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.6.ts index e274e2d418..7c45df071e 100644 --- a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.6.ts +++ b/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.6.ts @@ -7,22 +7,64 @@ */ export interface PolywrapManifest { + /** + * Polywrap manifest format version. + */ format: "0.0.1-prealpha.6"; + /** + * Path to the customized build manifest file. + */ build?: string; + /** + * Path to wrapper metadata manifest file. + */ meta?: string; + /** + * Language in which the source code is written. + */ language: string; + /** + * Modules of Polywrap schema and implementation. + */ modules: { + /** + * Module for mutation operations. + */ mutation?: { + /** + * Path to graphql schema. + */ schema: string; + /** + * Path to Polywrap implementation. + */ module?: string; }; + /** + * Module for query operations. + */ query?: { + /** + * Path to graphql schema. + */ schema: string; + /** + * Path to Polywrap implementation. + */ module?: string; }; }; + /** + * Redirects for the schema's imports. + */ import_redirects?: { + /** + * Import URI to be redirected. + */ uri: string; + /** + * Path to a graphql schema to be used for the import. + */ schema: string; }[]; __type: "PolywrapManifest"; diff --git a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.7.ts b/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.7.ts index 7295a599e7..d901c83e26 100644 --- a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.7.ts +++ b/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.7.ts @@ -7,23 +7,68 @@ */ export interface PolywrapManifest { + /** + * Polywrap manifest format version. + */ format: "0.0.1-prealpha.7"; + /** + * Name of this wrapper package. + */ name: string; + /** + * Path to the customized build manifest file. + */ build?: string; + /** + * Path to wrapper metadata manifest file. + */ meta?: string; + /** + * Language in which the source code is written. + */ language: string; + /** + * Modules of Polywrap schema and implementation. + */ modules: { + /** + * Module for mutation operations. + */ mutation?: { + /** + * Path to graphql schema. + */ schema: string; + /** + * Path to Polywrap implementation. + */ module?: string; }; + /** + * Module for query operations. + */ query?: { + /** + * Path to graphql schema. + */ schema: string; + /** + * Path to Polywrap implementation. + */ module?: string; }; }; + /** + * Redirects for the schema's imports. + */ import_redirects?: { + /** + * Import URI to be redirected. + */ uri: string; + /** + * Path to a graphql schema to be used for the import. + */ schema: string; }[]; __type: "PolywrapManifest"; diff --git a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.8.ts b/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.8.ts index dc98edbd44..b29a6d0313 100644 --- a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.8.ts +++ b/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.8.ts @@ -7,24 +7,72 @@ */ export interface PolywrapManifest { + /** + * Polywrap manifest format version. + */ format: "0.0.1-prealpha.8"; + /** + * Name of this wrapper package. + */ name: string; + /** + * Path to the customized build manifest file. + */ build?: string; + /** + * Path to wrapper metadata manifest file. + */ meta?: string; + /** + * Path to wrapper deploy manifest file. + */ deploy?: string; + /** + * Language in which the source code is written. + */ language: string; + /** + * Modules of Polywrap schema and implementation. + */ modules: { + /** + * Module for mutation operations. + */ mutation?: { + /** + * Path to graphql schema. + */ schema: string; + /** + * Path to Polywrap implementation. + */ module?: string; }; + /** + * Module for query operations. + */ query?: { + /** + * Path to graphql schema. + */ schema: string; + /** + * Path to Polywrap implementation. + */ module?: string; }; }; + /** + * Redirects for the schema's imports. + */ import_redirects?: { + /** + * Import URI to be redirected. + */ uri: string; + /** + * Path to a graphql schema to be used for the import. + */ schema: string; }[]; __type: "PolywrapManifest"; diff --git a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.9.ts b/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.9.ts index 534b871144..4dc52e2e12 100644 --- a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.9.ts +++ b/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.9.ts @@ -7,16 +7,49 @@ */ export interface PolywrapManifest { + /** + * Polywrap manifest format version. + */ format: "0.0.1-prealpha.9"; + /** + * Name of this wrapper package. + */ name: string; + /** + * Path to the wrapper build manifest file. + */ build?: string; + /** + * Path to wrapper metadata manifest file. + */ meta?: string; + /** + * Path to wrapper deploy manifest file. + */ deploy?: string; + /** + * Language in which the source code is written. + */ language: string; + /** + * Path to the module's entry point. + */ module?: string; + /** + * Path to the module's graphql schema. + */ schema: string; + /** + * Redirects for the schema's imports. + */ import_redirects?: { + /** + * Import URI to be redirected. + */ uri: string; + /** + * Path to a graphql schema to be used for the import. + */ schema: string; }[]; __type: "PolywrapManifest"; diff --git a/packages/js/core/src/manifest/formats/polywrap/validate.ts b/packages/js/core/src/manifest/formats/polywrap/validate.ts index 4ab8fc752f..12b4619293 100644 --- a/packages/js/core/src/manifest/formats/polywrap/validate.ts +++ b/packages/js/core/src/manifest/formats/polywrap/validate.ts @@ -51,6 +51,8 @@ Validator.prototype.customFormats.yamlFile = Validators.yamlFile; Validator.prototype.customFormats.graphqlFile = Validators.graphqlFile; Validator.prototype.customFormats.manifestFile = Validators.manifestFile; Validator.prototype.customFormats.packageName = Validators.packageName; +Validator.prototype.customFormats.polywrapUri = Validators.polywrapUri; +Validator.prototype.customFormats.schemaFile = Validators.schemaFile; export const validatePolywrapManifest = Tracer.traceFunc( "core: validatePolywrapManifest", diff --git a/packages/js/core/src/uri-resolution/core/resolveUri.ts b/packages/js/core/src/uri-resolution/core/resolveUri.ts index a027150027..6eeed2f2b3 100644 --- a/packages/js/core/src/uri-resolution/core/resolveUri.ts +++ b/packages/js/core/src/uri-resolution/core/resolveUri.ts @@ -37,11 +37,9 @@ export const resolveUri = async ( uri: currentUri, wrapper, uriHistory: new UriResolutionHistory(uriResolutionStack), - error: infiniteLoopDetected - ? { - type: ResolveUriErrorType.InfiniteLoop, - } - : undefined, + error: { + type: ResolveUriErrorType.InfiniteLoop, + }, }; } diff --git a/packages/js/plugins/ens/package.json b/packages/js/plugins/ens/package.json index 8f2c59987f..26045ebc00 100644 --- a/packages/js/plugins/ens/package.json +++ b/packages/js/plugins/ens/package.json @@ -12,9 +12,8 @@ "build" ], "scripts": { - "build": "rimraf ./build && tsc --project tsconfig.build.json", + "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", "codegen": "node ../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", - "codegen:patch": "node ../../../cli/bin/polywrap plugin codegen && rimraf ./src/wrap", "lint": "eslint --color -c ../../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", diff --git a/packages/js/plugins/ens/src/index.ts b/packages/js/plugins/ens/src/index.ts index 95be562c7d..8bc334fd9c 100644 --- a/packages/js/plugins/ens/src/index.ts +++ b/packages/js/plugins/ens/src/index.ts @@ -7,7 +7,7 @@ import { Bytes, Ethereum_Module, manifest, -} from "./wrap-man"; +} from "./wrap"; import { ethers } from "ethers"; import { Base58 } from "@ethersproject/basex"; diff --git a/packages/js/plugins/ens/src/wrap-man/index.ts b/packages/js/plugins/ens/src/wrap-man/index.ts deleted file mode 100644 index f367d143d9..0000000000 --- a/packages/js/plugins/ens/src/wrap-man/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export * from "./schema"; -export * from "./manifest"; -export * from "./module"; -export * from "./types"; - -export { Client } from "@polywrap/core-js"; diff --git a/packages/js/plugins/ens/src/wrap-man/manifest.ts b/packages/js/plugins/ens/src/wrap-man/manifest.ts deleted file mode 100644 index bdf0be5286..0000000000 --- a/packages/js/plugins/ens/src/wrap-man/manifest.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { schema } from "./"; - -import { PluginPackageManifest } from "@polywrap/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [], -}; diff --git a/packages/js/plugins/ens/src/wrap-man/module.ts b/packages/js/plugins/ens/src/wrap-man/module.ts deleted file mode 100644 index fb6ec175b7..0000000000 --- a/packages/js/plugins/ens/src/wrap-man/module.ts +++ /dev/null @@ -1,31 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/naming-convention */ - -import * as Types from "./types"; - -import { Client, PluginModule, MaybeAsync } from "@polywrap/core-js"; - -export interface Input_tryResolveUri extends Record { - authority: Types.String; - path: Types.String; -} - -export interface Input_getFile extends Record { - path: Types.String; -} - -export abstract class Module< - TConfig extends Record -> extends PluginModule { - abstract tryResolveUri( - input: Input_tryResolveUri, - client: Client - ): MaybeAsync; - - abstract getFile( - input: Input_getFile, - client: Client - ): MaybeAsync; -} diff --git a/packages/js/plugins/ens/src/wrap-man/types.ts b/packages/js/plugins/ens/src/wrap-man/types.ts deleted file mode 100644 index de46821d8a..0000000000 --- a/packages/js/plugins/ens/src/wrap-man/types.ts +++ /dev/null @@ -1,523 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/naming-convention */ - -import * as Types from "./"; - -import { Client, InvokeResult } from "@polywrap/core-js"; - -export type UInt = number; -export type UInt8 = number; -export type UInt16 = number; -export type UInt32 = number; -export type Int = number; -export type Int8 = number; -export type Int16 = number; -export type Int32 = number; -export type Bytes = ArrayBuffer; -export type BigInt = string; -export type BigNumber = string; -export type Json = string; -export type String = string; -export type Boolean = boolean; - -/// Envs START /// -/// Envs END /// - -/// Objects START /// -/// Objects END /// - -/// Enums START /// -/// Enums END /// - -/// Imported Objects START /// - -/* URI: "ens/uri-resolver.core.polywrap.eth" */ -export interface UriResolver_MaybeUriOrManifest { - uri?: Types.String | null; - manifest?: Types.String | null; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -export interface Ethereum_Connection { - node?: Types.String | null; - networkNameOrChainId?: Types.String | null; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -export interface Ethereum_TxOverrides { - gasLimit?: Types.BigInt | null; - gasPrice?: Types.BigInt | null; - value?: Types.BigInt | null; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -export interface Ethereum_StaticTxResult { - result: Types.String; - error: Types.Boolean; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -export interface Ethereum_TxRequest { - to?: Types.String | null; - from?: Types.String | null; - nonce?: Types.UInt32 | null; - gasLimit?: Types.BigInt | null; - gasPrice?: Types.BigInt | null; - data?: Types.String | null; - value?: Types.BigInt | null; - chainId?: Types.BigInt | null; - type?: Types.UInt32 | null; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -export interface Ethereum_TxReceipt { - to: Types.String; - from: Types.String; - contractAddress: Types.String; - transactionIndex: Types.UInt32; - root?: Types.String | null; - gasUsed: Types.BigInt; - logsBloom: Types.String; - transactionHash: Types.String; - logs: Array; - blockNumber: Types.BigInt; - blockHash: Types.String; - confirmations: Types.UInt32; - cumulativeGasUsed: Types.BigInt; - effectiveGasPrice: Types.BigInt; - byzantium: Types.Boolean; - type: Types.UInt32; - status?: Types.UInt32 | null; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -export interface Ethereum_Log { - blockNumber: Types.BigInt; - blockHash: Types.String; - transactionIndex: Types.UInt32; - removed: Types.Boolean; - address: Types.String; - data: Types.String; - topics: Array; - transactionHash: Types.String; - logIndex: Types.UInt32; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -export interface Ethereum_EventNotification { - data: Types.String; - address: Types.String; - log: Types.Ethereum_Log; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -export interface Ethereum_Network { - name: Types.String; - chainId: Types.BigInt; - ensAddress?: Types.String | null; -} - -/// Imported Objects END /// - -/// Imported Modules START /// - -/* URI: "ens/uri-resolver.core.polywrap.eth" */ -interface UriResolver_Module_Input_tryResolveUri - extends Record { - authority: Types.String; - path: Types.String; -} - -/* URI: "ens/uri-resolver.core.polywrap.eth" */ -interface UriResolver_Module_Input_getFile extends Record { - path: Types.String; -} - -/* URI: "ens/uri-resolver.core.polywrap.eth" */ -export const UriResolver_Module = { - tryResolveUri: async ( - input: UriResolver_Module_Input_tryResolveUri, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/uri-resolver.core.polywrap.eth", - method: "tryResolveUri", - input, - }); - }, - - getFile: async ( - input: UriResolver_Module_Input_getFile, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/uri-resolver.core.polywrap.eth", - method: "getFile", - input, - }); - }, -}; - -/* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Input_callContractView - extends Record { - address: Types.String; - method: Types.String; - args?: Array | null; - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Input_callContractStatic - extends Record { - address: Types.String; - method: Types.String; - args?: Array | null; - connection?: Types.Ethereum_Connection | null; - txOverrides?: Types.Ethereum_TxOverrides | null; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Input_getBalance extends Record { - address: Types.String; - blockTag?: Types.BigInt | null; - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Input_encodeParams extends Record { - types: Array; - values: Array; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Input_encodeFunction extends Record { - method: Types.String; - args?: Array | null; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Input_solidityPack extends Record { - types: Array; - values: Array; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Input_solidityKeccak256 - extends Record { - types: Array; - values: Array; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Input_soliditySha256 extends Record { - types: Array; - values: Array; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Input_getSignerAddress - extends Record { - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Input_getSignerBalance - extends Record { - blockTag?: Types.BigInt | null; - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Input_getSignerTransactionCount - extends Record { - blockTag?: Types.BigInt | null; - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Input_getGasPrice extends Record { - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Input_estimateTransactionGas - extends Record { - tx: Types.Ethereum_TxRequest; - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Input_estimateContractCallGas - extends Record { - address: Types.String; - method: Types.String; - args?: Array | null; - connection?: Types.Ethereum_Connection | null; - txOverrides?: Types.Ethereum_TxOverrides | null; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Input_checkAddress extends Record { - address: Types.String; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Input_toWei extends Record { - eth: Types.String; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Input_toEth extends Record { - wei: Types.BigInt; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Input_awaitTransaction - extends Record { - txHash: Types.String; - confirmations: Types.UInt32; - timeout: Types.UInt32; - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Input_waitForEvent extends Record { - address: Types.String; - event: Types.String; - args?: Array | null; - timeout?: Types.UInt32 | null; - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Input_getNetwork extends Record { - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.polywrap.eth" */ -export const Ethereum_Module = { - callContractView: async ( - input: Ethereum_Module_Input_callContractView, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.polywrap.eth", - method: "callContractView", - input, - }); - }, - - callContractStatic: async ( - input: Ethereum_Module_Input_callContractStatic, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.polywrap.eth", - method: "callContractStatic", - input, - }); - }, - - getBalance: async ( - input: Ethereum_Module_Input_getBalance, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.polywrap.eth", - method: "getBalance", - input, - }); - }, - - encodeParams: async ( - input: Ethereum_Module_Input_encodeParams, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.polywrap.eth", - method: "encodeParams", - input, - }); - }, - - encodeFunction: async ( - input: Ethereum_Module_Input_encodeFunction, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.polywrap.eth", - method: "encodeFunction", - input, - }); - }, - - solidityPack: async ( - input: Ethereum_Module_Input_solidityPack, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.polywrap.eth", - method: "solidityPack", - input, - }); - }, - - solidityKeccak256: async ( - input: Ethereum_Module_Input_solidityKeccak256, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.polywrap.eth", - method: "solidityKeccak256", - input, - }); - }, - - soliditySha256: async ( - input: Ethereum_Module_Input_soliditySha256, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.polywrap.eth", - method: "soliditySha256", - input, - }); - }, - - getSignerAddress: async ( - input: Ethereum_Module_Input_getSignerAddress, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.polywrap.eth", - method: "getSignerAddress", - input, - }); - }, - - getSignerBalance: async ( - input: Ethereum_Module_Input_getSignerBalance, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.polywrap.eth", - method: "getSignerBalance", - input, - }); - }, - - getSignerTransactionCount: async ( - input: Ethereum_Module_Input_getSignerTransactionCount, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.polywrap.eth", - method: "getSignerTransactionCount", - input, - }); - }, - - getGasPrice: async ( - input: Ethereum_Module_Input_getGasPrice, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.polywrap.eth", - method: "getGasPrice", - input, - }); - }, - - estimateTransactionGas: async ( - input: Ethereum_Module_Input_estimateTransactionGas, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.polywrap.eth", - method: "estimateTransactionGas", - input, - }); - }, - - estimateContractCallGas: async ( - input: Ethereum_Module_Input_estimateContractCallGas, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.polywrap.eth", - method: "estimateContractCallGas", - input, - }); - }, - - checkAddress: async ( - input: Ethereum_Module_Input_checkAddress, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.polywrap.eth", - method: "checkAddress", - input, - }); - }, - - toWei: async ( - input: Ethereum_Module_Input_toWei, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.polywrap.eth", - method: "toWei", - input, - }); - }, - - toEth: async ( - input: Ethereum_Module_Input_toEth, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.polywrap.eth", - method: "toEth", - input, - }); - }, - - awaitTransaction: async ( - input: Ethereum_Module_Input_awaitTransaction, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.polywrap.eth", - method: "awaitTransaction", - input, - }); - }, - - waitForEvent: async ( - input: Ethereum_Module_Input_waitForEvent, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.polywrap.eth", - method: "waitForEvent", - input, - }); - }, - - getNetwork: async ( - input: Ethereum_Module_Input_getNetwork, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.polywrap.eth", - method: "getNetwork", - input, - }); - }, -}; - -/// Imported Modules END /// diff --git a/packages/js/plugins/ethereum/package.json b/packages/js/plugins/ethereum/package.json index 22d399d51c..c7e8f1aeee 100644 --- a/packages/js/plugins/ethereum/package.json +++ b/packages/js/plugins/ethereum/package.json @@ -12,9 +12,8 @@ "build" ], "scripts": { - "build": "rimraf ./build && tsc --project tsconfig.build.json", + "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", "codegen": "node ../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", - "codegen:patch": "node ../../../cli/bin/polywrap plugin codegen && rimraf ./src/wrap", "lint": "eslint --color -c ../../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --detectOpenHandles --verbose", diff --git a/packages/js/plugins/ethereum/src/Connection.ts b/packages/js/plugins/ethereum/src/Connection.ts index 9bc730d6c7..a370075ca0 100644 --- a/packages/js/plugins/ethereum/src/Connection.ts +++ b/packages/js/plugins/ethereum/src/Connection.ts @@ -1,4 +1,4 @@ -import { Connection as SchemaConnection } from "./wrap-man"; +import { Connection as SchemaConnection } from "./wrap"; import { Signer, ethers } from "ethers"; import { diff --git a/packages/js/plugins/ethereum/src/__tests__/e2e.spec.ts b/packages/js/plugins/ethereum/src/__tests__/e2e.spec.ts index def46094b5..174c7adb95 100644 --- a/packages/js/plugins/ethereum/src/__tests__/e2e.spec.ts +++ b/packages/js/plugins/ethereum/src/__tests__/e2e.spec.ts @@ -1,5 +1,5 @@ import { ethereumPlugin } from ".."; -import * as Schema from "../wrap-man"; +import * as Schema from "../wrap"; import { PolywrapClient, defaultIpfsProviders } from "@polywrap/client-js"; import { ensPlugin } from "@polywrap/ens-plugin-js"; diff --git a/packages/js/plugins/ethereum/src/index.ts b/packages/js/plugins/ethereum/src/index.ts index 064a178583..c4cabf9e99 100644 --- a/packages/js/plugins/ethereum/src/index.ts +++ b/packages/js/plugins/ethereum/src/index.ts @@ -36,7 +36,7 @@ import { Network, Connection as SchemaConnection, manifest, -} from "./wrap-man"; +} from "./wrap"; import { Connections, Connection, diff --git a/packages/js/plugins/ethereum/src/utils/mapping.ts b/packages/js/plugins/ethereum/src/utils/mapping.ts index eb15b01667..7d3d603ef2 100644 --- a/packages/js/plugins/ethereum/src/utils/mapping.ts +++ b/packages/js/plugins/ethereum/src/utils/mapping.ts @@ -1,4 +1,4 @@ -import { Access, TxReceipt, TxResponse, TxRequest, Log } from "../wrap-man"; +import { Access, TxReceipt, TxResponse, TxRequest, Log } from "../wrap"; import { ethers } from "ethers"; diff --git a/packages/js/plugins/ethereum/src/wrap-man/index.ts b/packages/js/plugins/ethereum/src/wrap-man/index.ts deleted file mode 100644 index f367d143d9..0000000000 --- a/packages/js/plugins/ethereum/src/wrap-man/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export * from "./schema"; -export * from "./manifest"; -export * from "./module"; -export * from "./types"; - -export { Client } from "@polywrap/core-js"; diff --git a/packages/js/plugins/ethereum/src/wrap-man/manifest.ts b/packages/js/plugins/ethereum/src/wrap-man/manifest.ts deleted file mode 100644 index bdf0be5286..0000000000 --- a/packages/js/plugins/ethereum/src/wrap-man/manifest.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { schema } from "./"; - -import { PluginPackageManifest } from "@polywrap/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [], -}; diff --git a/packages/js/plugins/ethereum/src/wrap-man/module.ts b/packages/js/plugins/ethereum/src/wrap-man/module.ts deleted file mode 100644 index 902e0c9a6b..0000000000 --- a/packages/js/plugins/ethereum/src/wrap-man/module.ts +++ /dev/null @@ -1,295 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/naming-convention */ - -import * as Types from "./types"; - -import { Client, PluginModule, MaybeAsync } from "@polywrap/core-js"; - -export interface Input_callContractView extends Record { - address: Types.String; - method: Types.String; - args?: Array | null; - connection?: Types.Connection | null; -} - -export interface Input_callContractStatic extends Record { - address: Types.String; - method: Types.String; - args?: Array | null; - connection?: Types.Connection | null; - txOverrides?: Types.TxOverrides | null; -} - -export interface Input_getBalance extends Record { - address: Types.String; - blockTag?: Types.BigInt | null; - connection?: Types.Connection | null; -} - -export interface Input_encodeParams extends Record { - types: Array; - values: Array; -} - -export interface Input_encodeFunction extends Record { - method: Types.String; - args?: Array | null; -} - -export interface Input_solidityPack extends Record { - types: Array; - values: Array; -} - -export interface Input_solidityKeccak256 extends Record { - types: Array; - values: Array; -} - -export interface Input_soliditySha256 extends Record { - types: Array; - values: Array; -} - -export interface Input_getSignerAddress extends Record { - connection?: Types.Connection | null; -} - -export interface Input_getSignerBalance extends Record { - blockTag?: Types.BigInt | null; - connection?: Types.Connection | null; -} - -export interface Input_getSignerTransactionCount - extends Record { - blockTag?: Types.BigInt | null; - connection?: Types.Connection | null; -} - -export interface Input_getGasPrice extends Record { - connection?: Types.Connection | null; -} - -export interface Input_estimateTransactionGas extends Record { - tx: Types.TxRequest; - connection?: Types.Connection | null; -} - -export interface Input_estimateContractCallGas extends Record { - address: Types.String; - method: Types.String; - args?: Array | null; - connection?: Types.Connection | null; - txOverrides?: Types.TxOverrides | null; -} - -export interface Input_checkAddress extends Record { - address: Types.String; -} - -export interface Input_toWei extends Record { - eth: Types.String; -} - -export interface Input_toEth extends Record { - wei: Types.BigInt; -} - -export interface Input_awaitTransaction extends Record { - txHash: Types.String; - confirmations: Types.UInt32; - timeout: Types.UInt32; - connection?: Types.Connection | null; -} - -export interface Input_waitForEvent extends Record { - address: Types.String; - event: Types.String; - args?: Array | null; - timeout?: Types.UInt32 | null; - connection?: Types.Connection | null; -} - -export interface Input_getNetwork extends Record { - connection?: Types.Connection | null; -} - -export interface Input_callContractMethod extends Record { - address: Types.String; - method: Types.String; - args?: Array | null; - connection?: Types.Connection | null; - txOverrides?: Types.TxOverrides | null; -} - -export interface Input_callContractMethodAndWait - extends Record { - address: Types.String; - method: Types.String; - args?: Array | null; - connection?: Types.Connection | null; - txOverrides?: Types.TxOverrides | null; -} - -export interface Input_sendTransaction extends Record { - tx: Types.TxRequest; - connection?: Types.Connection | null; -} - -export interface Input_sendTransactionAndWait extends Record { - tx: Types.TxRequest; - connection?: Types.Connection | null; -} - -export interface Input_deployContract extends Record { - abi: Types.String; - bytecode: Types.String; - args?: Array | null; - connection?: Types.Connection | null; -} - -export interface Input_signMessage extends Record { - message: Types.String; - connection?: Types.Connection | null; -} - -export interface Input_sendRPC extends Record { - method: Types.String; - params: Array; - connection?: Types.Connection | null; -} - -export abstract class Module< - TConfig extends Record -> extends PluginModule { - abstract callContractView( - input: Input_callContractView, - client: Client - ): MaybeAsync; - - abstract callContractStatic( - input: Input_callContractStatic, - client: Client - ): MaybeAsync; - - abstract getBalance( - input: Input_getBalance, - client: Client - ): MaybeAsync; - - abstract encodeParams( - input: Input_encodeParams, - client: Client - ): MaybeAsync; - - abstract encodeFunction( - input: Input_encodeFunction, - client: Client - ): MaybeAsync; - - abstract solidityPack( - input: Input_solidityPack, - client: Client - ): MaybeAsync; - - abstract solidityKeccak256( - input: Input_solidityKeccak256, - client: Client - ): MaybeAsync; - - abstract soliditySha256( - input: Input_soliditySha256, - client: Client - ): MaybeAsync; - - abstract getSignerAddress( - input: Input_getSignerAddress, - client: Client - ): MaybeAsync; - - abstract getSignerBalance( - input: Input_getSignerBalance, - client: Client - ): MaybeAsync; - - abstract getSignerTransactionCount( - input: Input_getSignerTransactionCount, - client: Client - ): MaybeAsync; - - abstract getGasPrice( - input: Input_getGasPrice, - client: Client - ): MaybeAsync; - - abstract estimateTransactionGas( - input: Input_estimateTransactionGas, - client: Client - ): MaybeAsync; - - abstract estimateContractCallGas( - input: Input_estimateContractCallGas, - client: Client - ): MaybeAsync; - - abstract checkAddress( - input: Input_checkAddress, - client: Client - ): MaybeAsync; - - abstract toWei(input: Input_toWei, client: Client): MaybeAsync; - - abstract toEth(input: Input_toEth, client: Client): MaybeAsync; - - abstract awaitTransaction( - input: Input_awaitTransaction, - client: Client - ): MaybeAsync; - - abstract waitForEvent( - input: Input_waitForEvent, - client: Client - ): MaybeAsync; - - abstract getNetwork( - input: Input_getNetwork, - client: Client - ): MaybeAsync; - - abstract callContractMethod( - input: Input_callContractMethod, - client: Client - ): MaybeAsync; - - abstract callContractMethodAndWait( - input: Input_callContractMethodAndWait, - client: Client - ): MaybeAsync; - - abstract sendTransaction( - input: Input_sendTransaction, - client: Client - ): MaybeAsync; - - abstract sendTransactionAndWait( - input: Input_sendTransactionAndWait, - client: Client - ): MaybeAsync; - - abstract deployContract( - input: Input_deployContract, - client: Client - ): MaybeAsync; - - abstract signMessage( - input: Input_signMessage, - client: Client - ): MaybeAsync; - - abstract sendRPC( - input: Input_sendRPC, - client: Client - ): MaybeAsync; -} diff --git a/packages/js/plugins/ethereum/src/wrap-man/types.ts b/packages/js/plugins/ethereum/src/wrap-man/types.ts deleted file mode 100644 index 28682eaf17..0000000000 --- a/packages/js/plugins/ethereum/src/wrap-man/types.ts +++ /dev/null @@ -1,140 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/naming-convention */ - -import * as Types from "./"; - -export type UInt = number; -export type UInt8 = number; -export type UInt16 = number; -export type UInt32 = number; -export type Int = number; -export type Int8 = number; -export type Int16 = number; -export type Int32 = number; -export type Bytes = ArrayBuffer; -export type BigInt = string; -export type BigNumber = string; -export type Json = string; -export type String = string; -export type Boolean = boolean; - -/// Envs START /// -export interface Env extends Record { - connection?: Types.Connection | null; -} -/// Envs END /// - -/// Objects START /// -export interface TxReceipt { - to: Types.String; - from: Types.String; - contractAddress: Types.String; - transactionIndex: Types.UInt32; - root?: Types.String | null; - gasUsed: Types.BigInt; - logsBloom: Types.String; - transactionHash: Types.String; - logs: Array; - blockNumber: Types.BigInt; - blockHash: Types.String; - confirmations: Types.UInt32; - cumulativeGasUsed: Types.BigInt; - effectiveGasPrice: Types.BigInt; - byzantium: Types.Boolean; - type: Types.UInt32; - status?: Types.UInt32 | null; -} - -export interface Log { - blockNumber: Types.BigInt; - blockHash: Types.String; - transactionIndex: Types.UInt32; - removed: Types.Boolean; - address: Types.String; - data: Types.String; - topics: Array; - transactionHash: Types.String; - logIndex: Types.UInt32; -} - -export interface TxResponse { - hash: Types.String; - to?: Types.String | null; - from: Types.String; - nonce: Types.UInt32; - gasLimit: Types.BigInt; - gasPrice?: Types.BigInt | null; - data: Types.String; - value: Types.BigInt; - chainId: Types.BigInt; - blockNumber?: Types.BigInt | null; - blockHash?: Types.String | null; - timestamp?: Types.UInt32 | null; - confirmations: Types.UInt32; - raw?: Types.String | null; - r?: Types.String | null; - s?: Types.String | null; - v?: Types.UInt32 | null; - type?: Types.UInt32 | null; - accessList?: Array | null; -} - -export interface Access { - address: Types.String; - storageKeys: Array; -} - -export interface TxRequest { - to?: Types.String | null; - from?: Types.String | null; - nonce?: Types.UInt32 | null; - gasLimit?: Types.BigInt | null; - gasPrice?: Types.BigInt | null; - data?: Types.String | null; - value?: Types.BigInt | null; - chainId?: Types.BigInt | null; - type?: Types.UInt32 | null; -} - -export interface TxOverrides { - gasLimit?: Types.BigInt | null; - gasPrice?: Types.BigInt | null; - value?: Types.BigInt | null; -} - -export interface StaticTxResult { - result: Types.String; - error: Types.Boolean; -} - -export interface EventNotification { - data: Types.String; - address: Types.String; - log: Types.Log; -} - -export interface Connection { - node?: Types.String | null; - networkNameOrChainId?: Types.String | null; -} - -export interface Network { - name: Types.String; - chainId: Types.BigInt; - ensAddress?: Types.String | null; -} - -/// Objects END /// - -/// Enums START /// -/// Enums END /// - -/// Imported Objects START /// - -/// Imported Objects END /// - -/// Imported Modules START /// - -/// Imported Modules END /// diff --git a/packages/js/plugins/filesystem/package.json b/packages/js/plugins/filesystem/package.json index f8da949167..85b7e33e49 100644 --- a/packages/js/plugins/filesystem/package.json +++ b/packages/js/plugins/filesystem/package.json @@ -12,9 +12,8 @@ "build" ], "scripts": { - "build": "rimraf ./build && tsc --project tsconfig.build.json", + "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", "codegen": "node ../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", - "codegen:patch": "node ../../../cli/bin/polywrap plugin codegen && rimraf ./src/wrap", "lint": "eslint --color -c ../../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", diff --git a/packages/js/plugins/filesystem/src/index.ts b/packages/js/plugins/filesystem/src/index.ts index 694b1e35b1..e782c135fb 100644 --- a/packages/js/plugins/filesystem/src/index.ts +++ b/packages/js/plugins/filesystem/src/index.ts @@ -6,7 +6,7 @@ import { UriResolver_MaybeUriOrManifest, Bytes, manifest, -} from "./wrap-man"; +} from "./wrap"; import path from "path"; import fs from "fs"; diff --git a/packages/js/plugins/filesystem/src/wrap-man/index.ts b/packages/js/plugins/filesystem/src/wrap-man/index.ts deleted file mode 100644 index f367d143d9..0000000000 --- a/packages/js/plugins/filesystem/src/wrap-man/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export * from "./schema"; -export * from "./manifest"; -export * from "./module"; -export * from "./types"; - -export { Client } from "@polywrap/core-js"; diff --git a/packages/js/plugins/filesystem/src/wrap-man/manifest.ts b/packages/js/plugins/filesystem/src/wrap-man/manifest.ts deleted file mode 100644 index bdf0be5286..0000000000 --- a/packages/js/plugins/filesystem/src/wrap-man/manifest.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { schema } from "./"; - -import { PluginPackageManifest } from "@polywrap/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [], -}; diff --git a/packages/js/plugins/filesystem/src/wrap-man/module.ts b/packages/js/plugins/filesystem/src/wrap-man/module.ts deleted file mode 100644 index fb6ec175b7..0000000000 --- a/packages/js/plugins/filesystem/src/wrap-man/module.ts +++ /dev/null @@ -1,31 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/naming-convention */ - -import * as Types from "./types"; - -import { Client, PluginModule, MaybeAsync } from "@polywrap/core-js"; - -export interface Input_tryResolveUri extends Record { - authority: Types.String; - path: Types.String; -} - -export interface Input_getFile extends Record { - path: Types.String; -} - -export abstract class Module< - TConfig extends Record -> extends PluginModule { - abstract tryResolveUri( - input: Input_tryResolveUri, - client: Client - ): MaybeAsync; - - abstract getFile( - input: Input_getFile, - client: Client - ): MaybeAsync; -} diff --git a/packages/js/plugins/filesystem/src/wrap-man/schema.ts b/packages/js/plugins/filesystem/src/wrap-man/schema.ts deleted file mode 100644 index 4c6de4fab4..0000000000 --- a/packages/js/plugins/filesystem/src/wrap-man/schema.ts +++ /dev/null @@ -1,88 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema = `### 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 - -### Polywrap Header END ### - -type Module implements UriResolver_Module @imports( - types: [ - "UriResolver_Module", - "UriResolver_MaybeUriOrManifest" - ] -) { - tryResolveUri( - authority: String! - path: String! - ): UriResolver_MaybeUriOrManifest - - getFile( - path: String! - ): Bytes -} - -### Imported Modules START ### - -type UriResolver_Module @imported( - uri: "ens/uri-resolver.core.polywrap.eth", - namespace: "UriResolver", - nativeType: "Module" -) { - tryResolveUri( - authority: String! - path: String! - ): UriResolver_MaybeUriOrManifest - - getFile( - path: String! - ): Bytes -} - -### Imported Modules END ### - -### Imported Objects START ### - -type UriResolver_MaybeUriOrManifest @imported( - uri: "ens/uri-resolver.core.polywrap.eth", - namespace: "UriResolver", - nativeType: "MaybeUriOrManifest" -) { - uri: String - manifest: String -} - -### Imported Objects END ### -`; diff --git a/packages/js/plugins/filesystem/src/wrap-man/types.ts b/packages/js/plugins/filesystem/src/wrap-man/types.ts deleted file mode 100644 index e7db9ea1b7..0000000000 --- a/packages/js/plugins/filesystem/src/wrap-man/types.ts +++ /dev/null @@ -1,83 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/naming-convention */ - -import * as Types from "./"; - -import { Client, InvokeResult } from "@polywrap/core-js"; - -export type UInt = number; -export type UInt8 = number; -export type UInt16 = number; -export type UInt32 = number; -export type Int = number; -export type Int8 = number; -export type Int16 = number; -export type Int32 = number; -export type Bytes = ArrayBuffer; -export type BigInt = string; -export type BigNumber = string; -export type Json = string; -export type String = string; -export type Boolean = boolean; - -/// Envs START /// -/// Envs END /// - -/// Objects START /// -/// Objects END /// - -/// Enums START /// -/// Enums END /// - -/// Imported Objects START /// - -/* URI: "ens/uri-resolver.core.polywrap.eth" */ -export interface UriResolver_MaybeUriOrManifest { - uri?: Types.String | null; - manifest?: Types.String | null; -} - -/// Imported Objects END /// - -/// Imported Modules START /// - -/* URI: "ens/uri-resolver.core.polywrap.eth" */ -interface UriResolver_Module_Input_tryResolveUri - extends Record { - authority: Types.String; - path: Types.String; -} - -/* URI: "ens/uri-resolver.core.polywrap.eth" */ -interface UriResolver_Module_Input_getFile extends Record { - path: Types.String; -} - -/* URI: "ens/uri-resolver.core.polywrap.eth" */ -export const UriResolver_Module = { - tryResolveUri: async ( - input: UriResolver_Module_Input_tryResolveUri, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/uri-resolver.core.polywrap.eth", - method: "tryResolveUri", - input, - }); - }, - - getFile: async ( - input: UriResolver_Module_Input_getFile, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/uri-resolver.core.polywrap.eth", - method: "getFile", - input, - }); - }, -}; - -/// Imported Modules END /// diff --git a/packages/js/plugins/graph-node/package.json b/packages/js/plugins/graph-node/package.json index 7dd577cb65..fdd14d7232 100644 --- a/packages/js/plugins/graph-node/package.json +++ b/packages/js/plugins/graph-node/package.json @@ -12,9 +12,8 @@ "build" ], "scripts": { - "build": "rimraf ./build && tsc --project tsconfig.build.json", + "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", "codegen": "node ../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", - "codegen:patch": "node ../../../cli/bin/polywrap plugin codegen && rimraf ./src/wrap", "lint": "eslint --color -c ../../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", diff --git a/packages/js/plugins/graph-node/src/index.ts b/packages/js/plugins/graph-node/src/index.ts index 842bc0ca3e..7d4d4bd080 100644 --- a/packages/js/plugins/graph-node/src/index.ts +++ b/packages/js/plugins/graph-node/src/index.ts @@ -4,7 +4,7 @@ import { Input_querySubgraph, HTTP_Module, manifest, -} from "./wrap-man"; +} from "./wrap"; import { PluginFactory } from "@polywrap/core-js"; diff --git a/packages/js/plugins/graph-node/src/wrap-man/index.ts b/packages/js/plugins/graph-node/src/wrap-man/index.ts deleted file mode 100644 index f367d143d9..0000000000 --- a/packages/js/plugins/graph-node/src/wrap-man/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export * from "./schema"; -export * from "./manifest"; -export * from "./module"; -export * from "./types"; - -export { Client } from "@polywrap/core-js"; diff --git a/packages/js/plugins/graph-node/src/wrap-man/manifest.ts b/packages/js/plugins/graph-node/src/wrap-man/manifest.ts deleted file mode 100644 index bdf0be5286..0000000000 --- a/packages/js/plugins/graph-node/src/wrap-man/manifest.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { schema } from "./"; - -import { PluginPackageManifest } from "@polywrap/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [], -}; diff --git a/packages/js/plugins/graph-node/src/wrap-man/module.ts b/packages/js/plugins/graph-node/src/wrap-man/module.ts deleted file mode 100644 index f966dbe16e..0000000000 --- a/packages/js/plugins/graph-node/src/wrap-man/module.ts +++ /dev/null @@ -1,23 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/naming-convention */ - -import * as Types from "./types"; - -import { Client, PluginModule, MaybeAsync } from "@polywrap/core-js"; - -export interface Input_querySubgraph extends Record { - subgraphAuthor: Types.String; - subgraphName: Types.String; - query: Types.String; -} - -export abstract class Module< - TConfig extends Record -> extends PluginModule { - abstract querySubgraph( - input: Input_querySubgraph, - client: Client - ): MaybeAsync; -} diff --git a/packages/js/plugins/graph-node/src/wrap-man/schema.ts b/packages/js/plugins/graph-node/src/wrap-man/schema.ts deleted file mode 100644 index 55b8a00c6a..0000000000 --- a/packages/js/plugins/graph-node/src/wrap-man/schema.ts +++ /dev/null @@ -1,130 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema = `### 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 - -### Polywrap Header END ### - -type Module @imports( - types: [ - "HTTP_Module", - "HTTP_Request", - "HTTP_Header", - "HTTP_UrlParam", - "HTTP_ResponseType", - "HTTP_Response" - ] -) { - querySubgraph( - subgraphAuthor: String! - subgraphName: String! - query: String! - ): String! -} - -### Imported Modules START ### - -type HTTP_Module @imported( - uri: "ens/http.polywrap.eth", - namespace: "HTTP", - nativeType: "Module" -) { - get( - url: String! - request: HTTP_Request - ): HTTP_Response - - post( - url: String! - request: HTTP_Request - ): HTTP_Response -} - -### Imported Modules END ### - -### Imported Objects START ### - -type HTTP_Request @imported( - uri: "ens/http.polywrap.eth", - namespace: "HTTP", - nativeType: "Request" -) { - headers: [HTTP_Header!] - urlParams: [HTTP_UrlParam!] - responseType: HTTP_ResponseType! - body: String -} - -type HTTP_Header @imported( - uri: "ens/http.polywrap.eth", - namespace: "HTTP", - nativeType: "Header" -) { - key: String! - value: String! -} - -type HTTP_UrlParam @imported( - uri: "ens/http.polywrap.eth", - namespace: "HTTP", - nativeType: "UrlParam" -) { - key: String! - value: String! -} - -type HTTP_Response @imported( - uri: "ens/http.polywrap.eth", - namespace: "HTTP", - nativeType: "Response" -) { - status: Int! - statusText: String! - headers: [HTTP_Header!] - body: String -} - -enum HTTP_ResponseType @imported( - uri: "ens/http.polywrap.eth", - namespace: "HTTP", - nativeType: "ResponseType" -) { - TEXT - BINARY -} - -### Imported Objects END ### -`; diff --git a/packages/js/plugins/graph-node/src/wrap-man/types.ts b/packages/js/plugins/graph-node/src/wrap-man/types.ts deleted file mode 100644 index 18b622b929..0000000000 --- a/packages/js/plugins/graph-node/src/wrap-man/types.ts +++ /dev/null @@ -1,115 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/naming-convention */ - -import * as Types from "./"; - -import { Client, InvokeResult } from "@polywrap/core-js"; - -export type UInt = number; -export type UInt8 = number; -export type UInt16 = number; -export type UInt32 = number; -export type Int = number; -export type Int8 = number; -export type Int16 = number; -export type Int32 = number; -export type Bytes = ArrayBuffer; -export type BigInt = string; -export type BigNumber = string; -export type Json = string; -export type String = string; -export type Boolean = boolean; - -/// Envs START /// -/// Envs END /// - -/// Objects START /// -/// Objects END /// - -/// Enums START /// -/// Enums END /// - -/// Imported Objects START /// - -/* URI: "ens/http.polywrap.eth" */ -export interface HTTP_Request { - headers?: Array | null; - urlParams?: Array | null; - responseType: Types.HTTP_ResponseType; - body?: Types.String | null; -} - -/* URI: "ens/http.polywrap.eth" */ -export interface HTTP_Header { - key: Types.String; - value: Types.String; -} - -/* URI: "ens/http.polywrap.eth" */ -export interface HTTP_UrlParam { - key: Types.String; - value: Types.String; -} - -/* URI: "ens/http.polywrap.eth" */ -export interface HTTP_Response { - status: Types.Int; - statusText: Types.String; - headers?: Array | null; - body?: Types.String | null; -} - -/* URI: "ens/http.polywrap.eth" */ -export enum HTTP_ResponseTypeEnum { - TEXT, - BINARY, -} - -export type HTTP_ResponseTypeString = "TEXT" | "BINARY"; - -export type HTTP_ResponseType = HTTP_ResponseTypeEnum | HTTP_ResponseTypeString; - -/// Imported Objects END /// - -/// Imported Modules START /// - -/* URI: "ens/http.polywrap.eth" */ -interface HTTP_Module_Input_get extends Record { - url: Types.String; - request?: Types.HTTP_Request | null; -} - -/* URI: "ens/http.polywrap.eth" */ -interface HTTP_Module_Input_post extends Record { - url: Types.String; - request?: Types.HTTP_Request | null; -} - -/* URI: "ens/http.polywrap.eth" */ -export const HTTP_Module = { - get: async ( - input: HTTP_Module_Input_get, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/http.polywrap.eth", - method: "get", - input, - }); - }, - - post: async ( - input: HTTP_Module_Input_post, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/http.polywrap.eth", - method: "post", - input, - }); - }, -}; - -/// Imported Modules END /// diff --git a/packages/js/plugins/http/package.json b/packages/js/plugins/http/package.json index 9df30ec7d5..91cb250be2 100644 --- a/packages/js/plugins/http/package.json +++ b/packages/js/plugins/http/package.json @@ -12,9 +12,8 @@ "build" ], "scripts": { - "build": "rimraf ./build && tsc --project tsconfig.build.json", + "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", "codegen": "node ../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", - "codegen:patch": "node ../../../cli/bin/polywrap plugin codegen && rimraf ./src/wrap", "lint": "eslint --color -c ../../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", diff --git a/packages/js/plugins/http/src/__tests__/e2e/e2e.spec.ts b/packages/js/plugins/http/src/__tests__/e2e/e2e.spec.ts index 45ff5f6a45..13b0a0cdc6 100644 --- a/packages/js/plugins/http/src/__tests__/e2e/e2e.spec.ts +++ b/packages/js/plugins/http/src/__tests__/e2e/e2e.spec.ts @@ -1,5 +1,5 @@ import { httpPlugin } from "../.."; -import { Response } from "../../wrap-man"; +import { Response } from "../../wrap"; import { PolywrapClient } from "@polywrap/client-js" import nock from "nock"; diff --git a/packages/js/plugins/http/src/__tests__/e2e/integration.spec.ts b/packages/js/plugins/http/src/__tests__/e2e/integration.spec.ts index ef2329c01b..a611f67a21 100644 --- a/packages/js/plugins/http/src/__tests__/e2e/integration.spec.ts +++ b/packages/js/plugins/http/src/__tests__/e2e/integration.spec.ts @@ -1,5 +1,5 @@ import { httpPlugin } from "../.."; -import { Response } from "../../wrap-man"; +import { Response } from "../../wrap"; import { PolywrapClient } from "@polywrap/client-js" import { diff --git a/packages/js/plugins/http/src/__tests__/unit/index.test.ts b/packages/js/plugins/http/src/__tests__/unit/index.test.ts index 92408db302..1bdbcbe243 100644 --- a/packages/js/plugins/http/src/__tests__/unit/index.test.ts +++ b/packages/js/plugins/http/src/__tests__/unit/index.test.ts @@ -1,5 +1,5 @@ import { HttpPlugin } from "../.."; -import { ResponseTypeEnum, Client } from "../../wrap-man"; +import { ResponseTypeEnum, Client } from "../../wrap"; import axios, { AxiosResponse, AxiosRequestConfig } from "axios"; diff --git a/packages/js/plugins/http/src/__tests__/unit/util.test.ts b/packages/js/plugins/http/src/__tests__/unit/util.test.ts index 010aaa3440..5e32775cb8 100644 --- a/packages/js/plugins/http/src/__tests__/unit/util.test.ts +++ b/packages/js/plugins/http/src/__tests__/unit/util.test.ts @@ -1,5 +1,5 @@ import { fromAxiosResponse, toAxiosRequestConfig } from "../../util"; -import { ResponseTypeEnum } from "../../wrap-man"; +import { ResponseTypeEnum } from "../../wrap"; describe("converting axios response", () => { test("response type: text", () => { diff --git a/packages/js/plugins/http/src/index.ts b/packages/js/plugins/http/src/index.ts index eab1c299a1..ff994b1aaa 100644 --- a/packages/js/plugins/http/src/index.ts +++ b/packages/js/plugins/http/src/index.ts @@ -5,7 +5,7 @@ import { Input_post, Response, manifest, -} from "./wrap-man"; +} from "./wrap"; import { fromAxiosResponse, toAxiosRequestConfig } from "./util"; import axios from "axios"; diff --git a/packages/js/plugins/http/src/util.ts b/packages/js/plugins/http/src/util.ts index 883a5db048..94d5165fb2 100644 --- a/packages/js/plugins/http/src/util.ts +++ b/packages/js/plugins/http/src/util.ts @@ -1,4 +1,4 @@ -import { Request, Response, ResponseTypeEnum, Header } from "./wrap-man"; +import { Request, Response, ResponseTypeEnum, Header } from "./wrap"; import { AxiosResponse, AxiosRequestConfig } from "axios"; diff --git a/packages/js/plugins/http/src/wrap-man/index.ts b/packages/js/plugins/http/src/wrap-man/index.ts deleted file mode 100644 index f367d143d9..0000000000 --- a/packages/js/plugins/http/src/wrap-man/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export * from "./schema"; -export * from "./manifest"; -export * from "./module"; -export * from "./types"; - -export { Client } from "@polywrap/core-js"; diff --git a/packages/js/plugins/http/src/wrap-man/manifest.ts b/packages/js/plugins/http/src/wrap-man/manifest.ts deleted file mode 100644 index bdf0be5286..0000000000 --- a/packages/js/plugins/http/src/wrap-man/manifest.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { schema } from "./"; - -import { PluginPackageManifest } from "@polywrap/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [], -}; diff --git a/packages/js/plugins/http/src/wrap-man/module.ts b/packages/js/plugins/http/src/wrap-man/module.ts deleted file mode 100644 index c702c01eb5..0000000000 --- a/packages/js/plugins/http/src/wrap-man/module.ts +++ /dev/null @@ -1,32 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/naming-convention */ - -import * as Types from "./types"; - -import { Client, PluginModule, MaybeAsync } from "@polywrap/core-js"; - -export interface Input_get extends Record { - url: Types.String; - request?: Types.Request | null; -} - -export interface Input_post extends Record { - url: Types.String; - request?: Types.Request | null; -} - -export abstract class Module< - TConfig extends Record -> extends PluginModule { - abstract get( - input: Input_get, - client: Client - ): MaybeAsync; - - abstract post( - input: Input_post, - client: Client - ): MaybeAsync; -} diff --git a/packages/js/plugins/http/src/wrap-man/schema.ts b/packages/js/plugins/http/src/wrap-man/schema.ts deleted file mode 100644 index e19ac44483..0000000000 --- a/packages/js/plugins/http/src/wrap-man/schema.ts +++ /dev/null @@ -1,89 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema = `### 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 - -### Polywrap Header END ### - -type Module { - get( - url: String! - request: Request - ): Response - - post( - url: String! - request: Request - ): Response -} - -type Header { - key: String! - value: String! -} - -type UrlParam { - key: String! - value: String! -} - -type Response { - status: Int! - statusText: String! - headers: [Header!] - body: String -} - -type Request { - headers: [Header!] - urlParams: [UrlParam!] - responseType: ResponseType! - body: String -} - -enum ResponseType { - TEXT - BINARY -} - -### Imported Modules START ### - -### Imported Modules END ### - -### Imported Objects START ### - -### Imported Objects END ### -`; diff --git a/packages/js/plugins/http/src/wrap-man/types.ts b/packages/js/plugins/http/src/wrap-man/types.ts deleted file mode 100644 index 4e8098ca01..0000000000 --- a/packages/js/plugins/http/src/wrap-man/types.ts +++ /dev/null @@ -1,71 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/naming-convention */ - -import * as Types from "./"; - -export type UInt = number; -export type UInt8 = number; -export type UInt16 = number; -export type UInt32 = number; -export type Int = number; -export type Int8 = number; -export type Int16 = number; -export type Int32 = number; -export type Bytes = ArrayBuffer; -export type BigInt = string; -export type BigNumber = string; -export type Json = string; -export type String = string; -export type Boolean = boolean; - -/// Envs START /// -/// Envs END /// - -/// Objects START /// -export interface Header { - key: Types.String; - value: Types.String; -} - -export interface UrlParam { - key: Types.String; - value: Types.String; -} - -export interface Response { - status: Types.Int; - statusText: Types.String; - headers?: Array | null; - body?: Types.String | null; -} - -export interface Request { - headers?: Array | null; - urlParams?: Array | null; - responseType: Types.ResponseType; - body?: Types.String | null; -} - -/// Objects END /// - -/// Enums START /// -export enum ResponseTypeEnum { - TEXT, - BINARY, -} - -export type ResponseTypeString = "TEXT" | "BINARY"; - -export type ResponseType = ResponseTypeEnum | ResponseTypeString; - -/// Enums END /// - -/// Imported Objects START /// - -/// Imported Objects END /// - -/// Imported Modules START /// - -/// Imported Modules END /// diff --git a/packages/js/plugins/ipfs/package.json b/packages/js/plugins/ipfs/package.json index dda6501f0c..a29f6c8665 100644 --- a/packages/js/plugins/ipfs/package.json +++ b/packages/js/plugins/ipfs/package.json @@ -12,9 +12,8 @@ "build" ], "scripts": { - "build": "rimraf ./build && tsc --project tsconfig.build.json", + "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", "codegen": "node ../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", - "codegen:patch": "node ../../../cli/bin/polywrap plugin codegen && rimraf ./src/wrap", "lint": "eslint --color -c ../../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", diff --git a/packages/js/plugins/ipfs/src/index.ts b/packages/js/plugins/ipfs/src/index.ts index bdbdd506e5..a006c47be7 100644 --- a/packages/js/plugins/ipfs/src/index.ts +++ b/packages/js/plugins/ipfs/src/index.ts @@ -11,7 +11,7 @@ import { Env, UriResolver_MaybeUriOrManifest, manifest, -} from "./wrap-man"; +} from "./wrap"; import { IpfsClient } from "./utils/IpfsClient"; import { execSimple, execFallbacks } from "./utils/exec"; diff --git a/packages/js/plugins/ipfs/src/wrap-man/index.ts b/packages/js/plugins/ipfs/src/wrap-man/index.ts deleted file mode 100644 index f367d143d9..0000000000 --- a/packages/js/plugins/ipfs/src/wrap-man/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export * from "./schema"; -export * from "./manifest"; -export * from "./module"; -export * from "./types"; - -export { Client } from "@polywrap/core-js"; diff --git a/packages/js/plugins/ipfs/src/wrap-man/manifest.ts b/packages/js/plugins/ipfs/src/wrap-man/manifest.ts deleted file mode 100644 index f7b9e13f5e..0000000000 --- a/packages/js/plugins/ipfs/src/wrap-man/manifest.ts +++ /dev/null @@ -1,11 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -import { schema } from "./"; - -import { PluginPackageManifest } from "@polywrap/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [], -}; diff --git a/packages/js/plugins/ipfs/src/wrap-man/module.ts b/packages/js/plugins/ipfs/src/wrap-man/module.ts deleted file mode 100644 index ee6664ef40..0000000000 --- a/packages/js/plugins/ipfs/src/wrap-man/module.ts +++ /dev/null @@ -1,60 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/naming-convention */ - -import * as Types from "./types"; - -import { Client, PluginModule, MaybeAsync } from "@polywrap/core-js"; - -export interface Input_catFile extends Record { - cid: Types.String; - options?: Types.Options | null; -} - -export interface Input_resolve extends Record { - cid: Types.String; - options?: Types.Options | null; -} - -export interface Input_tryResolveUri extends Record { - authority: Types.String; - path: Types.String; -} - -export interface Input_getFile extends Record { - path: Types.String; -} - -export interface Input_addFile extends Record { - data: Types.Bytes; -} - -export abstract class Module< - TConfig extends Record -> extends PluginModule { - abstract catFile( - input: Input_catFile, - client: Client - ): MaybeAsync; - - abstract resolve( - input: Input_resolve, - client: Client - ): MaybeAsync; - - abstract tryResolveUri( - input: Input_tryResolveUri, - client: Client - ): MaybeAsync; - - abstract getFile( - input: Input_getFile, - client: Client - ): MaybeAsync; - - abstract addFile( - input: Input_addFile, - client: Client - ): MaybeAsync; -} diff --git a/packages/js/plugins/ipfs/src/wrap-man/schema.ts b/packages/js/plugins/ipfs/src/wrap-man/schema.ts deleted file mode 100644 index df53cfe010..0000000000 --- a/packages/js/plugins/ipfs/src/wrap-man/schema.ts +++ /dev/null @@ -1,130 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema = `### 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 - -### Polywrap Header END ### - -type Module implements UriResolver_Module @imports( - types: [ - "UriResolver_Module", - "UriResolver_MaybeUriOrManifest" - ] -) { - catFile( - cid: String! - options: Options - ): Bytes! - - resolve( - cid: String! - options: Options - ): ResolveResult - - tryResolveUri( - authority: String! - path: String! - ): UriResolver_MaybeUriOrManifest - - getFile( - path: String! - ): Bytes - - addFile( - data: Bytes! - ): String! -} - -type Env { - """ - Disable querying providers in parallel when resolving URIs - """ - disableParallelRequests: Boolean -} - -type ResolveResult { - cid: String! - provider: String! -} - -type Options { - """ - Timeout (in ms) for the operation. -Fallback providers are used if timeout is reached. - """ - timeout: UInt32 - """ - The IPFS provider to be used - """ - provider: String - """ - Disable querying providers in parallel when resolving URIs - """ - disableParallelRequests: Boolean -} - -### Imported Modules START ### - -type UriResolver_Module @imported( - uri: "ens/uri-resolver.core.polywrap.eth", - namespace: "UriResolver", - nativeType: "Module" -) { - tryResolveUri( - authority: String! - path: String! - ): UriResolver_MaybeUriOrManifest - - getFile( - path: String! - ): Bytes -} - -### Imported Modules END ### - -### Imported Objects START ### - -type UriResolver_MaybeUriOrManifest @imported( - uri: "ens/uri-resolver.core.polywrap.eth", - namespace: "UriResolver", - nativeType: "MaybeUriOrManifest" -) { - uri: String - manifest: String -} - -### Imported Objects END ### -`; diff --git a/packages/js/plugins/ipfs/src/wrap-man/types.ts b/packages/js/plugins/ipfs/src/wrap-man/types.ts deleted file mode 100644 index 5995af8e80..0000000000 --- a/packages/js/plugins/ipfs/src/wrap-man/types.ts +++ /dev/null @@ -1,97 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/naming-convention */ - -import * as Types from "./"; - -import { Client, InvokeResult } from "@polywrap/core-js"; - -export type UInt = number; -export type UInt8 = number; -export type UInt16 = number; -export type UInt32 = number; -export type Int = number; -export type Int8 = number; -export type Int16 = number; -export type Int32 = number; -export type Bytes = ArrayBuffer; -export type BigInt = string; -export type BigNumber = string; -export type Json = string; -export type String = string; -export type Boolean = boolean; - -/// Envs START /// -export interface Env extends Record { - disableParallelRequests?: Types.Boolean | null; -} -/// Envs END /// - -/// Objects START /// -export interface ResolveResult { - cid: Types.String; - provider: Types.String; -} - -export interface Options { - timeout?: Types.UInt32 | null; - provider?: Types.String | null; - disableParallelRequests?: Types.Boolean | null; -} - -/// Objects END /// - -/// Enums START /// -/// Enums END /// - -/// Imported Objects START /// - -/* URI: "ens/uri-resolver.core.polywrap.eth" */ -export interface UriResolver_MaybeUriOrManifest { - uri?: Types.String | null; - manifest?: Types.String | null; -} - -/// Imported Objects END /// - -/// Imported Modules START /// - -/* URI: "ens/uri-resolver.core.polywrap.eth" */ -interface UriResolver_Module_Input_tryResolveUri - extends Record { - authority: Types.String; - path: Types.String; -} - -/* URI: "ens/uri-resolver.core.polywrap.eth" */ -interface UriResolver_Module_Input_getFile extends Record { - path: Types.String; -} - -/* URI: "ens/uri-resolver.core.polywrap.eth" */ -export const UriResolver_Module = { - tryResolveUri: async ( - input: UriResolver_Module_Input_tryResolveUri, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/uri-resolver.core.polywrap.eth", - method: "tryResolveUri", - input, - }); - }, - - getFile: async ( - input: UriResolver_Module_Input_getFile, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/uri-resolver.core.polywrap.eth", - method: "getFile", - input, - }); - }, -}; - -/// Imported Modules END /// diff --git a/packages/js/plugins/logger/package.json b/packages/js/plugins/logger/package.json index e5a3edcc3a..60fb82fbce 100644 --- a/packages/js/plugins/logger/package.json +++ b/packages/js/plugins/logger/package.json @@ -12,9 +12,8 @@ "version": "0.0.1-prealpha.86", "main": "build/index.js", "scripts": { - "build": "rimraf ./build && tsc --project tsconfig.build.json", + "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", "codegen": "node ../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", - "codegen:patch": "node ../../../cli/bin/polywrap plugin codegen && rimraf ./src/wrap", "lint": "eslint --color -c ../../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", diff --git a/packages/js/plugins/logger/src/index.ts b/packages/js/plugins/logger/src/index.ts index 7deeeef6fc..1bbb999ef5 100644 --- a/packages/js/plugins/logger/src/index.ts +++ b/packages/js/plugins/logger/src/index.ts @@ -4,7 +4,7 @@ import { Logger_LogLevel, Logger_LogLevelEnum, manifest, -} from "./wrap-man"; +} from "./wrap"; import { PluginFactory } from "@polywrap/core-js"; diff --git a/packages/js/plugins/logger/src/wrap-man/index.ts b/packages/js/plugins/logger/src/wrap-man/index.ts deleted file mode 100644 index f367d143d9..0000000000 --- a/packages/js/plugins/logger/src/wrap-man/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export * from "./schema"; -export * from "./manifest"; -export * from "./module"; -export * from "./types"; - -export { Client } from "@polywrap/core-js"; diff --git a/packages/js/plugins/logger/src/wrap-man/manifest.ts b/packages/js/plugins/logger/src/wrap-man/manifest.ts deleted file mode 100644 index bdf0be5286..0000000000 --- a/packages/js/plugins/logger/src/wrap-man/manifest.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { schema } from "./"; - -import { PluginPackageManifest } from "@polywrap/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [], -}; diff --git a/packages/js/plugins/logger/src/wrap-man/module.ts b/packages/js/plugins/logger/src/wrap-man/module.ts deleted file mode 100644 index ded6effc40..0000000000 --- a/packages/js/plugins/logger/src/wrap-man/module.ts +++ /dev/null @@ -1,19 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/naming-convention */ - -import * as Types from "./types"; - -import { Client, PluginModule, MaybeAsync } from "@polywrap/core-js"; - -export interface Input_log extends Record { - level: Types.Logger_LogLevel; - message: Types.String; -} - -export abstract class Module< - TConfig extends Record -> extends PluginModule { - abstract log(input: Input_log, client: Client): MaybeAsync; -} diff --git a/packages/js/plugins/logger/src/wrap-man/schema.ts b/packages/js/plugins/logger/src/wrap-man/schema.ts deleted file mode 100644 index 4176115ba5..0000000000 --- a/packages/js/plugins/logger/src/wrap-man/schema.ts +++ /dev/null @@ -1,82 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema = `### 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 - -### Polywrap Header END ### - -type Module implements Logger_Module @imports( - types: [ - "Logger_Module", - "Logger_LogLevel" - ] -) { - log( - level: Logger_LogLevel! - message: String! - ): Boolean! -} - -### Imported Modules START ### - -type Logger_Module @imported( - uri: "ens/logger.core.polywrap.eth", - namespace: "Logger", - nativeType: "Module" -) { - log( - level: Logger_LogLevel! - message: String! - ): Boolean! -} - -### Imported Modules END ### - -### Imported Objects START ### - -enum Logger_LogLevel @imported( - uri: "ens/logger.core.polywrap.eth", - namespace: "Logger", - nativeType: "LogLevel" -) { - DEBUG - INFO - WARN - ERROR -} - -### Imported Objects END ### -`; diff --git a/packages/js/plugins/logger/src/wrap-man/types.ts b/packages/js/plugins/logger/src/wrap-man/types.ts deleted file mode 100644 index fa91f80b2c..0000000000 --- a/packages/js/plugins/logger/src/wrap-man/types.ts +++ /dev/null @@ -1,72 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/naming-convention */ - -import * as Types from "./"; - -import { Client, InvokeResult } from "@polywrap/core-js"; - -export type UInt = number; -export type UInt8 = number; -export type UInt16 = number; -export type UInt32 = number; -export type Int = number; -export type Int8 = number; -export type Int16 = number; -export type Int32 = number; -export type Bytes = ArrayBuffer; -export type BigInt = string; -export type BigNumber = string; -export type Json = string; -export type String = string; -export type Boolean = boolean; - -/// Envs START /// -/// Envs END /// - -/// Objects START /// -/// Objects END /// - -/// Enums START /// -/// Enums END /// - -/// Imported Objects START /// - -/* URI: "ens/logger.core.polywrap.eth" */ -export enum Logger_LogLevelEnum { - DEBUG, - INFO, - WARN, - ERROR, -} - -export type Logger_LogLevelString = "DEBUG" | "INFO" | "WARN" | "ERROR"; - -export type Logger_LogLevel = Logger_LogLevelEnum | Logger_LogLevelString; - -/// Imported Objects END /// - -/// Imported Modules START /// - -/* URI: "ens/logger.core.polywrap.eth" */ -interface Logger_Module_Input_log extends Record { - level: Types.Logger_LogLevel; - message: Types.String; -} - -/* URI: "ens/logger.core.polywrap.eth" */ -export const Logger_Module = { - log: async ( - input: Logger_Module_Input_log, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/logger.core.polywrap.eth", - method: "log", - input, - }); - }, -}; - -/// Imported Modules END /// diff --git a/packages/js/plugins/sha3/package.json b/packages/js/plugins/sha3/package.json index a2a7799f7d..24a8cb3016 100644 --- a/packages/js/plugins/sha3/package.json +++ b/packages/js/plugins/sha3/package.json @@ -12,9 +12,8 @@ "build" ], "scripts": { - "build": "rimraf ./build && tsc --project tsconfig.build.json", + "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", "codegen": "node ../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", - "codegen:patch": "node ../../../cli/bin/polywrap plugin codegen && rimraf ./src/wrap", "lint": "eslint --color -c ../../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", diff --git a/packages/js/plugins/sha3/src/index.ts b/packages/js/plugins/sha3/src/index.ts index 7e7aac31c5..8ca7f21f04 100644 --- a/packages/js/plugins/sha3/src/index.ts +++ b/packages/js/plugins/sha3/src/index.ts @@ -17,7 +17,7 @@ import { Input_shake_128, Input_shake_256, manifest, -} from "./wrap-man"; +} from "./wrap"; import { sha3_512, diff --git a/packages/js/plugins/sha3/src/wrap-man/index.ts b/packages/js/plugins/sha3/src/wrap-man/index.ts deleted file mode 100644 index f367d143d9..0000000000 --- a/packages/js/plugins/sha3/src/wrap-man/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export * from "./schema"; -export * from "./manifest"; -export * from "./module"; -export * from "./types"; - -export { Client } from "@polywrap/core-js"; diff --git a/packages/js/plugins/sha3/src/wrap-man/manifest.ts b/packages/js/plugins/sha3/src/wrap-man/manifest.ts deleted file mode 100644 index bdf0be5286..0000000000 --- a/packages/js/plugins/sha3/src/wrap-man/manifest.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { schema } from "./"; - -import { PluginPackageManifest } from "@polywrap/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [], -}; diff --git a/packages/js/plugins/sha3/src/wrap-man/module.ts b/packages/js/plugins/sha3/src/wrap-man/module.ts deleted file mode 100644 index 0b7ded2bd9..0000000000 --- a/packages/js/plugins/sha3/src/wrap-man/module.ts +++ /dev/null @@ -1,122 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/naming-convention */ - -import * as Types from "./types"; - -import { Client, PluginModule, MaybeAsync } from "@polywrap/core-js"; - -export interface Input_sha3_512 extends Record { - message: Types.String; -} - -export interface Input_sha3_384 extends Record { - message: Types.String; -} - -export interface Input_sha3_256 extends Record { - message: Types.String; -} - -export interface Input_sha3_224 extends Record { - message: Types.String; -} - -export interface Input_keccak_512 extends Record { - message: Types.String; -} - -export interface Input_keccak_384 extends Record { - message: Types.String; -} - -export interface Input_keccak_256 extends Record { - message: Types.String; -} - -export interface Input_keccak_224 extends Record { - message: Types.String; -} - -export interface Input_hex_keccak_256 extends Record { - message: Types.String; -} - -export interface Input_buffer_keccak_256 extends Record { - message: Types.Bytes; -} - -export interface Input_shake_128 extends Record { - message: Types.String; - outputBits: Types.Int; -} - -export interface Input_shake_256 extends Record { - message: Types.String; - outputBits: Types.Int; -} - -export abstract class Module< - TConfig extends Record -> extends PluginModule { - abstract sha3_512( - input: Input_sha3_512, - client: Client - ): MaybeAsync; - - abstract sha3_384( - input: Input_sha3_384, - client: Client - ): MaybeAsync; - - abstract sha3_256( - input: Input_sha3_256, - client: Client - ): MaybeAsync; - - abstract sha3_224( - input: Input_sha3_224, - client: Client - ): MaybeAsync; - - abstract keccak_512( - input: Input_keccak_512, - client: Client - ): MaybeAsync; - - abstract keccak_384( - input: Input_keccak_384, - client: Client - ): MaybeAsync; - - abstract keccak_256( - input: Input_keccak_256, - client: Client - ): MaybeAsync; - - abstract keccak_224( - input: Input_keccak_224, - client: Client - ): MaybeAsync; - - abstract hex_keccak_256( - input: Input_hex_keccak_256, - client: Client - ): MaybeAsync; - - abstract buffer_keccak_256( - input: Input_buffer_keccak_256, - client: Client - ): MaybeAsync; - - abstract shake_128( - input: Input_shake_128, - client: Client - ): MaybeAsync; - - abstract shake_256( - input: Input_shake_256, - client: Client - ): MaybeAsync; -} diff --git a/packages/js/plugins/sha3/src/wrap-man/schema.ts b/packages/js/plugins/sha3/src/wrap-man/schema.ts deleted file mode 100644 index 7bed343046..0000000000 --- a/packages/js/plugins/sha3/src/wrap-man/schema.ts +++ /dev/null @@ -1,100 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema = `### 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 - -### Polywrap Header END ### - -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! -} - -### Imported Modules START ### - -### Imported Modules END ### - -### Imported Objects START ### - -### Imported Objects END ### -`; diff --git a/packages/js/plugins/sha3/src/wrap-man/types.ts b/packages/js/plugins/sha3/src/wrap-man/types.ts deleted file mode 100644 index 4888424e2e..0000000000 --- a/packages/js/plugins/sha3/src/wrap-man/types.ts +++ /dev/null @@ -1,34 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export type UInt = number; -export type UInt8 = number; -export type UInt16 = number; -export type UInt32 = number; -export type Int = number; -export type Int8 = number; -export type Int16 = number; -export type Int32 = number; -export type Bytes = ArrayBuffer; -export type BigInt = string; -export type BigNumber = string; -export type Json = string; -export type String = string; -export type Boolean = boolean; - -/// Envs START /// -/// Envs END /// - -/// Objects START /// -/// Objects END /// - -/// Enums START /// -/// Enums END /// - -/// Imported Objects START /// - -/// Imported Objects END /// - -/// Imported Modules START /// - -/// Imported Modules END /// diff --git a/packages/js/plugins/uts46/package.json b/packages/js/plugins/uts46/package.json index cc75a3ae33..aa8f0768ba 100644 --- a/packages/js/plugins/uts46/package.json +++ b/packages/js/plugins/uts46/package.json @@ -12,9 +12,8 @@ "build" ], "scripts": { - "build": "rimraf ./build && tsc --project tsconfig.build.json", + "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", "codegen": "node ../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", - "codegen:patch": "node ../../../cli/bin/polywrap plugin codegen && rimraf ./src/wrap", "lint": "eslint --color -c ../../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", diff --git a/packages/js/plugins/uts46/src/index.ts b/packages/js/plugins/uts46/src/index.ts index 7c096b4aa7..5bcbd1ad34 100644 --- a/packages/js/plugins/uts46/src/index.ts +++ b/packages/js/plugins/uts46/src/index.ts @@ -6,7 +6,7 @@ import { Input_convert, ConvertResult, manifest, -} from "./wrap-man"; +} from "./wrap"; import { PluginFactory } from "@polywrap/core-js"; diff --git a/packages/js/plugins/uts46/src/wrap-man/index.ts b/packages/js/plugins/uts46/src/wrap-man/index.ts deleted file mode 100644 index f367d143d9..0000000000 --- a/packages/js/plugins/uts46/src/wrap-man/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export * from "./schema"; -export * from "./manifest"; -export * from "./module"; -export * from "./types"; - -export { Client } from "@polywrap/core-js"; diff --git a/packages/js/plugins/uts46/src/wrap-man/manifest.ts b/packages/js/plugins/uts46/src/wrap-man/manifest.ts deleted file mode 100644 index bdf0be5286..0000000000 --- a/packages/js/plugins/uts46/src/wrap-man/manifest.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { schema } from "./"; - -import { PluginPackageManifest } from "@polywrap/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [], -}; diff --git a/packages/js/plugins/uts46/src/wrap-man/module.ts b/packages/js/plugins/uts46/src/wrap-man/module.ts deleted file mode 100644 index 2b34f4b0e9..0000000000 --- a/packages/js/plugins/uts46/src/wrap-man/module.ts +++ /dev/null @@ -1,39 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/naming-convention */ - -import * as Types from "./types"; - -import { Client, PluginModule, MaybeAsync } from "@polywrap/core-js"; - -export interface Input_toAscii extends Record { - value: Types.String; -} - -export interface Input_toUnicode extends Record { - value: Types.String; -} - -export interface Input_convert extends Record { - value: Types.String; -} - -export abstract class Module< - TConfig extends Record -> extends PluginModule { - abstract toAscii( - input: Input_toAscii, - client: Client - ): MaybeAsync; - - abstract toUnicode( - input: Input_toUnicode, - client: Client - ): MaybeAsync; - - abstract convert( - input: Input_convert, - client: Client - ): MaybeAsync; -} diff --git a/packages/js/plugins/uts46/src/wrap-man/schema.ts b/packages/js/plugins/uts46/src/wrap-man/schema.ts deleted file mode 100644 index 268e68e8a3..0000000000 --- a/packages/js/plugins/uts46/src/wrap-man/schema.ts +++ /dev/null @@ -1,67 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema = `### 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 - -### Polywrap Header END ### - -type Module { - toAscii( - value: String! - ): String! - - toUnicode( - value: String! - ): String! - - convert( - value: String! - ): ConvertResult! -} - -type ConvertResult { - IDN: String! - PC: String! -} - -### Imported Modules START ### - -### Imported Modules END ### - -### Imported Objects START ### - -### Imported Objects END ### -`; diff --git a/packages/js/plugins/uts46/src/wrap-man/types.ts b/packages/js/plugins/uts46/src/wrap-man/types.ts deleted file mode 100644 index d27c658cf2..0000000000 --- a/packages/js/plugins/uts46/src/wrap-man/types.ts +++ /dev/null @@ -1,43 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/naming-convention */ - -import * as Types from "./"; - -export type UInt = number; -export type UInt8 = number; -export type UInt16 = number; -export type UInt32 = number; -export type Int = number; -export type Int8 = number; -export type Int16 = number; -export type Int32 = number; -export type Bytes = ArrayBuffer; -export type BigInt = string; -export type BigNumber = string; -export type Json = string; -export type String = string; -export type Boolean = boolean; - -/// Envs START /// -/// Envs END /// - -/// Objects START /// -export interface ConvertResult { - IDN: Types.String; - PC: Types.String; -} - -/// Objects END /// - -/// Enums START /// -/// Enums END /// - -/// Imported Objects START /// - -/// Imported Objects END /// - -/// Imported Modules START /// - -/// Imported Modules END /// diff --git a/packages/js/test-env/src/index.ts b/packages/js/test-env/src/index.ts index c1bc32d15d..ab6874e950 100644 --- a/packages/js/test-env/src/index.ts +++ b/packages/js/test-env/src/index.ts @@ -23,7 +23,7 @@ export const providers = { }; const monorepoCli = `${__dirname}/../../../cli/bin/polywrap`; -const npmCli = `${__dirname}/../../cli/bin/polywrap`; +const npmCli = `${__dirname}/../../polywrap/bin/polywrap`; async function awaitResponse( url: string, diff --git a/packages/js/validation/README.md b/packages/js/validation/README.md new file mode 100644 index 0000000000..30404ce4c5 --- /dev/null +++ b/packages/js/validation/README.md @@ -0,0 +1 @@ +TODO \ No newline at end of file diff --git a/packages/js/validation/jest.config.js b/packages/js/validation/jest.config.js new file mode 100644 index 0000000000..b156259895 --- /dev/null +++ b/packages/js/validation/jest.config.js @@ -0,0 +1,12 @@ +module.exports = { + collectCoverage: true, + preset: 'ts-jest', + testEnvironment: 'node', + testMatch: ["**/?(*.)+(spec|test).[jt]s?(x)"], + modulePathIgnorePatterns: ['./src/__tests__/apis'], + globals: { + 'ts-jest': { + diagnostics: false + } + } +}; diff --git a/packages/js/validation/package.json b/packages/js/validation/package.json new file mode 100644 index 0000000000..f74702a52a --- /dev/null +++ b/packages/js/validation/package.json @@ -0,0 +1,28 @@ +{ + "name": "@polywrap/package-validation", + "version": "0.0.1-prealpha.86", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/polywrap/monorepo.git" + }, + "scripts": { + "build": "rimraf ./build && tsc --project tsconfig.build.json", + "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.0.1-prealpha.86", + "@polywrap/schema-parse": "0.0.1-prealpha.86" + }, + "devDependencies": { + "@types/jest": "26.0.8", + "jest": "26.6.3", + "rimraf": "3.0.2", + "ts-jest": "26.5.4", + "ts-node": "8.10.2", + "typescript": "4.0.7" + } +} diff --git a/packages/js/validation/src/__tests__/manifests.spec.ts b/packages/js/validation/src/__tests__/manifests.spec.ts new file mode 100644 index 0000000000..d0cfe9421a --- /dev/null +++ b/packages/js/validation/src/__tests__/manifests.spec.ts @@ -0,0 +1,71 @@ +import path from "path"; +import { + FileSystemPackageReader, + ValidationFailReason, + WasmPackageValidator, +} from ".."; + +jest.setTimeout(200000); + +const testWrappersPath = path.join(__dirname, "./wrappers"); + +describe("manfiests", () => { + let validator: WasmPackageValidator; + + beforeAll(async () => { + validator = new WasmPackageValidator({ + maxSize: 1_000_000, + maxFileSize: 1_000_000, + maxModuleSize: 1_000_000, + maxNumberOfFiles: 1000, + }); + }); + + it("fails validating an invalid wrap manifest", async () => { + const reader = new FileSystemPackageReader( + path.join(testWrappersPath, "invalid-wrap-manifest") + ); + + const result = await validator.validate(reader); + + expect(result.valid).toBeFalsy(); + expect(result.failReason).toEqual(ValidationFailReason.InvalidWrapManifest); + }); + + it("fails validating when wrap manifest not found", async () => { + const reader = new FileSystemPackageReader( + path.join(testWrappersPath, "missing-wrap-manifest") + ); + + const result = await validator.validate(reader); + + expect(result.valid).toBeFalsy(); + expect(result.failReason).toEqual( + ValidationFailReason.WrapManifestNotFound + ); + }); + + it("fails validating an invalid build manifest", async () => { + const reader = new FileSystemPackageReader( + path.join(testWrappersPath, "invalid-build-manifest") + ); + + const result = await validator.validate(reader); + + expect(result.valid).toBeFalsy(); + expect(result.failReason).toEqual( + ValidationFailReason.InvalidBuildManifest + ); + }); + + it("fails validating an invalid meta manifest", async () => { + const reader = new FileSystemPackageReader( + path.join(testWrappersPath, "invalid-meta-manifest") + ); + + const result = await validator.validate(reader); + + expect(result.valid).toBeFalsy(); + expect(result.failReason).toEqual(ValidationFailReason.InvalidMetaManifest); + }); +}); diff --git a/packages/js/validation/src/__tests__/number_of_files.spec.ts b/packages/js/validation/src/__tests__/number_of_files.spec.ts new file mode 100644 index 0000000000..e4d411a6b3 --- /dev/null +++ b/packages/js/validation/src/__tests__/number_of_files.spec.ts @@ -0,0 +1,50 @@ +import path from "path"; +import { + FileSystemPackageReader, + ValidationFailReason, + WasmPackageValidator, +} from ".."; + +jest.setTimeout(200000); + +const testWrappersPath = path.join(__dirname, "./wrappers"); + +const assertValidWrapper = async (wrapperPath: string) => { + const reader = new FileSystemPackageReader(wrapperPath); + + const validator = new WasmPackageValidator({ + maxSize: 1_000_000, + maxFileSize: 1_000_000, + maxModuleSize: 1_000_000, + maxNumberOfFiles: 1000, + }); + + const result = await validator.validate(reader); + + expect(result.valid).toBeTruthy(); + expect(result.failReason).toEqual(undefined); +}; + +describe("number of files", () => { + it("sanity", async () => { + await assertValidWrapper(path.join(testWrappersPath, "more-than-6-files")); + }); + + it("fails validating when too many files", async () => { + const reader = new FileSystemPackageReader( + path.join(testWrappersPath, "more-than-6-files") + ); + + const validator = new WasmPackageValidator({ + maxSize: 1_000_000, + maxFileSize: 1_000_000, + maxModuleSize: 1_000_000, + maxNumberOfFiles: 6, + }); + + const result = await validator.validate(reader); + + expect(result.valid).toBeFalsy(); + expect(result.failReason).toEqual(ValidationFailReason.TooManyFiles); + }); +}); diff --git a/packages/js/validation/src/__tests__/sanity.spec.ts b/packages/js/validation/src/__tests__/sanity.spec.ts new file mode 100644 index 0000000000..553d880fa6 --- /dev/null +++ b/packages/js/validation/src/__tests__/sanity.spec.ts @@ -0,0 +1,42 @@ +import path from "path"; +import { WasmPackageValidator, FileSystemPackageReader } from ".."; + +jest.setTimeout(200000); + +const testWrappersPath = path.join(__dirname, "./wrappers"); + +describe("sanity", () => { + it("can validate a valid wasm wrapper", async () => { + const pathToValidWrapper = path.join(testWrappersPath, "valid"); + const reader = new FileSystemPackageReader(pathToValidWrapper); + + const validator = new WasmPackageValidator({ + maxSize: 1_000_000, + maxFileSize: 1_000_000, + maxModuleSize: 1_000_000, + maxNumberOfFiles: 1000, + }); + + const result = await validator.validate(reader); + + expect(result.valid).toBeTruthy(); + expect(result.failReason).toEqual(undefined); + }); + + it("can validate a valid wrapper interface", async () => { + const pathToValidWrapper = path.join(testWrappersPath, "valid-interface"); + const reader = new FileSystemPackageReader(pathToValidWrapper); + + const validator = new WasmPackageValidator({ + maxSize: 1_000_000, + maxFileSize: 1_000_000, + maxModuleSize: 1_000_000, + maxNumberOfFiles: 1000, + }); + + const result = await validator.validate(reader); + + expect(result.valid).toBeTruthy(); + expect(result.failReason).toEqual(undefined); + }); +}); diff --git a/packages/js/validation/src/__tests__/schema.spec.ts b/packages/js/validation/src/__tests__/schema.spec.ts new file mode 100644 index 0000000000..70d9c76ddf --- /dev/null +++ b/packages/js/validation/src/__tests__/schema.spec.ts @@ -0,0 +1,45 @@ +import path from "path"; +import { + FileSystemPackageReader, + ValidationFailReason, + WasmPackageValidator, +} from ".."; + +jest.setTimeout(200000); + +const testWrappersPath = path.join(__dirname, "./wrappers"); + +describe("schema", () => { + let validator: WasmPackageValidator; + + beforeAll(async () => { + validator = new WasmPackageValidator({ + maxSize: 1_000_000, + maxFileSize: 1_000_000, + maxModuleSize: 1_000_000, + maxNumberOfFiles: 1000, + }); + }); + + it("fails validating wrapper with missing schema", async () => { + const reader = new FileSystemPackageReader( + path.join(testWrappersPath, "missing-schema") + ); + + const result = await validator.validate(reader); + + expect(result.valid).toBeFalsy(); + expect(result.failReason).toEqual(ValidationFailReason.SchemaNotFound); + }); + + it("fails validating invalid schema file", async () => { + const reader = new FileSystemPackageReader( + path.join(testWrappersPath, "invalid-schema") + ); + + const result = await validator.validate(reader); + + expect(result.valid).toBeFalsy(); + expect(result.failReason).toEqual(ValidationFailReason.InvalidSchema); + }); +}); diff --git a/packages/js/validation/src/__tests__/sizes.spec.ts b/packages/js/validation/src/__tests__/sizes.spec.ts new file mode 100644 index 0000000000..dd88197961 --- /dev/null +++ b/packages/js/validation/src/__tests__/sizes.spec.ts @@ -0,0 +1,94 @@ +import path from "path"; +import { + FileSystemPackageReader, + ValidationFailReason, + WasmPackageValidator, +} from ".."; + +jest.setTimeout(200000); + +const testWrappersPath = path.join(__dirname, "./wrappers"); + +const assertValidWrapper = async (wrapperPath: string) => { + const reader = new FileSystemPackageReader(wrapperPath); + + const validator = new WasmPackageValidator({ + maxSize: 1_000_000, + maxFileSize: 1_000_000, + maxModuleSize: 1_000_000, + maxNumberOfFiles: 1000, + }); + + const result = await validator.validate(reader); + + expect(result.valid).toBeTruthy(); + expect(result.failReason).toEqual(undefined); +}; + +describe("manfiests", () => { + it("sanity", async () => { + await assertValidWrapper( + path.join(testWrappersPath, "wrapper-size-over-100-kb") + ); + await assertValidWrapper( + path.join(testWrappersPath, "file-size-over-100-kb") + ); + await assertValidWrapper( + path.join(testWrappersPath, "module-size-over-100-kb") + ); + }); + + it("fails validating a large wrapper", async () => { + const reader = new FileSystemPackageReader( + path.join(testWrappersPath, "wrapper-size-over-100-kb") + ); + + const validator = new WasmPackageValidator({ + maxSize: 100_000, + maxFileSize: 1_000_000, + maxModuleSize: 1_000_000, + maxNumberOfFiles: 1000, + }); + + const result = await validator.validate(reader); + + expect(result.valid).toBeFalsy(); + expect(result.failReason).toEqual(ValidationFailReason.WrapperTooLarge); + }); + + it("fails validating a large file", async () => { + const reader = new FileSystemPackageReader( + path.join(testWrappersPath, "module-size-over-100-kb") + ); + + const validator = new WasmPackageValidator({ + maxSize: 1_000_000, + maxFileSize: 100_000, + maxModuleSize: 1_000_000, + maxNumberOfFiles: 1000, + }); + + const result = await validator.validate(reader); + + expect(result.valid).toBeFalsy(); + expect(result.failReason).toEqual(ValidationFailReason.FileTooLarge); + }); + + it("fails validating a large module", async () => { + const reader = new FileSystemPackageReader( + path.join(testWrappersPath, "module-size-over-100-kb") + ); + + const validator = new WasmPackageValidator({ + maxSize: 1_000_000, + maxFileSize: 1_000_000, + maxModuleSize: 100_000, + maxNumberOfFiles: 1000, + }); + + const result = await validator.validate(reader); + + expect(result.valid).toBeFalsy(); + expect(result.failReason).toEqual(ValidationFailReason.ModuleTooLarge); + }); +}); diff --git a/packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/module.wasm b/packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/module.wasm new file mode 100644 index 0000000000..6b497232cb Binary files /dev/null and b/packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/module.wasm differ diff --git a/packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/polywrap.build.json b/packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/polywrap.build.json new file mode 100644 index 0000000000..fb006acf11 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/polywrap.build.json @@ -0,0 +1,6 @@ +{ + "format": "0.0.1-prealpha.3", + "docker": { + "buildImageId": "sha256:c6f86547730a5044febd75872db0afdfc4cda3cfa0053b838932f03721c458ca\n" + } +} \ No newline at end of file diff --git a/packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/polywrap.json b/packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/polywrap.json new file mode 100644 index 0000000000..ab7f052a11 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/polywrap.json @@ -0,0 +1,9 @@ +{ + "format": "0.0.1-prealpha.9", + "name": "Valid Wrapper", + "language": "wasm/assemblyscript", + "build": "./polywrap.build.json", + "meta": "./polywrap.meta.json", + "schema": "./schema.graphql", + "module": "./module.wasm" +} diff --git a/packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/polywrap.meta.json b/packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/polywrap.meta.json new file mode 100644 index 0000000000..4ed15fa713 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/polywrap.meta.json @@ -0,0 +1,8 @@ +{ + "format": "0.0.1-prealpha.3", + "displayName": "Valid Wrapper", + "tags": ["some", "tag"], + "subtext": "test subtext", + "description": "test description", + "repository": "https://github.com/test/test" +} diff --git a/packages/js/plugins/ens/src/wrap-man/schema.ts b/packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/schema.graphql similarity index 65% rename from packages/js/plugins/ens/src/wrap-man/schema.ts rename to packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/schema.graphql index f4e12b184b..baf49860be 100644 --- a/packages/js/plugins/ens/src/wrap-man/schema.ts +++ b/packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/schema.graphql @@ -1,7 +1,4 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema = `### Polywrap Header START ### +### Polywrap Header START ### scalar UInt scalar UInt8 scalar UInt16 @@ -38,10 +35,8 @@ directive @annotate(type: String!) on FIELD ### Polywrap Header END ### -type Module implements UriResolver_Module @imports( +type Module @imports( types: [ - "UriResolver_Module", - "UriResolver_MaybeUriOrManifest", "Ethereum_Module", "Ethereum_Connection", "Ethereum_TxOverrides", @@ -50,38 +45,41 @@ type Module implements UriResolver_Module @imports( "Ethereum_TxReceipt", "Ethereum_Log", "Ethereum_EventNotification", - "Ethereum_Network" + "Ethereum_Network", + "Ethereum_TxResponse", + "Ethereum_Access" ] ) { - tryResolveUri( - authority: String! - path: String! - ): UriResolver_MaybeUriOrManifest - - getFile( - path: String! - ): Bytes -} + getData( + address: String! + connection: Ethereum_Connection + ): Int! -### Imported Modules START ### + tryGetData( + address: String! + connection: Ethereum_Connection + ): String! -type UriResolver_Module @imported( - uri: "ens/uri-resolver.core.polywrap.eth", - namespace: "UriResolver", - nativeType: "Module" -) { - tryResolveUri( - authority: String! - path: String! - ): UriResolver_MaybeUriOrManifest - - getFile( - path: String! - ): Bytes + throwGetData( + address: String! + connection: Ethereum_Connection + ): String! + + setData( + address: String! + value: Int! + connection: Ethereum_Connection + ): String! + + deployContract( + connection: Ethereum_Connection + ): String! } +### Imported Modules START ### + type Ethereum_Module @imported( - uri: "ens/ethereum.polywrap.eth", + uri: "wrap://ens/ethereum.polywrap.eth", namespace: "Ethereum", nativeType: "Module" ) { @@ -192,23 +190,58 @@ type Ethereum_Module @imported( 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 } ### Imported Modules END ### ### Imported Objects START ### -type UriResolver_MaybeUriOrManifest @imported( - uri: "ens/uri-resolver.core.polywrap.eth", - namespace: "UriResolver", - nativeType: "MaybeUriOrManifest" -) { - uri: String - manifest: String -} - type Ethereum_Connection @imported( - uri: "ens/ethereum.polywrap.eth", + uri: "wrap://ens/ethereum.polywrap.eth", namespace: "Ethereum", nativeType: "Connection" ) { @@ -217,7 +250,7 @@ type Ethereum_Connection @imported( } type Ethereum_TxOverrides @imported( - uri: "ens/ethereum.polywrap.eth", + uri: "wrap://ens/ethereum.polywrap.eth", namespace: "Ethereum", nativeType: "TxOverrides" ) { @@ -227,7 +260,7 @@ type Ethereum_TxOverrides @imported( } type Ethereum_StaticTxResult @imported( - uri: "ens/ethereum.polywrap.eth", + uri: "wrap://ens/ethereum.polywrap.eth", namespace: "Ethereum", nativeType: "StaticTxResult" ) { @@ -236,7 +269,7 @@ type Ethereum_StaticTxResult @imported( } type Ethereum_TxRequest @imported( - uri: "ens/ethereum.polywrap.eth", + uri: "wrap://ens/ethereum.polywrap.eth", namespace: "Ethereum", nativeType: "TxRequest" ) { @@ -252,7 +285,7 @@ type Ethereum_TxRequest @imported( } type Ethereum_TxReceipt @imported( - uri: "ens/ethereum.polywrap.eth", + uri: "wrap://ens/ethereum.polywrap.eth", namespace: "Ethereum", nativeType: "TxReceipt" ) { @@ -276,7 +309,7 @@ type Ethereum_TxReceipt @imported( } type Ethereum_Log @imported( - uri: "ens/ethereum.polywrap.eth", + uri: "wrap://ens/ethereum.polywrap.eth", namespace: "Ethereum", nativeType: "Log" ) { @@ -292,7 +325,7 @@ type Ethereum_Log @imported( } type Ethereum_EventNotification @imported( - uri: "ens/ethereum.polywrap.eth", + uri: "wrap://ens/ethereum.polywrap.eth", namespace: "Ethereum", nativeType: "EventNotification" ) { @@ -302,7 +335,7 @@ type Ethereum_EventNotification @imported( } type Ethereum_Network @imported( - uri: "ens/ethereum.polywrap.eth", + uri: "wrap://ens/ethereum.polywrap.eth", namespace: "Ethereum", nativeType: "Network" ) { @@ -311,5 +344,39 @@ type Ethereum_Network @imported( 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!]! +} + ### Imported Objects END ### -`; diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/module.wasm b/packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/module.wasm new file mode 100644 index 0000000000..6b497232cb Binary files /dev/null and b/packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/module.wasm differ diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/polywrap.build.json b/packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/polywrap.build.json new file mode 100644 index 0000000000..51e5257f03 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/polywrap.build.json @@ -0,0 +1 @@ +Invalid build manifest \ No newline at end of file diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/polywrap.json b/packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/polywrap.json new file mode 100644 index 0000000000..ab7f052a11 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/polywrap.json @@ -0,0 +1,9 @@ +{ + "format": "0.0.1-prealpha.9", + "name": "Valid Wrapper", + "language": "wasm/assemblyscript", + "build": "./polywrap.build.json", + "meta": "./polywrap.meta.json", + "schema": "./schema.graphql", + "module": "./module.wasm" +} diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/polywrap.meta.json b/packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/polywrap.meta.json new file mode 100644 index 0000000000..4ed15fa713 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/polywrap.meta.json @@ -0,0 +1,8 @@ +{ + "format": "0.0.1-prealpha.3", + "displayName": "Valid Wrapper", + "tags": ["some", "tag"], + "subtext": "test subtext", + "description": "test description", + "repository": "https://github.com/test/test" +} diff --git a/packages/js/plugins/ethereum/src/wrap-man/schema.ts b/packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/schema.graphql similarity index 51% rename from packages/js/plugins/ethereum/src/wrap-man/schema.ts rename to packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/schema.graphql index f39380e97d..baf49860be 100644 --- a/packages/js/plugins/ethereum/src/wrap-man/schema.ts +++ b/packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/schema.graphql @@ -1,7 +1,4 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema = `### Polywrap Header START ### +### Polywrap Header START ### scalar UInt scalar UInt8 scalar UInt16 @@ -38,26 +35,73 @@ directive @annotate(type: String!) on FIELD ### Polywrap Header END ### -type Module { +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" + ] +) { + getData( + address: String! + connection: Ethereum_Connection + ): Int! + + tryGetData( + address: String! + connection: Ethereum_Connection + ): String! + + throwGetData( + address: String! + connection: Ethereum_Connection + ): String! + + setData( + address: String! + value: Int! + connection: Ethereum_Connection + ): String! + + deployContract( + connection: Ethereum_Connection + ): String! +} + +### 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: Connection + connection: Ethereum_Connection ): String! callContractStatic( address: String! method: String! args: [String!] - connection: Connection - txOverrides: TxOverrides - ): StaticTxResult! + connection: Ethereum_Connection + txOverrides: Ethereum_TxOverrides + ): Ethereum_StaticTxResult! getBalance( address: String! blockTag: BigInt - connection: Connection + connection: Ethereum_Connection ): BigInt! encodeParams( @@ -86,34 +130,34 @@ type Module { ): String! getSignerAddress( - connection: Connection + connection: Ethereum_Connection ): String! getSignerBalance( blockTag: BigInt - connection: Connection + connection: Ethereum_Connection ): BigInt! getSignerTransactionCount( blockTag: BigInt - connection: Connection + connection: Ethereum_Connection ): BigInt! getGasPrice( - connection: Connection + connection: Ethereum_Connection ): BigInt! estimateTransactionGas( - tx: TxRequest! - connection: Connection + tx: Ethereum_TxRequest! + connection: Ethereum_Connection ): BigInt! estimateContractCallGas( address: String! method: String! args: [String!] - connection: Connection - txOverrides: TxOverrides + connection: Ethereum_Connection + txOverrides: Ethereum_TxOverrides ): BigInt! checkAddress( @@ -132,71 +176,119 @@ type Module { txHash: String! confirmations: UInt32! timeout: UInt32! - connection: Connection - ): TxReceipt! + connection: Ethereum_Connection + ): Ethereum_TxReceipt! waitForEvent( address: String! event: String! args: [String!] timeout: UInt32 - connection: Connection - ): EventNotification! + connection: Ethereum_Connection + ): Ethereum_EventNotification! getNetwork( - connection: Connection - ): Network! + connection: Ethereum_Connection + ): Ethereum_Network! callContractMethod( address: String! method: String! args: [String!] - connection: Connection - txOverrides: TxOverrides - ): TxResponse! + connection: Ethereum_Connection + txOverrides: Ethereum_TxOverrides + ): Ethereum_TxResponse! callContractMethodAndWait( address: String! method: String! args: [String!] - connection: Connection - txOverrides: TxOverrides - ): TxReceipt! + connection: Ethereum_Connection + txOverrides: Ethereum_TxOverrides + ): Ethereum_TxReceipt! sendTransaction( - tx: TxRequest! - connection: Connection - ): TxResponse! + tx: Ethereum_TxRequest! + connection: Ethereum_Connection + ): Ethereum_TxResponse! sendTransactionAndWait( - tx: TxRequest! - connection: Connection - ): TxReceipt! + tx: Ethereum_TxRequest! + connection: Ethereum_Connection + ): Ethereum_TxReceipt! deployContract( abi: String! bytecode: String! args: [String!] - connection: Connection + connection: Ethereum_Connection ): String! signMessage( message: String! - connection: Connection + connection: Ethereum_Connection ): String! sendRPC( method: String! params: [String!]! - connection: Connection + connection: Ethereum_Connection ): String } -type Env { - connection: Connection +### 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 TxReceipt { +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! @@ -205,7 +297,7 @@ type TxReceipt { gasUsed: BigInt! logsBloom: String! transactionHash: String! - logs: [Log!]! + logs: [Ethereum_Log!]! blockNumber: BigInt! blockHash: String! confirmations: UInt32! @@ -216,7 +308,11 @@ type TxReceipt { status: UInt32 } -type Log { +type Ethereum_Log @imported( + uri: "wrap://ens/ethereum.polywrap.eth", + namespace: "Ethereum", + nativeType: "Log" +) { blockNumber: BigInt! blockHash: String! transactionIndex: UInt32! @@ -228,7 +324,31 @@ type Log { logIndex: UInt32! } -type TxResponse { +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! @@ -247,59 +367,16 @@ type TxResponse { s: String v: UInt32 type: UInt32 - accessList: [Access!] + accessList: [Ethereum_Access!] } -type Access { +type Ethereum_Access @imported( + uri: "wrap://ens/ethereum.polywrap.eth", + namespace: "Ethereum", + nativeType: "Access" +) { address: String! storageKeys: [String!]! } -type TxRequest { - to: String - from: String - nonce: UInt32 - gasLimit: BigInt - gasPrice: BigInt - data: String - value: BigInt - chainId: BigInt - type: UInt32 -} - -type TxOverrides { - gasLimit: BigInt - gasPrice: BigInt - value: BigInt -} - -type StaticTxResult { - result: String! - error: Boolean! -} - -type EventNotification { - data: String! - address: String! - log: Log! -} - -type Connection { - node: String - networkNameOrChainId: String -} - -type Network { - name: String! - chainId: BigInt! - ensAddress: String -} - -### Imported Modules START ### - -### Imported Modules END ### - -### Imported Objects START ### - ### Imported Objects END ### -`; diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/module.wasm b/packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/module.wasm new file mode 100644 index 0000000000..6b497232cb Binary files /dev/null and b/packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/module.wasm differ diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/polywrap.build.json b/packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/polywrap.build.json new file mode 100644 index 0000000000..fb006acf11 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/polywrap.build.json @@ -0,0 +1,6 @@ +{ + "format": "0.0.1-prealpha.3", + "docker": { + "buildImageId": "sha256:c6f86547730a5044febd75872db0afdfc4cda3cfa0053b838932f03721c458ca\n" + } +} \ No newline at end of file diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/polywrap.json b/packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/polywrap.json new file mode 100644 index 0000000000..ab7f052a11 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/polywrap.json @@ -0,0 +1,9 @@ +{ + "format": "0.0.1-prealpha.9", + "name": "Valid Wrapper", + "language": "wasm/assemblyscript", + "build": "./polywrap.build.json", + "meta": "./polywrap.meta.json", + "schema": "./schema.graphql", + "module": "./module.wasm" +} diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/polywrap.meta.json b/packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/polywrap.meta.json new file mode 100644 index 0000000000..f19ddb8aba --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/polywrap.meta.json @@ -0,0 +1 @@ +Invalid meta manifest \ No newline at end of file diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/schema.graphql b/packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/schema.graphql new file mode 100644 index 0000000000..baf49860be --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/schema.graphql @@ -0,0 +1,382 @@ +### 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 + +### 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" + ] +) { + getData( + address: String! + connection: Ethereum_Connection + ): Int! + + tryGetData( + address: String! + connection: Ethereum_Connection + ): String! + + throwGetData( + address: String! + connection: Ethereum_Connection + ): String! + + setData( + address: String! + value: Int! + connection: Ethereum_Connection + ): String! + + deployContract( + connection: Ethereum_Connection + ): String! +} + +### 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 +} + +### 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!]! +} + +### Imported Objects END ### diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-schema/module.wasm b/packages/js/validation/src/__tests__/wrappers/invalid-schema/module.wasm new file mode 100644 index 0000000000..6b497232cb Binary files /dev/null and b/packages/js/validation/src/__tests__/wrappers/invalid-schema/module.wasm differ diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-schema/polywrap.build.json b/packages/js/validation/src/__tests__/wrappers/invalid-schema/polywrap.build.json new file mode 100644 index 0000000000..fb006acf11 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/invalid-schema/polywrap.build.json @@ -0,0 +1,6 @@ +{ + "format": "0.0.1-prealpha.3", + "docker": { + "buildImageId": "sha256:c6f86547730a5044febd75872db0afdfc4cda3cfa0053b838932f03721c458ca\n" + } +} \ No newline at end of file diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-schema/polywrap.json b/packages/js/validation/src/__tests__/wrappers/invalid-schema/polywrap.json new file mode 100644 index 0000000000..ab7f052a11 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/invalid-schema/polywrap.json @@ -0,0 +1,9 @@ +{ + "format": "0.0.1-prealpha.9", + "name": "Valid Wrapper", + "language": "wasm/assemblyscript", + "build": "./polywrap.build.json", + "meta": "./polywrap.meta.json", + "schema": "./schema.graphql", + "module": "./module.wasm" +} diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-schema/polywrap.meta.json b/packages/js/validation/src/__tests__/wrappers/invalid-schema/polywrap.meta.json new file mode 100644 index 0000000000..4ed15fa713 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/invalid-schema/polywrap.meta.json @@ -0,0 +1,8 @@ +{ + "format": "0.0.1-prealpha.3", + "displayName": "Valid Wrapper", + "tags": ["some", "tag"], + "subtext": "test subtext", + "description": "test description", + "repository": "https://github.com/test/test" +} diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-schema/schema.graphql b/packages/js/validation/src/__tests__/wrappers/invalid-schema/schema.graphql new file mode 100644 index 0000000000..e9e90fa4c9 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/invalid-schema/schema.graphql @@ -0,0 +1 @@ +Some Invalid Schema \ No newline at end of file diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/module.wasm b/packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/module.wasm new file mode 100644 index 0000000000..6b497232cb Binary files /dev/null and b/packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/module.wasm differ diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/polywrap.build.json b/packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/polywrap.build.json new file mode 100644 index 0000000000..fb006acf11 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/polywrap.build.json @@ -0,0 +1,6 @@ +{ + "format": "0.0.1-prealpha.3", + "docker": { + "buildImageId": "sha256:c6f86547730a5044febd75872db0afdfc4cda3cfa0053b838932f03721c458ca\n" + } +} \ No newline at end of file diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/polywrap.json b/packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/polywrap.json new file mode 100644 index 0000000000..9efbd4ac9a --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/polywrap.json @@ -0,0 +1,4 @@ +{ + "format": "0.0.1-prealpha.9", + "name": "Invalid Wrap Manifest" +} diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/polywrap.meta.json b/packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/polywrap.meta.json new file mode 100644 index 0000000000..4ed15fa713 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/polywrap.meta.json @@ -0,0 +1,8 @@ +{ + "format": "0.0.1-prealpha.3", + "displayName": "Valid Wrapper", + "tags": ["some", "tag"], + "subtext": "test subtext", + "description": "test description", + "repository": "https://github.com/test/test" +} diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/schema.graphql b/packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/schema.graphql new file mode 100644 index 0000000000..baf49860be --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/schema.graphql @@ -0,0 +1,382 @@ +### 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 + +### 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" + ] +) { + getData( + address: String! + connection: Ethereum_Connection + ): Int! + + tryGetData( + address: String! + connection: Ethereum_Connection + ): String! + + throwGetData( + address: String! + connection: Ethereum_Connection + ): String! + + setData( + address: String! + value: Int! + connection: Ethereum_Connection + ): String! + + deployContract( + connection: Ethereum_Connection + ): String! +} + +### 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 +} + +### 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!]! +} + +### Imported Objects END ### diff --git a/packages/js/validation/src/__tests__/wrappers/missing-schema/module.wasm b/packages/js/validation/src/__tests__/wrappers/missing-schema/module.wasm new file mode 100644 index 0000000000..6b497232cb Binary files /dev/null and b/packages/js/validation/src/__tests__/wrappers/missing-schema/module.wasm differ diff --git a/packages/js/validation/src/__tests__/wrappers/missing-schema/polywrap.build.json b/packages/js/validation/src/__tests__/wrappers/missing-schema/polywrap.build.json new file mode 100644 index 0000000000..fb006acf11 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/missing-schema/polywrap.build.json @@ -0,0 +1,6 @@ +{ + "format": "0.0.1-prealpha.3", + "docker": { + "buildImageId": "sha256:c6f86547730a5044febd75872db0afdfc4cda3cfa0053b838932f03721c458ca\n" + } +} \ No newline at end of file diff --git a/packages/js/validation/src/__tests__/wrappers/missing-schema/polywrap.json b/packages/js/validation/src/__tests__/wrappers/missing-schema/polywrap.json new file mode 100644 index 0000000000..ab7f052a11 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/missing-schema/polywrap.json @@ -0,0 +1,9 @@ +{ + "format": "0.0.1-prealpha.9", + "name": "Valid Wrapper", + "language": "wasm/assemblyscript", + "build": "./polywrap.build.json", + "meta": "./polywrap.meta.json", + "schema": "./schema.graphql", + "module": "./module.wasm" +} diff --git a/packages/js/validation/src/__tests__/wrappers/missing-schema/polywrap.meta.json b/packages/js/validation/src/__tests__/wrappers/missing-schema/polywrap.meta.json new file mode 100644 index 0000000000..4ed15fa713 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/missing-schema/polywrap.meta.json @@ -0,0 +1,8 @@ +{ + "format": "0.0.1-prealpha.3", + "displayName": "Valid Wrapper", + "tags": ["some", "tag"], + "subtext": "test subtext", + "description": "test description", + "repository": "https://github.com/test/test" +} diff --git a/packages/js/validation/src/__tests__/wrappers/missing-wrap-manifest/module.wasm b/packages/js/validation/src/__tests__/wrappers/missing-wrap-manifest/module.wasm new file mode 100644 index 0000000000..6b497232cb Binary files /dev/null and b/packages/js/validation/src/__tests__/wrappers/missing-wrap-manifest/module.wasm differ diff --git a/packages/js/validation/src/__tests__/wrappers/missing-wrap-manifest/polywrap.build.json b/packages/js/validation/src/__tests__/wrappers/missing-wrap-manifest/polywrap.build.json new file mode 100644 index 0000000000..fb006acf11 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/missing-wrap-manifest/polywrap.build.json @@ -0,0 +1,6 @@ +{ + "format": "0.0.1-prealpha.3", + "docker": { + "buildImageId": "sha256:c6f86547730a5044febd75872db0afdfc4cda3cfa0053b838932f03721c458ca\n" + } +} \ No newline at end of file diff --git a/packages/js/validation/src/__tests__/wrappers/missing-wrap-manifest/polywrap.meta.json b/packages/js/validation/src/__tests__/wrappers/missing-wrap-manifest/polywrap.meta.json new file mode 100644 index 0000000000..4ed15fa713 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/missing-wrap-manifest/polywrap.meta.json @@ -0,0 +1,8 @@ +{ + "format": "0.0.1-prealpha.3", + "displayName": "Valid Wrapper", + "tags": ["some", "tag"], + "subtext": "test subtext", + "description": "test description", + "repository": "https://github.com/test/test" +} diff --git a/packages/js/validation/src/__tests__/wrappers/missing-wrap-manifest/schema.graphql b/packages/js/validation/src/__tests__/wrappers/missing-wrap-manifest/schema.graphql new file mode 100644 index 0000000000..baf49860be --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/missing-wrap-manifest/schema.graphql @@ -0,0 +1,382 @@ +### 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 + +### 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" + ] +) { + getData( + address: String! + connection: Ethereum_Connection + ): Int! + + tryGetData( + address: String! + connection: Ethereum_Connection + ): String! + + throwGetData( + address: String! + connection: Ethereum_Connection + ): String! + + setData( + address: String! + value: Int! + connection: Ethereum_Connection + ): String! + + deployContract( + connection: Ethereum_Connection + ): String! +} + +### 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 +} + +### 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!]! +} + +### Imported Objects END ### diff --git a/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/module.wasm b/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/module.wasm new file mode 100644 index 0000000000..6b497232cb Binary files /dev/null and b/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/module.wasm differ diff --git a/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/polywrap.build.json b/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/polywrap.build.json new file mode 100644 index 0000000000..fb006acf11 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/polywrap.build.json @@ -0,0 +1,6 @@ +{ + "format": "0.0.1-prealpha.3", + "docker": { + "buildImageId": "sha256:c6f86547730a5044febd75872db0afdfc4cda3cfa0053b838932f03721c458ca\n" + } +} \ No newline at end of file diff --git a/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/polywrap.json b/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/polywrap.json new file mode 100644 index 0000000000..ab7f052a11 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/polywrap.json @@ -0,0 +1,9 @@ +{ + "format": "0.0.1-prealpha.9", + "name": "Valid Wrapper", + "language": "wasm/assemblyscript", + "build": "./polywrap.build.json", + "meta": "./polywrap.meta.json", + "schema": "./schema.graphql", + "module": "./module.wasm" +} diff --git a/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/polywrap.meta.json b/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/polywrap.meta.json new file mode 100644 index 0000000000..4ed15fa713 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/polywrap.meta.json @@ -0,0 +1,8 @@ +{ + "format": "0.0.1-prealpha.3", + "displayName": "Valid Wrapper", + "tags": ["some", "tag"], + "subtext": "test subtext", + "description": "test description", + "repository": "https://github.com/test/test" +} diff --git a/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/schema.graphql b/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/schema.graphql new file mode 100644 index 0000000000..baf49860be --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/schema.graphql @@ -0,0 +1,382 @@ +### 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 + +### 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" + ] +) { + getData( + address: String! + connection: Ethereum_Connection + ): Int! + + tryGetData( + address: String! + connection: Ethereum_Connection + ): String! + + throwGetData( + address: String! + connection: Ethereum_Connection + ): String! + + setData( + address: String! + value: Int! + connection: Ethereum_Connection + ): String! + + deployContract( + connection: Ethereum_Connection + ): String! +} + +### 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 +} + +### 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!]! +} + +### Imported Objects END ### diff --git a/packages/js/validation/src/__tests__/wrappers/more-than-6-files/meta/icon/icon.png b/packages/js/validation/src/__tests__/wrappers/more-than-6-files/meta/icon/icon.png new file mode 100644 index 0000000000..3102d9847d Binary files /dev/null and b/packages/js/validation/src/__tests__/wrappers/more-than-6-files/meta/icon/icon.png differ diff --git a/packages/js/validation/src/__tests__/wrappers/more-than-6-files/module.wasm b/packages/js/validation/src/__tests__/wrappers/more-than-6-files/module.wasm new file mode 100644 index 0000000000..6b497232cb Binary files /dev/null and b/packages/js/validation/src/__tests__/wrappers/more-than-6-files/module.wasm differ diff --git a/packages/js/validation/src/__tests__/wrappers/more-than-6-files/polywrap.build.json b/packages/js/validation/src/__tests__/wrappers/more-than-6-files/polywrap.build.json new file mode 100644 index 0000000000..fb006acf11 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/more-than-6-files/polywrap.build.json @@ -0,0 +1,6 @@ +{ + "format": "0.0.1-prealpha.3", + "docker": { + "buildImageId": "sha256:c6f86547730a5044febd75872db0afdfc4cda3cfa0053b838932f03721c458ca\n" + } +} \ No newline at end of file diff --git a/packages/js/validation/src/__tests__/wrappers/more-than-6-files/polywrap.json b/packages/js/validation/src/__tests__/wrappers/more-than-6-files/polywrap.json new file mode 100644 index 0000000000..ab7f052a11 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/more-than-6-files/polywrap.json @@ -0,0 +1,9 @@ +{ + "format": "0.0.1-prealpha.9", + "name": "Valid Wrapper", + "language": "wasm/assemblyscript", + "build": "./polywrap.build.json", + "meta": "./polywrap.meta.json", + "schema": "./schema.graphql", + "module": "./module.wasm" +} diff --git a/packages/js/validation/src/__tests__/wrappers/more-than-6-files/polywrap.meta.json b/packages/js/validation/src/__tests__/wrappers/more-than-6-files/polywrap.meta.json new file mode 100644 index 0000000000..e322436686 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/more-than-6-files/polywrap.meta.json @@ -0,0 +1,9 @@ +{ + "format": "0.0.1-prealpha.3", + "displayName": "Valid Wrapper", + "tags": ["some", "tag"], + "subtext": "test subtext", + "description": "test description", + "repository": "https://github.com/test/test", + "icon": "./meta/icon/icon.png" +} diff --git a/packages/js/validation/src/__tests__/wrappers/more-than-6-files/schema.graphql b/packages/js/validation/src/__tests__/wrappers/more-than-6-files/schema.graphql new file mode 100644 index 0000000000..baf49860be --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/more-than-6-files/schema.graphql @@ -0,0 +1,382 @@ +### 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 + +### 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" + ] +) { + getData( + address: String! + connection: Ethereum_Connection + ): Int! + + tryGetData( + address: String! + connection: Ethereum_Connection + ): String! + + throwGetData( + address: String! + connection: Ethereum_Connection + ): String! + + setData( + address: String! + value: Int! + connection: Ethereum_Connection + ): String! + + deployContract( + connection: Ethereum_Connection + ): String! +} + +### 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 +} + +### 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!]! +} + +### Imported Objects END ### diff --git a/packages/js/validation/src/__tests__/wrappers/valid-interface/polywrap.build.json b/packages/js/validation/src/__tests__/wrappers/valid-interface/polywrap.build.json new file mode 100644 index 0000000000..fb006acf11 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/valid-interface/polywrap.build.json @@ -0,0 +1,6 @@ +{ + "format": "0.0.1-prealpha.3", + "docker": { + "buildImageId": "sha256:c6f86547730a5044febd75872db0afdfc4cda3cfa0053b838932f03721c458ca\n" + } +} \ No newline at end of file diff --git a/packages/js/validation/src/__tests__/wrappers/valid-interface/polywrap.json b/packages/js/validation/src/__tests__/wrappers/valid-interface/polywrap.json new file mode 100644 index 0000000000..159132cb04 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/valid-interface/polywrap.json @@ -0,0 +1,8 @@ +{ + "format": "0.0.1-prealpha.9", + "name": "Valid Wrapper Interface", + "language": "interface", + "build": "./polywrap.build.json", + "meta": "./polywrap.meta.json", + "schema": "./schema.graphql" +} diff --git a/packages/js/validation/src/__tests__/wrappers/valid-interface/polywrap.meta.json b/packages/js/validation/src/__tests__/wrappers/valid-interface/polywrap.meta.json new file mode 100644 index 0000000000..f0c205477c --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/valid-interface/polywrap.meta.json @@ -0,0 +1,8 @@ +{ + "format": "0.0.1-prealpha.3", + "displayName": "Valid Wrapper Interface", + "tags": ["some", "tag"], + "subtext": "test subtext", + "description": "test description", + "repository": "https://github.com/test/test" +} diff --git a/packages/js/validation/src/__tests__/wrappers/valid-interface/schema.graphql b/packages/js/validation/src/__tests__/wrappers/valid-interface/schema.graphql new file mode 100644 index 0000000000..baf49860be --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/valid-interface/schema.graphql @@ -0,0 +1,382 @@ +### 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 + +### 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" + ] +) { + getData( + address: String! + connection: Ethereum_Connection + ): Int! + + tryGetData( + address: String! + connection: Ethereum_Connection + ): String! + + throwGetData( + address: String! + connection: Ethereum_Connection + ): String! + + setData( + address: String! + value: Int! + connection: Ethereum_Connection + ): String! + + deployContract( + connection: Ethereum_Connection + ): String! +} + +### 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 +} + +### 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!]! +} + +### Imported Objects END ### diff --git a/packages/js/validation/src/__tests__/wrappers/valid/module.wasm b/packages/js/validation/src/__tests__/wrappers/valid/module.wasm new file mode 100644 index 0000000000..6b497232cb Binary files /dev/null and b/packages/js/validation/src/__tests__/wrappers/valid/module.wasm differ diff --git a/packages/js/validation/src/__tests__/wrappers/valid/polywrap.build.json b/packages/js/validation/src/__tests__/wrappers/valid/polywrap.build.json new file mode 100644 index 0000000000..fb006acf11 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/valid/polywrap.build.json @@ -0,0 +1,6 @@ +{ + "format": "0.0.1-prealpha.3", + "docker": { + "buildImageId": "sha256:c6f86547730a5044febd75872db0afdfc4cda3cfa0053b838932f03721c458ca\n" + } +} \ No newline at end of file diff --git a/packages/js/validation/src/__tests__/wrappers/valid/polywrap.json b/packages/js/validation/src/__tests__/wrappers/valid/polywrap.json new file mode 100644 index 0000000000..ab7f052a11 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/valid/polywrap.json @@ -0,0 +1,9 @@ +{ + "format": "0.0.1-prealpha.9", + "name": "Valid Wrapper", + "language": "wasm/assemblyscript", + "build": "./polywrap.build.json", + "meta": "./polywrap.meta.json", + "schema": "./schema.graphql", + "module": "./module.wasm" +} diff --git a/packages/js/validation/src/__tests__/wrappers/valid/polywrap.meta.json b/packages/js/validation/src/__tests__/wrappers/valid/polywrap.meta.json new file mode 100644 index 0000000000..4ed15fa713 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/valid/polywrap.meta.json @@ -0,0 +1,8 @@ +{ + "format": "0.0.1-prealpha.3", + "displayName": "Valid Wrapper", + "tags": ["some", "tag"], + "subtext": "test subtext", + "description": "test description", + "repository": "https://github.com/test/test" +} diff --git a/packages/js/validation/src/__tests__/wrappers/valid/schema.graphql b/packages/js/validation/src/__tests__/wrappers/valid/schema.graphql new file mode 100644 index 0000000000..baf49860be --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/valid/schema.graphql @@ -0,0 +1,382 @@ +### 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 + +### 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" + ] +) { + getData( + address: String! + connection: Ethereum_Connection + ): Int! + + tryGetData( + address: String! + connection: Ethereum_Connection + ): String! + + throwGetData( + address: String! + connection: Ethereum_Connection + ): String! + + setData( + address: String! + value: Int! + connection: Ethereum_Connection + ): String! + + deployContract( + connection: Ethereum_Connection + ): String! +} + +### 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 +} + +### 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!]! +} + +### Imported Objects END ### diff --git a/packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/module.wasm b/packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/module.wasm new file mode 100644 index 0000000000..6b497232cb Binary files /dev/null and b/packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/module.wasm differ diff --git a/packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/polywrap.build.json b/packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/polywrap.build.json new file mode 100644 index 0000000000..fb006acf11 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/polywrap.build.json @@ -0,0 +1,6 @@ +{ + "format": "0.0.1-prealpha.3", + "docker": { + "buildImageId": "sha256:c6f86547730a5044febd75872db0afdfc4cda3cfa0053b838932f03721c458ca\n" + } +} \ No newline at end of file diff --git a/packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/polywrap.json b/packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/polywrap.json new file mode 100644 index 0000000000..ab7f052a11 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/polywrap.json @@ -0,0 +1,9 @@ +{ + "format": "0.0.1-prealpha.9", + "name": "Valid Wrapper", + "language": "wasm/assemblyscript", + "build": "./polywrap.build.json", + "meta": "./polywrap.meta.json", + "schema": "./schema.graphql", + "module": "./module.wasm" +} diff --git a/packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/polywrap.meta.json b/packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/polywrap.meta.json new file mode 100644 index 0000000000..4ed15fa713 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/polywrap.meta.json @@ -0,0 +1,8 @@ +{ + "format": "0.0.1-prealpha.3", + "displayName": "Valid Wrapper", + "tags": ["some", "tag"], + "subtext": "test subtext", + "description": "test description", + "repository": "https://github.com/test/test" +} diff --git a/packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/schema.graphql b/packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/schema.graphql new file mode 100644 index 0000000000..baf49860be --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/schema.graphql @@ -0,0 +1,382 @@ +### 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 + +### 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" + ] +) { + getData( + address: String! + connection: Ethereum_Connection + ): Int! + + tryGetData( + address: String! + connection: Ethereum_Connection + ): String! + + throwGetData( + address: String! + connection: Ethereum_Connection + ): String! + + setData( + address: String! + value: Int! + connection: Ethereum_Connection + ): String! + + deployContract( + connection: Ethereum_Connection + ): String! +} + +### 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 +} + +### 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!]! +} + +### Imported Objects END ### diff --git a/packages/js/validation/src/constants.ts b/packages/js/validation/src/constants.ts new file mode 100644 index 0000000000..44a84597bd --- /dev/null +++ b/packages/js/validation/src/constants.ts @@ -0,0 +1 @@ +export const VALID_WRAP_MANIFEST_NAMES = ["polywrap.json"]; diff --git a/packages/js/validation/src/index.ts b/packages/js/validation/src/index.ts new file mode 100644 index 0000000000..e6869b197e --- /dev/null +++ b/packages/js/validation/src/index.ts @@ -0,0 +1,2 @@ +export * from "./constants"; +export * from "./types"; diff --git a/packages/js/validation/src/types/FileSystemPackageReader.ts b/packages/js/validation/src/types/FileSystemPackageReader.ts new file mode 100644 index 0000000000..29383f8ad9 --- /dev/null +++ b/packages/js/validation/src/types/FileSystemPackageReader.ts @@ -0,0 +1,35 @@ +import { PackageReader, PathStats } from "."; + +import path from "path"; +import fs from "fs"; + +export class FileSystemPackageReader implements PackageReader { + constructor(public readonly wrapperPath: string) {} + + readFileAsString(filePath: string): Promise { + return fs.promises.readFile(path.join(this.wrapperPath, filePath), "utf8"); + } + + readFile(filePath: string): Promise { + return fs.promises.readFile(path.join(this.wrapperPath, filePath)); + } + + exists(itemPath: string): Promise { + return Promise.resolve( + fs.existsSync(path.join(this.wrapperPath, itemPath)) + ); + } + + async getStats(itemPath: string): Promise { + const stat = await fs.promises.lstat(path.join(this.wrapperPath, itemPath)); + return { + isFile: stat.isFile(), + isDir: stat.isDirectory(), + size: stat.size, + }; + } + + readDir(dirPath: string): Promise { + return fs.promises.readdir(path.join(this.wrapperPath, dirPath)); + } +} diff --git a/packages/js/validation/src/types/PackageReader.ts b/packages/js/validation/src/types/PackageReader.ts new file mode 100644 index 0000000000..6db17f862c --- /dev/null +++ b/packages/js/validation/src/types/PackageReader.ts @@ -0,0 +1,9 @@ +import { PathStats } from "./PathStats"; + +export interface PackageReader { + readFileAsString: (path: string) => Promise; + readFile: (path: string) => Promise; + exists: (path: string) => Promise; + getStats: (path: string) => Promise; + readDir: (path: string) => Promise; +} diff --git a/packages/js/validation/src/types/PathStats.ts b/packages/js/validation/src/types/PathStats.ts new file mode 100644 index 0000000000..ca505808dd --- /dev/null +++ b/packages/js/validation/src/types/PathStats.ts @@ -0,0 +1,5 @@ +export type PathStats = { + isFile: boolean; + isDir: boolean; + size: number; +}; diff --git a/packages/js/validation/src/types/ValidationFailReason.ts b/packages/js/validation/src/types/ValidationFailReason.ts new file mode 100644 index 0000000000..e6a8ed95b7 --- /dev/null +++ b/packages/js/validation/src/types/ValidationFailReason.ts @@ -0,0 +1,13 @@ +export enum ValidationFailReason { + InvalidWrapManifest, + MultipleWrapManifests, + WrapManifestNotFound, + InvalidBuildManifest, + InvalidMetaManifest, + FileTooLarge, + WrapperTooLarge, + ModuleTooLarge, + InvalidSchema, + SchemaNotFound, + TooManyFiles, +} diff --git a/packages/js/validation/src/types/ValidationResult.ts b/packages/js/validation/src/types/ValidationResult.ts new file mode 100644 index 0000000000..3bb46bb14f --- /dev/null +++ b/packages/js/validation/src/types/ValidationResult.ts @@ -0,0 +1,7 @@ +import { ValidationFailReason } from "./ValidationFailReason"; + +export type ValidationResult = { + valid: boolean; + failError?: Error; + failReason?: ValidationFailReason; +}; diff --git a/packages/js/validation/src/types/WasmPackageConstraints.ts b/packages/js/validation/src/types/WasmPackageConstraints.ts new file mode 100644 index 0000000000..0f3e007a2e --- /dev/null +++ b/packages/js/validation/src/types/WasmPackageConstraints.ts @@ -0,0 +1,6 @@ +export type WasmPackageConstraints = { + maxSize: number; + maxFileSize: number; + maxModuleSize: number; + maxNumberOfFiles: number; +}; diff --git a/packages/js/validation/src/types/WasmPackageValidator.ts b/packages/js/validation/src/types/WasmPackageValidator.ts new file mode 100644 index 0000000000..86211ca93c --- /dev/null +++ b/packages/js/validation/src/types/WasmPackageValidator.ts @@ -0,0 +1,267 @@ +import { VALID_WRAP_MANIFEST_NAMES } from ".."; +import { + WasmPackageConstraints, + PackageReader, + ValidationResult, + ValidationFailReason, +} from "."; + +import { parseSchema } from "@polywrap/schema-parse"; +import { + deserializePolywrapManifest, + deserializeBuildManifest, + deserializeMetaManifest, + PolywrapManifest, +} from "@polywrap/core-js"; +import path from "path"; + +export class WasmPackageValidator { + constructor(private constraints: WasmPackageConstraints) {} + + async validate(reader: PackageReader): Promise { + let result = await this.validateManifests(reader); + if (!result.valid) { + return result; + } + + result = await this.validateStructure(reader); + if (!result.valid) { + return result; + } + + return this.success(); + } + + private async validateStructure( + reader: PackageReader + ): Promise { + const { result: pathResult } = await this.validatePath(reader, "./", 0, 0); + + if (!pathResult.valid) { + return pathResult; + } + + return this.success(); + } + + private async validatePath( + reader: PackageReader, + basePath: string, + currentSize: number, + currentFileCnt: number + ): Promise<{ + result: ValidationResult; + currentSize: number; + currentFileCnt: number; + }> { + const items = await reader.readDir(basePath); + for (const itemPath of items) { + const stats = await reader.getStats(path.join(basePath, itemPath)); + + currentSize += stats.size; + if (currentSize > this.constraints.maxSize) { + return { + result: this.fail(ValidationFailReason.WrapperTooLarge), + currentSize, + currentFileCnt, + }; + } + + currentFileCnt++; + if (currentFileCnt > this.constraints.maxNumberOfFiles) { + return { + result: this.fail(ValidationFailReason.TooManyFiles), + currentSize, + currentFileCnt, + }; + } + + if (stats.isFile) { + if (stats.size > this.constraints.maxFileSize) { + return { + result: this.fail(ValidationFailReason.FileTooLarge), + currentSize, + currentFileCnt, + }; + } + } else { + const { + result, + currentSize: newSize, + currentFileCnt: newFileCnt, + } = await this.validatePath( + reader, + path.join(basePath, itemPath), + currentSize, + currentFileCnt + ); + currentSize = newSize; + currentFileCnt = newFileCnt; + + if (!result.valid) { + return { + result, + currentSize, + currentFileCnt, + }; + } + } + } + + return { + result: this.success(), + currentSize, + currentFileCnt, + }; + } + + private async validateManifests( + reader: PackageReader + ): Promise { + let manifest: PolywrapManifest | undefined; + // Go through manifest names, if more than one wrap manifest exists, fail + // If no wrap manifest exists or is invalid, also fail + for (const manifestName of VALID_WRAP_MANIFEST_NAMES) { + if (!(await reader.exists(manifestName))) { + continue; + } + + if (manifest) { + return this.fail(ValidationFailReason.MultipleWrapManifests); + } + const manifestFile = await reader.readFileAsString(manifestName); + try { + manifest = deserializePolywrapManifest(manifestFile); + } catch (err) { + return this.fail(ValidationFailReason.InvalidWrapManifest, err); + } + } + + if (!manifest) { + return this.fail(ValidationFailReason.WrapManifestNotFound); + } + + const schemaResult = await this.validateSchema(reader, manifest.schema); + if (!schemaResult.valid) { + return schemaResult; + } + + const moduleResult = await this.validateModule(reader, manifest.module); + if (!moduleResult.valid) { + return moduleResult; + } + + let manifestValidationResult = await this.validateBuildManifest( + reader, + manifest + ); + if (!manifestValidationResult.valid) { + return manifestValidationResult; + } + + manifestValidationResult = await this.validateMetaManifest( + reader, + manifest + ); + if (!manifestValidationResult.valid) { + return manifestValidationResult; + } + + return this.success(); + } + + private async validateSchema( + reader: PackageReader, + schemaFilePath: string + ): Promise { + if (!(await reader.exists(schemaFilePath))) { + return this.fail(ValidationFailReason.SchemaNotFound); + } + try { + parseSchema(await reader.readFileAsString(schemaFilePath)); + } catch (err) { + return this.fail(ValidationFailReason.InvalidSchema, err); + } + + return this.success(); + } + + private async validateModule( + reader: PackageReader, + moduleFilePath: string | undefined + ): Promise { + if (!moduleFilePath) { + return this.success(); + } + + const moduleSize = (await reader.getStats(moduleFilePath)).size; + + if (moduleSize > this.constraints.maxModuleSize) { + return this.fail(ValidationFailReason.ModuleTooLarge); + } + + return this.success(); + } + + private async validateBuildManifest( + reader: PackageReader, + polywrapManifest: PolywrapManifest + ): Promise { + const manifestPath = polywrapManifest.build; + + if (manifestPath) { + // Manifests get built as a `.json` file so we need to change the extension + const fileName = path.parse(manifestPath).name; + const fullManifestName = `${fileName}.json`; + + const buildManifestFile = await reader.readFileAsString(fullManifestName); + try { + deserializeBuildManifest(buildManifestFile); + } catch (err) { + return this.fail(ValidationFailReason.InvalidBuildManifest, err); + } + } + + return this.success(); + } + + private async validateMetaManifest( + reader: PackageReader, + polywrapManifest: PolywrapManifest + ): Promise { + const manifestPath = polywrapManifest.meta; + + if (manifestPath) { + // Manifests get built as `.json` files so we need to change the extension + const fileName = path.parse(manifestPath).name; + const fullManifestName = `${fileName}.json`; + + const metaManifestFile = await reader.readFileAsString(fullManifestName); + + try { + deserializeMetaManifest(metaManifestFile); + } catch (err) { + return this.fail(ValidationFailReason.InvalidMetaManifest, err); + } + } + + return this.success(); + } + + private success(): ValidationResult { + return { + valid: true, + }; + } + + private fail( + reason: ValidationFailReason, + error: Error | undefined = undefined + ): ValidationResult { + return { + valid: false, + failReason: reason, + failError: error, + }; + } +} diff --git a/packages/js/validation/src/types/index.ts b/packages/js/validation/src/types/index.ts new file mode 100644 index 0000000000..b990dd4bc5 --- /dev/null +++ b/packages/js/validation/src/types/index.ts @@ -0,0 +1,7 @@ +export * from "./FileSystemPackageReader"; +export * from "./PackageReader"; +export * from "./PathStats"; +export * from "./ValidationFailReason"; +export * from "./ValidationResult"; +export * from "./WasmPackageConstraints"; +export * from "./WasmPackageValidator"; diff --git a/packages/js/validation/tsconfig.build.json b/packages/js/validation/tsconfig.build.json new file mode 100644 index 0000000000..77aadfdd2f --- /dev/null +++ b/packages/js/validation/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "include": [ + "./src/**/*.ts" + ], + "exclude": [ + "./src/**/__tests__" + ] +} diff --git a/packages/js/validation/tsconfig.json b/packages/js/validation/tsconfig.json new file mode 100644 index 0000000000..5d37204c00 --- /dev/null +++ b/packages/js/validation/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../tsconfig", + "compilerOptions": { + "outDir": "build" + }, + "include": [ + "./src/**/*.ts" + ], + "exclude": [] +} diff --git a/packages/manifest-schemas/formats/polywrap.app/0.0.1-prealpha.1.json b/packages/manifest-schemas/formats/polywrap.app/0.0.1-prealpha.1.json index b4e7046e86..7116d530f9 100644 --- a/packages/manifest-schemas/formats/polywrap.app/0.0.1-prealpha.1.json +++ b/packages/manifest-schemas/formats/polywrap.app/0.0.1-prealpha.1.json @@ -9,28 +9,34 @@ ], "properties": { "format": { + "description": "Polywrap app manifest format version.", "type": "string", "const": "0.0.1-prealpha.1" }, "language": { + "description": "Language in which the source code is written.", "type": "string", "format": "appLanguage" }, "schema": { + "description": "Path to graphql schema.", "type": "string", "format": "file" }, "import_redirects": { + "description": "Redirects for the schema's imports.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "uri": { + "description": "Import URI to be redirected.", "type": "string", "format": "polywrapUri" }, "schema": { + "description": "Path to a graphql schema to be used for the import.", "type": "string", "format": "schemaFile" } diff --git a/packages/manifest-schemas/formats/polywrap.app/0.0.1-prealpha.2.json b/packages/manifest-schemas/formats/polywrap.app/0.0.1-prealpha.2.json index 2b29b74b7f..78cad5deba 100644 --- a/packages/manifest-schemas/formats/polywrap.app/0.0.1-prealpha.2.json +++ b/packages/manifest-schemas/formats/polywrap.app/0.0.1-prealpha.2.json @@ -10,32 +10,39 @@ ], "properties": { "format": { + "description": "Polywrap app manifest format version.", "type": "string", "const": "0.0.1-prealpha.2" }, "name": { + "description": "Name of this wrapper package.", "type": "string", "format": "packageName" }, "language": { + "description": "Language in which the source code is written.", "type": "string", "format": "appLanguage" }, "schema": { + "description": "Path to graphql schema.", "type": "string", "format": "file" }, "import_redirects": { + "description": "Redirects for the schema's imports.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "uri": { + "description": "Import URI to be redirected.", "type": "string", "format": "polywrapUri" }, "schema": { + "description": "Path to a graphql schema to be used for the import.", "type": "string", "format": "schemaFile" } diff --git a/packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.1.json b/packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.1.json index 4537b545e1..d80c21a79e 100644 --- a/packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.1.json +++ b/packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.1.json @@ -7,28 +7,34 @@ ], "properties": { "format": { + "description": "Polywrap build manifest format version.", "type": "string", "const": "0.0.1-prealpha.1" }, "docker": { + "description": "Docker build artifact properties.", "type": "object", "additionalProperties": false, "properties": { "name": { + "description": "Docker image name.", "type": "string", "format": "dockerImageName" }, "dockerfile": { + "description": "Docker image file name.", "type": "string", "format": "dockerfileName" }, "buildImageId": { + "description": "Id of the docker image.", "type": "string", "format": "dockerImageId" } } }, "config": { + "description": "Custom configuration.", "type": "object" } } diff --git a/packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.2.json b/packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.2.json index 621b652c3f..559e7e67a2 100644 --- a/packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.2.json +++ b/packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.2.json @@ -5,6 +5,7 @@ "required": ["format"], "properties": { "format": { + "description": "Polywrap build manifest format version.", "type": "string", "const": "0.0.1-prealpha.2" }, @@ -13,35 +14,43 @@ "additionalProperties": false, "properties": { "name": { + "description": "Docker image name.", "type": "string", "format": "dockerImageName" }, "dockerfile": { + "description": "Docker image file name.", "type": "string", "format": "dockerfileName" }, "buildImageId": { + "description": "Id of the docker image.", "type": "string", "format": "dockerImageId" } } }, "config": { + "description": "Custom configuration.", "type": "object" }, "linked_packages": { + "description": "Locally linked packages into docker build image.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "name": { + "description": "Package name", "type": "string" }, "path": { + "description": "Path to linked package directory.", "type": "string" }, "filter": { + "description": "Ignore files matching this regex in linked package directory.", "type": "string", "format": "regexString" } diff --git a/packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.3.json b/packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.3.json index 66cfed79fb..5b7b5bda19 100644 --- a/packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.3.json +++ b/packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.3.json @@ -5,6 +5,7 @@ "required": ["format"], "properties": { "format": { + "description": "Polywrap build manifest format version.", "type": "string", "const": "0.0.1-prealpha.3" }, @@ -13,55 +14,68 @@ "additionalProperties": false, "properties": { "name": { + "description": "Docker image name.", "type": "string", "format": "dockerImageName" }, "dockerfile": { + "description": "Docker image file name.", "type": "string", "format": "dockerfileName" }, "buildImageId": { + "description": "Id of the docker image.", "type": "string", "format": "dockerImageId" }, "buildx": { + "description": "Configuration options for Docker Buildx, set to true for default value.", "type": ["object", "boolean"], "additionalProperties": false, "properties": { "cache": { + "description": "Path to cache directory, set to true for default value, set to false to disable caching.", "type": ["string", "boolean"], "format": "directory" }, "output": { + "description": "Path to cache directory, set to true or false for default value.", "type": ["string", "boolean"], "format": "buildxOutput" }, "removeBuilder": { + "description": "Remove the builder instance.", "type": "boolean" } } }, "removeImage": { + "description": "Remove the image.", "type": "boolean" } } }, "config": { + "description": "Custom build image configurations.", "type": "object" }, "linked_packages": { + "description": "Locally linked packages into docker build image.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "name": { + "description": "Package name.", "type": "string" }, "path": { + "description": "Path to linked package directory.", "type": "string" }, "filter": { + "description": "Ignore files matching this regex in linked package directory.", "type": "string", "format": "regexString" } diff --git a/packages/manifest-schemas/formats/polywrap.deploy/0.0.1-prealpha.1.json b/packages/manifest-schemas/formats/polywrap.deploy/0.0.1-prealpha.1.json index 09a2a1079b..ebef33fc11 100644 --- a/packages/manifest-schemas/formats/polywrap.deploy/0.0.1-prealpha.1.json +++ b/packages/manifest-schemas/formats/polywrap.deploy/0.0.1-prealpha.1.json @@ -8,26 +8,32 @@ ], "properties": { "format": { + "description": "Polywrap deployment manifest format version.", "type": "string", "const": "0.0.1-prealpha.1" }, "stages": { "patternProperties": { "^.*$": { + "description": "Deployment stage.", "type": "object", "additionalProperties": false, "required": ["package"], "properties": { "package": { + "description": "Name of the deploy stage.", "type": "string" }, "config": { + "description": "Custom configuration.", "type": "object" }, "depends_on": { + "description": "Name of dependent stages.", "type": "string" }, "uri": { + "description": "URI to pass into the deploy stage.", "type": "string", "format": "polywrapUri" } diff --git a/packages/manifest-schemas/formats/polywrap.infra/0.0.1-prealpha.1.json b/packages/manifest-schemas/formats/polywrap.infra/0.0.1-prealpha.1.json index 84cb3106a6..13f22f2104 100644 --- a/packages/manifest-schemas/formats/polywrap.infra/0.0.1-prealpha.1.json +++ b/packages/manifest-schemas/formats/polywrap.infra/0.0.1-prealpha.1.json @@ -5,10 +5,12 @@ "required": ["format", "modules"], "properties": { "format": { + "description": "Polywrap infra manifest format version.", "type": "string", "const": "0.0.1-prealpha.1" }, "dockerCompose": { + "description": "Path to docker compose manifest.", "type": "string" }, "env": { @@ -32,19 +34,24 @@ }, "definitions": { "remoteModule": { + "description": "A remote docker-compose package.", "type": "object", "additionalProperties": false, "properties": { "package": { + "description": "Package name.", "type": "string" }, "registry": { + "description": "Package registry name.", "type": "string" }, "version": { + "description": "Package version.", "type": "string" }, "dockerComposePath": { + "description": "Path to docker-compose file in the package directory.", "type": "string" } }, @@ -55,6 +62,7 @@ "additionalProperties": false, "properties": { "path": { + "description": "Path to the package.", "type": "string" } }, diff --git a/packages/manifest-schemas/formats/polywrap.infra/0.0.1-prealpha.2.json b/packages/manifest-schemas/formats/polywrap.infra/0.0.1-prealpha.2.json index eed51a8000..75c8b4bff5 100644 --- a/packages/manifest-schemas/formats/polywrap.infra/0.0.1-prealpha.2.json +++ b/packages/manifest-schemas/formats/polywrap.infra/0.0.1-prealpha.2.json @@ -5,10 +5,12 @@ "required": ["format", "modules"], "properties": { "format": { + "description": "Polywrap infra manifest format version.", "type": "string", "const": "0.0.1-prealpha.2" }, "dockerCompose": { + "description": "Path to docker compose manifest.", "type": "string" }, "env": { @@ -33,35 +35,43 @@ }, "definitions": { "remoteModule": { + "description": "A remote package with a docker-compose file.", "type": "object", "additionalProperties": false, "properties": { "package": { + "description": "Package name.", "type": "string" }, "registry": { + "description": "Package registry name.", "type": "string" }, "version": { + "description": "Package version.", "type": "string" }, "dockerComposePath": { + "description": "Path to docker-compose file in the package directory.", "type": "string" } }, "required": ["package", "version", "registry"] }, "localModule": { + "description": "A local package with a docker-compose file.", "type": "object", "additionalProperties": false, "properties": { "path": { + "description": "Path to the package.", "type": "string" } }, "required": ["path"] }, "defaultModule": { + "description": "A module available by default.", "type": "string", "const": "default" } diff --git a/packages/manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.1.json b/packages/manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.1.json index 4d40e158a3..c13a8241fd 100644 --- a/packages/manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.1.json +++ b/packages/manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.1.json @@ -8,40 +8,50 @@ ], "properties": { "format": { + "description": "Polywrap wrapper metadata manifest format version.", "type": "string", "const": "0.0.1-prealpha.1" }, "name": { + "description": "Name of the wrapper.", "type": "string" }, "subtext": { + "description": "Short or summary description of the wrapper.", "type": "string" }, "description": { + "description": "Long description for the wrapper.", "type": "string" }, "repository": { + "description": "Reference to the repository holding source code.", "type": "string", "format": "websiteUrl" }, "icon": { + "description": "Path to wrapper icon.", "type": "string", "format": "imageFile" }, "links": { + "description": "Relevant web links.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "name": { + "description": "Web link name.", "type": "string" }, "icon": { + "description": "Web link icon.", "type": "string", "format": "imageFile" }, "url": { + "description": "Url to the web link.", "type": "string", "format": "websiteUrl" } @@ -53,22 +63,27 @@ } }, "queries": { + "description": "List of example queries.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "name": { + "description": "Query name.", "type": "string" }, "description": { + "description": "Query description.", "type": "string" }, "query": { + "description": "Path to graph ql file.", "type": "string", "format": "graphqlFile" }, "vars": { + "description": "Query parameters.", "type": "string", "format": "jsonFile" } diff --git a/packages/manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.2.json b/packages/manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.2.json index 33fbd05dbd..a0b24090d5 100644 --- a/packages/manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.2.json +++ b/packages/manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.2.json @@ -7,40 +7,50 @@ ], "properties": { "format": { + "description": "Polywrap wrapper metadata manifest format version.", "type": "string", "const": "0.0.1-prealpha.2" }, "displayName": { + "description": "Name of the wrapper.", "type": "string" }, "subtext": { + "description": "Short or summary description of the wrapper.", "type": "string" }, "description": { + "description": "Long description for the wrapper.", "type": "string" }, "repository": { + "description": "Reference to the repository holding source code.", "type": "string", "format": "websiteUrl" }, "icon": { + "description": "Path to wrapper icon.", "type": "string", "format": "imageFile" }, "links": { + "description": "Relevant web links.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "name": { + "description": "Web link name.", "type": "string" }, "icon": { + "description": "Web link icon.", "type": "string", "format": "imageFile" }, "url": { + "description": "Url to the web link.", "type": "string", "format": "websiteUrl" } @@ -52,22 +62,27 @@ } }, "queries": { + "description": "List of example queries.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "name": { + "description": "Query name.", "type": "string" }, "description": { + "description": "Query description.", "type": "string" }, "query": { + "description": "Path to graph ql file.", "type": "string", "format": "graphqlFile" }, "vars": { + "description": "Query parameters.", "type": "string", "format": "jsonFile" } diff --git a/packages/manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.3.json b/packages/manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.3.json index 772b15fa48..33790085bb 100644 --- a/packages/manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.3.json +++ b/packages/manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.3.json @@ -7,47 +7,59 @@ ], "properties": { "format": { + "description": "Polywrap wrapper metadata manifest format version.", "type": "string", "const": "0.0.1-prealpha.3" }, "displayName": { + "description": "Name of the wrapper.", "type": "string" }, "subtext": { + "description": "Short or summary description of the wrapper.", "type": "string" }, "description": { + "description": "Long description for the wrapper.", "type": "string" }, "repository": { + "description": "Reference to the repository holding source code.", "type": "string", "format": "websiteUrl" }, "tags": { + "description": "List of relevant tag keywords.", "type": "array", "items": { + "description": "Tag keyword.", "type": "string", "format": "packageTag" } }, "icon": { + "description": "Path to wrapper icon.", "type": "string", "format": "imageFile" }, "links": { + "description": "Relevant web links.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "name": { + "description": "Web link name.", "type": "string" }, "icon": { + "description": "Web link icon.", "type": "string", "format": "imageFile" }, "url": { + "description": "Url to the web link.", "type": "string", "format": "websiteUrl" } @@ -59,22 +71,27 @@ } }, "queries": { + "description": "List of example queries.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "name": { + "description": "Query name.", "type": "string" }, "description": { + "description": "Query description.", "type": "string" }, "query": { + "description": "Path to graph ql file.", "type": "string", "format": "graphqlFile" }, "vars": { + "description": "Query parameters.", "type": "string", "format": "jsonFile" } diff --git a/packages/manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.1.json b/packages/manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.1.json index 77f8bb2cfa..a6a0d093bc 100644 --- a/packages/manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.1.json +++ b/packages/manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.1.json @@ -9,27 +9,33 @@ ], "properties": { "format": { + "description": "Polywrap plugin manifest format version.", "type": "string", "const": "0.0.1-prealpha.1" }, "language": { + "description" : "Plugin language.", "type": "string", "format": "pluginLanguage" }, "schema": { + "description": "Path to graphql schema.", "type": "string", "format": "file" }, "import_redirects": { + "description": "Redirects source URI to local wrapper or plugin.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "uri": { + "description": "Source URI that needs to be redirected.", "type": "string" }, "schema": { + "description": "Path to GraphQL schema of the module to which URI will be redirected.", "type": "string" } }, diff --git a/packages/manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.2.json b/packages/manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.2.json index b57184edf9..da9f710352 100644 --- a/packages/manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.2.json +++ b/packages/manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.2.json @@ -10,30 +10,37 @@ ], "properties": { "format": { + "description": "Polywrap plugin manifest format version.", "type": "string", "const": "0.0.1-prealpha.2" }, "name": { + "description": "Plugin name.", "type": "string", "format": "packageName" }, "language": { + "description" : "Plugin language.", "type": "string", "format": "pluginLanguage" }, "modules": { + "description": "Modules of Polywrap schema and implementation.", "type": "object", "additionalProperties": false, "properties": { "mutation": { + "description": "Module for mutation operations.", "type": "object", "additionalProperties": false, "properties": { "schema": { + "description": "Path to graphql schema.", "type": "string", "format": "graphqlFile" }, "module": { + "description": "Path to Polywrap implementation.", "type": "string", "format": "file" } @@ -43,14 +50,17 @@ ] }, "query": { + "description": "Module for mutation operations.", "type": "object", "additionalProperties": false, "properties": { "schema": { + "description": "Path to graphql schema.", "type": "string", "format": "graphqlFile" }, "module": { + "description": "Path to Polywrap implementation.", "type": "string", "format": "file" } @@ -62,15 +72,18 @@ } }, "import_redirects": { + "description": "Redirects source URI to local wrapper or plugin.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "uri": { + "description": "Source URI that needs to be redirected.", "type": "string" }, "schema": { + "description": "Path to GraphQL schema of the module to which URI will be redirected.", "type": "string" } }, diff --git a/packages/manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.3.json b/packages/manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.3.json index 523c7fa2f1..bfedbe2f38 100644 --- a/packages/manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.3.json +++ b/packages/manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.3.json @@ -10,35 +10,43 @@ ], "properties": { "format": { + "description": "Polywrap plugin manifest format version.", "type": "string", "const": "0.0.1-prealpha.3" }, "name": { + "description": "Plugin name.", "type": "string", "format": "packageName" }, "language": { + "description" : "Plugin language.", "type": "string", "format": "pluginLanguage" }, "module": { + "description": "Path to Polywrap implementation.", "type": "string", "format": "file" }, "schema": { + "description": "Path to graphql schema.", "type": "string", "format": "graphqlFile" }, "import_redirects": { + "description": "Redirects source URI to local wrapper or plugin.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "uri": { + "description": "Source URI that needs to be redirected.", "type": "string" }, "schema": { + "description": "Path to GraphQL schema of the module to which URI will be redirected.", "type": "string" } }, diff --git a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.1.json b/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.1.json index 64becc108b..7282beb4d6 100644 --- a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.1.json +++ b/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.1.json @@ -7,24 +7,30 @@ ], "properties": { "format": { + "description": "Polywrap manifest format version.", "type": "string", "const": "0.0.1-prealpha.1" }, "description": { + "description": "Description about this wrapper.", "type": "string" }, "repository": { + "description": "Reference to the repository holding source code.", "type": "string" }, "mutation": { + "description": "Mutation module metadata.", "type": "object", "additionalProperties": false, "properties": { "schema": { + "description": "The module's graphql schema.", "type": "object", "additionalProperties": false, "properties": { "file": { + "description": "Path to graphql schema file.", "type": "string", "format": "file" } @@ -34,13 +40,16 @@ ] }, "module": { + "description": "Module for mutation operations.", "type": "object", "additionalProperties": false, "properties": { "language": { + "description": "Language in which the source code is written.", "type": "string" }, "file": { + "description": "Path to Polywrap module implementation file.", "type": "string", "format": "file" } @@ -57,14 +66,17 @@ ] }, "query": { + "description": "Module for query operations.", "type": "object", "additionalProperties": false, "properties": { "schema": { + "description": "The module's graphql schema.", "type": "object", "additionalProperties": false, "properties": { "file": { + "description": "Path to graphql schema file.", "type": "string", "format": "file" } @@ -74,13 +86,16 @@ ] }, "module": { + "description": "Module for query operations.", "type": "object", "additionalProperties": false, "properties": { "language": { + "description": "Language in which the source code is written.", "type": "string" }, "file": { + "description": "Path to Polywrap module implementation file.", "type": "string", "format": "file" } @@ -97,15 +112,18 @@ ] }, "import_redirects": { + "description": "Redirects for the schema's imports.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "uri": { + "description": "Import URI to be redirected.", "type": "string" }, "schema": { + "description": "Path to a graphql schema to be used for the import.", "type": "string" } }, diff --git a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.2.json b/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.2.json index 95bee5e6e9..6e696fd383 100644 --- a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.2.json +++ b/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.2.json @@ -9,33 +9,41 @@ ], "properties": { "format": { + "description": "Polywrap manifest format version", "type": "string", "const": "0.0.1-prealpha.2" }, "repository": { + "description": "Reference to the repository holding source code.", "type": "string" }, "build": { + "description": "Path to the customized build manifest file.", "type": "string", "format": "file" }, "language": { + "description": "Language in which the source code is written.", "type": "string", "format": "wasmLanguage" }, "modules": { + "description": "Modules of Polywrap schema and implementation.", "type": "object", "additionalProperties": false, "properties": { "mutation": { + "description": "Module for mutation operations.", "type": "object", "additionalProperties": false, "properties": { "schema": { + "description": "Path to graphql schema.", "type": "string", "format": "file" }, "module": { + "description": "Path to Polywrap implementation.", "type": "string", "format": "file" } @@ -46,14 +54,17 @@ ] }, "query": { + "description": "Module for query operations.", "type": "object", "additionalProperties": false, "properties": { "schema": { + "description": "Path to graphql schema.", "type": "string", "format": "file" }, "module": { + "description": "Path to Polywrap implementation.", "type": "string", "format": "file" } @@ -66,15 +77,18 @@ } }, "import_redirects": { + "description": "Redirects for the schema's imports.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "uri": { + "description": "Import URI to be redirected.", "type": "string" }, "schema": { + "description": "Path to a graphql schema to be used for the import.", "type": "string" } }, diff --git a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.3.json b/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.3.json index 0cb60875d7..43675e821f 100644 --- a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.3.json +++ b/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.3.json @@ -8,36 +8,45 @@ ], "properties": { "format": { + "description": "Polywrap manifest format version.", "type": "string", "const": "0.0.1-prealpha.3" }, "repository": { + "description": "Reference to the repository holding source code.", "type": "string" }, "build": { + "description": "Path to the customized build manifest file.", "type": "string", "format": "file" }, "language": { + "description": "Language in which the source code is written.", "type": "string", "format": "wasmLanguage" }, "interface": { + "description": "Wrapper has no Wasm implementation, only the schema.", "type": "boolean" }, "modules": { + "description": "Modules of Polywrap schema and implementation.", "type": "object", "additionalProperties": false, "properties": { "mutation": { + "description": "Module for mutation operations.", "type": "object", "additionalProperties": false, "properties": { "schema": { + "description": "Path to graphql schema.", "type": "string", "format": "file" }, "module": { + "description": "Path to Polywrap implementation.", "type": "string", "format": "file" } @@ -47,14 +56,17 @@ ] }, "query": { + "description": "Module for query operations.", "type": "object", "additionalProperties": false, "properties": { "schema": { + "description": "Path to graphql schema.", "type": "string", "format": "file" }, "module": { + "description": "Path to Polywrap implementation.", "type": "string", "format": "file" } @@ -66,15 +78,18 @@ } }, "import_redirects": { + "description": "Redirects for the schema's imports.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "uri": { + "description": "Import URI to be redirected.", "type": "string" }, "schema": { + "description": "Path to a graphql schema to be used for the import.", "type": "string" } }, diff --git a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.4.json b/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.4.json index edd4576818..6e9e6e35c4 100644 --- a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.4.json +++ b/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.4.json @@ -9,33 +9,41 @@ ], "properties": { "format": { + "description": "Polywrap manifest format version.", "type": "string", "const": "0.0.1-prealpha.4" }, "repository": { + "description": "Reference to the repository holding source code.", "type": "string" }, "build": { + "description": "Path to the customized build manifest file.", "type": "string", "format": "file" }, "language": { + "description": "Language in which the source code is written.", "type": "string", "format": "wasmLanguage" }, "modules": { + "description": "Modules of Polywrap schema and implementation.", "type": "object", "additionalProperties": false, "properties": { "mutation": { + "description": "Module for mutation operations.", "type": "object", "additionalProperties": false, "properties": { "schema": { + "description": "Path to graphql schema.", "type": "string", "format": "file" }, "module": { + "description": "Path to Polywrap implementation.", "type": "string", "format": "file" } @@ -45,14 +53,17 @@ ] }, "query": { + "description": "Module for query operations.", "type": "object", "additionalProperties": false, "properties": { "schema": { + "description": "Path to graphql schema.", "type": "string", "format": "file" }, "module": { + "description": "Path to Polywrap implementation.", "type": "string", "format": "file" } @@ -64,15 +75,18 @@ } }, "import_redirects": { + "description": "Redirects for the schema's imports.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "uri": { + "description": "Import URI to be redirected.", "type": "string" }, "schema": { + "description": "Path to a graphql schema to be used for the import.", "type": "string" } }, diff --git a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.5.json b/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.5.json index 6fdcd05337..623bf43829 100644 --- a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.5.json +++ b/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.5.json @@ -9,34 +9,42 @@ ], "properties": { "format": { + "description": "Polywrap manifest format version.", "type": "string", "const": "0.0.1-prealpha.5" }, "build": { + "description": "Path to the customized build manifest file.", "type": "string", "format": "yamlFile" }, "meta": { + "description": "Path to wrapper metadata manifest file.", "type": "string", "format": "yamlFile" }, "language": { + "description": "Language in which the source code is written.", "type": "string", "format": "wasmLanguage" }, "modules": { + "description": "Modules of Polywrap schema and implementation.", "type": "object", "additionalProperties": false, "properties": { "mutation": { + "description": "Module for mutation operations.", "type": "object", "additionalProperties": false, "properties": { "schema": { + "description": "Path to graphql schema.", "type": "string", "format": "graphqlFile" }, "module": { + "description": "Path to Polywrap implementation.", "type": "string", "format": "file" } @@ -46,14 +54,17 @@ ] }, "query": { + "description": "Module for query operations.", "type": "object", "additionalProperties": false, "properties": { "schema": { + "description": "Path to graphql schema.", "type": "string", "format": "graphqlFile" }, "module": { + "description": "Path to Polywrap implementation.", "type": "string", "format": "file" } @@ -65,15 +76,18 @@ } }, "import_redirects": { + "description": "Redirects for the schema's imports.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "uri": { + "description": "Import URI to be redirected.", "type": "string" }, "schema": { + "description": "Path to a graphql schema to be used for the import.", "type": "string" } }, diff --git a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.6.json b/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.6.json index ea756a351e..d15a84c8e4 100644 --- a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.6.json +++ b/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.6.json @@ -9,34 +9,42 @@ ], "properties": { "format": { + "description": "Polywrap manifest format version.", "type": "string", "const": "0.0.1-prealpha.6" }, "build": { + "description": "Path to the customized build manifest file.", "type": "string", "format": "manifestFile" }, "meta": { + "description": "Path to wrapper metadata manifest file.", "type": "string", "format": "manifestFile" }, "language": { + "description": "Language in which the source code is written.", "type": "string", "format": "wasmLanguage" }, "modules": { + "description": "Modules of Polywrap schema and implementation.", "type": "object", "additionalProperties": false, "properties": { "mutation": { + "description": "Module for mutation operations.", "type": "object", "additionalProperties": false, "properties": { "schema": { + "description": "Path to graphql schema.", "type": "string", "format": "graphqlFile" }, "module": { + "description": "Path to Polywrap implementation.", "type": "string", "format": "file" } @@ -46,14 +54,17 @@ ] }, "query": { + "description": "Module for query operations.", "type": "object", "additionalProperties": false, "properties": { "schema": { + "description": "Path to graphql schema.", "type": "string", "format": "graphqlFile" }, "module": { + "description": "Path to Polywrap implementation.", "type": "string", "format": "file" } @@ -65,15 +76,18 @@ } }, "import_redirects": { + "description": "Redirects for the schema's imports.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "uri": { + "description": "Import URI to be redirected.", "type": "string" }, "schema": { + "description": "Path to a graphql schema to be used for the import.", "type": "string" } }, diff --git a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.7.json b/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.7.json index 3aaddec8cc..f507bfc5c9 100644 --- a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.7.json +++ b/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.7.json @@ -10,38 +10,47 @@ ], "properties": { "format": { + "description": "Polywrap manifest format version.", "type": "string", "const": "0.0.1-prealpha.7" }, "name": { + "description": "Name of this wrapper package.", "type": "string", "format": "packageName" }, "build": { + "description": "Path to the customized build manifest file.", "type": "string", "format": "manifestFile" }, "meta": { + "description": "Path to wrapper metadata manifest file.", "type": "string", "format": "manifestFile" }, "language": { + "description": "Language in which the source code is written.", "type": "string", "format": "wasmLanguage" }, "modules": { + "description": "Modules of Polywrap schema and implementation.", "type": "object", "additionalProperties": false, "properties": { "mutation": { + "description": "Module for mutation operations.", "type": "object", "additionalProperties": false, "properties": { "schema": { + "description": "Path to graphql schema.", "type": "string", "format": "graphqlFile" }, "module": { + "description": "Path to Polywrap implementation.", "type": "string", "format": "file" } @@ -51,14 +60,17 @@ ] }, "query": { + "description": "Module for query operations.", "type": "object", "additionalProperties": false, "properties": { "schema": { + "description": "Path to graphql schema.", "type": "string", "format": "graphqlFile" }, "module": { + "description": "Path to Polywrap implementation.", "type": "string", "format": "file" } @@ -70,15 +82,18 @@ } }, "import_redirects": { + "description": "Redirects for the schema's imports.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "uri": { + "description": "Import URI to be redirected.", "type": "string" }, "schema": { + "description": "Path to a graphql schema to be used for the import.", "type": "string" } }, diff --git a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.8.json b/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.8.json index 47382f2e24..1c0feaa85c 100644 --- a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.8.json +++ b/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.8.json @@ -10,42 +10,52 @@ ], "properties": { "format": { + "description": "Polywrap manifest format version.", "type": "string", "const": "0.0.1-prealpha.8" }, "name": { + "description": "Name of this wrapper package.", "type": "string", "format": "packageName" }, "build": { + "description": "Path to the customized build manifest file.", "type": "string", "format": "manifestFile" }, "meta": { + "description": "Path to wrapper metadata manifest file.", "type": "string", "format": "manifestFile" }, "deploy": { + "description": "Path to wrapper deploy manifest file.", "type": "string", "format": "manifestFile" }, "language": { + "description": "Language in which the source code is written.", "type": "string", "format": "wasmLanguage" }, "modules": { + "description": "Modules of Polywrap schema and implementation.", "type": "object", "additionalProperties": false, "properties": { "mutation": { + "description": "Module for mutation operations.", "type": "object", "additionalProperties": false, "properties": { "schema": { + "description": "Path to graphql schema.", "type": "string", "format": "graphqlFile" }, "module": { + "description": "Path to Polywrap implementation.", "type": "string", "format": "file" } @@ -55,14 +65,17 @@ ] }, "query": { + "description": "Module for query operations.", "type": "object", "additionalProperties": false, "properties": { "schema": { + "description": "Path to graphql schema.", "type": "string", "format": "graphqlFile" }, "module": { + "description": "Path to Polywrap implementation.", "type": "string", "format": "file" } @@ -74,15 +87,18 @@ } }, "import_redirects": { + "description": "Redirects for the schema's imports.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "uri": { + "description": "Import URI to be redirected.", "type": "string" }, "schema": { + "description": "Path to a graphql schema to be used for the import.", "type": "string" } }, diff --git a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.9.json b/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.9.json index 6f81020573..03f4e5a3ef 100644 --- a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.9.json +++ b/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.9.json @@ -10,48 +10,61 @@ ], "properties": { "format": { + "description": "Polywrap manifest format version.", "type": "string", "const": "0.0.1-prealpha.9" }, "name": { + "description": "Name of this wrapper package.", "type": "string", "format": "packageName" }, "build": { + "description": "Path to the wrapper build manifest file.", "type": "string", "format": "manifestFile" }, "meta": { + "description": "Path to wrapper metadata manifest file.", "type": "string", "format": "manifestFile" }, "deploy": { + "description": "Path to wrapper deploy manifest file.", "type": "string", "format": "manifestFile" }, "language": { + "description": "Language in which the source code is written.", "type": "string", "format": "wasmLanguage" }, "module": { + "description": "Path to the module's entry point.", "type": "string", "format": "file" }, "schema": { + "description": "Path to the module's graphql schema.", "type": "string", "format": "graphqlFile" }, "import_redirects": { + "description": "Redirects for the schema's imports.", "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "uri": { - "type": "string" + "description": "Import URI to be redirected.", + "type": "string", + "format": "polywrapUri" }, "schema": { - "type": "string" + "description": "Path to a graphql schema to be used for the import.", + "type": "string", + "format": "schemaFile" } }, "required": [ diff --git a/packages/schema/bind/src/bindings/typescript/functions.ts b/packages/schema/bind/src/bindings/typescript/functions.ts index 202ca6a648..bc80d02255 100644 --- a/packages/schema/bind/src/bindings/typescript/functions.ts +++ b/packages/schema/bind/src/bindings/typescript/functions.ts @@ -66,7 +66,7 @@ const _toTypescript = ( switch (type) { case "JSON": - type = "Json"; + type = "Types.Json"; break; default: if (type.includes("Enum_")) { 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 3bd22c19dc..b325904177 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 @@ -38,8 +38,8 @@ export interface CustomType { optBigint?: Types.BigInt | null; bignumber: Types.BigNumber; optBignumber?: Types.BigNumber | null; - json: Json; - optJson?: Json | null; + json: Types.Json; + optJson?: Types.Json | null; bytes: Types.Bytes; optBytes?: Types.Bytes | null; boolean: Types.Boolean; 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 f63231ef88..004fd2aaa9 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 @@ -50,8 +50,8 @@ export interface CustomType { optBigint?: Types.BigInt | null; bignumber: Types.BigNumber; optBignumber?: Types.BigNumber | null; - json: Json; - optJson?: Json | null; + json: Types.Json; + optJson?: Types.Json | null; bytes: Types.Bytes; optBytes?: Types.Bytes | null; boolean: Types.Boolean; diff --git a/yarn.lock b/yarn.lock index 57019aadd2..8da8eb0bc5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1384,9 +1384,9 @@ strip-json-comments "^3.1.1" "@ethersproject/abi@^5.0.0", "@ethersproject/abi@^5.6.3": - version "5.6.3" - resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.6.3.tgz#2d643544abadf6e6b63150508af43475985c23db" - integrity sha512-CxKTdoZY4zDJLWXG6HzNH6znWK0M79WzzxHegDoecE3+K32pzfHOzuXg2/oGSTecZynFgpkjYXNPOqXVJlqClw== + version "5.6.4" + resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.6.4.tgz#f6e01b6ed391a505932698ecc0d9e7a99ee60362" + integrity sha512-TTeZUlCeIHG6527/2goZA6gW5F8Emoc7MrZDC7hhP84aRGvW3TEdTnZR08Ls88YXM1m2SuK42Osw/jSi3uO8gg== dependencies: "@ethersproject/address" "^5.6.1" "@ethersproject/bignumber" "^5.6.2" @@ -1571,9 +1571,9 @@ integrity sha512-BiBWllUROH9w+P21RzoxJKzqoqpkyM1pRnEKG69bulE9TSQD8SAIvTQqIMZmmCO8pUNkgLP1wndX1gKghSpBmg== "@ethersproject/networks@^5.0.0", "@ethersproject/networks@^5.0.3", "@ethersproject/networks@^5.6.3": - version "5.6.3" - resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.6.3.tgz#3ee3ab08f315b433b50c99702eb32e0cf31f899f" - integrity sha512-QZxRH7cA5Ut9TbXwZFiCyuPchdWi87ZtVNHWZd0R6YFgYtes2jQ3+bsslJ0WdyDe0i6QumqtoYqvY3rrQFRZOQ== + version "5.6.4" + resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.6.4.tgz#51296d8fec59e9627554f5a8a9c7791248c8dc07" + integrity sha512-KShHeHPahHI2UlWdtDMn2lJETcbtaJge4k7XSjDR9h79QTd6yQJmv6Cp2ZA4JdqWnhszAOLSuJEd9C0PRw7hSQ== dependencies: "@ethersproject/logger" "^5.6.0" @@ -3472,14 +3472,14 @@ integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA== "@tsconfig/node12@^1.0.7": - version "1.0.10" - resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.10.tgz#10fecee4a3be17357ce99b370bd81874044d8dbd" - integrity sha512-N+srakvPaYMGkwjNDx3ASx65Zl3QG8dJgVtIB+YMOkucU+zctlv/hdP5250VKdDHSDoW9PFZoCqbqNcAPjCjXA== + version "1.0.11" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" + integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== "@tsconfig/node14@^1.0.0": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.2.tgz#b09c08de2eb319ca2acab17a1b8028af110b24b3" - integrity sha512-YwrUA5ysDXHFYfL0Xed9x3sNS4P+aKlCOnnbqUa2E5HdQshHFleCJVrj1PlGTb4GgFUCDyte1v3JWLy2sz8Oqg== + version "1.0.3" + resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" + integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== "@tsconfig/node16@^1.0.2": version "1.0.3" @@ -3670,9 +3670,9 @@ integrity sha512-wH6Tu9mbiOt0n5EvdoWy0VGQaJMHfLIxY/6wS0xLC7CV1taM6gESEzcYy0ZlWvxxiiljYvfDIvz4hHbUUDRlhw== "@types/node@*": - version "17.0.44" - resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.44.tgz#16dd0bb5338f016d8ca10631789f0d0612fe5d5b" - integrity sha512-gWYiOlu6Y4oyLYBvsJAPlwHbC8H4tX+tLsHy6Ee976wedwwZKrG2hFl3Y/HiH6bIyLTbDWQexQF/ohwKkOpUCg== + version "18.0.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.0.0.tgz#67c7b724e1bcdd7a8821ce0d5ee184d3b4dd525a" + integrity sha512-cHlGmko4gWLVI27cGJntjs/Sj8th9aYwplmZFwmmgYQQvL5NUsgVJG7OddLvNfLqYS31KFN0s3qlaD9qCaxACA== "@types/node@12.12.26": version "12.12.26" @@ -5640,9 +5640,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.30001349: - version "1.0.30001354" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001354.tgz#95c5efdb64148bb4870771749b9a619304755ce5" - integrity sha512-mImKeCkyGDAHNywYFA4bqnLAzTUvVkqPvhY4DV47X+Gl2c5Z8c3KNETnXp14GQt11LvxE8AwjzGxJ+rsikiOzg== + version "1.0.30001357" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001357.tgz#dec7fc4158ef6ad24690d0eec7b91f32b8cb1b5d" + integrity sha512-b+KbWHdHePp+ZpNj+RDHFChZmuN+J5EvuQUlee9jOQIUAdhv9uvAZeEtUeLAknXbkiu1uxjQ9NLp1ie894CuWg== capture-exit@^2.0.0: version "2.0.0" @@ -7320,9 +7320,9 @@ electron-fetch@^1.7.2: encoding "^0.1.13" electron-to-chromium@^1.3.378, electron-to-chromium@^1.4.147: - version "1.4.157" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.157.tgz#25799684ed6f2be52bee2b716f9de257b24f3ba7" - integrity sha512-gteFnXPKsDAdm1U5vVuyrLnKOaR/x/SY+HjUQoHypLUYWJt4RaWU3PaiTBEkRDJh8/Zd8KC/EFjV+uPaHsjKFA== + version "1.4.161" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.161.tgz#49cb5b35385bfee6cc439d0a04fbba7a7a7f08a1" + integrity sha512-sTjBRhqh6wFodzZtc5Iu8/R95OkwaPNn7tj/TaDU5nu/5EFiQDtADGAXdR4tJcTEHlYfJpHqigzJqHvPgehP8A== elliptic@6.5.4, elliptic@^6.5.3: version "6.5.4" @@ -9952,7 +9952,7 @@ is-color-stop@^1.0.0: rgb-regex "^1.0.1" rgba-regex "^1.0.0" -is-core-module@^2.5.0, is-core-module@^2.8.1: +is-core-module@^2.5.0, is-core-module@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.9.0.tgz#e1c34429cd51c6dd9e09e0799e396e27b19a9c69" integrity sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A== @@ -12547,9 +12547,9 @@ minipass@^2.6.0, minipass@^2.9.0: yallist "^3.0.0" minipass@^3.0.0, minipass@^3.1.0, minipass@^3.1.1, minipass@^3.1.3: - version "3.1.6" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.6.tgz#3b8150aa688a711a1521af5e8779c1d3bb4f45ee" - integrity sha512-rty5kpw9/z8SX9dmxblFA6edItUmwJgMeYDZRrwlIVN27i8gysGbznJwUggw2V/FVqFSDdWy040ZPS811DYAqQ== + version "3.3.3" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.3.3.tgz#fd1f0e6c06449c10dadda72618b59c00f3d6378d" + integrity sha512-N0BOsdFAlNRfmwMhjAsLVWOk7Ljmeb39iqFlsV1At+jqRhSUP9yeof8FyJu4imaJiSUp8vQebWD/guZwGQC8iA== dependencies: yallist "^4.0.0" @@ -14757,9 +14757,9 @@ prettier@2.2.1: integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== prettier@^2.2.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.0.tgz#a4fdae07e5596c51c9857ea676cd41a0163879d6" - integrity sha512-nwoX4GMFgxoPC6diHvSwmK/4yU8FFH3V8XWtLQrbj4IBsK2pkYhG4kf/ljF/haaZ/aii+wNJqISrCDPgxGWDVQ== + version "2.7.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" + integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== pretty-bytes@^5.1.0: version "5.6.0" @@ -15774,11 +15774,11 @@ resolve@1.15.0: path-parse "^1.0.6" resolve@^1.10.0, resolve@^1.12.0, resolve@^1.14.2, resolve@^1.15.1, resolve@^1.17.0, resolve@^1.18.1, resolve@^1.20.0, resolve@^1.3.2, resolve@^1.8.1: - version "1.22.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.0.tgz#5e0b8c67c15df57a89bdbabe603a002f21731198" - integrity sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw== + version "1.22.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" + integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== dependencies: - is-core-module "^2.8.1" + is-core-module "^2.9.0" path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" @@ -17494,14 +17494,14 @@ typescript@4.0.7: integrity sha512-yi7M4y74SWvYbnazbn8/bmJmX4Zlej39ZOqwG/8dut/MYoSQ119GY9ZFbbGsD4PFZYWxqik/XsP3vk3+W5H3og== typescript@^4.0: - version "4.7.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.3.tgz#8364b502d5257b540f9de4c40be84c98e23a129d" - integrity sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA== + version "4.7.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" + integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== uglify-js@^3.1.4: - version "3.16.0" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.16.0.tgz#b778ba0831ca102c1d8ecbdec2d2bdfcc7353190" - integrity sha512-FEikl6bR30n0T3amyBh3LoiBdqHRy/f4H80+My34HOesOKyHfOsxAPAxOoqC0JUnC1amnO0IwkYC3sko51caSw== + version "3.16.1" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.16.1.tgz#0e7ec928b3d0b1e1d952bce634c384fd56377317" + integrity sha512-X5BGTIDH8U6IQ1TIRP62YC36k+ULAa1d59BxlWvPUJ1NkW5L3FwcGfEzuVvGmhJFBu0YJ5Ge25tmRISqCmLiRQ== uid-number@0.0.6: version "0.0.6"