From 06ba2e5b56b8b15824c446ba324b267c1379637c Mon Sep 17 00:00:00 2001 From: cbrzn Date: Tue, 28 Jun 2022 14:51:25 +0200 Subject: [PATCH 01/46] chore(cli/compiler): update build modules logic to support wrap.info & wrap.wasm --- packages/cli/src/lib/Compiler.ts | 79 +++++------------- .../wrappers/valid/polywrap.build.json | 6 -- .../__tests__/wrappers/valid/polywrap.json | 9 -- .../valid/{schema.graphql => wrap.info} | 0 .../wrappers/valid/{module.wasm => wrap.wasm} | Bin .../006-custom-dockerfile/Dockerfile | 2 +- 6 files changed, 24 insertions(+), 72 deletions(-) delete mode 100644 packages/js/validation/src/__tests__/wrappers/valid/polywrap.build.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/valid/polywrap.json rename packages/js/validation/src/__tests__/wrappers/valid/{schema.graphql => wrap.info} (100%) rename packages/js/validation/src/__tests__/wrappers/valid/{module.wasm => wrap.wasm} (100%) diff --git a/packages/cli/src/lib/Compiler.ts b/packages/cli/src/lib/Compiler.ts index 1fefd3427d..6ffb5bdf50 100644 --- a/packages/cli/src/lib/Compiler.ts +++ b/packages/cli/src/lib/Compiler.ts @@ -17,8 +17,9 @@ import { import { PolywrapManifest, - BuildManifest, + WrapManifest, MetaManifest, + msgpackEncode, } from "@polywrap/core-js"; import { WasmWrapper } from "@polywrap/client-js"; import { WrapImports } from "@polywrap/client-js/build/wasm/types"; @@ -98,26 +99,20 @@ export class Compiler { // Init & clean output directory resetDir(this._config.outputDir); - await this._outputComposedSchema(state); - - let buildManifest: BuildManifest | undefined = undefined; + await this._outputInfo(state); if (!(await this._isInterface())) { // Generate the bindings await this._generateCode(state); // Compile the Wrapper - buildManifest = await this._buildModules(state); + await this._buildModules(state); } // Output all metadata if present const metaManifest = await this._outputMetadata(); - await this._outputManifests( - state.polywrapManifest, - buildManifest, - metaManifest - ); + await this._outputManifests(metaManifest); }; if (project.quiet) { @@ -230,7 +225,7 @@ export class Compiler { return writeDirectorySync(binding.outputDirAbs, binding.output); } - private async _buildModules(state: CompilerState): Promise { + private async _buildModules(state: CompilerState): Promise { const { outputDir } = this._config; const { polywrapManifest } = state; @@ -239,24 +234,14 @@ export class Compiler { } // Build the sources - const dockerImageId = await this._buildSourcesInDocker(); + await this._buildSourcesInDocker(); // Validate the Wasm module await this._validateWasmModule(outputDir); // Update the PolywrapManifest - polywrapManifest.module = "./module.wasm"; - polywrapManifest.schema = "./schema.graphql"; - polywrapManifest.build = "./polywrap.build.json"; - - // Create the BuildManifest - return { - format: "0.0.1-prealpha.3", - __type: "BuildManifest", - docker: { - buildImageId: dockerImageId, - }, - }; + polywrapManifest.module = "./wrap.wasm"; + // polywrapManifest.info = "./wrap.info"; } private async _buildSourcesInDocker(): Promise { @@ -331,7 +316,7 @@ export class Compiler { await copyArtifactsFromBuildImage( outputDir, - "module.wasm", + "wrap.wasm", imageName, removeBuilder, removeImage, @@ -342,43 +327,25 @@ export class Compiler { return dockerImageId; } - private async _outputComposedSchema(state: CompilerState): Promise { + private async _outputInfo(state: CompilerState): Promise { const { outputDir } = this._config; - writeFileSync( - `${outputDir}/schema.graphql`, - state.composerOutput.schema, - "utf-8" - ); - - // Update the PolywrapManifest schema paths - state.polywrapManifest = { - ...state.polywrapManifest, - schema: "./schema.graphql", + const info: WrapManifest = { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + abi: state.composerOutput.typeInfo as unknown, + name: state.polywrapManifest.name, + type: state.polywrapManifest.module ? "wasm" : "interface", + version: "0.0.1", + __type: "WrapManifest", }; + + writeFileSync(`${outputDir}/wrap.info`, msgpackEncode(info)); } - private async _outputManifests( - polywrapManifest: PolywrapManifest, - buildManifest?: BuildManifest, - metaManifest?: MetaManifest - ): Promise { + private async _outputManifests(metaManifest?: MetaManifest): Promise { const { outputDir, project } = this._config; - await outputManifest( - polywrapManifest, - path.join(outputDir, "polywrap.json"), - project.quiet - ); - - if (buildManifest) { - await outputManifest( - buildManifest, - path.join(outputDir, "polywrap.build.json"), - project.quiet - ); - } - if (metaManifest) { await outputManifest( metaManifest, @@ -424,7 +391,7 @@ export class Compiler { } private async _validateWasmModule(buildDir: string): Promise { - const modulePath = path.join(buildDir, `module.wasm`); + const modulePath = path.join(buildDir, `wrap.wasm`); const wasmSource = fs.readFileSync(modulePath); const wrapImports: Record void> = { __wrap_subinvoke: () => {}, diff --git a/packages/js/validation/src/__tests__/wrappers/valid/polywrap.build.json b/packages/js/validation/src/__tests__/wrappers/valid/polywrap.build.json deleted file mode 100644 index fb006acf11..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/valid/polywrap.build.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "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 deleted file mode 100644 index ab7f052a11..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/valid/polywrap.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "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/schema.graphql b/packages/js/validation/src/__tests__/wrappers/valid/wrap.info similarity index 100% rename from packages/js/validation/src/__tests__/wrappers/valid/schema.graphql rename to packages/js/validation/src/__tests__/wrappers/valid/wrap.info diff --git a/packages/js/validation/src/__tests__/wrappers/valid/module.wasm b/packages/js/validation/src/__tests__/wrappers/valid/wrap.wasm similarity index 100% rename from packages/js/validation/src/__tests__/wrappers/valid/module.wasm rename to packages/js/validation/src/__tests__/wrappers/valid/wrap.wasm diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/006-custom-dockerfile/Dockerfile b/packages/test-cases/cases/cli/wasm/build-cmd/006-custom-dockerfile/Dockerfile index c8df8fd245..ddfb89b7e0 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/006-custom-dockerfile/Dockerfile +++ b/packages/test-cases/cases/cli/wasm/build-cmd/006-custom-dockerfile/Dockerfile @@ -30,7 +30,7 @@ COPY ./package.json ./package.json # Build the module at src RUN ./node_modules/.bin/asc src/wrap/entry.ts \ --path ./node_modules \ - --outFile ./build/module.wasm \ + --outFile ./build/wrap.wasm \ --use abort=src/wrap/entry/wrapAbort \ --optimize --debug --importMemory \ --runtime stub \ From c73bf0b72fbc0b863bc536f50eb8d5936c0a8a9d Mon Sep 17 00:00:00 2001 From: cbrzn Date: Tue, 28 Jun 2022 14:53:07 +0200 Subject: [PATCH 02/46] chore(manifest-schemas): add wrap.info folder and create polywrap folder for toolchain manifest --- .../polywrap.app/0.0.1-prealpha.1.json | 0 .../polywrap.app/0.0.1-prealpha.2.json | 0 .../polywrap.build/0.0.1-prealpha.1.json | 0 .../polywrap.build/0.0.1-prealpha.2.json | 0 .../polywrap.build/0.0.1-prealpha.3.json | 0 .../polywrap.deploy/0.0.1-prealpha.1.json | 0 .../polywrap.infra/0.0.1-prealpha.1.json | 0 .../polywrap.infra/0.0.1-prealpha.2.json | 0 .../polywrap.meta/0.0.1-prealpha.1.json | 0 .../polywrap.meta/0.0.1-prealpha.2.json | 0 .../polywrap.meta/0.0.1-prealpha.3.json | 0 .../polywrap.plugin/0.0.1-prealpha.1.json | 0 .../polywrap.plugin/0.0.1-prealpha.2.json | 0 .../polywrap.plugin/0.0.1-prealpha.3.json | 0 .../polywrap/0.0.1-prealpha.1.json | 0 .../polywrap/0.0.1-prealpha.2.json | 0 .../polywrap/0.0.1-prealpha.3.json | 0 .../polywrap/0.0.1-prealpha.4.json | 0 .../polywrap/0.0.1-prealpha.5.json | 0 .../polywrap/0.0.1-prealpha.6.json | 0 .../polywrap/0.0.1-prealpha.7.json | 0 .../polywrap/0.0.1-prealpha.8.json | 0 .../polywrap/0.0.1-prealpha.9.json | 0 .../manifest-schemas/wrap.info/0.0.1.json | 31 +++++++++++++++++++ 24 files changed, 31 insertions(+) rename packages/manifest-schemas/{formats => polywrap}/polywrap.app/0.0.1-prealpha.1.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap.app/0.0.1-prealpha.2.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap.build/0.0.1-prealpha.1.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap.build/0.0.1-prealpha.2.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap.build/0.0.1-prealpha.3.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap.deploy/0.0.1-prealpha.1.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap.infra/0.0.1-prealpha.1.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap.infra/0.0.1-prealpha.2.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap.meta/0.0.1-prealpha.1.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap.meta/0.0.1-prealpha.2.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap.meta/0.0.1-prealpha.3.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap.plugin/0.0.1-prealpha.1.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap.plugin/0.0.1-prealpha.2.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap.plugin/0.0.1-prealpha.3.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap/0.0.1-prealpha.1.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap/0.0.1-prealpha.2.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap/0.0.1-prealpha.3.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap/0.0.1-prealpha.4.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap/0.0.1-prealpha.5.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap/0.0.1-prealpha.6.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap/0.0.1-prealpha.7.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap/0.0.1-prealpha.8.json (100%) rename packages/manifest-schemas/{formats => polywrap}/polywrap/0.0.1-prealpha.9.json (100%) create mode 100644 packages/manifest-schemas/wrap.info/0.0.1.json diff --git a/packages/manifest-schemas/formats/polywrap.app/0.0.1-prealpha.1.json b/packages/manifest-schemas/polywrap/polywrap.app/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap.app/0.0.1-prealpha.1.json rename to packages/manifest-schemas/polywrap/polywrap.app/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/formats/polywrap.app/0.0.1-prealpha.2.json b/packages/manifest-schemas/polywrap/polywrap.app/0.0.1-prealpha.2.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap.app/0.0.1-prealpha.2.json rename to packages/manifest-schemas/polywrap/polywrap.app/0.0.1-prealpha.2.json diff --git a/packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.1.json b/packages/manifest-schemas/polywrap/polywrap.build/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.1.json rename to packages/manifest-schemas/polywrap/polywrap.build/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.2.json b/packages/manifest-schemas/polywrap/polywrap.build/0.0.1-prealpha.2.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.2.json rename to packages/manifest-schemas/polywrap/polywrap.build/0.0.1-prealpha.2.json diff --git a/packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.3.json b/packages/manifest-schemas/polywrap/polywrap.build/0.0.1-prealpha.3.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.3.json rename to packages/manifest-schemas/polywrap/polywrap.build/0.0.1-prealpha.3.json diff --git a/packages/manifest-schemas/formats/polywrap.deploy/0.0.1-prealpha.1.json b/packages/manifest-schemas/polywrap/polywrap.deploy/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap.deploy/0.0.1-prealpha.1.json rename to packages/manifest-schemas/polywrap/polywrap.deploy/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/formats/polywrap.infra/0.0.1-prealpha.1.json b/packages/manifest-schemas/polywrap/polywrap.infra/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap.infra/0.0.1-prealpha.1.json rename to packages/manifest-schemas/polywrap/polywrap.infra/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/formats/polywrap.infra/0.0.1-prealpha.2.json b/packages/manifest-schemas/polywrap/polywrap.infra/0.0.1-prealpha.2.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap.infra/0.0.1-prealpha.2.json rename to packages/manifest-schemas/polywrap/polywrap.infra/0.0.1-prealpha.2.json diff --git a/packages/manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.1.json b/packages/manifest-schemas/polywrap/polywrap.meta/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.1.json rename to packages/manifest-schemas/polywrap/polywrap.meta/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.2.json b/packages/manifest-schemas/polywrap/polywrap.meta/0.0.1-prealpha.2.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.2.json rename to packages/manifest-schemas/polywrap/polywrap.meta/0.0.1-prealpha.2.json diff --git a/packages/manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.3.json b/packages/manifest-schemas/polywrap/polywrap.meta/0.0.1-prealpha.3.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.3.json rename to packages/manifest-schemas/polywrap/polywrap.meta/0.0.1-prealpha.3.json diff --git a/packages/manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.1.json b/packages/manifest-schemas/polywrap/polywrap.plugin/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.1.json rename to packages/manifest-schemas/polywrap/polywrap.plugin/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.2.json b/packages/manifest-schemas/polywrap/polywrap.plugin/0.0.1-prealpha.2.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.2.json rename to packages/manifest-schemas/polywrap/polywrap.plugin/0.0.1-prealpha.2.json diff --git a/packages/manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.3.json b/packages/manifest-schemas/polywrap/polywrap.plugin/0.0.1-prealpha.3.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.3.json rename to packages/manifest-schemas/polywrap/polywrap.plugin/0.0.1-prealpha.3.json diff --git a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.1.json b/packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.1.json rename to packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.2.json b/packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.2.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.2.json rename to packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.2.json diff --git a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.3.json b/packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.3.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.3.json rename to packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.3.json diff --git a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.4.json b/packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.4.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.4.json rename to packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.4.json diff --git a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.5.json b/packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.5.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.5.json rename to packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.5.json diff --git a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.6.json b/packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.6.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.6.json rename to packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.6.json diff --git a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.7.json b/packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.7.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.7.json rename to packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.7.json diff --git a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.8.json b/packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.8.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.8.json rename to packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.8.json diff --git a/packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.9.json b/packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.9.json similarity index 100% rename from packages/manifest-schemas/formats/polywrap/0.0.1-prealpha.9.json rename to packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.9.json diff --git a/packages/manifest-schemas/wrap.info/0.0.1.json b/packages/manifest-schemas/wrap.info/0.0.1.json new file mode 100644 index 0000000000..307727285d --- /dev/null +++ b/packages/manifest-schemas/wrap.info/0.0.1.json @@ -0,0 +1,31 @@ +{ + "id": "WrapManifest", + "type": "object", + "additionalProperties": false, + "required": [ + "version", + "name", + "type", + "abi" + ], + "properties": { + "version": { + "description": "Wrap manifest format version", + "type": "string", + "const": "0.0.1" + }, + "type": { + "description" : "Wrap language", + "type": "string", + "format": "validType" + }, + "name": { + "description": "Wrapper name", + "type": "string" + }, + "abi": { + "description": "Type info of wrapper", + "type": "object" + } + } +} From b5983e1a159c83c0bf7b2965e8da04fb2cc7b01c Mon Sep 17 00:00:00 2001 From: cbrzn Date: Tue, 28 Jun 2022 14:55:36 +0200 Subject: [PATCH 03/46] chore(js/core): create new templates for different manifest files --- .../scripts/manifest/generateFormatTypes.js | 180 ------------------ .../{ => polywrap}/deserialize-ts.mustache | 0 .../manifest/{ => polywrap}/index-ts.mustache | 0 .../{ => polywrap}/migrate-ts.mustache | 0 .../manifest/polywrap/validate-ts.mustache | 67 +++++++ .../wrap.info/deserialize-ts.mustache | 61 ++++++ .../manifest/wrap.info/index-ts.mustache | 39 ++++ .../manifest/wrap.info/migrate-ts.mustache | 59 ++++++ .../{ => wrap.info}/validate-ts.mustache | 0 9 files changed, 226 insertions(+), 180 deletions(-) delete mode 100644 packages/js/core/scripts/manifest/generateFormatTypes.js rename packages/js/core/scripts/manifest/{ => polywrap}/deserialize-ts.mustache (100%) rename packages/js/core/scripts/manifest/{ => polywrap}/index-ts.mustache (100%) rename packages/js/core/scripts/manifest/{ => polywrap}/migrate-ts.mustache (100%) create mode 100644 packages/js/core/scripts/manifest/polywrap/validate-ts.mustache create mode 100644 packages/js/core/scripts/manifest/wrap.info/deserialize-ts.mustache create mode 100644 packages/js/core/scripts/manifest/wrap.info/index-ts.mustache create mode 100644 packages/js/core/scripts/manifest/wrap.info/migrate-ts.mustache rename packages/js/core/scripts/manifest/{ => wrap.info}/validate-ts.mustache (100%) diff --git a/packages/js/core/scripts/manifest/generateFormatTypes.js b/packages/js/core/scripts/manifest/generateFormatTypes.js deleted file mode 100644 index d46882c057..0000000000 --- a/packages/js/core/scripts/manifest/generateFormatTypes.js +++ /dev/null @@ -1,180 +0,0 @@ -const SchemaToTypescript = require("json-schema-to-typescript"); -const os = require("@polywrap/os-js"); -const fs = require("fs"); -const path = require("path"); -const Mustache = require("mustache"); - -async function generateFormatTypes() { - // Fetch all schemas within the @polywrap/manifest-schemas/formats directory - const formatsDir = path.join( - path.dirname(require.resolve("@polywrap/manifest-schemas")), - "formats" - ); - - // Get all format types (polywrap, polywrap.build, etc) - const formatTypes = fs.readdirSync( - formatsDir, { withFileTypes: true } - ).filter((dirent) => dirent.isDirectory); - - // For each format type - for (let i = 0; i < formatTypes.length; ++i) { - const formatTypeName = formatTypes[i].name; - const formatTypeDir = path.join(formatsDir, formatTypeName); - const formatModules = []; - - // Get all JSON schemas for this format type (v1, v2, etc) - const formatSchemaFiles = fs.readdirSync(formatTypeDir); - const formatSchemas = []; - - for (let k = 0; k < formatSchemaFiles.length; ++k) { - const formatSchemaName = formatSchemaFiles[k]; - const formatVersion = formatSchemaName.replace(".json", ""); - const formatSchemaPath = path.join(formatTypeDir, formatSchemaName); - - try { - // Parse the JSON schema - const formatSchema = JSON.parse( - fs.readFileSync(formatSchemaPath, { encoding: "utf-8" }) - ); - - // Insert the __type property for introspection - formatSchema.properties["__type"] = { - type: "string", - const: formatSchema.id - }; - formatSchema.required = [ - ...formatSchema.required, - "__type" - ]; - - formatSchemas.push(formatSchema); - - // Convert it to a TypeScript interface - const tsFile = await SchemaToTypescript.compile( - formatSchema, - formatSchema.id - ); - - // Emit the result - const tsOutputPath = path.join(__dirname, `/../../src/manifest/formats/${formatTypeName}/${formatVersion}.ts`); - fs.mkdirSync(path.dirname(tsOutputPath), { recursive: true }); - os.writeFileSync( - tsOutputPath, - `/* eslint-disable @typescript-eslint/naming-convention */\n${tsFile}` - ); - - // Add metadata for the root index.ts file to use - formatModules.push({ - interface: formatSchema.id, - version: formatVersion - }); - } catch (error) { - console.error(`Error generating the Manifest file ${formatSchemaPath}: `, error); - throw error; - } - } - - const renderTemplate = (name, context) => { - const tsTemplate = fs.readFileSync( - __dirname + `/${name}-ts.mustache`, { encoding: "utf-8" } - ); - - // Render the template - const tsSrc = Mustache.render(tsTemplate, context); - - // Emit the source - const tsOutputPath = path.join(__dirname, `/../../src/manifest/formats/${formatTypeName}/${name}.ts`); - fs.mkdirSync(path.dirname(tsOutputPath), { recursive: true }); - os.writeFileSync(tsOutputPath, tsSrc); - } - - const lastItem = (arr) => arr[arr.length - 1]; - const versionToTs = (version) => - version.replace(/\./g, "_").replace(/\-/g, "_"); - - // Generate an index.ts file that exports root types that aggregate all versions - const indexContext = { }; - indexContext.formats = formatModules.map((module) => { - return { - type: module.interface, - version: module.version, - tsVersion: versionToTs(module.version) - } - }); - indexContext.latest = lastItem(indexContext.formats); - - renderTemplate("index", indexContext); - - // Generate a migrate.ts file that exports a migration function from all version to the latest version - const migrateContext = { }; - migrateContext.prevFormats = formatModules.map((module) => { - return { - type: module.interface, - version: module.version, - tsVersion: versionToTs(module.version) - } - }); - migrateContext.latest = lastItem(migrateContext.prevFormats); - migrateContext.prevFormats.pop(); - - renderTemplate("migrate", migrateContext); - - // Generate a deserialize.ts file that exports a deserialization function for the latest format version - const deserializeContext = { - type: migrateContext.latest.type - }; - - renderTemplate("deserialize", deserializeContext); - - // Generate a validate.ts file that validates the manifest against the JSON schema - const validateContext = { }; - validateContext.formats = formatModules.map((module) => { - return { - type: module.interface, - version: module.version, - tsVersion: versionToTs(module.version), - dir: formatTypeName - }; - }); - validateContext.latest = lastItem(validateContext.formats); - - // Extract all validators - validateContext.validators = []; - - for (let k = 0; k < formatSchemas.length; ++k) { - const formatSchema = formatSchemas[k]; - - const getValidator = (obj) => { - if (typeof obj !== "object") { - return; - } - - if (obj.format && typeof obj.format === "string") { - if (validateContext.validators.indexOf(obj.format) === -1) { - validateContext.validators.push(obj.format); - } - } - - const keys = Object.keys(obj); - for (let j = 0; j < keys.length; ++j) { - getValidator(obj[keys[j]]); - } - } - - getValidator(formatSchema); - } - - renderTemplate("validate", validateContext); - } - - return Promise.resolve(); -}; - -generateFormatTypes() - .then(text => { - process.exit(); - }) - .catch(err => { - console.error(err); - process.abort(); - }); diff --git a/packages/js/core/scripts/manifest/deserialize-ts.mustache b/packages/js/core/scripts/manifest/polywrap/deserialize-ts.mustache similarity index 100% rename from packages/js/core/scripts/manifest/deserialize-ts.mustache rename to packages/js/core/scripts/manifest/polywrap/deserialize-ts.mustache diff --git a/packages/js/core/scripts/manifest/index-ts.mustache b/packages/js/core/scripts/manifest/polywrap/index-ts.mustache similarity index 100% rename from packages/js/core/scripts/manifest/index-ts.mustache rename to packages/js/core/scripts/manifest/polywrap/index-ts.mustache diff --git a/packages/js/core/scripts/manifest/migrate-ts.mustache b/packages/js/core/scripts/manifest/polywrap/migrate-ts.mustache similarity index 100% rename from packages/js/core/scripts/manifest/migrate-ts.mustache rename to packages/js/core/scripts/manifest/polywrap/migrate-ts.mustache diff --git a/packages/js/core/scripts/manifest/polywrap/validate-ts.mustache b/packages/js/core/scripts/manifest/polywrap/validate-ts.mustache new file mode 100644 index 0000000000..87ca05b555 --- /dev/null +++ b/packages/js/core/scripts/manifest/polywrap/validate-ts.mustache @@ -0,0 +1,67 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/validate-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ +import { + Any{{#latest}}{{type}}{{/latest}}, + {{#latest}}{{type}}{{/latest}}Formats +} from "."; +{{#validators.length}}import * as Validators from "../../validators";{{/validators.length}} +{{#formats}} +import schema_{{tsVersion}} from "@polywrap/manifest-schemas/polywrap/{{dir}}/{{version}}.json"; +{{/formats}} +import { Tracer } from "@polywrap/tracing-js" + +import { + Schema, + Validator, + ValidationError, + ValidatorResult +} from "jsonschema"; + +type {{#latest}}{{type}}{{/latest}}Schemas = { + [key in {{#latest}}{{type}}{{/latest}}Formats]: Schema | undefined +}; + +const schemas: {{#latest}}{{type}}{{/latest}}Schemas = { + {{#formats}} + "{{version}}": schema_{{tsVersion}}, + {{/formats}} +}; + +const validator = new Validator(); + +{{#validators}} +Validator.prototype.customFormats.{{.}} = Validators.{{.}}; +{{/validators}} + +export const validate{{#latest}}{{type}}{{/latest}} = Tracer.traceFunc( + "core: validate{{#latest}}{{type}}{{/latest}}", + ( + manifest: Any{{#latest}}{{type}}{{/latest}}, + extSchema: Schema | undefined = undefined + ): void => { + const schema = schemas[manifest.format as {{#latest}}{{type}}{{/latest}}Formats]; + + if (!schema) { + throw Error(`Unrecognized {{#latest}}{{type}}{{/latest}} schema format "${manifest.format}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); + } + + const throwIfErrors = (result: ValidatorResult) => { + if (result.errors.length) { + throw new Error([ + `Validation errors encountered while sanitizing {{#latest}}{{type}}{{/latest}} format ${manifest.format}`, + ...result.errors.map((error: ValidationError) => error.toString()) + ].join("\n")); + } + }; + + throwIfErrors(validator.validate(manifest, schema)); + + if (extSchema) { + throwIfErrors(validator.validate(manifest, extSchema)); + } + } +); diff --git a/packages/js/core/scripts/manifest/wrap.info/deserialize-ts.mustache b/packages/js/core/scripts/manifest/wrap.info/deserialize-ts.mustache new file mode 100644 index 0000000000..b878a34338 --- /dev/null +++ b/packages/js/core/scripts/manifest/wrap.info/deserialize-ts.mustache @@ -0,0 +1,61 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, + * and run node ./scripts/manifest/generateTypes.js to regenerate this file. + */ + +import { + {{type}}, + Any{{type}}, + migrate{{type}}, + validate{{type}}, + latest{{type}}Version, +} from "."; +import { DeserializeManifestOptions } from "../../"; + +import { compare } from "semver"; +import YAML from "js-yaml"; +import { Tracer } from "@polywrap/tracing-js"; + +export const deserialize{{type}} = Tracer.traceFunc( + "core: deserialize{{type}}", + (manifest: string, options?: DeserializeManifestOptions): {{type}} => { + let any{{type}}: Any{{type}} | undefined; + try { + any{{type}} = JSON.parse(manifest) as Any{{type}}; + } catch (e) { + any{{type}} = YAML.safeLoad(manifest) as + | Any{{type}} + | undefined; + } + + if (!any{{type}}) { + throw Error(`Unable to parse {{type}}: ${manifest}`); + } + + if (!options || !options.noValidate) { + validate{{type}}(any{{type}}, options?.extSchema); + } + + any{{type}}.__type = "{{type}}"; + + const versionCompare = compare( + any{{type}}.version, + latest{{type}}Version + ); + + if (versionCompare === -1) { + // Upgrade + return migrate{{type}}(any{{type}}, latest{{type}}Version); + } else if (versionCompare === 1) { + // Downgrade + throw Error( + `Cannot downgrade wrap.info version ${anyWrapManifest.version}, please upgrade your PolywrapClient package.` + ); + } else { + // Latest + return any{{type}} as {{type}}; + } + } +); diff --git a/packages/js/core/scripts/manifest/wrap.info/index-ts.mustache b/packages/js/core/scripts/manifest/wrap.info/index-ts.mustache new file mode 100644 index 0000000000..bb87660abc --- /dev/null +++ b/packages/js/core/scripts/manifest/wrap.info/index-ts.mustache @@ -0,0 +1,39 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/index-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/index-ts.mustache, + * and run node ./scripts/manifest/generateTypes.js to regenerate this file. + */ + +{{#formats}} +import { + {{type}} as {{type}}{{tsVersion}} +} from "./{{version}}"; +{{/formats}} + +export { + {{#formats}} + {{type}}{{tsVersion}}, + {{/formats}} +}; + +export enum {{#latest}}{{type}}{{/latest}}Formats { + {{#formats}} + "{{version}}" = "{{version}}", + {{/formats}} +} + +export type Any{{#latest}}{{type}}{{/latest}} = +{{#formats}} + | {{type}}{{tsVersion}} +{{/formats}} + +export type {{#latest}}{{type}}{{/latest}} = {{#latest}}{{type}}{{tsVersion}}{{/latest}}; + +export const latest{{#latest}}{{type}}{{/latest}}Format = {{#latest}}{{type}}{{/latest}}Formats["{{#latest}}{{version}}{{/latest}}"] + +export { migrate{{#latest}}{{type}}{{/latest}} } from "./migrate"; + +export { deserialize{{#latest}}{{type}}{{/latest}} } from "./deserialize"; + +export { validate{{#latest}}{{type}}{{/latest}} } from "./validate"; diff --git a/packages/js/core/scripts/manifest/wrap.info/migrate-ts.mustache b/packages/js/core/scripts/manifest/wrap.info/migrate-ts.mustache new file mode 100644 index 0000000000..acb1153c75 --- /dev/null +++ b/packages/js/core/scripts/manifest/wrap.info/migrate-ts.mustache @@ -0,0 +1,59 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/migrate-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/migrate-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ +import { + Any{{#latest}}{{type}}{{/latest}}, + {{#latest}}{{type}}{{/latest}}, + {{#latest}}{{type}}{{/latest}}Formats, + latest{{#latest}}{{type}}{{/latest}}Format +} from "."; + +{{#prevFormats}} +import { + migrate as migrate_{{tsVersion}}_to_{{#latest}}{{tsVersion}}{{/latest}} +} from "./migrators/{{version}}_to_{{#latest}}{{version}}{{/latest}}"; +{{/prevFormats}} + +import { Tracer } from "@polywrap/tracing-js"; + +type Migrator = { + [key in {{#latest}}{{type}}{{/latest}}Formats]?: (m: Any{{#latest}}{{type}}{{/latest}}) => {{#latest}}{{type}}{{/latest}}; +}; + +export const migrators: Migrator = { +{{#prevFormats}} + "{{version}}": migrate_{{tsVersion}}_to_{{#latest}}{{tsVersion}}{{/latest}}, +{{/prevFormats}} +}; + +export const migrate{{#latest}}{{type}}{{/latest}} = Tracer.traceFunc( + "core: migrate{{#latest}}{{type}}{{/latest}}", + (manifest: Any{{#latest}}{{type}}{{/latest}}, to: {{#latest}}{{type}}{{/latest}}Formats): {{#latest}}{{type}}{{/latest}} => { + const from = manifest.format as {{#latest}}{{type}}{{/latest}}Formats; + + if (from === latest{{#latest}}{{type}}{{/latest}}Format) { + return manifest as {{#latest}}{{type}}{{/latest}}; + } + + if (!(from in {{#latest}}{{type}}{{/latest}}Formats)) { + throw new Error(`Unrecognized {{#latest}}{{type}}{{/latest}}Format "${manifest.format}"`); + } + +{{#prevFormats.length}} + const migrator = migrators[from]; + if (!migrator) { + throw new Error( + `Migrator from {{#latest}}{{type}}{{/latest}}Format "${from}" to "${to}" is not available` + ); + } + + return migrator(manifest); +{{/prevFormats.length}} +{{^prevFormats.length}} + throw new Error(`This should never happen, {{#latest}}{{type}}{{/latest}} migrators is empty. from: ${from}, to: ${to}`); +{{/prevFormats.length}} + } +); diff --git a/packages/js/core/scripts/manifest/validate-ts.mustache b/packages/js/core/scripts/manifest/wrap.info/validate-ts.mustache similarity index 100% rename from packages/js/core/scripts/manifest/validate-ts.mustache rename to packages/js/core/scripts/manifest/wrap.info/validate-ts.mustache From 8aa55544b9d070ecdbb9c25bfcd8b2b9e536a527 Mon Sep 17 00:00:00 2001 From: cbrzn Date: Tue, 28 Jun 2022 14:59:16 +0200 Subject: [PATCH 04/46] chore(js/core): update manifest autogenerated files - build works --- packages/js/core/package.json | 2 +- packages/js/core/src/manifest/index.ts | 3 +- .../manifest/{formats => polywrap}/index.ts | 0 .../polywrap.app/0.0.1-prealpha.1.ts | 0 .../polywrap.app/0.0.1-prealpha.2.ts | 0 .../polywrap.app/deserialize.ts | 0 .../polywrap.app/index.ts | 0 .../polywrap.app/migrate.ts | 0 .../0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts | 0 .../polywrap.app/validate.ts | 4 +- .../polywrap.build/0.0.1-prealpha.1.ts | 0 .../polywrap.build/0.0.1-prealpha.2.ts | 0 .../polywrap.build/0.0.1-prealpha.3.ts | 0 .../polywrap.build/deserialize.ts | 0 .../polywrap.build/index.ts | 0 .../polywrap.build/migrate.ts | 0 .../0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts | 0 .../0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts | 0 .../polywrap.build/validate.ts | 6 +- .../polywrap.deploy/0.0.1-prealpha.1.ts | 0 .../polywrap.deploy/deserialize.ts | 0 .../polywrap.deploy/index.ts | 0 .../polywrap.deploy/migrate.ts | 0 .../polywrap.deploy/validate.ts | 2 +- .../polywrap.infra/0.0.1-prealpha.1.ts | 0 .../polywrap.infra/0.0.1-prealpha.2.ts | 0 .../polywrap.infra/deserialize.ts | 0 .../polywrap.infra/index.ts | 0 .../polywrap.infra/migrate.ts | 0 .../0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts | 0 .../polywrap.infra/validate.ts | 4 +- .../polywrap.meta/0.0.1-prealpha.1.ts | 0 .../polywrap.meta/0.0.1-prealpha.2.ts | 0 .../polywrap.meta/0.0.1-prealpha.3.ts | 0 .../polywrap.meta/deserialize.ts | 0 .../polywrap.meta/index.ts | 0 .../polywrap.meta/migrate.ts | 0 .../0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts | 0 .../0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts | 0 .../polywrap.meta/validate.ts | 6 +- .../polywrap.plugin/0.0.1-prealpha.1.ts | 0 .../polywrap.plugin/0.0.1-prealpha.2.ts | 0 .../polywrap.plugin/0.0.1-prealpha.3.ts | 0 .../polywrap.plugin/deserialize.ts | 0 .../polywrap.plugin/index.ts | 0 .../polywrap.plugin/migrate.ts | 0 .../0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts | 0 .../0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts | 0 .../polywrap.plugin/validate.ts | 6 +- .../polywrap/0.0.1-prealpha.1.ts | 0 .../polywrap/0.0.1-prealpha.2.ts | 0 .../polywrap/0.0.1-prealpha.3.ts | 0 .../polywrap/0.0.1-prealpha.4.ts | 0 .../polywrap/0.0.1-prealpha.5.ts | 0 .../polywrap/0.0.1-prealpha.6.ts | 0 .../polywrap/0.0.1-prealpha.7.ts | 0 .../polywrap/0.0.1-prealpha.8.ts | 0 .../polywrap/0.0.1-prealpha.9.ts | 0 .../polywrap/deserialize.ts | 0 .../{formats => polywrap}/polywrap/index.ts | 0 .../{formats => polywrap}/polywrap/migrate.ts | 0 .../0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts | 0 .../polywrap/validate.ts | 18 +++--- packages/js/core/src/manifest/validators.ts | 4 ++ .../js/core/src/manifest/wrap.info/0.0.1.ts | 27 ++++++++ .../src/manifest/wrap.info/deserialize.ts | 61 +++++++++++++++++++ .../js/core/src/manifest/wrap.info/index.ts | 31 ++++++++++ .../js/core/src/manifest/wrap.info/migrate.ts | 39 ++++++++++++ .../core/src/manifest/wrap.info/validate.ts | 61 +++++++++++++++++++ 76 files changed, 249 insertions(+), 25 deletions(-) rename packages/js/core/src/manifest/{formats => polywrap}/index.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.app/0.0.1-prealpha.1.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.app/0.0.1-prealpha.2.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.app/deserialize.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.app/index.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.app/migrate.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.app/validate.ts (95%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.build/0.0.1-prealpha.1.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.build/0.0.1-prealpha.2.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.build/0.0.1-prealpha.3.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.build/deserialize.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.build/index.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.build/migrate.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.build/validate.ts (94%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.deploy/0.0.1-prealpha.1.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.deploy/deserialize.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.deploy/index.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.deploy/migrate.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.deploy/validate.ts (97%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.infra/0.0.1-prealpha.1.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.infra/0.0.1-prealpha.2.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.infra/deserialize.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.infra/index.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.infra/migrate.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.infra/validate.ts (94%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.meta/0.0.1-prealpha.1.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.meta/0.0.1-prealpha.2.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.meta/0.0.1-prealpha.3.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.meta/deserialize.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.meta/index.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.meta/migrate.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.meta/validate.ts (94%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.plugin/0.0.1-prealpha.1.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.plugin/0.0.1-prealpha.2.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.plugin/0.0.1-prealpha.3.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.plugin/deserialize.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.plugin/index.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.plugin/migrate.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap.plugin/validate.ts (93%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap/0.0.1-prealpha.1.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap/0.0.1-prealpha.2.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap/0.0.1-prealpha.3.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap/0.0.1-prealpha.4.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap/0.0.1-prealpha.5.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap/0.0.1-prealpha.6.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap/0.0.1-prealpha.7.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap/0.0.1-prealpha.8.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap/0.0.1-prealpha.9.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap/deserialize.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap/index.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap/migrate.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts (100%) rename packages/js/core/src/manifest/{formats => polywrap}/polywrap/validate.ts (89%) create mode 100644 packages/js/core/src/manifest/wrap.info/0.0.1.ts create mode 100644 packages/js/core/src/manifest/wrap.info/deserialize.ts create mode 100644 packages/js/core/src/manifest/wrap.info/index.ts create mode 100644 packages/js/core/src/manifest/wrap.info/migrate.ts create mode 100644 packages/js/core/src/manifest/wrap.info/validate.ts diff --git a/packages/js/core/package.json b/packages/js/core/package.json index 6f9f3a18b7..2029a874ad 100644 --- a/packages/js/core/package.json +++ b/packages/js/core/package.json @@ -12,7 +12,7 @@ "build" ], "scripts": { - "build": "rimraf ./build && yarn build:manifest && tsc --project tsconfig.build.json", + "build": "rimraf ./build && tsc --project tsconfig.build.json", "build:manifest": "node ./scripts/manifest/generateFormatTypes.js", "lint": "eslint --color -c ../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", diff --git a/packages/js/core/src/manifest/index.ts b/packages/js/core/src/manifest/index.ts index 041f37b508..43f2530d24 100644 --- a/packages/js/core/src/manifest/index.ts +++ b/packages/js/core/src/manifest/index.ts @@ -1,2 +1,3 @@ -export * from "./formats"; +export * from "./polywrap"; +export * from "./wrap.info"; export * from "./deserialize"; diff --git a/packages/js/core/src/manifest/formats/index.ts b/packages/js/core/src/manifest/polywrap/index.ts similarity index 100% rename from packages/js/core/src/manifest/formats/index.ts rename to packages/js/core/src/manifest/polywrap/index.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.app/0.0.1-prealpha.1.ts b/packages/js/core/src/manifest/polywrap/polywrap.app/0.0.1-prealpha.1.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.app/0.0.1-prealpha.1.ts rename to packages/js/core/src/manifest/polywrap/polywrap.app/0.0.1-prealpha.1.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.app/0.0.1-prealpha.2.ts b/packages/js/core/src/manifest/polywrap/polywrap.app/0.0.1-prealpha.2.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.app/0.0.1-prealpha.2.ts rename to packages/js/core/src/manifest/polywrap/polywrap.app/0.0.1-prealpha.2.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.app/deserialize.ts b/packages/js/core/src/manifest/polywrap/polywrap.app/deserialize.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.app/deserialize.ts rename to packages/js/core/src/manifest/polywrap/polywrap.app/deserialize.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.app/index.ts b/packages/js/core/src/manifest/polywrap/polywrap.app/index.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.app/index.ts rename to packages/js/core/src/manifest/polywrap/polywrap.app/index.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.app/migrate.ts b/packages/js/core/src/manifest/polywrap/polywrap.app/migrate.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.app/migrate.ts rename to packages/js/core/src/manifest/polywrap/polywrap.app/migrate.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts b/packages/js/core/src/manifest/polywrap/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts rename to packages/js/core/src/manifest/polywrap/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.app/validate.ts b/packages/js/core/src/manifest/polywrap/polywrap.app/validate.ts similarity index 95% rename from packages/js/core/src/manifest/formats/polywrap.app/validate.ts rename to packages/js/core/src/manifest/polywrap/polywrap.app/validate.ts index 7e7a4a4477..7a97f6a7ce 100644 --- a/packages/js/core/src/manifest/formats/polywrap.app/validate.ts +++ b/packages/js/core/src/manifest/polywrap/polywrap.app/validate.ts @@ -9,8 +9,8 @@ import { AppManifestFormats } from "."; import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/manifest-schemas/formats/polywrap.app/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/manifest-schemas/formats/polywrap.app/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_1 from "@polywrap/manifest-schemas/polywrap/polywrap.app/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/manifest-schemas/polywrap/polywrap.app/0.0.1-prealpha.2.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.1.ts b/packages/js/core/src/manifest/polywrap/polywrap.build/0.0.1-prealpha.1.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.1.ts rename to packages/js/core/src/manifest/polywrap/polywrap.build/0.0.1-prealpha.1.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.2.ts b/packages/js/core/src/manifest/polywrap/polywrap.build/0.0.1-prealpha.2.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.2.ts rename to packages/js/core/src/manifest/polywrap/polywrap.build/0.0.1-prealpha.2.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.3.ts b/packages/js/core/src/manifest/polywrap/polywrap.build/0.0.1-prealpha.3.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.3.ts rename to packages/js/core/src/manifest/polywrap/polywrap.build/0.0.1-prealpha.3.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.build/deserialize.ts b/packages/js/core/src/manifest/polywrap/polywrap.build/deserialize.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.build/deserialize.ts rename to packages/js/core/src/manifest/polywrap/polywrap.build/deserialize.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.build/index.ts b/packages/js/core/src/manifest/polywrap/polywrap.build/index.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.build/index.ts rename to packages/js/core/src/manifest/polywrap/polywrap.build/index.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.build/migrate.ts b/packages/js/core/src/manifest/polywrap/polywrap.build/migrate.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.build/migrate.ts rename to packages/js/core/src/manifest/polywrap/polywrap.build/migrate.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts b/packages/js/core/src/manifest/polywrap/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts rename to packages/js/core/src/manifest/polywrap/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts b/packages/js/core/src/manifest/polywrap/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts rename to packages/js/core/src/manifest/polywrap/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.build/validate.ts b/packages/js/core/src/manifest/polywrap/polywrap.build/validate.ts similarity index 94% rename from packages/js/core/src/manifest/formats/polywrap.build/validate.ts rename to packages/js/core/src/manifest/polywrap/polywrap.build/validate.ts index ca7d90c93c..e1cb9f0ab1 100644 --- a/packages/js/core/src/manifest/formats/polywrap.build/validate.ts +++ b/packages/js/core/src/manifest/polywrap/polywrap.build/validate.ts @@ -9,9 +9,9 @@ import { BuildManifestFormats } from "."; import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.2.json"; -import schema_0_0_1_prealpha_3 from "@polywrap/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.3.json"; +import schema_0_0_1_prealpha_1 from "@polywrap/manifest-schemas/polywrap/polywrap.build/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/manifest-schemas/polywrap/polywrap.build/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_3 from "@polywrap/manifest-schemas/polywrap/polywrap.build/0.0.1-prealpha.3.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/js/core/src/manifest/formats/polywrap.deploy/0.0.1-prealpha.1.ts b/packages/js/core/src/manifest/polywrap/polywrap.deploy/0.0.1-prealpha.1.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.deploy/0.0.1-prealpha.1.ts rename to packages/js/core/src/manifest/polywrap/polywrap.deploy/0.0.1-prealpha.1.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.deploy/deserialize.ts b/packages/js/core/src/manifest/polywrap/polywrap.deploy/deserialize.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.deploy/deserialize.ts rename to packages/js/core/src/manifest/polywrap/polywrap.deploy/deserialize.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.deploy/index.ts b/packages/js/core/src/manifest/polywrap/polywrap.deploy/index.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.deploy/index.ts rename to packages/js/core/src/manifest/polywrap/polywrap.deploy/index.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.deploy/migrate.ts b/packages/js/core/src/manifest/polywrap/polywrap.deploy/migrate.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.deploy/migrate.ts rename to packages/js/core/src/manifest/polywrap/polywrap.deploy/migrate.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.deploy/validate.ts b/packages/js/core/src/manifest/polywrap/polywrap.deploy/validate.ts similarity index 97% rename from packages/js/core/src/manifest/formats/polywrap.deploy/validate.ts rename to packages/js/core/src/manifest/polywrap/polywrap.deploy/validate.ts index 62232865eb..6da8234512 100644 --- a/packages/js/core/src/manifest/formats/polywrap.deploy/validate.ts +++ b/packages/js/core/src/manifest/polywrap/polywrap.deploy/validate.ts @@ -9,7 +9,7 @@ import { DeployManifestFormats } from "."; import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/manifest-schemas/formats/polywrap.deploy/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_1 from "@polywrap/manifest-schemas/polywrap/polywrap.deploy/0.0.1-prealpha.1.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/js/core/src/manifest/formats/polywrap.infra/0.0.1-prealpha.1.ts b/packages/js/core/src/manifest/polywrap/polywrap.infra/0.0.1-prealpha.1.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.infra/0.0.1-prealpha.1.ts rename to packages/js/core/src/manifest/polywrap/polywrap.infra/0.0.1-prealpha.1.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.infra/0.0.1-prealpha.2.ts b/packages/js/core/src/manifest/polywrap/polywrap.infra/0.0.1-prealpha.2.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.infra/0.0.1-prealpha.2.ts rename to packages/js/core/src/manifest/polywrap/polywrap.infra/0.0.1-prealpha.2.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.infra/deserialize.ts b/packages/js/core/src/manifest/polywrap/polywrap.infra/deserialize.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.infra/deserialize.ts rename to packages/js/core/src/manifest/polywrap/polywrap.infra/deserialize.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.infra/index.ts b/packages/js/core/src/manifest/polywrap/polywrap.infra/index.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.infra/index.ts rename to packages/js/core/src/manifest/polywrap/polywrap.infra/index.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.infra/migrate.ts b/packages/js/core/src/manifest/polywrap/polywrap.infra/migrate.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.infra/migrate.ts rename to packages/js/core/src/manifest/polywrap/polywrap.infra/migrate.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts b/packages/js/core/src/manifest/polywrap/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts rename to packages/js/core/src/manifest/polywrap/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.infra/validate.ts b/packages/js/core/src/manifest/polywrap/polywrap.infra/validate.ts similarity index 94% rename from packages/js/core/src/manifest/formats/polywrap.infra/validate.ts rename to packages/js/core/src/manifest/polywrap/polywrap.infra/validate.ts index 452c36fa84..4fb410117b 100644 --- a/packages/js/core/src/manifest/formats/polywrap.infra/validate.ts +++ b/packages/js/core/src/manifest/polywrap/polywrap.infra/validate.ts @@ -9,8 +9,8 @@ import { InfraManifestFormats } from "."; -import schema_0_0_1_prealpha_1 from "@polywrap/manifest-schemas/formats/polywrap.infra/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/manifest-schemas/formats/polywrap.infra/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_1 from "@polywrap/manifest-schemas/polywrap/polywrap.infra/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/manifest-schemas/polywrap/polywrap.infra/0.0.1-prealpha.2.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/js/core/src/manifest/formats/polywrap.meta/0.0.1-prealpha.1.ts b/packages/js/core/src/manifest/polywrap/polywrap.meta/0.0.1-prealpha.1.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.meta/0.0.1-prealpha.1.ts rename to packages/js/core/src/manifest/polywrap/polywrap.meta/0.0.1-prealpha.1.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.meta/0.0.1-prealpha.2.ts b/packages/js/core/src/manifest/polywrap/polywrap.meta/0.0.1-prealpha.2.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.meta/0.0.1-prealpha.2.ts rename to packages/js/core/src/manifest/polywrap/polywrap.meta/0.0.1-prealpha.2.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.meta/0.0.1-prealpha.3.ts b/packages/js/core/src/manifest/polywrap/polywrap.meta/0.0.1-prealpha.3.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.meta/0.0.1-prealpha.3.ts rename to packages/js/core/src/manifest/polywrap/polywrap.meta/0.0.1-prealpha.3.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.meta/deserialize.ts b/packages/js/core/src/manifest/polywrap/polywrap.meta/deserialize.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.meta/deserialize.ts rename to packages/js/core/src/manifest/polywrap/polywrap.meta/deserialize.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.meta/index.ts b/packages/js/core/src/manifest/polywrap/polywrap.meta/index.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.meta/index.ts rename to packages/js/core/src/manifest/polywrap/polywrap.meta/index.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.meta/migrate.ts b/packages/js/core/src/manifest/polywrap/polywrap.meta/migrate.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.meta/migrate.ts rename to packages/js/core/src/manifest/polywrap/polywrap.meta/migrate.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts b/packages/js/core/src/manifest/polywrap/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts rename to packages/js/core/src/manifest/polywrap/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts b/packages/js/core/src/manifest/polywrap/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts rename to packages/js/core/src/manifest/polywrap/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.meta/validate.ts b/packages/js/core/src/manifest/polywrap/polywrap.meta/validate.ts similarity index 94% rename from packages/js/core/src/manifest/formats/polywrap.meta/validate.ts rename to packages/js/core/src/manifest/polywrap/polywrap.meta/validate.ts index 7d0b3b1849..37b2e3e5fc 100644 --- a/packages/js/core/src/manifest/formats/polywrap.meta/validate.ts +++ b/packages/js/core/src/manifest/polywrap/polywrap.meta/validate.ts @@ -9,9 +9,9 @@ import { MetaManifestFormats } from "."; import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.2.json"; -import schema_0_0_1_prealpha_3 from "@polywrap/manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.3.json"; +import schema_0_0_1_prealpha_1 from "@polywrap/manifest-schemas/polywrap/polywrap.meta/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/manifest-schemas/polywrap/polywrap.meta/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_3 from "@polywrap/manifest-schemas/polywrap/polywrap.meta/0.0.1-prealpha.3.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/js/core/src/manifest/formats/polywrap.plugin/0.0.1-prealpha.1.ts b/packages/js/core/src/manifest/polywrap/polywrap.plugin/0.0.1-prealpha.1.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.plugin/0.0.1-prealpha.1.ts rename to packages/js/core/src/manifest/polywrap/polywrap.plugin/0.0.1-prealpha.1.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.plugin/0.0.1-prealpha.2.ts b/packages/js/core/src/manifest/polywrap/polywrap.plugin/0.0.1-prealpha.2.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.plugin/0.0.1-prealpha.2.ts rename to packages/js/core/src/manifest/polywrap/polywrap.plugin/0.0.1-prealpha.2.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.plugin/0.0.1-prealpha.3.ts b/packages/js/core/src/manifest/polywrap/polywrap.plugin/0.0.1-prealpha.3.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.plugin/0.0.1-prealpha.3.ts rename to packages/js/core/src/manifest/polywrap/polywrap.plugin/0.0.1-prealpha.3.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.plugin/deserialize.ts b/packages/js/core/src/manifest/polywrap/polywrap.plugin/deserialize.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.plugin/deserialize.ts rename to packages/js/core/src/manifest/polywrap/polywrap.plugin/deserialize.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.plugin/index.ts b/packages/js/core/src/manifest/polywrap/polywrap.plugin/index.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.plugin/index.ts rename to packages/js/core/src/manifest/polywrap/polywrap.plugin/index.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.plugin/migrate.ts b/packages/js/core/src/manifest/polywrap/polywrap.plugin/migrate.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.plugin/migrate.ts rename to packages/js/core/src/manifest/polywrap/polywrap.plugin/migrate.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts b/packages/js/core/src/manifest/polywrap/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts rename to packages/js/core/src/manifest/polywrap/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts b/packages/js/core/src/manifest/polywrap/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts rename to packages/js/core/src/manifest/polywrap/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts diff --git a/packages/js/core/src/manifest/formats/polywrap.plugin/validate.ts b/packages/js/core/src/manifest/polywrap/polywrap.plugin/validate.ts similarity index 93% rename from packages/js/core/src/manifest/formats/polywrap.plugin/validate.ts rename to packages/js/core/src/manifest/polywrap/polywrap.plugin/validate.ts index 025f0ccee4..cc287a86c2 100644 --- a/packages/js/core/src/manifest/formats/polywrap.plugin/validate.ts +++ b/packages/js/core/src/manifest/polywrap/polywrap.plugin/validate.ts @@ -9,9 +9,9 @@ import { PluginManifestFormats } from "."; import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.2.json"; -import schema_0_0_1_prealpha_3 from "@polywrap/manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.3.json"; +import schema_0_0_1_prealpha_1 from "@polywrap/manifest-schemas/polywrap/polywrap.plugin/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/manifest-schemas/polywrap/polywrap.plugin/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_3 from "@polywrap/manifest-schemas/polywrap/polywrap.plugin/0.0.1-prealpha.3.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.1.ts b/packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.1.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.1.ts rename to packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.1.ts diff --git a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.2.ts b/packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.2.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.2.ts rename to packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.2.ts diff --git a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.3.ts b/packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.3.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.3.ts rename to packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.3.ts diff --git a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.4.ts b/packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.4.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.4.ts rename to packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.4.ts diff --git a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.5.ts b/packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.5.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.5.ts rename to packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.5.ts diff --git a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.6.ts b/packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.6.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.6.ts rename to packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.6.ts diff --git a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.7.ts b/packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.7.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.7.ts rename to packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.7.ts diff --git a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.8.ts b/packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.8.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.8.ts rename to packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.8.ts diff --git a/packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.9.ts b/packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.9.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap/0.0.1-prealpha.9.ts rename to packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.9.ts diff --git a/packages/js/core/src/manifest/formats/polywrap/deserialize.ts b/packages/js/core/src/manifest/polywrap/polywrap/deserialize.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap/deserialize.ts rename to packages/js/core/src/manifest/polywrap/polywrap/deserialize.ts diff --git a/packages/js/core/src/manifest/formats/polywrap/index.ts b/packages/js/core/src/manifest/polywrap/polywrap/index.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap/index.ts rename to packages/js/core/src/manifest/polywrap/polywrap/index.ts diff --git a/packages/js/core/src/manifest/formats/polywrap/migrate.ts b/packages/js/core/src/manifest/polywrap/polywrap/migrate.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap/migrate.ts rename to packages/js/core/src/manifest/polywrap/polywrap/migrate.ts diff --git a/packages/js/core/src/manifest/formats/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts b/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts rename to packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts diff --git a/packages/js/core/src/manifest/formats/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts b/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts rename to packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts diff --git a/packages/js/core/src/manifest/formats/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts b/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts rename to packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts diff --git a/packages/js/core/src/manifest/formats/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts b/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts rename to packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts diff --git a/packages/js/core/src/manifest/formats/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts b/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts rename to packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts diff --git a/packages/js/core/src/manifest/formats/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts b/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts rename to packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts diff --git a/packages/js/core/src/manifest/formats/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts b/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts rename to packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts diff --git a/packages/js/core/src/manifest/formats/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts b/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/js/core/src/manifest/formats/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts rename to packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts diff --git a/packages/js/core/src/manifest/formats/polywrap/validate.ts b/packages/js/core/src/manifest/polywrap/polywrap/validate.ts similarity index 89% rename from packages/js/core/src/manifest/formats/polywrap/validate.ts rename to packages/js/core/src/manifest/polywrap/polywrap/validate.ts index 12b4619293..6c4576930b 100644 --- a/packages/js/core/src/manifest/formats/polywrap/validate.ts +++ b/packages/js/core/src/manifest/polywrap/polywrap/validate.ts @@ -9,15 +9,15 @@ import { PolywrapManifestFormats } from "."; import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/manifest-schemas/formats/polywrap/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/manifest-schemas/formats/polywrap/0.0.1-prealpha.2.json"; -import schema_0_0_1_prealpha_3 from "@polywrap/manifest-schemas/formats/polywrap/0.0.1-prealpha.3.json"; -import schema_0_0_1_prealpha_4 from "@polywrap/manifest-schemas/formats/polywrap/0.0.1-prealpha.4.json"; -import schema_0_0_1_prealpha_5 from "@polywrap/manifest-schemas/formats/polywrap/0.0.1-prealpha.5.json"; -import schema_0_0_1_prealpha_6 from "@polywrap/manifest-schemas/formats/polywrap/0.0.1-prealpha.6.json"; -import schema_0_0_1_prealpha_7 from "@polywrap/manifest-schemas/formats/polywrap/0.0.1-prealpha.7.json"; -import schema_0_0_1_prealpha_8 from "@polywrap/manifest-schemas/formats/polywrap/0.0.1-prealpha.8.json"; -import schema_0_0_1_prealpha_9 from "@polywrap/manifest-schemas/formats/polywrap/0.0.1-prealpha.9.json"; +import schema_0_0_1_prealpha_1 from "@polywrap/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_3 from "@polywrap/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.3.json"; +import schema_0_0_1_prealpha_4 from "@polywrap/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.4.json"; +import schema_0_0_1_prealpha_5 from "@polywrap/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.5.json"; +import schema_0_0_1_prealpha_6 from "@polywrap/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.6.json"; +import schema_0_0_1_prealpha_7 from "@polywrap/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.7.json"; +import schema_0_0_1_prealpha_8 from "@polywrap/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.8.json"; +import schema_0_0_1_prealpha_9 from "@polywrap/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.9.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/js/core/src/manifest/validators.ts b/packages/js/core/src/manifest/validators.ts index 667bd1204e..ace7924e00 100644 --- a/packages/js/core/src/manifest/validators.ts +++ b/packages/js/core/src/manifest/validators.ts @@ -140,3 +140,7 @@ export function directory(path: unknown): boolean { return !!validDirRegex.test(path); } + +export function validType(type: unknown): boolean { + return typeof type === "string" && (type === "wasm" || type === "interface"); +} diff --git a/packages/js/core/src/manifest/wrap.info/0.0.1.ts b/packages/js/core/src/manifest/wrap.info/0.0.1.ts new file mode 100644 index 0000000000..31fedc7231 --- /dev/null +++ b/packages/js/core/src/manifest/wrap.info/0.0.1.ts @@ -0,0 +1,27 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +/* tslint:disable */ +/** + * This file was automatically generated by json-schema-to-typescript. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run json-schema-to-typescript to regenerate this file. + */ + +export interface WrapManifest { + /** + * Wrap manifest format version + */ + version: "0.0.1"; + /** + * Wrap language + */ + type: string; + /** + * Wrapper name + */ + name: string; + /** + * Type info of wrapper + */ + abi: unknown; + __type: "WrapManifest"; +} diff --git a/packages/js/core/src/manifest/wrap.info/deserialize.ts b/packages/js/core/src/manifest/wrap.info/deserialize.ts new file mode 100644 index 0000000000..4f1b29a44f --- /dev/null +++ b/packages/js/core/src/manifest/wrap.info/deserialize.ts @@ -0,0 +1,61 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ + +import { + WrapManifest, + AnyWrapManifest, + migrateWrapManifest, + validateWrapManifest, + latestWrapManifestVersion, +} from "."; +import { DeserializeManifestOptions } from "../../"; + +import { compare } from "semver"; +import YAML from "js-yaml"; +import { Tracer } from "@polywrap/tracing-js"; + +export const deserializeWrapManifest = Tracer.traceFunc( + "core: deserializeWrapManifest", + (manifest: string, options?: DeserializeManifestOptions): WrapManifest => { + let anyWrapManifest: AnyWrapManifest | undefined; + try { + anyWrapManifest = JSON.parse(manifest) as AnyWrapManifest; + } catch (e) { + anyWrapManifest = YAML.safeLoad(manifest) as + | AnyWrapManifest + | undefined; + } + + if (!anyWrapManifest) { + throw Error(`Unable to parse WrapManifest: ${manifest}`); + } + + if (!options || !options.noValidate) { + validateWrapManifest(anyWrapManifest, options?.extSchema); + } + + anyWrapManifest.__type = "WrapManifest"; + + const versionCompare = compare( + anyWrapManifest.version, + latestWrapManifestVersion + ); + + if (versionCompare === -1) { + // Upgrade + return migrateWrapManifest(anyWrapManifest, latestWrapManifestVersion); + } else if (versionCompare === 1) { + // Downgrade + throw Error( + `Cannot downgrade wrap.info version ${anyWrapManifest.version}, please upgrade your PolywrapClient package.` + ); + } else { + // Latest + return anyWrapManifest as WrapManifest; + } + } +); diff --git a/packages/js/core/src/manifest/wrap.info/index.ts b/packages/js/core/src/manifest/wrap.info/index.ts new file mode 100644 index 0000000000..88727b7317 --- /dev/null +++ b/packages/js/core/src/manifest/wrap.info/index.ts @@ -0,0 +1,31 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/index-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/index-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ + +import { + WrapManifest as WrapManifest0_0_1 +} from "./0.0.1"; + +export { + WrapManifest0_0_1, +}; + +export enum WrapManifestVersions { + "0.0.1" = "0.0.1", +} + +export type AnyWrapManifest = + | WrapManifest0_0_1 + +export type WrapManifest = WrapManifest0_0_1; + +export const latestWrapManifestVersion = WrapManifestVersions["0.0.1"] + +export { migrateWrapManifest } from "./migrate"; + +export { deserializeWrapManifest } from "./deserialize"; + +export { validateWrapManifest } from "./validate"; diff --git a/packages/js/core/src/manifest/wrap.info/migrate.ts b/packages/js/core/src/manifest/wrap.info/migrate.ts new file mode 100644 index 0000000000..6225a65ac7 --- /dev/null +++ b/packages/js/core/src/manifest/wrap.info/migrate.ts @@ -0,0 +1,39 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/migrate-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/migrate-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ +import { + AnyWrapManifest, + WrapManifest, + WrapManifestVersions, + latestWrapManifestVersion +} from "."; + + +import { Tracer } from "@polywrap/tracing-js"; + +type Migrator = { + [key in WrapManifestVersions]?: (m: AnyWrapManifest) => WrapManifest; +}; + +export const migrators: Migrator = { +}; + +export const migrateWrapManifest = Tracer.traceFunc( + "core: migrateWrapManifest", + (manifest: AnyWrapManifest, to: WrapManifestVersions): WrapManifest => { + const from = manifest.version as WrapManifestVersions; + + if (from === latestWrapManifestVersion) { + return manifest as WrapManifest; + } + + if (!(from in WrapManifestVersions)) { + throw new Error(`Unrecognized WrapManifestVersion "${manifest.version}"`); + } + + throw new Error(`This should never happen, WrapManifest migrators is empty. from: ${from}, to: ${to}`); + } +); diff --git a/packages/js/core/src/manifest/wrap.info/validate.ts b/packages/js/core/src/manifest/wrap.info/validate.ts new file mode 100644 index 0000000000..5a20dae3f6 --- /dev/null +++ b/packages/js/core/src/manifest/wrap.info/validate.ts @@ -0,0 +1,61 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/validate-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ +import { + AnyWrapManifest, + WrapManifestVersions +} from "."; +import * as Validators from "../validators"; +import schema_0_0_1 from "@polywrap/manifest-schemas/wrap.info/0.0.1.json"; +import { Tracer } from "@polywrap/tracing-js" + +import { + Schema, + Validator, + ValidationError, + ValidatorResult +} from "jsonschema"; + +type WrapManifestSchemas = { + [key in WrapManifestVersions]: Schema | undefined +}; + +const schemas: WrapManifestSchemas = { + "0.0.1": schema_0_0_1, +}; + +const validator = new Validator(); + +Validator.prototype.customFormats.validType = Validators.validType; + +export const validateWrapManifest = Tracer.traceFunc( + "core: validateWrapManifest", + ( + manifest: AnyWrapManifest, + extSchema: Schema | undefined = undefined + ): void => { + const schema = schemas[manifest.version as WrapManifestVersions]; + + if (!schema) { + throw Error(`Unrecognized WrapManifest schema format "${manifest.version}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); + } + + const throwIfErrors = (result: ValidatorResult) => { + if (result.errors.length) { + throw new Error([ + `Validation errors encountered while sanitizing WrapManifest version ${manifest.version}`, + ...result.errors.map((error: ValidationError) => error.toString()) + ].join("\n")); + } + }; + + throwIfErrors(validator.validate(manifest, schema)); + + if (extSchema) { + throwIfErrors(validator.validate(manifest, extSchema)); + } + } +); From e0750d43665c6e85f09cd116458155a62679191a Mon Sep 17 00:00:00 2001 From: cbrzn Date: Tue, 28 Jun 2022 15:14:20 +0200 Subject: [PATCH 05/46] feat(js/core): manifest script update to handle wrap.info and polywrap folders --- .../core/scripts/manifest/newGenerateTypes.js | 203 ++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 packages/js/core/scripts/manifest/newGenerateTypes.js diff --git a/packages/js/core/scripts/manifest/newGenerateTypes.js b/packages/js/core/scripts/manifest/newGenerateTypes.js new file mode 100644 index 0000000000..22a9c999eb --- /dev/null +++ b/packages/js/core/scripts/manifest/newGenerateTypes.js @@ -0,0 +1,203 @@ +const SchemaToTypescript = require("json-schema-to-typescript"); +const os = require("@polywrap/os-js"); +const fs = require("fs"); +const path = require("path"); +const Mustache = require("mustache"); + +const readFileFromDirectory = (typeDirectory, fileName) => { + const version = fileName.replace(".json", ""); + const dirPath = path.join(typeDirectory, fileName); + console.log({dirPath}) + try { + // Parse the JSON schema + const schema = JSON.parse( + fs.readFileSync(dirPath, { encoding: "utf-8" }) + ); + + // Insert the __type property for introspection + schema.properties["__type"] = { + type: "string", + const: schema.id + }; + schema.required = [ + ...schema.required, + "__type" + ]; + + return { + schema, + interface: schema.id, + version, + dir: typeDirectory + } + } catch (error) { + console.error(`Error generating the Manifest file ${fileName}: `, error); + throw error; + } +} + +const generateTs = async (schema, dir, fileName) => { + const version = fileName.replace(".json", ""); + + + const dirPath = path.join(dir, version.concat(".ts")); + + const polywrapPath = path.join(__dirname, `/../../src/manifest/polywrap/`.concat(dirPath)); + // const wrapInfoPath = path.join(__dirname, `/../../src/manifest/wrap.info/${version}.ts`); + + console.log({schema}) + // Convert it to a TypeScript interface + const tsFile = await SchemaToTypescript.compile( + schema, + schema.id + ); + + console.log({ + dir, + fileName + }) + + console.log(dirPath) + fs.mkdirSync(path.dirname(polywrapPath), { recursive: true }); + // os.writeFileSync(polywrapPath, + // `/* eslint-disable @typescript-eslint/naming-convention */\n${tsFile}` + // ); +} + +async function generateFormatTypes() { + // Fetch all schemas within the @polywrap/manifest-schemas/formats directory + const formatsDir = path.join( + path.dirname(require.resolve("@polywrap/manifest-schemas")), + "polywrap" + ); + + // Get all format types (polywrap, polywrap.build, etc) + const formatTypes = fs.readdirSync( + formatsDir, { withFileTypes: true } + ).filter((dirent) => dirent.isDirectory); + + // For each format type + for (let i = 0; i < formatTypes.length; ++i) { + const formatTypeName = formatTypes[i].name; + const formatTypeDir = path.join(formatsDir, formatTypeName); + const formatModules = []; + // Get all JSON schemas for this format type (v1, v2, etc) + const formatSchemaFiles = fs.readdirSync(formatTypeDir); + const formatSchemas = []; + const fetchFiles = formatSchemaFiles.map(async file => { + const schema = readFileFromDirectory(formatTypeDir, file) + await generateTs(schema, formatTypeName, file) + formatSchemas.push(schema) + formatModules.push({ + interface: schema.interface, + version: schema.version, + dir: schema.dir + }) + }) + const t = await Promise.all(fetchFiles) + // const renderTemplate = (name, context) => { + // const tsTemplate = fs.readFileSync( + // __dirname + `/polywrap/${name}-ts.mustache`, { encoding: "utf-8" } + // ); + // + // // Render the template + // const tsSrc = Mustache.render(tsTemplate, context); + // + // console.log(path.join(__dirname, `/../../src/manifest/polywrap/${formatTypeName}/${name}.ts`)) + // // Emit the source + // const tsOutputPath = path.join(__dirname, `/../../src/manifest/polywrap/${formatTypeName}/${name}.ts`); + // fs.mkdirSync(path.dirname(tsOutputPath), { recursive: true }); + // os.writeFileSync(tsOutputPath, tsSrc); + // } + // + // const lastItem = (arr) => arr[arr.length - 1]; + // const versionToTs = (version) => + // version.replace(/\./g, "_").replace(/\-/g, "_"); + // + // // Generate an index.ts file that exports root types that aggregate all versions + // const indexContext = { }; + // indexContext.formats = formatModules.map((module) => { + // return { + // type: module.interface, + // version: module.version, + // tsVersion: versionToTs(module.version) + // } + // }); + // indexContext.latest = lastItem(indexContext.formats); + // renderTemplate("index", indexContext); + // + // // Generate a migrate.ts file that exports a migration function from all version to the latest version + // const migrateContext = { }; + // migrateContext.prevFormats = formatModules.map((module) => { + // console.log(module.interface) + // return { + // type: module.interface, + // version: module.version, + // tsVersion: versionToTs(module.version), + // dir: module.dir + // } + // }); + // migrateContext.latest = lastItem(migrateContext.prevFormats); + // migrateContext.prevFormats.pop(); + // + // renderTemplate("migrate", migrateContext); + // + // // Generate a deserialize.ts file that exports a deserialization function for the latest format version + // const deserializeContext = { + // type: migrateContext.latest.type + // }; + // + // renderTemplate("deserialize", deserializeContext); + // + // // Generate a validate.ts file that validates the manifest against the JSON schema + // const validateContext = { }; + // validateContext.formats = formatModules.map((module) => { + // return { + // type: module.interface, + // version: module.version, + // tsVersion: versionToTs(module.version), + // dir: formatTypeName + // }; + // }); + // validateContext.latest = lastItem(validateContext.formats); + // + // // Extract all validators + // validateContext.validators = []; + // + // for (let k = 0; k < formatSchemas.length; ++k) { + // const formatSchema = formatSchemas[k]; + // + // const getValidator = (obj) => { + // if (typeof obj !== "object") { + // return; + // } + // + // if (obj.format && typeof obj.format === "string") { + // if (validateContext.validators.indexOf(obj.format) === -1) { + // validateContext.validators.push(obj.format); + // } + // } + // + // const keys = Object.keys(obj); + // for (let j = 0; j < keys.length; ++j) { + // getValidator(obj[keys[j]]); + // } + // } + // + // getValidator(formatSchema); + // } + // + // renderTemplate("validate", validateContext); + } + + return Promise.resolve(); +}; + +generateFormatTypes() + .then(text => { + process.exit(); + }) + .catch(err => { + console.error(err); + process.abort(); + }); From 7632eba20a748304a3d9f8829cb4e78f0c8c591f Mon Sep 17 00:00:00 2001 From: cbrzn Date: Tue, 28 Jun 2022 16:01:39 +0200 Subject: [PATCH 06/46] chore(js/core): manifest script generation works --- packages/cli/src/lib/Compiler.ts | 2 +- .../js/core/scripts/manifest/generateTypes.js | 181 +++++++++++++++ .../core/scripts/manifest/newGenerateTypes.js | 213 +++++++++--------- 3 files changed, 284 insertions(+), 112 deletions(-) create mode 100644 packages/js/core/scripts/manifest/generateTypes.js diff --git a/packages/cli/src/lib/Compiler.ts b/packages/cli/src/lib/Compiler.ts index 6ffb5bdf50..032b4b85d8 100644 --- a/packages/cli/src/lib/Compiler.ts +++ b/packages/cli/src/lib/Compiler.ts @@ -333,7 +333,7 @@ export class Compiler { const info: WrapManifest = { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - abi: state.composerOutput.typeInfo as unknown, + abi: state.composerOutput.abi as unknown, name: state.polywrapManifest.name, type: state.polywrapManifest.module ? "wasm" : "interface", version: "0.0.1", diff --git a/packages/js/core/scripts/manifest/generateTypes.js b/packages/js/core/scripts/manifest/generateTypes.js new file mode 100644 index 0000000000..3747ddd094 --- /dev/null +++ b/packages/js/core/scripts/manifest/generateTypes.js @@ -0,0 +1,181 @@ +const SchemaToTypescript = require("json-schema-to-typescript"); +const os = require("@polywrap/os-js"); +const fs = require("fs"); +const path = require("path"); +const Mustache = require("mustache"); + +async function generateFormatTypes() { + // Fetch all schemas within the @polywrap/manifest-schemas/formats directory + const formatsDir = path.join( + path.dirname(require.resolve("@polywrap/manifest-schemas")), + "polywrap" + ); + + // Get all format types (polywrap, polywrap.build, etc) + const formatTypes = fs.readdirSync( + formatsDir, { withFileTypes: true } + ).filter((dirent) => dirent.isDirectory); + + // For each format type + for (let i = 0; i < formatTypes.length; ++i) { + const formatTypeName = formatTypes[i].name; + const formatTypeDir = path.join(formatsDir, formatTypeName); + const formatModules = []; + + // Get all JSON schemas for this format type (v1, v2, etc) + const formatSchemaFiles = fs.readdirSync(formatTypeDir); + const formatSchemas = []; + + for (let k = 0; k < formatSchemaFiles.length; ++k) { + const formatSchemaName = formatSchemaFiles[k]; + const formatVersion = formatSchemaName.replace(".json", ""); + const formatSchemaPath = path.join(formatTypeDir, formatSchemaName); + + try { + // Parse the JSON schema + const formatSchema = JSON.parse( + fs.readFileSync(formatSchemaPath, { encoding: "utf-8" }) + ); + + // Insert the __type property for introspection + formatSchema.properties["__type"] = { + type: "string", + const: formatSchema.id + }; + formatSchema.required = [ + ...formatSchema.required, + "__type" + ]; + + formatSchemas.push(formatSchema); + + console.log({ formatSchema }) + // Convert it to a TypeScript interface + const tsFile = await SchemaToTypescript.compile( + formatSchema, + formatSchema.id + ); + + // Emit the result + const tsOutputPath = path.join(__dirname, `/../../src/manifest/polywrap/${formatTypeName}/${formatVersion}.ts`); + fs.mkdirSync(path.dirname(tsOutputPath), { recursive: true }); + os.writeFileSync( + tsOutputPath, + `/* eslint-disable @typescript-eslint/naming-convention */\n${tsFile}` + ); + + // Add metadata for the root index.ts file to use + formatModules.push({ + interface: formatSchema.id, + version: formatVersion + }); + } catch (error) { + console.error(`Error generating the Manifest file ${formatSchemaPath}: `, error); + throw error; + } + } + + const renderTemplate = (name, context) => { + const tsTemplate = fs.readFileSync( + __dirname + `/polywrap/${name}-ts.mustache`, { encoding: "utf-8" } + ); + + // Render the template + const tsSrc = Mustache.render(tsTemplate, context); + + // Emit the source + const tsOutputPath = path.join(__dirname, `/../../src/manifest/polywrap/${formatTypeName}/${name}.ts`); + fs.mkdirSync(path.dirname(tsOutputPath), { recursive: true }); + os.writeFileSync(tsOutputPath, tsSrc); + } + + const lastItem = (arr) => arr[arr.length - 1]; + const versionToTs = (version) => + version.replace(/\./g, "_").replace(/\-/g, "_"); + + // Generate an index.ts file that exports root types that aggregate all versions + const indexContext = { }; + indexContext.formats = formatModules.map((module) => { + return { + type: module.interface, + version: module.version, + tsVersion: versionToTs(module.version) + } + }); + indexContext.latest = lastItem(indexContext.formats); + + renderTemplate("index", indexContext); + + // Generate a migrate.ts file that exports a migration function from all version to the latest version + const migrateContext = { }; + migrateContext.prevFormats = formatModules.map((module) => { + return { + type: module.interface, + version: module.version, + tsVersion: versionToTs(module.version) + } + }); + migrateContext.latest = lastItem(migrateContext.prevFormats); + migrateContext.prevFormats.pop(); + + renderTemplate("migrate", migrateContext); + + // Generate a deserialize.ts file that exports a deserialization function for the latest format version + const deserializeContext = { + type: migrateContext.latest.type + }; + + renderTemplate("deserialize", deserializeContext); + + // Generate a validate.ts file that validates the manifest against the JSON schema + const validateContext = { }; + validateContext.formats = formatModules.map((module) => { + return { + type: module.interface, + version: module.version, + tsVersion: versionToTs(module.version), + dir: formatTypeName + }; + }); + validateContext.latest = lastItem(validateContext.formats); + + // Extract all validators + validateContext.validators = []; + + for (let k = 0; k < formatSchemas.length; ++k) { + const formatSchema = formatSchemas[k]; + + const getValidator = (obj) => { + if (typeof obj !== "object") { + return; + } + + if (obj.format && typeof obj.format === "string") { + if (validateContext.validators.indexOf(obj.format) === -1) { + validateContext.validators.push(obj.format); + } + } + + const keys = Object.keys(obj); + for (let j = 0; j < keys.length; ++j) { + getValidator(obj[keys[j]]); + } + } + + getValidator(formatSchema); + } + + renderTemplate("validate", validateContext); + } + + return Promise.resolve(); +}; + +generateFormatTypes() + .then(text => { + process.exit(); + }) + .catch(err => { + console.error(err); + process.abort(); + }); diff --git a/packages/js/core/scripts/manifest/newGenerateTypes.js b/packages/js/core/scripts/manifest/newGenerateTypes.js index 22a9c999eb..f794e3d45d 100644 --- a/packages/js/core/scripts/manifest/newGenerateTypes.js +++ b/packages/js/core/scripts/manifest/newGenerateTypes.js @@ -7,7 +7,6 @@ const Mustache = require("mustache"); const readFileFromDirectory = (typeDirectory, fileName) => { const version = fileName.replace(".json", ""); const dirPath = path.join(typeDirectory, fileName); - console.log({dirPath}) try { // Parse the JSON schema const schema = JSON.parse( @@ -38,30 +37,24 @@ const readFileFromDirectory = (typeDirectory, fileName) => { const generateTs = async (schema, dir, fileName) => { const version = fileName.replace(".json", ""); + let directoryPath = `/../../src/manifest/polywrap/${dir}/${version}.ts` + // if (dir === "wrap.info") { + // directoryPath = `/../../src/manifest/${dir}/${version}.ts` + // } - const dirPath = path.join(dir, version.concat(".ts")); + const tsOutputPath = path.join(__dirname, directoryPath); - const polywrapPath = path.join(__dirname, `/../../src/manifest/polywrap/`.concat(dirPath)); - // const wrapInfoPath = path.join(__dirname, `/../../src/manifest/wrap.info/${version}.ts`); - - console.log({schema}) // Convert it to a TypeScript interface const tsFile = await SchemaToTypescript.compile( schema, schema.id ); - console.log({ - dir, - fileName - }) - - console.log(dirPath) - fs.mkdirSync(path.dirname(polywrapPath), { recursive: true }); - // os.writeFileSync(polywrapPath, - // `/* eslint-disable @typescript-eslint/naming-convention */\n${tsFile}` - // ); + fs.mkdirSync(path.dirname(tsOutputPath), { recursive: true }); + os.writeFileSync(tsOutputPath, + `/* eslint-disable @typescript-eslint/naming-convention */\n${tsFile}` + ); } async function generateFormatTypes() { @@ -86,7 +79,7 @@ async function generateFormatTypes() { const formatSchemas = []; const fetchFiles = formatSchemaFiles.map(async file => { const schema = readFileFromDirectory(formatTypeDir, file) - await generateTs(schema, formatTypeName, file) + await generateTs(schema.schema, formatTypeName, file) formatSchemas.push(schema) formatModules.push({ interface: schema.interface, @@ -94,100 +87,98 @@ async function generateFormatTypes() { dir: schema.dir }) }) - const t = await Promise.all(fetchFiles) - // const renderTemplate = (name, context) => { - // const tsTemplate = fs.readFileSync( - // __dirname + `/polywrap/${name}-ts.mustache`, { encoding: "utf-8" } - // ); - // - // // Render the template - // const tsSrc = Mustache.render(tsTemplate, context); - // - // console.log(path.join(__dirname, `/../../src/manifest/polywrap/${formatTypeName}/${name}.ts`)) - // // Emit the source - // const tsOutputPath = path.join(__dirname, `/../../src/manifest/polywrap/${formatTypeName}/${name}.ts`); - // fs.mkdirSync(path.dirname(tsOutputPath), { recursive: true }); - // os.writeFileSync(tsOutputPath, tsSrc); - // } - // - // const lastItem = (arr) => arr[arr.length - 1]; - // const versionToTs = (version) => - // version.replace(/\./g, "_").replace(/\-/g, "_"); - // - // // Generate an index.ts file that exports root types that aggregate all versions - // const indexContext = { }; - // indexContext.formats = formatModules.map((module) => { - // return { - // type: module.interface, - // version: module.version, - // tsVersion: versionToTs(module.version) - // } - // }); - // indexContext.latest = lastItem(indexContext.formats); - // renderTemplate("index", indexContext); - // - // // Generate a migrate.ts file that exports a migration function from all version to the latest version - // const migrateContext = { }; - // migrateContext.prevFormats = formatModules.map((module) => { - // console.log(module.interface) - // return { - // type: module.interface, - // version: module.version, - // tsVersion: versionToTs(module.version), - // dir: module.dir - // } - // }); - // migrateContext.latest = lastItem(migrateContext.prevFormats); - // migrateContext.prevFormats.pop(); - // - // renderTemplate("migrate", migrateContext); - // - // // Generate a deserialize.ts file that exports a deserialization function for the latest format version - // const deserializeContext = { - // type: migrateContext.latest.type - // }; - // - // renderTemplate("deserialize", deserializeContext); - // - // // Generate a validate.ts file that validates the manifest against the JSON schema - // const validateContext = { }; - // validateContext.formats = formatModules.map((module) => { - // return { - // type: module.interface, - // version: module.version, - // tsVersion: versionToTs(module.version), - // dir: formatTypeName - // }; - // }); - // validateContext.latest = lastItem(validateContext.formats); - // - // // Extract all validators - // validateContext.validators = []; - // - // for (let k = 0; k < formatSchemas.length; ++k) { - // const formatSchema = formatSchemas[k]; - // - // const getValidator = (obj) => { - // if (typeof obj !== "object") { - // return; - // } - // - // if (obj.format && typeof obj.format === "string") { - // if (validateContext.validators.indexOf(obj.format) === -1) { - // validateContext.validators.push(obj.format); - // } - // } - // - // const keys = Object.keys(obj); - // for (let j = 0; j < keys.length; ++j) { - // getValidator(obj[keys[j]]); - // } - // } - // - // getValidator(formatSchema); - // } - // - // renderTemplate("validate", validateContext); + await Promise.all(fetchFiles) + const renderTemplate = (name, context) => { + const tsTemplate = fs.readFileSync( + __dirname + `/polywrap/${name}-ts.mustache`, { encoding: "utf-8" } + ); + + // Render the template + const tsSrc = Mustache.render(tsTemplate, context); + + // Emit the source + const tsOutputPath = path.join(__dirname, `/../../src/manifest/polywrap/${formatTypeName}/${name}.ts`); + fs.mkdirSync(path.dirname(tsOutputPath), { recursive: true }); + os.writeFileSync(tsOutputPath, tsSrc); + } + + const lastItem = (arr) => arr[arr.length - 1]; + const versionToTs = (version) => + version.replace(/\./g, "_").replace(/\-/g, "_"); + + // Generate an index.ts file that exports root types that aggregate all versions + const indexContext = { }; + + indexContext.formats = formatModules.map((module) => { + return { + type: module.interface, + version: module.version, + tsVersion: versionToTs(module.version) + } + }); + indexContext.latest = lastItem(indexContext.formats); + renderTemplate("index", indexContext); + + // Generate a migrate.ts file that exports a migration function from all version to the latest version + const migrateContext = { }; + migrateContext.prevFormats = formatModules.map((module) => { + return { + type: module.interface, + version: module.version, + tsVersion: versionToTs(module.version) + } + }); + migrateContext.latest = lastItem(migrateContext.prevFormats); + migrateContext.prevFormats.pop(); + + renderTemplate("migrate", migrateContext); + + // Generate a deserialize.ts file that exports a deserialization function for the latest format version + const deserializeContext = { + type: migrateContext.latest.type + }; + + renderTemplate("deserialize", deserializeContext); + + // Generate a validate.ts file that validates the manifest against the JSON schema + const validateContext = { }; + validateContext.formats = formatModules.map((module) => { + return { + type: module.interface, + version: module.version, + tsVersion: versionToTs(module.version), + dir: formatTypeName + }; + }); + validateContext.latest = lastItem(validateContext.formats); + + // Extract all validators + validateContext.validators = []; + + for (let k = 0; k < formatSchemas.length; ++k) { + const formatSchema = formatSchemas[k]; + + const getValidator = (obj) => { + if (typeof obj !== "object") { + return; + } + + if (obj.format && typeof obj.format === "string") { + if (validateContext.validators.indexOf(obj.format) === -1) { + validateContext.validators.push(obj.format); + } + } + + const keys = Object.keys(obj); + for (let j = 0; j < keys.length; ++j) { + getValidator(obj[keys[j]]); + } + } + + getValidator(formatSchema); + } + + renderTemplate("validate", validateContext); } return Promise.resolve(); From 7a5ef35439cf76f2450517cefbdfe937cc4d7578 Mon Sep 17 00:00:00 2001 From: cbrzn Date: Tue, 28 Jun 2022 21:56:01 +0200 Subject: [PATCH 07/46] chore: refactor with jordan --- packages/cli/package.json | 5 +- packages/cli/{ => scripts}/copyfiles.ts | 5 +- .../scripts/generatePolywrapManifestTypes.ts} | 78 +++---- .../templates}/deserialize-ts.mustache | 0 .../scripts/templates}/index-ts.mustache | 0 .../scripts/templates}/migrate-ts.mustache | 0 .../scripts/templates}/validate-ts.mustache | 0 packages/cli/src/commands/deploy.ts | 3 +- packages/cli/src/commands/infra.ts | 3 +- packages/cli/src/lib/CodeGenerator.ts | 4 +- packages/cli/src/lib/Compiler.ts | 9 +- packages/cli/src/lib/SchemaComposer.ts | 4 +- packages/cli/src/lib/index.ts | 3 +- .../lib/polywrap-manifests}/deserialize.ts | 0 .../lib/polywrap-manifests/formats/index.ts | 7 + .../formats}/polywrap.app/0.0.1-prealpha.1.ts | 0 .../formats}/polywrap.app/0.0.1-prealpha.2.ts | 0 .../formats}/polywrap.app/deserialize.ts | 0 .../formats}/polywrap.app/index.ts | 0 .../formats}/polywrap.app/migrate.ts | 0 .../formats}/polywrap.app/validate.ts | 0 .../polywrap.build/0.0.1-prealpha.1.ts | 0 .../polywrap.build/0.0.1-prealpha.2.ts | 0 .../polywrap.build/0.0.1-prealpha.3.ts | 0 .../formats}/polywrap.build/deserialize.ts | 0 .../formats}/polywrap.build/index.ts | 0 .../formats}/polywrap.build/migrate.ts | 0 .../formats}/polywrap.build/validate.ts | 0 .../polywrap.deploy/0.0.1-prealpha.1.ts | 0 .../formats}/polywrap.deploy/deserialize.ts | 0 .../formats}/polywrap.deploy/index.ts | 0 .../formats}/polywrap.deploy/migrate.ts | 0 .../formats}/polywrap.deploy/validate.ts | 0 .../polywrap.infra/0.0.1-prealpha.1.ts | 0 .../polywrap.infra/0.0.1-prealpha.2.ts | 0 .../formats}/polywrap.infra/deserialize.ts | 0 .../formats}/polywrap.infra/index.ts | 0 .../formats}/polywrap.infra/migrate.ts | 0 .../formats}/polywrap.infra/validate.ts | 0 .../polywrap.meta/0.0.1-prealpha.1.ts | 0 .../polywrap.meta/0.0.1-prealpha.2.ts | 0 .../polywrap.meta/0.0.1-prealpha.3.ts | 0 .../formats}/polywrap.meta/deserialize.ts | 0 .../formats}/polywrap.meta/index.ts | 0 .../formats}/polywrap.meta/migrate.ts | 0 .../formats}/polywrap.meta/validate.ts | 0 .../polywrap.plugin/0.0.1-prealpha.1.ts | 0 .../polywrap.plugin/0.0.1-prealpha.2.ts | 0 .../polywrap.plugin/0.0.1-prealpha.3.ts | 0 .../formats}/polywrap.plugin/deserialize.ts | 0 .../formats}/polywrap.plugin/index.ts | 0 .../formats}/polywrap.plugin/migrate.ts | 0 .../formats}/polywrap.plugin/validate.ts | 0 .../formats}/polywrap/0.0.1-prealpha.1.ts | 0 .../formats}/polywrap/0.0.1-prealpha.2.ts | 0 .../formats}/polywrap/0.0.1-prealpha.3.ts | 0 .../formats}/polywrap/0.0.1-prealpha.4.ts | 0 .../formats}/polywrap/0.0.1-prealpha.5.ts | 0 .../formats}/polywrap/0.0.1-prealpha.6.ts | 0 .../formats}/polywrap/0.0.1-prealpha.7.ts | 0 .../formats}/polywrap/0.0.1-prealpha.8.ts | 0 .../formats}/polywrap/0.0.1-prealpha.9.ts | 0 .../formats}/polywrap/deserialize.ts | 0 .../formats}/polywrap/index.ts | 0 .../formats}/polywrap/migrate.ts | 0 .../formats}/polywrap/validate.ts | 0 .../cli/src/lib/polywrap-manifests/index.ts | 2 + .../src/lib/polywrap-manifests}/validators.ts | 2 +- .../app/index.ts | 0 .../app/languages.ts | 0 .../app/load.ts | 0 .../{manifest => project-manifests}/index.ts | 4 +- .../language.ts | 2 +- .../{manifest => project-manifests}/output.ts | 8 +- .../plugin/index.ts | 0 .../plugin/languages.ts | 0 .../plugin/load.ts | 0 .../polywrap/index.ts | 0 .../polywrap/languages.ts | 0 .../polywrap/load.ts | 0 packages/cli/src/lib/project/Project.ts | 8 +- packages/cli/src/lib/system/DockerCompose.ts | 2 +- .../core-interfaces/file-system/package.json | 3 + packages/core-interfaces/ipfs/package.json | 3 + packages/core-interfaces/logger/package.json | 3 + .../core-interfaces/uri-resolver/package.json | 3 + packages/js/client/src/PolywrapClient.ts | 25 --- .../src/__tests__/core/wasm-wrapper.spec.ts | 56 +---- .../js/client/src/plugin/PluginWrapper.ts | 10 - packages/js/client/src/wasm/WasmWrapper.ts | 54 +---- packages/js/core/package.json | 4 +- .../core/scripts/generateWrapManifestTypes.ts | 157 ++++++++++++++ .../core/scripts/manifest/newGenerateTypes.js | 194 ------------------ .../wrap.info/deserialize-ts.mustache | 61 ------ .../manifest/wrap.info/index-ts.mustache | 39 ---- .../manifest/wrap.info/migrate-ts.mustache | 59 ------ .../scripts/templates/deserialize-ts.mustache | 53 +++++ .../core/scripts/templates/index-ts.mustache | 39 ++++ .../scripts/templates/migrate-ts.mustache | 59 ++++++ .../validate-ts.mustache | 28 +-- .../js/core/src/__tests__/resolveUri.spec.ts | 45 +--- packages/js/core/src/manifest/index.ts | 3 - .../js/core/src/manifest/polywrap/index.ts | 34 --- .../0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts | 13 -- .../0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts | 12 -- .../0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts | 12 -- .../0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts | 11 - .../0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts | 19 -- .../0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts | 12 -- .../0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts | 10 - .../0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts | 10 - .../0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts | 10 - .../0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts | 10 - .../0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts | 10 - .../0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts | 10 - .../0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts | 10 - .../0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts | 10 - .../0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts | 10 - .../0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts | 10 - packages/js/core/src/types/Client.ts | 15 -- packages/js/core/src/types/Wrapper.ts | 15 -- .../js/core/src/wrap-manifests/deserialize.ts | 3 + .../formats}/0.0.1.ts | 5 +- .../formats}/deserialize.ts | 24 +-- .../formats}/index.ts | 2 +- .../formats}/migrate.ts | 0 .../formats}/validate.ts | 6 +- packages/js/core/src/wrap-manifests/index.ts | 2 + .../js/core/src/wrap-manifests/validators.ts | 15 ++ .../file-system-resolver/package.json | 3 + packages/js/validation/package.json | 3 + packages/manifest-schemas/.gitignore | 1 + .../polywrap.app/0.0.1-prealpha.1.json | 0 .../polywrap.app/0.0.1-prealpha.2.json | 0 .../polywrap.build/0.0.1-prealpha.1.json | 0 .../polywrap.build/0.0.1-prealpha.2.json | 0 .../polywrap.build/0.0.1-prealpha.3.json | 0 .../polywrap.deploy/0.0.1-prealpha.1.json | 0 .../polywrap.infra/0.0.1-prealpha.1.json | 0 .../polywrap.infra/0.0.1-prealpha.2.json | 0 .../polywrap.meta/0.0.1-prealpha.1.json | 0 .../polywrap.meta/0.0.1-prealpha.2.json | 0 .../polywrap.meta/0.0.1-prealpha.3.json | 0 .../polywrap.plugin/0.0.1-prealpha.1.json | 0 .../polywrap.plugin/0.0.1-prealpha.2.json | 0 .../polywrap.plugin/0.0.1-prealpha.3.json | 0 .../polywrap/0.0.1-prealpha.1.json | 0 .../polywrap/0.0.1-prealpha.2.json | 0 .../polywrap/0.0.1-prealpha.3.json | 0 .../polywrap/0.0.1-prealpha.4.json | 0 .../polywrap/0.0.1-prealpha.5.json | 0 .../polywrap/0.0.1-prealpha.6.json | 0 .../polywrap/0.0.1-prealpha.7.json | 0 .../polywrap/0.0.1-prealpha.8.json | 0 .../polywrap/0.0.1-prealpha.9.json | 0 .../{ => polywrap}/package.json | 2 +- .../{wrap.info => wrap/formats}/0.0.1.json | 0 packages/manifest-schemas/wrap/package.json | 18 ++ todo | 3 + 159 files changed, 488 insertions(+), 889 deletions(-) rename packages/cli/{ => scripts}/copyfiles.ts (67%) rename packages/{js/core/scripts/manifest/generateTypes.js => cli/scripts/generatePolywrapManifestTypes.ts} (70%) rename packages/{js/core/scripts/manifest/polywrap => cli/scripts/templates}/deserialize-ts.mustache (100%) rename packages/{js/core/scripts/manifest/polywrap => cli/scripts/templates}/index-ts.mustache (100%) rename packages/{js/core/scripts/manifest/polywrap => cli/scripts/templates}/migrate-ts.mustache (100%) rename packages/{js/core/scripts/manifest/polywrap => cli/scripts/templates}/validate-ts.mustache (100%) rename packages/{js/core/src/manifest => cli/src/lib/polywrap-manifests}/deserialize.ts (100%) create mode 100644 packages/cli/src/lib/polywrap-manifests/formats/index.ts rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.app/0.0.1-prealpha.1.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.app/0.0.1-prealpha.2.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.app/deserialize.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.app/index.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.app/migrate.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.app/validate.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.build/0.0.1-prealpha.1.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.build/0.0.1-prealpha.2.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.build/0.0.1-prealpha.3.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.build/deserialize.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.build/index.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.build/migrate.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.build/validate.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.deploy/0.0.1-prealpha.1.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.deploy/deserialize.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.deploy/index.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.deploy/migrate.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.deploy/validate.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.infra/0.0.1-prealpha.1.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.infra/0.0.1-prealpha.2.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.infra/deserialize.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.infra/index.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.infra/migrate.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.infra/validate.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.meta/0.0.1-prealpha.1.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.meta/0.0.1-prealpha.2.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.meta/0.0.1-prealpha.3.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.meta/deserialize.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.meta/index.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.meta/migrate.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.meta/validate.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.plugin/0.0.1-prealpha.1.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.plugin/0.0.1-prealpha.2.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.plugin/0.0.1-prealpha.3.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.plugin/deserialize.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.plugin/index.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.plugin/migrate.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap.plugin/validate.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap/0.0.1-prealpha.1.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap/0.0.1-prealpha.2.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap/0.0.1-prealpha.3.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap/0.0.1-prealpha.4.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap/0.0.1-prealpha.5.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap/0.0.1-prealpha.6.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap/0.0.1-prealpha.7.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap/0.0.1-prealpha.8.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap/0.0.1-prealpha.9.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap/deserialize.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap/index.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap/migrate.ts (100%) rename packages/{js/core/src/manifest/polywrap => cli/src/lib/polywrap-manifests/formats}/polywrap/validate.ts (100%) create mode 100644 packages/cli/src/lib/polywrap-manifests/index.ts rename packages/{js/core/src/manifest => cli/src/lib/polywrap-manifests}/validators.ts (98%) rename packages/cli/src/lib/{manifest => project-manifests}/app/index.ts (100%) rename packages/cli/src/lib/{manifest => project-manifests}/app/languages.ts (100%) rename packages/cli/src/lib/{manifest => project-manifests}/app/load.ts (100%) rename packages/cli/src/lib/{manifest => project-manifests}/index.ts (65%) rename packages/cli/src/lib/{manifest => project-manifests}/language.ts (81%) rename packages/cli/src/lib/{manifest => project-manifests}/output.ts (96%) rename packages/cli/src/lib/{manifest => project-manifests}/plugin/index.ts (100%) rename packages/cli/src/lib/{manifest => project-manifests}/plugin/languages.ts (100%) rename packages/cli/src/lib/{manifest => project-manifests}/plugin/load.ts (100%) rename packages/cli/src/lib/{manifest => project-manifests}/polywrap/index.ts (100%) rename packages/cli/src/lib/{manifest => project-manifests}/polywrap/languages.ts (100%) rename packages/cli/src/lib/{manifest => project-manifests}/polywrap/load.ts (100%) create mode 100644 packages/js/core/scripts/generateWrapManifestTypes.ts delete mode 100644 packages/js/core/scripts/manifest/newGenerateTypes.js delete mode 100644 packages/js/core/scripts/manifest/wrap.info/deserialize-ts.mustache delete mode 100644 packages/js/core/scripts/manifest/wrap.info/index-ts.mustache delete mode 100644 packages/js/core/scripts/manifest/wrap.info/migrate-ts.mustache create mode 100644 packages/js/core/scripts/templates/deserialize-ts.mustache create mode 100644 packages/js/core/scripts/templates/index-ts.mustache create mode 100644 packages/js/core/scripts/templates/migrate-ts.mustache rename packages/js/core/scripts/{manifest/wrap.info => templates}/validate-ts.mustache (53%) delete mode 100644 packages/js/core/src/manifest/index.ts delete mode 100644 packages/js/core/src/manifest/polywrap/index.ts delete mode 100644 packages/js/core/src/manifest/polywrap/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts delete mode 100644 packages/js/core/src/manifest/polywrap/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts delete mode 100644 packages/js/core/src/manifest/polywrap/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts delete mode 100644 packages/js/core/src/manifest/polywrap/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts delete mode 100644 packages/js/core/src/manifest/polywrap/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts delete mode 100644 packages/js/core/src/manifest/polywrap/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts delete mode 100644 packages/js/core/src/manifest/polywrap/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts delete mode 100644 packages/js/core/src/manifest/polywrap/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts delete mode 100644 packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts delete mode 100644 packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts delete mode 100644 packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts delete mode 100644 packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts delete mode 100644 packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts delete mode 100644 packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts delete mode 100644 packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts delete mode 100644 packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts create mode 100644 packages/js/core/src/wrap-manifests/deserialize.ts rename packages/js/core/src/{manifest/wrap.info => wrap-manifests/formats}/0.0.1.ts (92%) rename packages/js/core/src/{manifest/wrap.info => wrap-manifests/formats}/deserialize.ts (59%) rename packages/js/core/src/{manifest/wrap.info => wrap-manifests/formats}/index.ts (89%) rename packages/js/core/src/{manifest/wrap.info => wrap-manifests/formats}/migrate.ts (100%) rename packages/js/core/src/{manifest/wrap.info => wrap-manifests/formats}/validate.ts (84%) create mode 100644 packages/js/core/src/wrap-manifests/index.ts create mode 100644 packages/js/core/src/wrap-manifests/validators.ts create mode 100644 packages/manifest-schemas/.gitignore rename packages/manifest-schemas/polywrap/{ => formats}/polywrap.app/0.0.1-prealpha.1.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap.app/0.0.1-prealpha.2.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap.build/0.0.1-prealpha.1.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap.build/0.0.1-prealpha.2.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap.build/0.0.1-prealpha.3.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap.deploy/0.0.1-prealpha.1.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap.infra/0.0.1-prealpha.1.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap.infra/0.0.1-prealpha.2.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap.meta/0.0.1-prealpha.1.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap.meta/0.0.1-prealpha.2.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap.meta/0.0.1-prealpha.3.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap.plugin/0.0.1-prealpha.1.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap.plugin/0.0.1-prealpha.2.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap.plugin/0.0.1-prealpha.3.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap/0.0.1-prealpha.1.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap/0.0.1-prealpha.2.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap/0.0.1-prealpha.3.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap/0.0.1-prealpha.4.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap/0.0.1-prealpha.5.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap/0.0.1-prealpha.6.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap/0.0.1-prealpha.7.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap/0.0.1-prealpha.8.json (100%) rename packages/manifest-schemas/polywrap/{ => formats}/polywrap/0.0.1-prealpha.9.json (100%) rename packages/manifest-schemas/{ => polywrap}/package.json (89%) rename packages/manifest-schemas/{wrap.info => wrap/formats}/0.0.1.json (100%) create mode 100644 packages/manifest-schemas/wrap/package.json create mode 100644 todo diff --git a/packages/cli/package.json b/packages/cli/package.json index ff0b50b305..de352e7e96 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -17,9 +17,10 @@ }, "scripts": { "build": "rimraf ./build && tsc --project tsconfig.build.json && yarn build:build-images && yarn build:deploy-modules && yarn build:infra-modules", + "build:polywrap-manifests": "ts-node ./scripts/generatePolywrapManifestTypes.ts", "build:build-images": "copyfiles ./src/lib/defaults/build-images/**/**/* ./build/lib/defaults/build-images/ -u 4", "build:deploy-modules": "copyfiles ./src/lib/defaults/deploy-modules/**/polywrap.deploy.ext.json ./build/lib/defaults/deploy-modules -u 4", - "build:infra-modules": "ts-node ./copyfiles ./src/lib/defaults/infra-modules ./build/lib/defaults/infra-modules", + "build:infra-modules": "ts-node ./scripts/copyfiles ./src/lib/defaults/infra-modules ./build/lib/defaults/infra-modules", "prebuild": "ts-node ./scripts/generateIntlTypes.ts", "build:fast": "rimraf ./build && tsc --project tsconfig.build.json", "lint": "eslint --color -c ../../.eslintrc.js .", @@ -45,6 +46,7 @@ "@polywrap/schema-compose": "0.0.1-prealpha.90", "@polywrap/schema-parse": "0.0.1-prealpha.90", "@polywrap/test-env-js": "0.0.1-prealpha.90", + "@polywrap/polywrap-manifest-schemas": "0.0.1-prealpha.90", "assemblyscript": "0.19.1", "axios": "0.21.2", "chalk": "4.1.0", @@ -78,6 +80,7 @@ "dir-compare": "3.3.0", "eslint-plugin-formatjs": "2.12.7", "jest": "26.6.3", + "json-schema-to-typescript": "10.1.3", "ts-jest": "26.5.4", "ts-morph": "10.0.1", "ts-node": "8.10.2" diff --git a/packages/cli/copyfiles.ts b/packages/cli/scripts/copyfiles.ts similarity index 67% rename from packages/cli/copyfiles.ts rename to packages/cli/scripts/copyfiles.ts index b32300610d..4ecba3a3d1 100644 --- a/packages/cli/copyfiles.ts +++ b/packages/cli/scripts/copyfiles.ts @@ -1,7 +1,8 @@ import fse from "fs-extra"; +import path from "path"; -const source = process.argv[2]; -const dest = process.argv[3]; +const source = path.join(process.cwd(), process.argv[2]); +const dest = path.join(process.cwd(), process.argv[3]); const ignore = [ ".env", diff --git a/packages/js/core/scripts/manifest/generateTypes.js b/packages/cli/scripts/generatePolywrapManifestTypes.ts similarity index 70% rename from packages/js/core/scripts/manifest/generateTypes.js rename to packages/cli/scripts/generatePolywrapManifestTypes.ts index 3747ddd094..2be81c452b 100644 --- a/packages/js/core/scripts/manifest/generateTypes.js +++ b/packages/cli/scripts/generatePolywrapManifestTypes.ts @@ -1,25 +1,26 @@ -const SchemaToTypescript = require("json-schema-to-typescript"); -const os = require("@polywrap/os-js"); -const fs = require("fs"); -const path = require("path"); -const Mustache = require("mustache"); +import path from "path" +import fs, { Dirent } from "fs"; +import * as os from "@polywrap/os-js"; +import Mustache from "mustache"; +import * as JsonSchema from "json-schema-to-typescript"; async function generateFormatTypes() { - // Fetch all schemas within the @polywrap/manifest-schemas/formats directory + // Fetch all schemas within the @polywrap/polywrap-manifest-schemas/formats directory const formatsDir = path.join( - path.dirname(require.resolve("@polywrap/manifest-schemas")), - "polywrap" + path.dirname(require.resolve("@polywrap/polywrap-manifest-schemas")), + "formats" ); - // Get all format types (polywrap, polywrap.build, etc) + // Get all format types (wasm, build, infra, app, plugin, etc) const formatTypes = fs.readdirSync( formatsDir, { withFileTypes: true } - ).filter((dirent) => dirent.isDirectory); + ).filter((dirent: Dirent) => dirent.isDirectory); // For each format type for (let i = 0; i < formatTypes.length; ++i) { const formatTypeName = formatTypes[i].name; const formatTypeDir = path.join(formatsDir, formatTypeName); + const formatOutputDir = path.join(__dirname, `/../src/lib/polywrap-manifests/formats/${formatTypeName}`); const formatModules = []; // Get all JSON schemas for this format type (v1, v2, etc) @@ -49,15 +50,14 @@ async function generateFormatTypes() { formatSchemas.push(formatSchema); - console.log({ formatSchema }) // Convert it to a TypeScript interface - const tsFile = await SchemaToTypescript.compile( + const tsFile = await JsonSchema.compile( formatSchema, formatSchema.id ); // Emit the result - const tsOutputPath = path.join(__dirname, `/../../src/manifest/polywrap/${formatTypeName}/${formatVersion}.ts`); + const tsOutputPath = path.join(formatOutputDir, `${formatVersion}.ts`); fs.mkdirSync(path.dirname(tsOutputPath), { recursive: true }); os.writeFileSync( tsOutputPath, @@ -75,47 +75,47 @@ async function generateFormatTypes() { } } - const renderTemplate = (name, context) => { + const renderTemplate = (name: string, context: unknown) => { const tsTemplate = fs.readFileSync( - __dirname + `/polywrap/${name}-ts.mustache`, { encoding: "utf-8" } + path.join(__dirname, `/templates/${name}-ts.mustache`), + { encoding: "utf-8" } ); // Render the template const tsSrc = Mustache.render(tsTemplate, context); // Emit the source - const tsOutputPath = path.join(__dirname, `/../../src/manifest/polywrap/${formatTypeName}/${name}.ts`); + const tsOutputPath = path.join(formatOutputDir, `${name}.ts`); fs.mkdirSync(path.dirname(tsOutputPath), { recursive: true }); os.writeFileSync(tsOutputPath, tsSrc); } - const lastItem = (arr) => arr[arr.length - 1]; - const versionToTs = (version) => + const lastItem = (arr: Array) => arr[arr.length - 1]; + const versionToTs = (version: string) => version.replace(/\./g, "_").replace(/\-/g, "_"); - // Generate an index.ts file that exports root types that aggregate all versions - const indexContext = { }; - indexContext.formats = formatModules.map((module) => { + const formats = formatModules.map((module) => { return { type: module.interface, version: module.version, tsVersion: versionToTs(module.version) } }); - indexContext.latest = lastItem(indexContext.formats); + const latest = lastItem(formats); + + // Generate an index.ts file that exports root types that aggregate all versions + const indexContext = { + formats, + latest + }; renderTemplate("index", indexContext); // Generate a migrate.ts file that exports a migration function from all version to the latest version - const migrateContext = { }; - migrateContext.prevFormats = formatModules.map((module) => { - return { - type: module.interface, - version: module.version, - tsVersion: versionToTs(module.version) - } - }); - migrateContext.latest = lastItem(migrateContext.prevFormats); + const migrateContext = { + prevFormats: [...formats], + latest: latest + }; migrateContext.prevFormats.pop(); renderTemplate("migrate", migrateContext); @@ -128,8 +128,7 @@ async function generateFormatTypes() { renderTemplate("deserialize", deserializeContext); // Generate a validate.ts file that validates the manifest against the JSON schema - const validateContext = { }; - validateContext.formats = formatModules.map((module) => { + const validateFormats = formatModules.map((module) => { return { type: module.interface, version: module.version, @@ -137,15 +136,18 @@ async function generateFormatTypes() { dir: formatTypeName }; }); - validateContext.latest = lastItem(validateContext.formats); - // Extract all validators - validateContext.validators = []; + const validateContext = { + formats: validateFormats, + latest: lastItem(validateFormats), + validators: [] as string[] + }; + // Extract all validators for (let k = 0; k < formatSchemas.length; ++k) { const formatSchema = formatSchemas[k]; - const getValidator = (obj) => { + const getValidator = (obj: Record) => { if (typeof obj !== "object") { return; } @@ -158,7 +160,7 @@ async function generateFormatTypes() { const keys = Object.keys(obj); for (let j = 0; j < keys.length; ++j) { - getValidator(obj[keys[j]]); + getValidator(obj[keys[j]] as Record); } } diff --git a/packages/js/core/scripts/manifest/polywrap/deserialize-ts.mustache b/packages/cli/scripts/templates/deserialize-ts.mustache similarity index 100% rename from packages/js/core/scripts/manifest/polywrap/deserialize-ts.mustache rename to packages/cli/scripts/templates/deserialize-ts.mustache diff --git a/packages/js/core/scripts/manifest/polywrap/index-ts.mustache b/packages/cli/scripts/templates/index-ts.mustache similarity index 100% rename from packages/js/core/scripts/manifest/polywrap/index-ts.mustache rename to packages/cli/scripts/templates/index-ts.mustache diff --git a/packages/js/core/scripts/manifest/polywrap/migrate-ts.mustache b/packages/cli/scripts/templates/migrate-ts.mustache similarity index 100% rename from packages/js/core/scripts/manifest/polywrap/migrate-ts.mustache rename to packages/cli/scripts/templates/migrate-ts.mustache diff --git a/packages/js/core/scripts/manifest/polywrap/validate-ts.mustache b/packages/cli/scripts/templates/validate-ts.mustache similarity index 100% rename from packages/js/core/scripts/manifest/polywrap/validate-ts.mustache rename to packages/cli/scripts/templates/validate-ts.mustache diff --git a/packages/cli/src/commands/deploy.ts b/packages/cli/src/commands/deploy.ts index 98bdda4538..1f113cecc8 100644 --- a/packages/cli/src/commands/deploy.ts +++ b/packages/cli/src/commands/deploy.ts @@ -4,6 +4,7 @@ import { PolywrapProject, defaultPolywrapManifest, DeployPackage, + DeployManifest, parseWasmManifestFileOption, } from "../lib"; import { DeployerHandler } from "../lib/deploy/deployer"; @@ -12,7 +13,7 @@ import { Command, Program } from "./types"; import fs from "fs"; import nodePath from "path"; import { print } from "gluegun"; -import { Uri, DeployManifest } from "@polywrap/core-js"; +import { Uri } from "@polywrap/core-js"; import { validate } from "jsonschema"; const defaultManifestStr = defaultPolywrapManifest.join(" | "); diff --git a/packages/cli/src/commands/infra.ts b/packages/cli/src/commands/infra.ts index 6a5e5d2b93..3bef7e2a8f 100644 --- a/packages/cli/src/commands/infra.ts +++ b/packages/cli/src/commands/infra.ts @@ -1,4 +1,4 @@ -import { intlMsg, Infra, loadInfraManifest } from "../lib"; +import { intlMsg, Infra, loadInfraManifest, InfraManifest } from "../lib"; import { Command, Program } from "./types"; import { print } from "gluegun"; @@ -7,7 +7,6 @@ import { Argument } from "commander"; import chalk from "chalk"; import yaml from "js-yaml"; import { readdirSync } from "fs"; -import { InfraManifest } from "@polywrap/core-js"; type InfraCommandOptions = { modules?: string; diff --git a/packages/cli/src/lib/CodeGenerator.ts b/packages/cli/src/lib/CodeGenerator.ts index 977641eee6..10d2eae3aa 100644 --- a/packages/cli/src/lib/CodeGenerator.ts +++ b/packages/cli/src/lib/CodeGenerator.ts @@ -13,7 +13,7 @@ import { isAppManifestLanguage, appManifestLanguageToBindLanguage, Project, - AnyManifest, + AnyProjectManifest, SchemaComposer, intlMsg, resetDir, @@ -29,7 +29,7 @@ import Mustache from "mustache"; export interface CodeGeneratorConfig { codegenDirAbs: string; - project: Project; + project: Project; schemaComposer: SchemaComposer; customScript?: string; mustacheView?: Record; diff --git a/packages/cli/src/lib/Compiler.ts b/packages/cli/src/lib/Compiler.ts index 032b4b85d8..fbb5f16519 100644 --- a/packages/cli/src/lib/Compiler.ts +++ b/packages/cli/src/lib/Compiler.ts @@ -2,6 +2,8 @@ /* eslint-disable @typescript-eslint/no-empty-function */ import { + PolywrapManifest, + MetaManifest, PolywrapProject, SchemaComposer, withSpinner, @@ -15,12 +17,7 @@ import { resetDir, } from "./"; -import { - PolywrapManifest, - WrapManifest, - MetaManifest, - msgpackEncode, -} from "@polywrap/core-js"; +import { msgpackEncode, WrapManifest } from "@polywrap/core-js"; import { WasmWrapper } from "@polywrap/client-js"; import { WrapImports } from "@polywrap/client-js/build/wasm/types"; import { AsyncWasmInstance } from "@polywrap/asyncify-js"; diff --git a/packages/cli/src/lib/SchemaComposer.ts b/packages/cli/src/lib/SchemaComposer.ts index e5026d08ce..7f3a0ced49 100644 --- a/packages/cli/src/lib/SchemaComposer.ts +++ b/packages/cli/src/lib/SchemaComposer.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable @typescript-eslint/no-empty-function */ -import { Project, AnyManifest, getSimpleClient } from "./"; +import { Project, AnyProjectManifest, getSimpleClient } from "./"; import { Uri, PolywrapClient } from "@polywrap/client-js"; import { @@ -16,7 +16,7 @@ import path from "path"; import * as gluegun from "gluegun"; export interface SchemaComposerConfig { - project: Project; + project: Project; // TODO: add this to the project configuration // and make it configurable diff --git a/packages/cli/src/lib/index.ts b/packages/cli/src/lib/index.ts index c52ba0b79f..e59273a30c 100644 --- a/packages/cli/src/lib/index.ts +++ b/packages/cli/src/lib/index.ts @@ -2,9 +2,10 @@ export * from "./deploy"; export * from "./helpers"; export * from "./infra"; export * from "./intl"; -export * from "./manifest"; export * from "./option-parsers"; +export * from "./polywrap-manifests"; export * from "./project"; +export * from "./project-manifests"; export * from "./project-templates"; export * from "./system"; export * from "./test-env"; diff --git a/packages/js/core/src/manifest/deserialize.ts b/packages/cli/src/lib/polywrap-manifests/deserialize.ts similarity index 100% rename from packages/js/core/src/manifest/deserialize.ts rename to packages/cli/src/lib/polywrap-manifests/deserialize.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/index.ts b/packages/cli/src/lib/polywrap-manifests/formats/index.ts new file mode 100644 index 0000000000..fa265d6b2f --- /dev/null +++ b/packages/cli/src/lib/polywrap-manifests/formats/index.ts @@ -0,0 +1,7 @@ +export * from "./polywrap"; +export * from "./polywrap.build"; +export * from "./polywrap.infra"; +export * from "./polywrap.deploy"; +export * from "./polywrap.meta"; +export * from "./polywrap.plugin"; +export * from "./polywrap.app"; diff --git a/packages/js/core/src/manifest/polywrap/polywrap.app/0.0.1-prealpha.1.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/0.0.1-prealpha.1.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.app/0.0.1-prealpha.1.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/0.0.1-prealpha.1.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.app/0.0.1-prealpha.2.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/0.0.1-prealpha.2.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.app/0.0.1-prealpha.2.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/0.0.1-prealpha.2.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.app/deserialize.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/deserialize.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.app/deserialize.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/deserialize.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.app/index.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/index.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.app/index.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/index.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.app/migrate.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/migrate.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.app/migrate.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/migrate.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.app/validate.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/validate.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.app/validate.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/validate.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.build/0.0.1-prealpha.1.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/0.0.1-prealpha.1.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.build/0.0.1-prealpha.1.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/0.0.1-prealpha.1.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.build/0.0.1-prealpha.2.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/0.0.1-prealpha.2.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.build/0.0.1-prealpha.2.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/0.0.1-prealpha.2.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.build/0.0.1-prealpha.3.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/0.0.1-prealpha.3.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.build/0.0.1-prealpha.3.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/0.0.1-prealpha.3.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.build/deserialize.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/deserialize.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.build/deserialize.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/deserialize.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.build/index.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/index.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.build/index.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/index.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.build/migrate.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/migrate.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.build/migrate.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/migrate.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.build/validate.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/validate.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.build/validate.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/validate.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.deploy/0.0.1-prealpha.1.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/0.0.1-prealpha.1.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.deploy/0.0.1-prealpha.1.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/0.0.1-prealpha.1.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.deploy/deserialize.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/deserialize.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.deploy/deserialize.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/deserialize.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.deploy/index.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/index.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.deploy/index.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/index.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.deploy/migrate.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/migrate.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.deploy/migrate.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/migrate.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.deploy/validate.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/validate.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.deploy/validate.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/validate.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.infra/0.0.1-prealpha.1.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/0.0.1-prealpha.1.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.infra/0.0.1-prealpha.1.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/0.0.1-prealpha.1.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.infra/0.0.1-prealpha.2.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/0.0.1-prealpha.2.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.infra/0.0.1-prealpha.2.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/0.0.1-prealpha.2.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.infra/deserialize.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/deserialize.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.infra/deserialize.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/deserialize.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.infra/index.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/index.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.infra/index.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/index.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.infra/migrate.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/migrate.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.infra/migrate.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/migrate.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.infra/validate.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/validate.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.infra/validate.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/validate.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.meta/0.0.1-prealpha.1.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/0.0.1-prealpha.1.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.meta/0.0.1-prealpha.1.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/0.0.1-prealpha.1.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.meta/0.0.1-prealpha.2.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/0.0.1-prealpha.2.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.meta/0.0.1-prealpha.2.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/0.0.1-prealpha.2.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.meta/0.0.1-prealpha.3.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/0.0.1-prealpha.3.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.meta/0.0.1-prealpha.3.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/0.0.1-prealpha.3.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.meta/deserialize.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/deserialize.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.meta/deserialize.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/deserialize.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.meta/index.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/index.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.meta/index.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/index.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.meta/migrate.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/migrate.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.meta/migrate.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/migrate.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.meta/validate.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/validate.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.meta/validate.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/validate.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.plugin/0.0.1-prealpha.1.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/0.0.1-prealpha.1.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.plugin/0.0.1-prealpha.1.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/0.0.1-prealpha.1.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.plugin/0.0.1-prealpha.2.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/0.0.1-prealpha.2.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.plugin/0.0.1-prealpha.2.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/0.0.1-prealpha.2.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.plugin/0.0.1-prealpha.3.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/0.0.1-prealpha.3.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.plugin/0.0.1-prealpha.3.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/0.0.1-prealpha.3.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.plugin/deserialize.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/deserialize.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.plugin/deserialize.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/deserialize.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.plugin/index.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/index.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.plugin/index.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/index.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.plugin/migrate.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/migrate.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.plugin/migrate.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/migrate.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap.plugin/validate.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/validate.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap.plugin/validate.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/validate.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.1.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.1.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.1.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.1.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.2.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.2.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.2.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.2.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.3.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.3.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.3.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.3.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.4.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.4.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.4.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.4.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.5.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.5.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.5.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.5.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.6.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.6.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.6.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.6.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.7.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.7.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.7.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.7.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.8.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.8.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.8.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.8.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.9.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.9.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap/0.0.1-prealpha.9.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.9.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap/deserialize.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/deserialize.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap/deserialize.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap/deserialize.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap/index.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/index.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap/index.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap/index.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap/migrate.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrate.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap/migrate.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrate.ts diff --git a/packages/js/core/src/manifest/polywrap/polywrap/validate.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/validate.ts similarity index 100% rename from packages/js/core/src/manifest/polywrap/polywrap/validate.ts rename to packages/cli/src/lib/polywrap-manifests/formats/polywrap/validate.ts diff --git a/packages/cli/src/lib/polywrap-manifests/index.ts b/packages/cli/src/lib/polywrap-manifests/index.ts new file mode 100644 index 0000000000..041f37b508 --- /dev/null +++ b/packages/cli/src/lib/polywrap-manifests/index.ts @@ -0,0 +1,2 @@ +export * from "./formats"; +export * from "./deserialize"; diff --git a/packages/js/core/src/manifest/validators.ts b/packages/cli/src/lib/polywrap-manifests/validators.ts similarity index 98% rename from packages/js/core/src/manifest/validators.ts rename to packages/cli/src/lib/polywrap-manifests/validators.ts index ace7924e00..f1d20d60e2 100644 --- a/packages/js/core/src/manifest/validators.ts +++ b/packages/cli/src/lib/polywrap-manifests/validators.ts @@ -1,4 +1,4 @@ -import { Uri } from "../types"; +import { Uri } from "@polywrap/core-js"; export function file(path: unknown): boolean { if (typeof path !== "string") { diff --git a/packages/cli/src/lib/manifest/app/index.ts b/packages/cli/src/lib/project-manifests/app/index.ts similarity index 100% rename from packages/cli/src/lib/manifest/app/index.ts rename to packages/cli/src/lib/project-manifests/app/index.ts diff --git a/packages/cli/src/lib/manifest/app/languages.ts b/packages/cli/src/lib/project-manifests/app/languages.ts similarity index 100% rename from packages/cli/src/lib/manifest/app/languages.ts rename to packages/cli/src/lib/project-manifests/app/languages.ts diff --git a/packages/cli/src/lib/manifest/app/load.ts b/packages/cli/src/lib/project-manifests/app/load.ts similarity index 100% rename from packages/cli/src/lib/manifest/app/load.ts rename to packages/cli/src/lib/project-manifests/app/load.ts diff --git a/packages/cli/src/lib/manifest/index.ts b/packages/cli/src/lib/project-manifests/index.ts similarity index 65% rename from packages/cli/src/lib/manifest/index.ts rename to packages/cli/src/lib/project-manifests/index.ts index 7a32926103..13b354feeb 100644 --- a/packages/cli/src/lib/manifest/index.ts +++ b/packages/cli/src/lib/project-manifests/index.ts @@ -8,6 +8,6 @@ import { PolywrapManifest, PluginManifest, AppManifest, -} from "@polywrap/core-js"; +} from "../"; -export type AnyManifest = PolywrapManifest | PluginManifest | AppManifest; +export type AnyProjectManifest = PolywrapManifest | PluginManifest | AppManifest; diff --git a/packages/cli/src/lib/manifest/language.ts b/packages/cli/src/lib/project-manifests/language.ts similarity index 81% rename from packages/cli/src/lib/manifest/language.ts rename to packages/cli/src/lib/project-manifests/language.ts index d4931470d3..6214ade0c7 100644 --- a/packages/cli/src/lib/manifest/language.ts +++ b/packages/cli/src/lib/project-manifests/language.ts @@ -4,7 +4,7 @@ import { AppManifestLanguage, } from "./"; -export type AnyManifestLanguage = +export type AnyProjectManifestLanguage = | PolywrapManifestLanguage | PluginManifestLanguage | AppManifestLanguage; diff --git a/packages/cli/src/lib/manifest/output.ts b/packages/cli/src/lib/project-manifests/output.ts similarity index 96% rename from packages/cli/src/lib/manifest/output.ts rename to packages/cli/src/lib/project-manifests/output.ts index 2027b0cb14..73be298b03 100644 --- a/packages/cli/src/lib/manifest/output.ts +++ b/packages/cli/src/lib/project-manifests/output.ts @@ -1,11 +1,13 @@ -import { displayPath, withSpinner, intlMsg } from "../"; - import { + displayPath, + withSpinner, + intlMsg, BuildManifest, PolywrapManifest, MetaManifest, PluginManifest, -} from "@polywrap/core-js"; +} from "../"; + import { writeFileSync, normalizePath } from "@polywrap/os-js"; import YAML from "js-yaml"; import path from "path"; diff --git a/packages/cli/src/lib/manifest/plugin/index.ts b/packages/cli/src/lib/project-manifests/plugin/index.ts similarity index 100% rename from packages/cli/src/lib/manifest/plugin/index.ts rename to packages/cli/src/lib/project-manifests/plugin/index.ts diff --git a/packages/cli/src/lib/manifest/plugin/languages.ts b/packages/cli/src/lib/project-manifests/plugin/languages.ts similarity index 100% rename from packages/cli/src/lib/manifest/plugin/languages.ts rename to packages/cli/src/lib/project-manifests/plugin/languages.ts diff --git a/packages/cli/src/lib/manifest/plugin/load.ts b/packages/cli/src/lib/project-manifests/plugin/load.ts similarity index 100% rename from packages/cli/src/lib/manifest/plugin/load.ts rename to packages/cli/src/lib/project-manifests/plugin/load.ts diff --git a/packages/cli/src/lib/manifest/polywrap/index.ts b/packages/cli/src/lib/project-manifests/polywrap/index.ts similarity index 100% rename from packages/cli/src/lib/manifest/polywrap/index.ts rename to packages/cli/src/lib/project-manifests/polywrap/index.ts diff --git a/packages/cli/src/lib/manifest/polywrap/languages.ts b/packages/cli/src/lib/project-manifests/polywrap/languages.ts similarity index 100% rename from packages/cli/src/lib/manifest/polywrap/languages.ts rename to packages/cli/src/lib/project-manifests/polywrap/languages.ts diff --git a/packages/cli/src/lib/manifest/polywrap/load.ts b/packages/cli/src/lib/project-manifests/polywrap/load.ts similarity index 100% rename from packages/cli/src/lib/manifest/polywrap/load.ts rename to packages/cli/src/lib/project-manifests/polywrap/load.ts diff --git a/packages/cli/src/lib/project/Project.ts b/packages/cli/src/lib/project/Project.ts index a62d87c237..e18c4802a3 100644 --- a/packages/cli/src/lib/project/Project.ts +++ b/packages/cli/src/lib/project/Project.ts @@ -1,7 +1,7 @@ import { intlMsg, - AnyManifest, - AnyManifestLanguage, + AnyProjectManifest, + AnyProjectManifestLanguage, CacheDirectory, CacheDirectoryConfig, } from "../"; @@ -14,7 +14,7 @@ export interface ProjectConfig { quiet?: boolean; } -export abstract class Project { +export abstract class Project { protected _cache: CacheDirectory; constructor(protected _config: ProjectConfig, _cache: CacheDirectoryConfig) { @@ -56,7 +56,7 @@ export abstract class Project { public abstract getManifestPath(): string; - public abstract getManifestLanguage(): Promise; + public abstract getManifestLanguage(): Promise; public abstract getSchemaNamedPath(): Promise; diff --git a/packages/cli/src/lib/system/DockerCompose.ts b/packages/cli/src/lib/system/DockerCompose.ts index f1802e03ab..7d7b0d87d3 100644 --- a/packages/cli/src/lib/system/DockerCompose.ts +++ b/packages/cli/src/lib/system/DockerCompose.ts @@ -1,9 +1,9 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ +import { InfraManifest } from "../" import { getDockerFileLock } from "./docker"; import path from "path"; import Commands, { IDockerComposeOptions } from "docker-compose"; -import { InfraManifest } from "@polywrap/core-js"; export class DockerCompose { private _dockerLock = getDockerFileLock(); diff --git a/packages/core-interfaces/file-system/package.json b/packages/core-interfaces/file-system/package.json index 384c21e09b..9f0ba4fd29 100644 --- a/packages/core-interfaces/file-system/package.json +++ b/packages/core-interfaces/file-system/package.json @@ -12,5 +12,8 @@ }, "devDependencies": { "polywrap": "0.0.1-prealpha.90" + }, + "publishConfig": { + "access": "public" } } diff --git a/packages/core-interfaces/ipfs/package.json b/packages/core-interfaces/ipfs/package.json index d4c3dcf2b5..e5c4bb3643 100644 --- a/packages/core-interfaces/ipfs/package.json +++ b/packages/core-interfaces/ipfs/package.json @@ -12,5 +12,8 @@ }, "devDependencies": { "polywrap": "0.0.1-prealpha.90" + }, + "publishConfig": { + "access": "public" } } diff --git a/packages/core-interfaces/logger/package.json b/packages/core-interfaces/logger/package.json index b36462b07b..2369b61e52 100644 --- a/packages/core-interfaces/logger/package.json +++ b/packages/core-interfaces/logger/package.json @@ -12,5 +12,8 @@ }, "devDependencies": { "polywrap": "0.0.1-prealpha.90" + }, + "publishConfig": { + "access": "public" } } diff --git a/packages/core-interfaces/uri-resolver/package.json b/packages/core-interfaces/uri-resolver/package.json index a896c3f3c8..407db3b8e7 100644 --- a/packages/core-interfaces/uri-resolver/package.json +++ b/packages/core-interfaces/uri-resolver/package.json @@ -12,5 +12,8 @@ }, "devDependencies": { "polywrap": "0.0.1-prealpha.90" + }, + "publishConfig": { + "access": "public" } } diff --git a/packages/js/client/src/PolywrapClient.ts b/packages/js/client/src/PolywrapClient.ts index 013c957e44..8a7fefc39b 100644 --- a/packages/js/client/src/PolywrapClient.ts +++ b/packages/js/client/src/PolywrapClient.ts @@ -11,7 +11,6 @@ import { GetFileOptions, GetImplementationsOptions, GetInterfacesOptions, - GetManifestOptions, GetPluginsOptions, GetRedirectsOptions, GetSchemaOptions, @@ -28,8 +27,6 @@ import { createQueryDocument, getImplementations, parseQuery, - ManifestArtifactType, - AnyManifestArtifact, ResolveUriOptions, ResolveUriResult, UriResolver, @@ -180,19 +177,6 @@ export class PolywrapClient implements Client { return await wrapper.getSchema(client); } - @Tracer.traceMethod("PolywrapClient: getManifest") - public async getManifest< - TUri extends Uri | string, - TManifestArtifactType extends ManifestArtifactType - >( - uri: TUri, - options: GetManifestOptions - ): Promise> { - const wrapper = await this._loadWrapper(this._toUri(uri), options); - const client = contextualizeClient(this, options.contextId); - return await wrapper.getManifest(options, client); - } - @Tracer.traceMethod("PolywrapClient: getFile") public async getFile( uri: TUri, @@ -851,15 +835,6 @@ const contextualizeClient = ( ) => { return client.getSchema(uri, { ...options, contextId }); }, - getManifest: < - TUri extends Uri | string, - TManifestArtifactType extends ManifestArtifactType - >( - uri: TUri, - options: GetManifestOptions - ) => { - return client.getManifest(uri, { ...options, contextId }); - }, getFile: ( uri: TUri, options: GetFileOptions diff --git a/packages/js/client/src/__tests__/core/wasm-wrapper.spec.ts b/packages/js/client/src/__tests__/core/wasm-wrapper.spec.ts index f58ce78a34..8e9ecb48a2 100644 --- a/packages/js/client/src/__tests__/core/wasm-wrapper.spec.ts +++ b/packages/js/client/src/__tests__/core/wasm-wrapper.spec.ts @@ -234,55 +234,10 @@ describe("wasm-wrapper", () => { expect(getFail.data?.getData).toBeFalsy(); }); - test("getManifest -- polywrap manifest, build manifest, meta manifest", async () => { - const client = await getClient(); - - const actualManifestStr: string = fs.readFileSync( - `${GetPathToTestWrappers()}/wasm-as/simple-storage/build/polywrap.json`, - "utf8" - ); - const actualManifest: PolywrapManifest = deserializePolywrapManifest( - actualManifestStr - ); - const manifest: PolywrapManifest = await client.getManifest(wrapperUri, { - type: "polywrap", - }); - expect(manifest).toStrictEqual(actualManifest); - - const actualBuildManifestStr: string = fs.readFileSync( - `${GetPathToTestWrappers()}/wasm-as/simple-storage/build/polywrap.build.json`, - "utf8" - ); - const actualBuildManifest: BuildManifest = deserializeBuildManifest( - actualBuildManifestStr - ); - const buildManifest: BuildManifest = await client.getManifest(wrapperUri, { - type: "build", - }); - expect(buildManifest).toStrictEqual(actualBuildManifest); - - const actualMetaManifestStr: string = fs.readFileSync( - `${GetPathToTestWrappers()}/wasm-as/simple-storage/build/polywrap.meta.json`, - "utf8" - ); - const actualMetaManifest: MetaManifest = deserializeMetaManifest( - actualMetaManifestStr - ); - const metaManifest: MetaManifest = await client.getManifest(wrapperUri, { - type: "meta", - }); - expect(metaManifest).toStrictEqual(actualMetaManifest); - }); - test("getFile -- simple-storage polywrap", async () => { const client = await getClient(); - - const manifest: PolywrapManifest = await client.getManifest(wrapperUri, { - type: "polywrap", - }); - const fileStr: string = (await client.getFile(wrapperUri, { - path: manifest.schema as string, + path: "./schema.graphql", encoding: "utf8", })) as string; expect(fileStr).toContain(`getData( @@ -292,7 +247,7 @@ describe("wasm-wrapper", () => { `); const fileBuffer: ArrayBuffer = (await client.getFile(wrapperUri, { - path: manifest.schema!, + path: "./schema.graphql", })) as ArrayBuffer; const decoder = new TextDecoder("utf8"); const text = decoder.decode(fileBuffer); @@ -302,13 +257,6 @@ describe("wasm-wrapper", () => { ): Int! `); - await expect(() => - client.getManifest(new Uri("wrap://ens/ipfs.polywrap.eth"), { - type: "polywrap", - }) - ).rejects.toThrow( - "client.getManifest(...) is not implemented for Plugins." - ); await expect(() => client.getFile(new Uri("wrap://ens/ipfs.polywrap.eth"), { path: "./index.js", diff --git a/packages/js/client/src/plugin/PluginWrapper.ts b/packages/js/client/src/plugin/PluginWrapper.ts index 38c44e3b53..6a5d3ded28 100644 --- a/packages/js/client/src/plugin/PluginWrapper.ts +++ b/packages/js/client/src/plugin/PluginWrapper.ts @@ -1,14 +1,11 @@ import { Wrapper, Client, - GetManifestOptions, InvokeOptions, InvokeResult, PluginModule, PluginPackage, Uri, - AnyManifestArtifact, - ManifestArtifactType, GetFileOptions, Env, msgpackEncode, @@ -41,13 +38,6 @@ export class PluginWrapper extends Wrapper { return Promise.resolve(this._plugin.manifest.schema); } - public async getManifest( - _options: GetManifestOptions, - _client: Client - ): Promise> { - throw Error("client.getManifest(...) is not implemented for Plugins."); - } - public async getFile( _options: GetFileOptions, _client: Client diff --git a/packages/js/client/src/wasm/WasmWrapper.ts b/packages/js/client/src/wasm/WasmWrapper.ts index 56e82b8d80..51e04cef5d 100644 --- a/packages/js/client/src/wasm/WasmWrapper.ts +++ b/packages/js/client/src/wasm/WasmWrapper.ts @@ -6,15 +6,9 @@ import { InvokeOptions, InvokeResult, Wrapper, - PolywrapManifest, + WrapManifest, Uri, Client, - GetManifestOptions, - deserializePolywrapManifest, - deserializeBuildManifest, - deserializeMetaManifest, - AnyManifestArtifact, - ManifestArtifactType, combinePaths, Env, UriResolverInterface, @@ -72,7 +66,7 @@ export class WasmWrapper extends Wrapper { constructor( private _uri: Uri, - private _manifest: PolywrapManifest, + private _manifest: WrapManifest, private _uriResolver: string, private _clientEnv?: Env ) { @@ -88,50 +82,6 @@ export class WasmWrapper extends Wrapper { Tracer.endSpan(); } - @Tracer.traceMethod("WasmWrapper: getManifest") - public async getManifest( - options: GetManifestOptions, - client: Client - ): Promise> { - if (!options?.type) { - return this._manifest as AnyManifestArtifact; - } - let manifest: string | undefined; - const fileTitle: string = - options.type === "polywrap" ? "polywrap" : "polywrap." + options.type; - - const manifestExts = ["json", "yaml", "yml"]; - for (const ext of manifestExts) { - const path = `${fileTitle}.${ext}`; - try { - manifest = (await this.getFile( - { path, encoding: "utf8" }, - client - )) as string; - break; - } catch (error) { - continue; - } - } - if (!manifest) { - throw new Error("WasmWrapper: Manifest was not found."); - } - switch (options.type) { - case "build": - return deserializeBuildManifest( - manifest - ) as AnyManifestArtifact; - case "meta": - return deserializeMetaManifest( - manifest - ) as AnyManifestArtifact; - default: - return deserializePolywrapManifest( - manifest - ) as AnyManifestArtifact; - } - } - @Tracer.traceMethod("WasmWrapper: getFile") public async getFile( options: GetFileOptions, diff --git a/packages/js/core/package.json b/packages/js/core/package.json index 2029a874ad..8438c1dc3e 100644 --- a/packages/js/core/package.json +++ b/packages/js/core/package.json @@ -13,7 +13,7 @@ ], "scripts": { "build": "rimraf ./build && tsc --project tsconfig.build.json", - "build:manifest": "node ./scripts/manifest/generateFormatTypes.js", + "build:wrap-manifests": "ts-node ./scripts/generateWrapManifestTypes.ts", "lint": "eslint --color -c ../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", @@ -21,7 +21,6 @@ }, "dependencies": { "@msgpack/msgpack": "2.7.2", - "@polywrap/manifest-schemas": "0.0.1-prealpha.90", "@polywrap/tracing-js": "0.0.1-prealpha.90", "graphql": "15.5.0", "graphql-tag": "2.10.4", @@ -31,6 +30,7 @@ }, "devDependencies": { "@polywrap/os-js": "0.0.1-prealpha.90", + "@polywrap/polywrap-manifest-schemas": "0.0.1-prealpha.90", "@types/jest": "26.0.8", "@types/prettier": "2.6.0", "@types/semver": "7.3.8", diff --git a/packages/js/core/scripts/generateWrapManifestTypes.ts b/packages/js/core/scripts/generateWrapManifestTypes.ts new file mode 100644 index 0000000000..abbf504cd8 --- /dev/null +++ b/packages/js/core/scripts/generateWrapManifestTypes.ts @@ -0,0 +1,157 @@ +import path from "path" +import fs from "fs"; +import * as os from "@polywrap/os-js"; +import Mustache from "mustache"; +import { compile } from "json-schema-to-typescript" + +async function generateFormatTypes() { + // Fetch all schemas within the @polywrap/wrap-manifest-schemas/formats directory + const formatsDir = path.join( + path.dirname(require.resolve("@polywrap/wrap-manifest-schemas")), + "formats" + ); + + const formatOutputDir = path.join(__dirname, `/../src/wrap-manifests/formats`); + + // Get all JSON schemas for this format type (0.0.1, 0.0.2, etc) + const formatSchemaFiles = fs.readdirSync(formatsDir); + const formatSchemas: any[] = []; + const formatModules: any[] = []; + + for (let k = 0; k < formatSchemaFiles.length; ++k) { + const formatSchemaName = formatSchemaFiles[k]; + const formatVersion = formatSchemaName.replace(".json", ""); + const formatSchemaPath = path.join(formatsDir, formatSchemaName); + + try { + // Parse the JSON schema + const formatSchema = JSON.parse( + fs.readFileSync(formatSchemaPath, { encoding: "utf-8" }) + ); + + formatSchemas.push(formatSchema); + + // Convert it to a TypeScript interface + const tsFile = await compile( + formatSchema, + formatSchema.id + ); + + // Emit the result + const tsOutputPath = path.join(formatOutputDir, `${formatVersion}.ts`); + fs.mkdirSync(path.dirname(tsOutputPath), { recursive: true }); + os.writeFileSync( + tsOutputPath, + `/* eslint-disable @typescript-eslint/naming-convention */\n${tsFile}` + ); + + // Add metadata for the root index.ts file to use + formatModules.push({ + interface: formatSchema.id, + version: formatVersion + }); + } catch (error) { + console.error(`Error generating the Manifest file ${formatSchemaPath}: `, error); + throw error; + } + } + + const renderTemplate = (name: string, context: unknown) => { + const tsTemplate = fs.readFileSync( + path.join(__dirname, `./templates/${name}-ts.mustache`), + { encoding: "utf-8" } + ); + + // Render the template + const tsSrc = Mustache.render(tsTemplate, context); + + // Emit the source + const tsOutputPath = path.join(formatOutputDir, `${name}.ts`); + fs.mkdirSync(path.dirname(tsOutputPath), { recursive: true }); + os.writeFileSync(tsOutputPath, tsSrc); + } + + const lastItem = (arr: any): unknown => arr[arr.length - 1]; + const versionToTs = (version: any) => + version.replace(/\./g, "_").replace(/\-/g, "_"); + + const formats = formatModules.map((module) => { + return { + type: module.interface, + version: module.version, + tsVersion: versionToTs(module.version) + } + }); + const latest = lastItem(formats); + + // Generate an index.ts file that exports root types that aggregate all versions + const indexContext = { + formats, + latest + }; + + renderTemplate("index", indexContext); + + // Generate a migrate.ts file that exports a migration function from all version to the latest version + const migrateContext = { + prevFormats: [...formats], + latest: latest + }; + migrateContext.prevFormats.pop(); + + renderTemplate("migrate", migrateContext); + + // Generate a deserialize.ts file that exports a deserialization function for the latest format version + renderTemplate("deserialize", {}); + + // Generate a validate.ts file that validates the manifest against the JSON schema + const validateFormats = formatModules.map((module) => { + return { + type: module.interface, + version: module.version, + tsVersion: versionToTs(module.version), + }; + }); + + const validateContext = { + formats: validateFormats, + latest: lastItem(validateFormats), + validators: [] as string[] + }; + + for (let k = 0; k < formatSchemas.length; ++k) { + const formatSchema = formatSchemas[k]; + + const getValidator = (obj: any) => { + if (typeof obj !== "object") { + return; + } + + if (obj.format && typeof obj.format === "string") { + if (validateContext.validators.indexOf(obj.format) === -1) { + validateContext.validators.push(obj.format); + } + } + + const keys = Object.keys(obj); + for (let j = 0; j < keys.length; ++j) { + getValidator(obj[keys[j]]); + } + } + + getValidator(formatSchema); + } + + renderTemplate("validate", validateContext); + + return Promise.resolve(); +}; + +generateFormatTypes() + .then(text => { + process.exit(); + }) + .catch(err => { + console.error(err); + process.abort(); + }); diff --git a/packages/js/core/scripts/manifest/newGenerateTypes.js b/packages/js/core/scripts/manifest/newGenerateTypes.js deleted file mode 100644 index f794e3d45d..0000000000 --- a/packages/js/core/scripts/manifest/newGenerateTypes.js +++ /dev/null @@ -1,194 +0,0 @@ -const SchemaToTypescript = require("json-schema-to-typescript"); -const os = require("@polywrap/os-js"); -const fs = require("fs"); -const path = require("path"); -const Mustache = require("mustache"); - -const readFileFromDirectory = (typeDirectory, fileName) => { - const version = fileName.replace(".json", ""); - const dirPath = path.join(typeDirectory, fileName); - try { - // Parse the JSON schema - const schema = JSON.parse( - fs.readFileSync(dirPath, { encoding: "utf-8" }) - ); - - // Insert the __type property for introspection - schema.properties["__type"] = { - type: "string", - const: schema.id - }; - schema.required = [ - ...schema.required, - "__type" - ]; - - return { - schema, - interface: schema.id, - version, - dir: typeDirectory - } - } catch (error) { - console.error(`Error generating the Manifest file ${fileName}: `, error); - throw error; - } -} - -const generateTs = async (schema, dir, fileName) => { - const version = fileName.replace(".json", ""); - let directoryPath = `/../../src/manifest/polywrap/${dir}/${version}.ts` - - // if (dir === "wrap.info") { - // directoryPath = `/../../src/manifest/${dir}/${version}.ts` - // } - - const tsOutputPath = path.join(__dirname, directoryPath); - - // Convert it to a TypeScript interface - const tsFile = await SchemaToTypescript.compile( - schema, - schema.id - ); - - fs.mkdirSync(path.dirname(tsOutputPath), { recursive: true }); - os.writeFileSync(tsOutputPath, - `/* eslint-disable @typescript-eslint/naming-convention */\n${tsFile}` - ); -} - -async function generateFormatTypes() { - // Fetch all schemas within the @polywrap/manifest-schemas/formats directory - const formatsDir = path.join( - path.dirname(require.resolve("@polywrap/manifest-schemas")), - "polywrap" - ); - - // Get all format types (polywrap, polywrap.build, etc) - const formatTypes = fs.readdirSync( - formatsDir, { withFileTypes: true } - ).filter((dirent) => dirent.isDirectory); - - // For each format type - for (let i = 0; i < formatTypes.length; ++i) { - const formatTypeName = formatTypes[i].name; - const formatTypeDir = path.join(formatsDir, formatTypeName); - const formatModules = []; - // Get all JSON schemas for this format type (v1, v2, etc) - const formatSchemaFiles = fs.readdirSync(formatTypeDir); - const formatSchemas = []; - const fetchFiles = formatSchemaFiles.map(async file => { - const schema = readFileFromDirectory(formatTypeDir, file) - await generateTs(schema.schema, formatTypeName, file) - formatSchemas.push(schema) - formatModules.push({ - interface: schema.interface, - version: schema.version, - dir: schema.dir - }) - }) - await Promise.all(fetchFiles) - const renderTemplate = (name, context) => { - const tsTemplate = fs.readFileSync( - __dirname + `/polywrap/${name}-ts.mustache`, { encoding: "utf-8" } - ); - - // Render the template - const tsSrc = Mustache.render(tsTemplate, context); - - // Emit the source - const tsOutputPath = path.join(__dirname, `/../../src/manifest/polywrap/${formatTypeName}/${name}.ts`); - fs.mkdirSync(path.dirname(tsOutputPath), { recursive: true }); - os.writeFileSync(tsOutputPath, tsSrc); - } - - const lastItem = (arr) => arr[arr.length - 1]; - const versionToTs = (version) => - version.replace(/\./g, "_").replace(/\-/g, "_"); - - // Generate an index.ts file that exports root types that aggregate all versions - const indexContext = { }; - - indexContext.formats = formatModules.map((module) => { - return { - type: module.interface, - version: module.version, - tsVersion: versionToTs(module.version) - } - }); - indexContext.latest = lastItem(indexContext.formats); - renderTemplate("index", indexContext); - - // Generate a migrate.ts file that exports a migration function from all version to the latest version - const migrateContext = { }; - migrateContext.prevFormats = formatModules.map((module) => { - return { - type: module.interface, - version: module.version, - tsVersion: versionToTs(module.version) - } - }); - migrateContext.latest = lastItem(migrateContext.prevFormats); - migrateContext.prevFormats.pop(); - - renderTemplate("migrate", migrateContext); - - // Generate a deserialize.ts file that exports a deserialization function for the latest format version - const deserializeContext = { - type: migrateContext.latest.type - }; - - renderTemplate("deserialize", deserializeContext); - - // Generate a validate.ts file that validates the manifest against the JSON schema - const validateContext = { }; - validateContext.formats = formatModules.map((module) => { - return { - type: module.interface, - version: module.version, - tsVersion: versionToTs(module.version), - dir: formatTypeName - }; - }); - validateContext.latest = lastItem(validateContext.formats); - - // Extract all validators - validateContext.validators = []; - - for (let k = 0; k < formatSchemas.length; ++k) { - const formatSchema = formatSchemas[k]; - - const getValidator = (obj) => { - if (typeof obj !== "object") { - return; - } - - if (obj.format && typeof obj.format === "string") { - if (validateContext.validators.indexOf(obj.format) === -1) { - validateContext.validators.push(obj.format); - } - } - - const keys = Object.keys(obj); - for (let j = 0; j < keys.length; ++j) { - getValidator(obj[keys[j]]); - } - } - - getValidator(formatSchema); - } - - renderTemplate("validate", validateContext); - } - - return Promise.resolve(); -}; - -generateFormatTypes() - .then(text => { - process.exit(); - }) - .catch(err => { - console.error(err); - process.abort(); - }); diff --git a/packages/js/core/scripts/manifest/wrap.info/deserialize-ts.mustache b/packages/js/core/scripts/manifest/wrap.info/deserialize-ts.mustache deleted file mode 100644 index b878a34338..0000000000 --- a/packages/js/core/scripts/manifest/wrap.info/deserialize-ts.mustache +++ /dev/null @@ -1,61 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, - * and run node ./scripts/manifest/generateTypes.js to regenerate this file. - */ - -import { - {{type}}, - Any{{type}}, - migrate{{type}}, - validate{{type}}, - latest{{type}}Version, -} from "."; -import { DeserializeManifestOptions } from "../../"; - -import { compare } from "semver"; -import YAML from "js-yaml"; -import { Tracer } from "@polywrap/tracing-js"; - -export const deserialize{{type}} = Tracer.traceFunc( - "core: deserialize{{type}}", - (manifest: string, options?: DeserializeManifestOptions): {{type}} => { - let any{{type}}: Any{{type}} | undefined; - try { - any{{type}} = JSON.parse(manifest) as Any{{type}}; - } catch (e) { - any{{type}} = YAML.safeLoad(manifest) as - | Any{{type}} - | undefined; - } - - if (!any{{type}}) { - throw Error(`Unable to parse {{type}}: ${manifest}`); - } - - if (!options || !options.noValidate) { - validate{{type}}(any{{type}}, options?.extSchema); - } - - any{{type}}.__type = "{{type}}"; - - const versionCompare = compare( - any{{type}}.version, - latest{{type}}Version - ); - - if (versionCompare === -1) { - // Upgrade - return migrate{{type}}(any{{type}}, latest{{type}}Version); - } else if (versionCompare === 1) { - // Downgrade - throw Error( - `Cannot downgrade wrap.info version ${anyWrapManifest.version}, please upgrade your PolywrapClient package.` - ); - } else { - // Latest - return any{{type}} as {{type}}; - } - } -); diff --git a/packages/js/core/scripts/manifest/wrap.info/index-ts.mustache b/packages/js/core/scripts/manifest/wrap.info/index-ts.mustache deleted file mode 100644 index bb87660abc..0000000000 --- a/packages/js/core/scripts/manifest/wrap.info/index-ts.mustache +++ /dev/null @@ -1,39 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/index-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/index-ts.mustache, - * and run node ./scripts/manifest/generateTypes.js to regenerate this file. - */ - -{{#formats}} -import { - {{type}} as {{type}}{{tsVersion}} -} from "./{{version}}"; -{{/formats}} - -export { - {{#formats}} - {{type}}{{tsVersion}}, - {{/formats}} -}; - -export enum {{#latest}}{{type}}{{/latest}}Formats { - {{#formats}} - "{{version}}" = "{{version}}", - {{/formats}} -} - -export type Any{{#latest}}{{type}}{{/latest}} = -{{#formats}} - | {{type}}{{tsVersion}} -{{/formats}} - -export type {{#latest}}{{type}}{{/latest}} = {{#latest}}{{type}}{{tsVersion}}{{/latest}}; - -export const latest{{#latest}}{{type}}{{/latest}}Format = {{#latest}}{{type}}{{/latest}}Formats["{{#latest}}{{version}}{{/latest}}"] - -export { migrate{{#latest}}{{type}}{{/latest}} } from "./migrate"; - -export { deserialize{{#latest}}{{type}}{{/latest}} } from "./deserialize"; - -export { validate{{#latest}}{{type}}{{/latest}} } from "./validate"; diff --git a/packages/js/core/scripts/manifest/wrap.info/migrate-ts.mustache b/packages/js/core/scripts/manifest/wrap.info/migrate-ts.mustache deleted file mode 100644 index acb1153c75..0000000000 --- a/packages/js/core/scripts/manifest/wrap.info/migrate-ts.mustache +++ /dev/null @@ -1,59 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/migrate-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/migrate-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. - */ -import { - Any{{#latest}}{{type}}{{/latest}}, - {{#latest}}{{type}}{{/latest}}, - {{#latest}}{{type}}{{/latest}}Formats, - latest{{#latest}}{{type}}{{/latest}}Format -} from "."; - -{{#prevFormats}} -import { - migrate as migrate_{{tsVersion}}_to_{{#latest}}{{tsVersion}}{{/latest}} -} from "./migrators/{{version}}_to_{{#latest}}{{version}}{{/latest}}"; -{{/prevFormats}} - -import { Tracer } from "@polywrap/tracing-js"; - -type Migrator = { - [key in {{#latest}}{{type}}{{/latest}}Formats]?: (m: Any{{#latest}}{{type}}{{/latest}}) => {{#latest}}{{type}}{{/latest}}; -}; - -export const migrators: Migrator = { -{{#prevFormats}} - "{{version}}": migrate_{{tsVersion}}_to_{{#latest}}{{tsVersion}}{{/latest}}, -{{/prevFormats}} -}; - -export const migrate{{#latest}}{{type}}{{/latest}} = Tracer.traceFunc( - "core: migrate{{#latest}}{{type}}{{/latest}}", - (manifest: Any{{#latest}}{{type}}{{/latest}}, to: {{#latest}}{{type}}{{/latest}}Formats): {{#latest}}{{type}}{{/latest}} => { - const from = manifest.format as {{#latest}}{{type}}{{/latest}}Formats; - - if (from === latest{{#latest}}{{type}}{{/latest}}Format) { - return manifest as {{#latest}}{{type}}{{/latest}}; - } - - if (!(from in {{#latest}}{{type}}{{/latest}}Formats)) { - throw new Error(`Unrecognized {{#latest}}{{type}}{{/latest}}Format "${manifest.format}"`); - } - -{{#prevFormats.length}} - const migrator = migrators[from]; - if (!migrator) { - throw new Error( - `Migrator from {{#latest}}{{type}}{{/latest}}Format "${from}" to "${to}" is not available` - ); - } - - return migrator(manifest); -{{/prevFormats.length}} -{{^prevFormats.length}} - throw new Error(`This should never happen, {{#latest}}{{type}}{{/latest}} migrators is empty. from: ${from}, to: ${to}`); -{{/prevFormats.length}} - } -); diff --git a/packages/js/core/scripts/templates/deserialize-ts.mustache b/packages/js/core/scripts/templates/deserialize-ts.mustache new file mode 100644 index 0000000000..41a1c92d37 --- /dev/null +++ b/packages/js/core/scripts/templates/deserialize-ts.mustache @@ -0,0 +1,53 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, + * and run node ./scripts/manifest/generateTypes.js to regenerate this file. + */ + +import { + WrapManifest, + AnyWrapManifest, + migrateWrapManifest, + validateWrapManifest, + latestWrapManifestVersion, +} from "."; +import { DeserializeManifestOptions } from "../"; +import { msgpackDecode } from "../../"; + +import { compare } from "semver"; +import { Tracer } from "@polywrap/tracing-js"; + +export const deserializeWrapManifest = Tracer.traceFunc( + "core: deserializeWrapManifest", + (manifest: ArrayBuffer, options?: DeserializeManifestOptions): WrapManifest => { + let anyWrapManifest: AnyWrapManifest | undefined; + try { + anyWrapManifest = msgpackDecode(manifest) as AnyWrapManifest; + } catch (e) { + throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); + } + + if (!options || !options.noValidate) { + validateWrapManifest(anyWrapManifest); + } + + const versionCompare = compare( + anyWrapManifest.version, + latestWrapManifestVersion + ); + + if (versionCompare === -1) { + // Upgrade + return migrateWrapManifest(anyWrapManifest, latestWrapManifestVersion); + } else if (versionCompare === 1) { + // Downgrade + throw Error( + `Cannot downgrade WrapManifest version ${anyWrapManifest.version}, please upgrade your WRAP package.` + ); + } else { + // Latest + return anyWrapManifest as WrapManifest; + } + } +); diff --git a/packages/js/core/scripts/templates/index-ts.mustache b/packages/js/core/scripts/templates/index-ts.mustache new file mode 100644 index 0000000000..65ad12513a --- /dev/null +++ b/packages/js/core/scripts/templates/index-ts.mustache @@ -0,0 +1,39 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/index-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/index-ts.mustache, + * and run node ./scripts/manifest/generateTypes.js to regenerate this file. + */ + +{{#formats}} +import { + WrapManifest as WrapManifest{{tsVersion}} +} from "./{{version}}"; +{{/formats}} + +export { + {{#formats}} + WrapManifest{{tsVersion}}, + {{/formats}} +}; + +export enum {{#latest}}WrapManifest{{/latest}}Versions { + {{#formats}} + "{{version}}" = "{{version}}", + {{/formats}} +} + +export type Any{{#latest}}WrapManifest{{/latest}} = +{{#formats}} + | WrapManifest{{tsVersion}} +{{/formats}} + +export type {{#latest}}WrapManifest{{/latest}} = {{#latest}}WrapManifest{{tsVersion}}{{/latest}}; + +export const latest{{#latest}}WrapManifest{{/latest}}Version = {{#latest}}WrapManifest{{/latest}}Versions["{{#latest}}{{version}}{{/latest}}"] + +export { migrate{{#latest}}WrapManifest{{/latest}} } from "./migrate"; + +export { deserialize{{#latest}}WrapManifest{{/latest}} } from "./deserialize"; + +export { validate{{#latest}}WrapManifest{{/latest}} } from "./validate"; diff --git a/packages/js/core/scripts/templates/migrate-ts.mustache b/packages/js/core/scripts/templates/migrate-ts.mustache new file mode 100644 index 0000000000..2c3fd92936 --- /dev/null +++ b/packages/js/core/scripts/templates/migrate-ts.mustache @@ -0,0 +1,59 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/migrate-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/migrate-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ +import { + Any{{#latest}}WrapManifest{{/latest}}, + {{#latest}}WrapManifest{{/latest}}, + {{#latest}}WrapManifest{{/latest}}Versions, + latest{{#latest}}WrapManifest{{/latest}}Version +} from "."; + +{{#prevFormats}} +import { + migrate as migrate_{{tsVersion}}_to_{{#latest}}{{tsVersion}}{{/latest}} +} from "./migrators/{{version}}_to_{{#latest}}{{version}}{{/latest}}"; +{{/prevFormats}} + +import { Tracer } from "@polywrap/tracing-js"; + +type Migrator = { + [key in {{#latest}}WrapManifest{{/latest}}Versions]?: (m: Any{{#latest}}WrapManifest{{/latest}}) => {{#latest}}WrapManifest{{/latest}}; +}; + +export const migrators: Migrator = { +{{#prevFormats}} + "{{version}}": migrate_{{tsVersion}}_to_{{#latest}}{{tsVersion}}{{/latest}}, +{{/prevFormats}} +}; + +export const migrate{{#latest}}WrapManifest{{/latest}} = Tracer.traceFunc( + "core: migrate{{#latest}}WrapManifest{{/latest}}", + (manifest: Any{{#latest}}WrapManifest{{/latest}}, to: {{#latest}}WrapManifest{{/latest}}Versions): {{#latest}}WrapManifest{{/latest}} => { + const from = manifest.version as {{#latest}}WrapManifest{{/latest}}Versions; + + if (from === latest{{#latest}}WrapManifest{{/latest}}Version) { + return manifest as {{#latest}}WrapManifest{{/latest}}; + } + + if (!(from in {{#latest}}WrapManifest{{/latest}}Versions)) { + throw new Error(`Unrecognized {{#latest}}WrapManifest{{/latest}}Version "${manifest.version}"`); + } + +{{#prevFormats.length}} + const migrator = migrators[from]; + if (!migrator) { + throw new Error( + `Migrator from {{#latest}}WrapManifest{{/latest}}Version "${from}" to "${to}" is not available` + ); + } + + return migrator(manifest); +{{/prevFormats.length}} +{{^prevFormats.length}} + throw new Error(`This should never happen, {{#latest}}WrapManifest{{/latest}} migrators is empty. from: ${from}, to: ${to}`); +{{/prevFormats.length}} + } +); diff --git a/packages/js/core/scripts/manifest/wrap.info/validate-ts.mustache b/packages/js/core/scripts/templates/validate-ts.mustache similarity index 53% rename from packages/js/core/scripts/manifest/wrap.info/validate-ts.mustache rename to packages/js/core/scripts/templates/validate-ts.mustache index 691fa5d402..c62da1b1c9 100644 --- a/packages/js/core/scripts/manifest/wrap.info/validate-ts.mustache +++ b/packages/js/core/scripts/templates/validate-ts.mustache @@ -5,12 +5,12 @@ * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. */ import { - Any{{#latest}}{{type}}{{/latest}}, - {{#latest}}{{type}}{{/latest}}Formats + Any{{#latest}}WrapManifest{{/latest}}, + {{#latest}}WrapManifest{{/latest}}Versions } from "."; -{{#validators.length}}import * as Validators from "../../validators";{{/validators.length}} +{{#validators.length}}import * as Validators from "../validators";{{/validators.length}} {{#formats}} -import schema_{{tsVersion}} from "@polywrap/manifest-schemas/formats/{{dir}}/{{version}}.json"; +import schema_{{tsVersion}} from "@polywrap/wrap-manifest-schemas/formats/{{version}}.json"; {{/formats}} import { Tracer } from "@polywrap/tracing-js" @@ -21,11 +21,11 @@ import { ValidatorResult } from "jsonschema"; -type {{#latest}}{{type}}{{/latest}}Schemas = { - [key in {{#latest}}{{type}}{{/latest}}Formats]: Schema | undefined +type {{#latest}}WrapManifest{{/latest}}Schemas = { + [key in {{#latest}}WrapManifest{{/latest}}Versions]: Schema | undefined }; -const schemas: {{#latest}}{{type}}{{/latest}}Schemas = { +const schemas: {{#latest}}WrapManifest{{/latest}}Schemas = { {{#formats}} "{{version}}": schema_{{tsVersion}}, {{/formats}} @@ -34,25 +34,25 @@ const schemas: {{#latest}}{{type}}{{/latest}}Schemas = { const validator = new Validator(); {{#validators}} -Validator.prototype.customFormats.{{.}} = Validators.{{.}}; +Validator.prototype.customVersions.{{.}} = Validators.{{.}}; {{/validators}} -export const validate{{#latest}}{{type}}{{/latest}} = Tracer.traceFunc( - "core: validate{{#latest}}{{type}}{{/latest}}", +export const validate{{#latest}}WrapManifest{{/latest}} = Tracer.traceFunc( + "core: validate{{#latest}}WrapManifest{{/latest}}", ( - manifest: Any{{#latest}}{{type}}{{/latest}}, + manifest: Any{{#latest}}WrapManifest{{/latest}}, extSchema: Schema | undefined = undefined ): void => { - const schema = schemas[manifest.format as {{#latest}}{{type}}{{/latest}}Formats]; + const schema = schemas[manifest.version as {{#latest}}WrapManifest{{/latest}}Versions]; if (!schema) { - throw Error(`Unrecognized {{#latest}}{{type}}{{/latest}} schema format "${manifest.format}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); + throw Error(`Unrecognized {{#latest}}WrapManifest{{/latest}} schema version "${manifest.version}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); } const throwIfErrors = (result: ValidatorResult) => { if (result.errors.length) { throw new Error([ - `Validation errors encountered while sanitizing {{#latest}}{{type}}{{/latest}} format ${manifest.format}`, + `Validation errors encountered while sanitizing {{#latest}}WrapManifest{{/latest}} version ${manifest.version}`, ...result.errors.map((error: ValidationError) => error.toString()) ].join("\n")); } diff --git a/packages/js/core/src/__tests__/resolveUri.spec.ts b/packages/js/core/src/__tests__/resolveUri.spec.ts index 910a604a22..157f97e781 100644 --- a/packages/js/core/src/__tests__/resolveUri.spec.ts +++ b/packages/js/core/src/__tests__/resolveUri.spec.ts @@ -4,15 +4,13 @@ import { Client, InvokeOptions, InvokeResult, - PolywrapManifest, + WrapManifest, PluginModule, PluginPackage, QueryOptions, QueryResult, Uri, UriRedirect, - AnyManifestArtifact, - ManifestArtifactType, UriResolver, resolveUri, RedirectsResolver, @@ -22,7 +20,6 @@ import { Env, GetFileOptions, GetImplementationsOptions, - GetManifestOptions, InterfaceImplementations, PluginRegistration, SubscribeOptions, @@ -86,20 +83,6 @@ describe("resolveUri", () => { getSchema: (uri: Uri | string): Promise => { return Promise.resolve(""); }, - getManifest: < - TUri extends Uri | string, - TManifestType extends ManifestArtifactType - >( - uri: TUri, - options: GetManifestOptions - ) => { - const manifest = { - format: "0.0.1-prealpha.8", - language: "", - __type: "PolywrapManifest", - }; - return Promise.resolve(manifest as AnyManifestArtifact); - }, getFile: () => { return Promise.resolve(""); }, @@ -120,23 +103,12 @@ describe("resolveUri", () => { } as InvokeResult), getSchema: (_client: Client): Promise => Promise.resolve(""), getFile: (options: GetFileOptions, client: Client) => Promise.resolve(""), - getManifest: ( - options: GetManifestOptions, - client: Client - ) => { - const manifest = { - format: "0.0.1-prealpha.9", - language: "", - __type: "PluginManifest", - }; - return Promise.resolve(manifest as AnyManifestArtifact); - }, }; }; const createWrapper = ( uri: Uri, - manifest: PolywrapManifest, + manifest: WrapManifest, uriResolver: string ): Wrapper => { return { @@ -148,19 +120,6 @@ describe("resolveUri", () => { } as InvokeResult), getSchema: (_client: Client): Promise => Promise.resolve(""), getFile: (options: GetFileOptions, client: Client) => Promise.resolve(""), - getManifest: ( - options: GetManifestOptions, - client: Client - ) => { - const manifest: unknown = { - format: "0.0.1-prealpha.9", - language: "", - module: "", - schema: "", - __type: "PolywrapManifest", - }; - return Promise.resolve(manifest as AnyManifestArtifact); - }, }; }; diff --git a/packages/js/core/src/manifest/index.ts b/packages/js/core/src/manifest/index.ts deleted file mode 100644 index 43f2530d24..0000000000 --- a/packages/js/core/src/manifest/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./polywrap"; -export * from "./wrap.info"; -export * from "./deserialize"; diff --git a/packages/js/core/src/manifest/polywrap/index.ts b/packages/js/core/src/manifest/polywrap/index.ts deleted file mode 100644 index c1bae5a6f0..0000000000 --- a/packages/js/core/src/manifest/polywrap/index.ts +++ /dev/null @@ -1,34 +0,0 @@ -export * from "./polywrap"; -export * from "./polywrap.build"; -export * from "./polywrap.infra"; -export * from "./polywrap.deploy"; -export * from "./polywrap.meta"; -export * from "./polywrap.plugin"; -export * from "./polywrap.app"; - -import { PolywrapManifest } from "./polywrap"; -import { BuildManifest } from "./polywrap.build"; -import { InfraManifest } from "./polywrap.infra"; -import { DeployManifest } from "./polywrap.deploy"; -import { MetaManifest } from "./polywrap.meta"; - -export type ManifestArtifactType = - | "polywrap" - | "meta" - | "build" - | "deploy" - | "infra"; - -export type AnyManifestArtifact< - TManifestType extends ManifestArtifactType -> = TManifestType extends "polywrap" - ? PolywrapManifest - : TManifestType extends "build" - ? BuildManifest - : TManifestType extends "infra" - ? InfraManifest - : TManifestType extends "deploy" - ? DeployManifest - : TManifestType extends "meta" - ? MetaManifest - : never; diff --git a/packages/js/core/src/manifest/polywrap/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts b/packages/js/core/src/manifest/polywrap/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts deleted file mode 100644 index adeb6ff8f3..0000000000 --- a/packages/js/core/src/manifest/polywrap/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable @typescript-eslint/naming-convention */ - -import { AppManifest as OldManifest } from "../0.0.1-prealpha.1"; -import { AppManifest as NewManifest } from "../0.0.1-prealpha.2"; - -export function migrate(old: OldManifest): NewManifest { - return { - ...old, - __type: "AppManifest", - format: "0.0.1-prealpha.2", - name: "Unnamed", - }; -} diff --git a/packages/js/core/src/manifest/polywrap/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts b/packages/js/core/src/manifest/polywrap/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts deleted file mode 100644 index 0b2952f5f1..0000000000 --- a/packages/js/core/src/manifest/polywrap/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable @typescript-eslint/naming-convention */ - -import { BuildManifest as OldManifest } from "../0.0.1-prealpha.1"; -import { BuildManifest as NewManifest } from "../0.0.1-prealpha.3"; - -export function migrate(old: OldManifest): NewManifest { - return { - ...old, - __type: "BuildManifest", - format: "0.0.1-prealpha.3", - }; -} diff --git a/packages/js/core/src/manifest/polywrap/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts b/packages/js/core/src/manifest/polywrap/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts deleted file mode 100644 index 0b2952f5f1..0000000000 --- a/packages/js/core/src/manifest/polywrap/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable @typescript-eslint/naming-convention */ - -import { BuildManifest as OldManifest } from "../0.0.1-prealpha.1"; -import { BuildManifest as NewManifest } from "../0.0.1-prealpha.3"; - -export function migrate(old: OldManifest): NewManifest { - return { - ...old, - __type: "BuildManifest", - format: "0.0.1-prealpha.3", - }; -} diff --git a/packages/js/core/src/manifest/polywrap/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts b/packages/js/core/src/manifest/polywrap/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts deleted file mode 100644 index a0732788eb..0000000000 --- a/packages/js/core/src/manifest/polywrap/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* eslint-disable @typescript-eslint/naming-convention */ - -import { InfraManifest as OldManifest } from "../0.0.1-prealpha.1"; -import { InfraManifest as NewManifest } from "../0.0.1-prealpha.2"; - -export function migrate(old: OldManifest): NewManifest { - return { - ...old, - format: "0.0.1-prealpha.2", - }; -} diff --git a/packages/js/core/src/manifest/polywrap/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts b/packages/js/core/src/manifest/polywrap/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts deleted file mode 100644 index 6474bb7fe4..0000000000 --- a/packages/js/core/src/manifest/polywrap/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* eslint-disable @typescript-eslint/naming-convention */ - -import { MetaManifest as OldManifest } from "../0.0.1-prealpha.1"; -import { MetaManifest as NewManifest } from "../0.0.1-prealpha.3"; - -export function migrate(old: OldManifest): NewManifest { - const manifest: Record = { - ...old, - }; - - delete manifest.name; - - return { - ...manifest, - __type: "MetaManifest", - format: "0.0.1-prealpha.3", - displayName: old.name, - }; -} diff --git a/packages/js/core/src/manifest/polywrap/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts b/packages/js/core/src/manifest/polywrap/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts deleted file mode 100644 index dd3f7132b5..0000000000 --- a/packages/js/core/src/manifest/polywrap/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable @typescript-eslint/naming-convention */ - -import { MetaManifest as OldManifest } from "../0.0.1-prealpha.2"; -import { MetaManifest as NewManifest } from "../0.0.1-prealpha.3"; - -export function migrate(old: OldManifest): NewManifest { - return { - ...old, - __type: "MetaManifest", - format: "0.0.1-prealpha.3", - }; -} diff --git a/packages/js/core/src/manifest/polywrap/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts b/packages/js/core/src/manifest/polywrap/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts deleted file mode 100644 index da97165078..0000000000 --- a/packages/js/core/src/manifest/polywrap/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable @typescript-eslint/naming-convention */ - -import { PluginManifest as OldManifest } from "../0.0.1-prealpha.1"; -import { PluginManifest as NewManifest } from "../0.0.1-prealpha.3"; - -export function migrate(_: OldManifest): NewManifest { - throw new Error( - "Plugin manifest file is deprecated. Please update to 0.0.1-prealpha.3" - ); -} diff --git a/packages/js/core/src/manifest/polywrap/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts b/packages/js/core/src/manifest/polywrap/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts deleted file mode 100644 index 52d03dc256..0000000000 --- a/packages/js/core/src/manifest/polywrap/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable @typescript-eslint/naming-convention */ - -import { PluginManifest as OldManifest } from "../0.0.1-prealpha.2"; -import { PluginManifest as NewManifest } from "../0.0.1-prealpha.3"; - -export function migrate(_: OldManifest): NewManifest { - throw new Error( - "Plugin manifest file is deprecated. Please update to 0.0.1-prealpha.3" - ); -} diff --git a/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts b/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts deleted file mode 100644 index 877fcae7b2..0000000000 --- a/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable @typescript-eslint/naming-convention */ - -import { PolywrapManifest as OldManifest } from "../0.0.1-prealpha.1"; -import { PolywrapManifest as NewManifest } from "../0.0.1-prealpha.9"; - -export function migrate(_: OldManifest): NewManifest { - throw new Error( - "Manifest file is deprecated. Please update to 0.0.1-prealpha.9" - ); -} diff --git a/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts b/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts deleted file mode 100644 index feb614ae29..0000000000 --- a/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable @typescript-eslint/naming-convention */ - -import { PolywrapManifest as OldManifest } from "../0.0.1-prealpha.2"; -import { PolywrapManifest as NewManifest } from "../0.0.1-prealpha.9"; - -export function migrate(_: OldManifest): NewManifest { - throw new Error( - "Manifest file is deprecated. Please update to 0.0.1-prealpha.9" - ); -} diff --git a/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts b/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts deleted file mode 100644 index f18ff04d05..0000000000 --- a/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable @typescript-eslint/naming-convention */ - -import { PolywrapManifest as OldManifest } from "../0.0.1-prealpha.3"; -import { PolywrapManifest as NewManifest } from "../0.0.1-prealpha.9"; - -export function migrate(_: OldManifest): NewManifest { - throw new Error( - "Manifest file is deprecated. Please update to 0.0.1-prealpha.9" - ); -} diff --git a/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts b/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts deleted file mode 100644 index ed81776103..0000000000 --- a/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable @typescript-eslint/naming-convention */ - -import { PolywrapManifest as OldManifest } from "../0.0.1-prealpha.4"; -import { PolywrapManifest as NewManifest } from "../0.0.1-prealpha.9"; - -export function migrate(_: OldManifest): NewManifest { - throw new Error( - "Manifest file is deprecated. Please update to 0.0.1-prealpha.9" - ); -} diff --git a/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts b/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts deleted file mode 100644 index 4356bd3545..0000000000 --- a/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable @typescript-eslint/naming-convention */ - -import { PolywrapManifest as OldManifest } from "../0.0.1-prealpha.5"; -import { PolywrapManifest as NewManifest } from "../0.0.1-prealpha.9"; - -export function migrate(_: OldManifest): NewManifest { - throw new Error( - "Manifest file is deprecated. Please update to 0.0.1-prealpha.9" - ); -} diff --git a/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts b/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts deleted file mode 100644 index dcdc22e593..0000000000 --- a/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable @typescript-eslint/naming-convention */ - -import { PolywrapManifest as OldManifest } from "../0.0.1-prealpha.6"; -import { PolywrapManifest as NewManifest } from "../0.0.1-prealpha.9"; - -export function migrate(_: OldManifest): NewManifest { - throw new Error( - "Manifest file is deprecated. Please update to 0.0.1-prealpha.9" - ); -} diff --git a/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts b/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts deleted file mode 100644 index fa157c927d..0000000000 --- a/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable @typescript-eslint/naming-convention */ - -import { PolywrapManifest as OldManifest } from "../0.0.1-prealpha.7"; -import { PolywrapManifest as NewManifest } from "../0.0.1-prealpha.9"; - -export function migrate(_: OldManifest): NewManifest { - throw new Error( - "Manifest file is deprecated. Please update to 0.0.1-prealpha.9" - ); -} diff --git a/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts b/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts deleted file mode 100644 index 6821a4761f..0000000000 --- a/packages/js/core/src/manifest/polywrap/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable @typescript-eslint/naming-convention */ - -import { PolywrapManifest as OldManifest } from "../0.0.1-prealpha.8"; -import { PolywrapManifest as NewManifest } from "../0.0.1-prealpha.9"; - -export function migrate(_: OldManifest): NewManifest { - throw new Error( - "Manifest file is deprecated. Please update to 0.0.1-prealpha.9" - ); -} diff --git a/packages/js/core/src/types/Client.ts b/packages/js/core/src/types/Client.ts index 23dfa55b8a..85069479d8 100644 --- a/packages/js/core/src/types/Client.ts +++ b/packages/js/core/src/types/Client.ts @@ -9,7 +9,6 @@ import { Env, WorkflowHandler, } from "./"; -import { AnyManifestArtifact, ManifestArtifactType } from "../manifest"; import { UriResolver } from "../uri-resolution/core"; import { UriResolverHandler } from "./UriResolver"; @@ -37,12 +36,6 @@ export type GetEnvsOptions = Contextualized; export type GetUriResolversOptions = Contextualized; -export interface GetManifestOptions< - TManifestArtifactType extends ManifestArtifactType -> extends Contextualized { - type: TManifestArtifactType; -} - export interface GetFileOptions extends Contextualized { path: string; encoding?: "utf-8" | string; @@ -80,14 +73,6 @@ export interface Client options: GetSchemaOptions ): Promise; - getManifest< - TUri extends Uri | string, - TManifestArtifactType extends ManifestArtifactType - >( - uri: TUri, - options: GetManifestOptions - ): Promise>; - getFile( uri: TUri, options: GetFileOptions diff --git a/packages/js/core/src/types/Wrapper.ts b/packages/js/core/src/types/Wrapper.ts index b9308c81b9..cb212870f4 100644 --- a/packages/js/core/src/types/Wrapper.ts +++ b/packages/js/core/src/types/Wrapper.ts @@ -2,11 +2,9 @@ import { Uri, Client, GetFileOptions, - GetManifestOptions, InvokeOptions, InvokeResult, } from "."; -import { AnyManifestArtifact, ManifestArtifactType } from "../manifest"; /** * The Wrapper definition, which can be used to spawn @@ -34,19 +32,6 @@ export abstract class Wrapper { */ public abstract getSchema(client: Client): Promise; - /** - * Get the Wrapper's manifest - * - * @param options Configuration options for manifest retrieval - * @param client The client instance requesting the manifest. - */ - public abstract getManifest< - TManifestArtifactType extends ManifestArtifactType - >( - options: GetManifestOptions, - client: Client - ): Promise>; - /** * Get a file from the Wrapper package. * Not implemented for plugin wrappers. diff --git a/packages/js/core/src/wrap-manifests/deserialize.ts b/packages/js/core/src/wrap-manifests/deserialize.ts new file mode 100644 index 0000000000..8f9cc63150 --- /dev/null +++ b/packages/js/core/src/wrap-manifests/deserialize.ts @@ -0,0 +1,3 @@ +export interface DeserializeManifestOptions { + noValidate?: boolean; +} diff --git a/packages/js/core/src/manifest/wrap.info/0.0.1.ts b/packages/js/core/src/wrap-manifests/formats/0.0.1.ts similarity index 92% rename from packages/js/core/src/manifest/wrap.info/0.0.1.ts rename to packages/js/core/src/wrap-manifests/formats/0.0.1.ts index 31fedc7231..3ddd64ca64 100644 --- a/packages/js/core/src/manifest/wrap.info/0.0.1.ts +++ b/packages/js/core/src/wrap-manifests/formats/0.0.1.ts @@ -22,6 +22,7 @@ export interface WrapManifest { /** * Type info of wrapper */ - abi: unknown; - __type: "WrapManifest"; + abi: { + [k: string]: unknown; + }; } diff --git a/packages/js/core/src/manifest/wrap.info/deserialize.ts b/packages/js/core/src/wrap-manifests/formats/deserialize.ts similarity index 59% rename from packages/js/core/src/manifest/wrap.info/deserialize.ts rename to packages/js/core/src/wrap-manifests/formats/deserialize.ts index 4f1b29a44f..41a1c92d37 100644 --- a/packages/js/core/src/manifest/wrap.info/deserialize.ts +++ b/packages/js/core/src/wrap-manifests/formats/deserialize.ts @@ -2,7 +2,7 @@ /** * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + * and run node ./scripts/manifest/generateTypes.js to regenerate this file. */ import { @@ -12,34 +12,26 @@ import { validateWrapManifest, latestWrapManifestVersion, } from "."; -import { DeserializeManifestOptions } from "../../"; +import { DeserializeManifestOptions } from "../"; +import { msgpackDecode } from "../../"; import { compare } from "semver"; -import YAML from "js-yaml"; import { Tracer } from "@polywrap/tracing-js"; export const deserializeWrapManifest = Tracer.traceFunc( "core: deserializeWrapManifest", - (manifest: string, options?: DeserializeManifestOptions): WrapManifest => { + (manifest: ArrayBuffer, options?: DeserializeManifestOptions): WrapManifest => { let anyWrapManifest: AnyWrapManifest | undefined; try { - anyWrapManifest = JSON.parse(manifest) as AnyWrapManifest; + anyWrapManifest = msgpackDecode(manifest) as AnyWrapManifest; } catch (e) { - anyWrapManifest = YAML.safeLoad(manifest) as - | AnyWrapManifest - | undefined; - } - - if (!anyWrapManifest) { - throw Error(`Unable to parse WrapManifest: ${manifest}`); + throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); } if (!options || !options.noValidate) { - validateWrapManifest(anyWrapManifest, options?.extSchema); + validateWrapManifest(anyWrapManifest); } - anyWrapManifest.__type = "WrapManifest"; - const versionCompare = compare( anyWrapManifest.version, latestWrapManifestVersion @@ -51,7 +43,7 @@ export const deserializeWrapManifest = Tracer.traceFunc( } else if (versionCompare === 1) { // Downgrade throw Error( - `Cannot downgrade wrap.info version ${anyWrapManifest.version}, please upgrade your PolywrapClient package.` + `Cannot downgrade WrapManifest version ${anyWrapManifest.version}, please upgrade your WRAP package.` ); } else { // Latest diff --git a/packages/js/core/src/manifest/wrap.info/index.ts b/packages/js/core/src/wrap-manifests/formats/index.ts similarity index 89% rename from packages/js/core/src/manifest/wrap.info/index.ts rename to packages/js/core/src/wrap-manifests/formats/index.ts index 88727b7317..e52a5465f5 100644 --- a/packages/js/core/src/manifest/wrap.info/index.ts +++ b/packages/js/core/src/wrap-manifests/formats/index.ts @@ -2,7 +2,7 @@ /** * This file was automatically generated by scripts/manifest/index-ts.mustache. * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/index-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + * and run node ./scripts/manifest/generateTypes.js to regenerate this file. */ import { diff --git a/packages/js/core/src/manifest/wrap.info/migrate.ts b/packages/js/core/src/wrap-manifests/formats/migrate.ts similarity index 100% rename from packages/js/core/src/manifest/wrap.info/migrate.ts rename to packages/js/core/src/wrap-manifests/formats/migrate.ts diff --git a/packages/js/core/src/manifest/wrap.info/validate.ts b/packages/js/core/src/wrap-manifests/formats/validate.ts similarity index 84% rename from packages/js/core/src/manifest/wrap.info/validate.ts rename to packages/js/core/src/wrap-manifests/formats/validate.ts index 5a20dae3f6..ad0a64f3d8 100644 --- a/packages/js/core/src/manifest/wrap.info/validate.ts +++ b/packages/js/core/src/wrap-manifests/formats/validate.ts @@ -9,7 +9,7 @@ import { WrapManifestVersions } from "."; import * as Validators from "../validators"; -import schema_0_0_1 from "@polywrap/manifest-schemas/wrap.info/0.0.1.json"; +import schema_0_0_1 from "@polywrap/wrap-manifest-schemas/formats/0.0.1.json"; import { Tracer } from "@polywrap/tracing-js" import { @@ -29,7 +29,7 @@ const schemas: WrapManifestSchemas = { const validator = new Validator(); -Validator.prototype.customFormats.validType = Validators.validType; +Validator.prototype.customVersions.validType = Validators.validType; export const validateWrapManifest = Tracer.traceFunc( "core: validateWrapManifest", @@ -40,7 +40,7 @@ export const validateWrapManifest = Tracer.traceFunc( const schema = schemas[manifest.version as WrapManifestVersions]; if (!schema) { - throw Error(`Unrecognized WrapManifest schema format "${manifest.version}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); + throw Error(`Unrecognized WrapManifest schema version "${manifest.version}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); } const throwIfErrors = (result: ValidatorResult) => { diff --git a/packages/js/core/src/wrap-manifests/index.ts b/packages/js/core/src/wrap-manifests/index.ts new file mode 100644 index 0000000000..041f37b508 --- /dev/null +++ b/packages/js/core/src/wrap-manifests/index.ts @@ -0,0 +1,2 @@ +export * from "./formats"; +export * from "./deserialize"; diff --git a/packages/js/core/src/wrap-manifests/validators.ts b/packages/js/core/src/wrap-manifests/validators.ts new file mode 100644 index 0000000000..f3f182e6b2 --- /dev/null +++ b/packages/js/core/src/wrap-manifests/validators.ts @@ -0,0 +1,15 @@ +export function file(path: unknown): boolean { + if (typeof path !== "string") { + return false; + } + + // eslint-disable-next-line no-useless-escape + const validPathMatch = path.match(/^((\.\/|..\/)[^\/ ]*)+\/?$/gm); + + let result = false; + if (validPathMatch && validPathMatch[0]) { + result = validPathMatch[0].length === path.length; + } + + return result; +} diff --git a/packages/js/plugins/uri-resolvers/file-system-resolver/package.json b/packages/js/plugins/uri-resolvers/file-system-resolver/package.json index 119848aa67..353f94dbc0 100644 --- a/packages/js/plugins/uri-resolvers/file-system-resolver/package.json +++ b/packages/js/plugins/uri-resolvers/file-system-resolver/package.json @@ -31,5 +31,8 @@ "ts-jest": "26.5.4", "ts-node": "8.10.2", "typescript": "4.0.7" + }, + "publishConfig": { + "access": "public" } } diff --git a/packages/js/validation/package.json b/packages/js/validation/package.json index 3766f98e47..948e65cc75 100644 --- a/packages/js/validation/package.json +++ b/packages/js/validation/package.json @@ -29,5 +29,8 @@ "ts-jest": "26.5.4", "ts-node": "8.10.2", "typescript": "4.0.7" + }, + "publishConfig": { + "access": "public" } } diff --git a/packages/manifest-schemas/.gitignore b/packages/manifest-schemas/.gitignore new file mode 100644 index 0000000000..119393e708 --- /dev/null +++ b/packages/manifest-schemas/.gitignore @@ -0,0 +1 @@ +!wrap diff --git a/packages/manifest-schemas/polywrap/polywrap.app/0.0.1-prealpha.1.json b/packages/manifest-schemas/polywrap/formats/polywrap.app/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap.app/0.0.1-prealpha.1.json rename to packages/manifest-schemas/polywrap/formats/polywrap.app/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/polywrap/polywrap.app/0.0.1-prealpha.2.json b/packages/manifest-schemas/polywrap/formats/polywrap.app/0.0.1-prealpha.2.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap.app/0.0.1-prealpha.2.json rename to packages/manifest-schemas/polywrap/formats/polywrap.app/0.0.1-prealpha.2.json diff --git a/packages/manifest-schemas/polywrap/polywrap.build/0.0.1-prealpha.1.json b/packages/manifest-schemas/polywrap/formats/polywrap.build/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap.build/0.0.1-prealpha.1.json rename to packages/manifest-schemas/polywrap/formats/polywrap.build/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/polywrap/polywrap.build/0.0.1-prealpha.2.json b/packages/manifest-schemas/polywrap/formats/polywrap.build/0.0.1-prealpha.2.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap.build/0.0.1-prealpha.2.json rename to packages/manifest-schemas/polywrap/formats/polywrap.build/0.0.1-prealpha.2.json diff --git a/packages/manifest-schemas/polywrap/polywrap.build/0.0.1-prealpha.3.json b/packages/manifest-schemas/polywrap/formats/polywrap.build/0.0.1-prealpha.3.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap.build/0.0.1-prealpha.3.json rename to packages/manifest-schemas/polywrap/formats/polywrap.build/0.0.1-prealpha.3.json diff --git a/packages/manifest-schemas/polywrap/polywrap.deploy/0.0.1-prealpha.1.json b/packages/manifest-schemas/polywrap/formats/polywrap.deploy/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap.deploy/0.0.1-prealpha.1.json rename to packages/manifest-schemas/polywrap/formats/polywrap.deploy/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/polywrap/polywrap.infra/0.0.1-prealpha.1.json b/packages/manifest-schemas/polywrap/formats/polywrap.infra/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap.infra/0.0.1-prealpha.1.json rename to packages/manifest-schemas/polywrap/formats/polywrap.infra/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/polywrap/polywrap.infra/0.0.1-prealpha.2.json b/packages/manifest-schemas/polywrap/formats/polywrap.infra/0.0.1-prealpha.2.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap.infra/0.0.1-prealpha.2.json rename to packages/manifest-schemas/polywrap/formats/polywrap.infra/0.0.1-prealpha.2.json diff --git a/packages/manifest-schemas/polywrap/polywrap.meta/0.0.1-prealpha.1.json b/packages/manifest-schemas/polywrap/formats/polywrap.meta/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap.meta/0.0.1-prealpha.1.json rename to packages/manifest-schemas/polywrap/formats/polywrap.meta/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/polywrap/polywrap.meta/0.0.1-prealpha.2.json b/packages/manifest-schemas/polywrap/formats/polywrap.meta/0.0.1-prealpha.2.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap.meta/0.0.1-prealpha.2.json rename to packages/manifest-schemas/polywrap/formats/polywrap.meta/0.0.1-prealpha.2.json diff --git a/packages/manifest-schemas/polywrap/polywrap.meta/0.0.1-prealpha.3.json b/packages/manifest-schemas/polywrap/formats/polywrap.meta/0.0.1-prealpha.3.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap.meta/0.0.1-prealpha.3.json rename to packages/manifest-schemas/polywrap/formats/polywrap.meta/0.0.1-prealpha.3.json diff --git a/packages/manifest-schemas/polywrap/polywrap.plugin/0.0.1-prealpha.1.json b/packages/manifest-schemas/polywrap/formats/polywrap.plugin/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap.plugin/0.0.1-prealpha.1.json rename to packages/manifest-schemas/polywrap/formats/polywrap.plugin/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/polywrap/polywrap.plugin/0.0.1-prealpha.2.json b/packages/manifest-schemas/polywrap/formats/polywrap.plugin/0.0.1-prealpha.2.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap.plugin/0.0.1-prealpha.2.json rename to packages/manifest-schemas/polywrap/formats/polywrap.plugin/0.0.1-prealpha.2.json diff --git a/packages/manifest-schemas/polywrap/polywrap.plugin/0.0.1-prealpha.3.json b/packages/manifest-schemas/polywrap/formats/polywrap.plugin/0.0.1-prealpha.3.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap.plugin/0.0.1-prealpha.3.json rename to packages/manifest-schemas/polywrap/formats/polywrap.plugin/0.0.1-prealpha.3.json diff --git a/packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.1.json b/packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.1.json rename to packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.2.json b/packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.2.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.2.json rename to packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.2.json diff --git a/packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.3.json b/packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.3.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.3.json rename to packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.3.json diff --git a/packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.4.json b/packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.4.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.4.json rename to packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.4.json diff --git a/packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.5.json b/packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.5.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.5.json rename to packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.5.json diff --git a/packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.6.json b/packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.6.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.6.json rename to packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.6.json diff --git a/packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.7.json b/packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.7.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.7.json rename to packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.7.json diff --git a/packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.8.json b/packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.8.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.8.json rename to packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.8.json diff --git a/packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.9.json b/packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.9.json similarity index 100% rename from packages/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.9.json rename to packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.9.json diff --git a/packages/manifest-schemas/package.json b/packages/manifest-schemas/polywrap/package.json similarity index 89% rename from packages/manifest-schemas/package.json rename to packages/manifest-schemas/polywrap/package.json index f1e740ad87..7d81eb9ae4 100644 --- a/packages/manifest-schemas/package.json +++ b/packages/manifest-schemas/polywrap/package.json @@ -1,5 +1,5 @@ { - "name": "@polywrap/manifest-schemas", + "name": "@polywrap/polywrap-manifest-schemas", "description": "Polywrap Manifest Schemas", "version": "0.0.1-prealpha.90", "license": "MIT", diff --git a/packages/manifest-schemas/wrap.info/0.0.1.json b/packages/manifest-schemas/wrap/formats/0.0.1.json similarity index 100% rename from packages/manifest-schemas/wrap.info/0.0.1.json rename to packages/manifest-schemas/wrap/formats/0.0.1.json diff --git a/packages/manifest-schemas/wrap/package.json b/packages/manifest-schemas/wrap/package.json new file mode 100644 index 0000000000..21e6e58ede --- /dev/null +++ b/packages/manifest-schemas/wrap/package.json @@ -0,0 +1,18 @@ +{ + "name": "@polywrap/wrap-manifest-schemas", + "description": "WRAP Manifest Schemas", + "version": "0.0.1-prealpha.90", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/polywrap/monorepo.git" + }, + "main": "./package.json", + "scripts": { + "lint": "eslint --color -c ../../.eslintrc.js ." + }, + "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", + "publishConfig": { + "access": "public" + } +} diff --git a/todo b/todo new file mode 100644 index 0000000000..53e649d1a5 --- /dev/null +++ b/todo @@ -0,0 +1,3 @@ +1- update invocation to support wrap.info instead of polywrap.json +2- update uri resolvers to search for wrap.info +3- \ No newline at end of file From e7212f62923befffe868161a621c8e82b41cfb8d Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Tue, 28 Jun 2022 16:13:45 -0700 Subject: [PATCH 08/46] core building --- .../uri-resolver/src/schema.graphql | 2 +- packages/js/core/package.json | 2 +- .../core/scripts/generateWrapManifestTypes.ts | 2 +- .../scripts/templates/validate-ts.mustache | 4 ++-- packages/js/core/src/index.ts | 2 +- .../js/core/src/interfaces/uri-resolver.ts | 2 +- .../extendable/UriResolverWrapper.ts | 21 ++++++++++--------- .../extendable/types/CreateWrapperFunc.ts | 4 ++-- .../core/src/wrap-manifests/formats/0.0.1.ts | 10 ++++----- .../src/wrap-manifests/formats/validate.ts | 5 ++--- .../js/core/src/wrap-manifests/validators.ts | 15 ------------- .../wrap/formats/{ => wrap.info}/0.0.1.json | 13 ++++++------ 12 files changed, 34 insertions(+), 48 deletions(-) delete mode 100644 packages/js/core/src/wrap-manifests/validators.ts rename packages/manifest-schemas/wrap/formats/{ => wrap.info}/0.0.1.json (57%) diff --git a/packages/core-interfaces/uri-resolver/src/schema.graphql b/packages/core-interfaces/uri-resolver/src/schema.graphql index f033c031b2..e92ebf4fdf 100644 --- a/packages/core-interfaces/uri-resolver/src/schema.graphql +++ b/packages/core-interfaces/uri-resolver/src/schema.graphql @@ -11,5 +11,5 @@ type Module { type MaybeUriOrManifest { uri: String - manifest: String + manifest: Bytes } diff --git a/packages/js/core/package.json b/packages/js/core/package.json index 8438c1dc3e..252a2faeca 100644 --- a/packages/js/core/package.json +++ b/packages/js/core/package.json @@ -12,7 +12,7 @@ "build" ], "scripts": { - "build": "rimraf ./build && tsc --project tsconfig.build.json", + "build": "rimraf ./build && yarn build:wrap-manifests && tsc --project tsconfig.build.json", "build:wrap-manifests": "ts-node ./scripts/generateWrapManifestTypes.ts", "lint": "eslint --color -c ../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", diff --git a/packages/js/core/scripts/generateWrapManifestTypes.ts b/packages/js/core/scripts/generateWrapManifestTypes.ts index abbf504cd8..72886ea93e 100644 --- a/packages/js/core/scripts/generateWrapManifestTypes.ts +++ b/packages/js/core/scripts/generateWrapManifestTypes.ts @@ -8,7 +8,7 @@ async function generateFormatTypes() { // Fetch all schemas within the @polywrap/wrap-manifest-schemas/formats directory const formatsDir = path.join( path.dirname(require.resolve("@polywrap/wrap-manifest-schemas")), - "formats" + "formats/wrap.info" ); const formatOutputDir = path.join(__dirname, `/../src/wrap-manifests/formats`); diff --git a/packages/js/core/scripts/templates/validate-ts.mustache b/packages/js/core/scripts/templates/validate-ts.mustache index c62da1b1c9..1e753ec3aa 100644 --- a/packages/js/core/scripts/templates/validate-ts.mustache +++ b/packages/js/core/scripts/templates/validate-ts.mustache @@ -10,7 +10,7 @@ import { } from "."; {{#validators.length}}import * as Validators from "../validators";{{/validators.length}} {{#formats}} -import schema_{{tsVersion}} from "@polywrap/wrap-manifest-schemas/formats/{{version}}.json"; +import schema_{{tsVersion}} from "@polywrap/wrap-manifest-schemas/formats/wrap.info/{{version}}.json"; {{/formats}} import { Tracer } from "@polywrap/tracing-js" @@ -34,7 +34,7 @@ const schemas: {{#latest}}WrapManifest{{/latest}}Schemas = { const validator = new Validator(); {{#validators}} -Validator.prototype.customVersions.{{.}} = Validators.{{.}}; +Validator.prototype.{{.}} = Validators.{{.}}; {{/validators}} export const validate{{#latest}}WrapManifest{{/latest}} = Tracer.traceFunc( diff --git a/packages/js/core/src/index.ts b/packages/js/core/src/index.ts index d0e1a0b9e3..601b82512c 100644 --- a/packages/js/core/src/index.ts +++ b/packages/js/core/src/index.ts @@ -1,7 +1,7 @@ export * from "./types"; export * from "./algorithms"; export * from "./interfaces"; -export * from "./manifest"; +export * from "./wrap-manifests"; export * from "./msgpack"; export * from "./uri-resolution/core"; export * from "./uri-resolution/resolvers"; diff --git a/packages/js/core/src/interfaces/uri-resolver.ts b/packages/js/core/src/interfaces/uri-resolver.ts index 46e30c52a6..4be9431fb6 100644 --- a/packages/js/core/src/interfaces/uri-resolver.ts +++ b/packages/js/core/src/interfaces/uri-resolver.ts @@ -5,7 +5,7 @@ import { Tracer } from "@polywrap/tracing-js"; export interface MaybeUriOrManifest { uri?: string; - manifest?: string; + manifest?: ArrayBuffer; } // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts b/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts index a8cdef56d0..3a4e48f162 100644 --- a/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts +++ b/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts @@ -1,16 +1,17 @@ -import { UriResolverInterface } from "../../../interfaces"; -import { - DeserializeManifestOptions, - deserializePolywrapManifest, -} from "../../../manifest"; -import { Uri, WrapperCache, Client, InvokeHandler } from "../../../types"; import { + Uri, + Client, + InvokeHandler, + WrapperCache, UriResolver, UriResolutionStack, UriResolutionResult, -} from "../../core"; -import { CreateWrapperFunc } from "./types/CreateWrapperFunc"; -import { getEnvFromUriOrResolutionStack } from "../getEnvFromUriOrResolutionStack"; + CreateWrapperFunc, + getEnvFromUriOrResolutionStack, + UriResolverInterface, + DeserializeManifestOptions, + deserializeWrapManifest +} from "../../.."; import { Tracer } from "@polywrap/tracing-js"; @@ -50,7 +51,7 @@ export class UriResolverWrapper implements UriResolver { } else if (result.manifest) { // We've found our manifest at the current implementation, // meaning the URI resolver can also be used as an Wrapper resolver - const manifest = deserializePolywrapManifest( + const manifest = deserializeWrapManifest( result.manifest, this.deserializeOptions ); diff --git a/packages/js/core/src/uri-resolution/resolvers/extendable/types/CreateWrapperFunc.ts b/packages/js/core/src/uri-resolution/resolvers/extendable/types/CreateWrapperFunc.ts index b46ba51345..890a1d24b8 100644 --- a/packages/js/core/src/uri-resolution/resolvers/extendable/types/CreateWrapperFunc.ts +++ b/packages/js/core/src/uri-resolution/resolvers/extendable/types/CreateWrapperFunc.ts @@ -1,8 +1,8 @@ -import { Uri, Wrapper, PolywrapManifest, Env } from "../../../.."; +import { Uri, Wrapper, WrapManifest, Env } from "../../../.."; export type CreateWrapperFunc = ( uri: Uri, - manifest: PolywrapManifest, + manifest: WrapManifest, uriResolver: string, // name or URI environment: Env | undefined ) => Wrapper; diff --git a/packages/js/core/src/wrap-manifests/formats/0.0.1.ts b/packages/js/core/src/wrap-manifests/formats/0.0.1.ts index 3ddd64ca64..f9df3265dc 100644 --- a/packages/js/core/src/wrap-manifests/formats/0.0.1.ts +++ b/packages/js/core/src/wrap-manifests/formats/0.0.1.ts @@ -8,19 +8,19 @@ export interface WrapManifest { /** - * Wrap manifest format version + * WRAP Standard Version */ version: "0.0.1"; /** - * Wrap language + * Wrapper Package Type */ - type: string; + type: "wasm" | "interface"; /** - * Wrapper name + * Wrapper Name */ name: string; /** - * Type info of wrapper + * Wrapper ABI */ abi: { [k: string]: unknown; diff --git a/packages/js/core/src/wrap-manifests/formats/validate.ts b/packages/js/core/src/wrap-manifests/formats/validate.ts index ad0a64f3d8..8e71a693fb 100644 --- a/packages/js/core/src/wrap-manifests/formats/validate.ts +++ b/packages/js/core/src/wrap-manifests/formats/validate.ts @@ -8,8 +8,8 @@ import { AnyWrapManifest, WrapManifestVersions } from "."; -import * as Validators from "../validators"; -import schema_0_0_1 from "@polywrap/wrap-manifest-schemas/formats/0.0.1.json"; + +import schema_0_0_1 from "@polywrap/wrap-manifest-schemas/formats/wrap.info/0.0.1.json"; import { Tracer } from "@polywrap/tracing-js" import { @@ -29,7 +29,6 @@ const schemas: WrapManifestSchemas = { const validator = new Validator(); -Validator.prototype.customVersions.validType = Validators.validType; export const validateWrapManifest = Tracer.traceFunc( "core: validateWrapManifest", diff --git a/packages/js/core/src/wrap-manifests/validators.ts b/packages/js/core/src/wrap-manifests/validators.ts deleted file mode 100644 index f3f182e6b2..0000000000 --- a/packages/js/core/src/wrap-manifests/validators.ts +++ /dev/null @@ -1,15 +0,0 @@ -export function file(path: unknown): boolean { - if (typeof path !== "string") { - return false; - } - - // eslint-disable-next-line no-useless-escape - const validPathMatch = path.match(/^((\.\/|..\/)[^\/ ]*)+\/?$/gm); - - let result = false; - if (validPathMatch && validPathMatch[0]) { - result = validPathMatch[0].length === path.length; - } - - return result; -} diff --git a/packages/manifest-schemas/wrap/formats/0.0.1.json b/packages/manifest-schemas/wrap/formats/wrap.info/0.0.1.json similarity index 57% rename from packages/manifest-schemas/wrap/formats/0.0.1.json rename to packages/manifest-schemas/wrap/formats/wrap.info/0.0.1.json index 307727285d..897cee41fc 100644 --- a/packages/manifest-schemas/wrap/formats/0.0.1.json +++ b/packages/manifest-schemas/wrap/formats/wrap.info/0.0.1.json @@ -10,21 +10,22 @@ ], "properties": { "version": { - "description": "Wrap manifest format version", + "description": "WRAP Standard Version", "type": "string", "const": "0.0.1" }, "type": { - "description" : "Wrap language", + "description" : "Wrapper Package Type", "type": "string", - "format": "validType" + "enum": ["wasm", "interface"] }, "name": { - "description": "Wrapper name", - "type": "string" + "description": "Wrapper Name", + "type": "string", + "pattern": "^[a-zA-Z0-9\\-\\_]+$" }, "abi": { - "description": "Type info of wrapper", + "description": "Wrapper ABI", "type": "object" } } From ef8ef589b970f975b7dd2d1d51a44c3a925e236c Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Tue, 28 Jun 2022 17:29:58 -0700 Subject: [PATCH 09/46] core builds + runs tests --- .../scripts/templates/deserialize-ts.mustache | 7 +- packages/js/core/src/__tests__/Plugin.spec.ts | 22 ++---- .../src/__tests__/PolywrapManifest.spec.ts | 35 --------- .../core/src/__tests__/WrapManifest.spec.ts | 64 ++++++++++++++++ .../js/core/src/__tests__/resolveUri.spec.ts | 73 +++++++++---------- .../src/algorithms/find-plugin-package.ts | 15 ---- .../algorithms/find-plugin-registration.ts | 14 ++++ packages/js/core/src/algorithms/index.ts | 2 +- .../js/core/src/interfaces/uri-resolver.ts | 2 +- packages/js/core/src/msgpack/index.ts | 6 +- packages/js/core/src/types/Plugin.ts | 27 +++---- .../js/core/src/types/PluginRegistration.ts | 6 +- .../resolvers/plugin/PluginResolver.ts | 8 +- .../src/wrap-manifests/formats/deserialize.ts | 7 +- 14 files changed, 149 insertions(+), 139 deletions(-) delete mode 100644 packages/js/core/src/__tests__/PolywrapManifest.spec.ts create mode 100644 packages/js/core/src/__tests__/WrapManifest.spec.ts delete mode 100644 packages/js/core/src/algorithms/find-plugin-package.ts create mode 100644 packages/js/core/src/algorithms/find-plugin-registration.ts diff --git a/packages/js/core/scripts/templates/deserialize-ts.mustache b/packages/js/core/scripts/templates/deserialize-ts.mustache index 41a1c92d37..206b4f3e32 100644 --- a/packages/js/core/scripts/templates/deserialize-ts.mustache +++ b/packages/js/core/scripts/templates/deserialize-ts.mustache @@ -20,12 +20,15 @@ import { Tracer } from "@polywrap/tracing-js"; export const deserializeWrapManifest = Tracer.traceFunc( "core: deserializeWrapManifest", - (manifest: ArrayBuffer, options?: DeserializeManifestOptions): WrapManifest => { + (manifest: ArrayBufferView, options?: DeserializeManifestOptions): WrapManifest => { let anyWrapManifest: AnyWrapManifest | undefined; try { anyWrapManifest = msgpackDecode(manifest) as AnyWrapManifest; } catch (e) { - throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); + throw Error( + `Unable to parse WrapManifest: ` + + `[${new Uint8Array(manifest.buffer, manifest.byteOffset, manifest.byteLength).toString()}]` + ); } if (!options || !options.noValidate) { diff --git a/packages/js/core/src/__tests__/Plugin.spec.ts b/packages/js/core/src/__tests__/Plugin.spec.ts index 4274313cf8..5800986988 100644 --- a/packages/js/core/src/__tests__/Plugin.spec.ts +++ b/packages/js/core/src/__tests__/Plugin.spec.ts @@ -1,23 +1,11 @@ import { Client, PluginModule, - PluginPackageManifest, - Uri, } from ".."; -const testPluginManifest: PluginPackageManifest = { - schema: ` - type Module { - testQuery: Number! - testMutation: Boolean! - } - `, - implements: [new Uri("host2/path2")], -}; - class TestPluginModule extends PluginModule<{}> { - testQuery(_args: unknown, _client: Client): number { - return 5; + testQuery(args: { value: number }, _client: Client): number { + return 5 + args.value; } testMutation(_args: unknown, _client: Client): Promise { return Promise.resolve(true); @@ -27,9 +15,11 @@ class TestPluginModule extends PluginModule<{}> { describe("Plugin", () => { const plugin = new TestPluginModule({}); - it("sanity", () => { - expect(testPluginManifest.implements.length).toBe(1); + it("sanity", async () => { expect(plugin).toBeTruthy(); expect(plugin.getMethod("testMutation")).toBeTruthy(); + expect ( + await plugin._wrap_invoke("testQuery", { value: 5 }, {} as Client) + ).toBe(10); }); }); diff --git a/packages/js/core/src/__tests__/PolywrapManifest.spec.ts b/packages/js/core/src/__tests__/PolywrapManifest.spec.ts deleted file mode 100644 index c407b2e183..0000000000 --- a/packages/js/core/src/__tests__/PolywrapManifest.spec.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { deserializePolywrapManifest } from "../manifest"; - -import fs from "fs"; - -describe("Polywrap Manifest Validation", () => { - it("Should throw file string does not exist error", async () => { - const manifestPath = __dirname + "/manifest/polywrap/file-string-malformed/polywrap.yaml"; - const manifest = fs.readFileSync(manifestPath, "utf-8"); - - expect(() => deserializePolywrapManifest(manifest)).toThrowError(/instance.schema does not conform to the "graphqlFile" format/); - }); - it("Should throw incorrect version format error", async () => { - const manifestPath = __dirname + "/manifest/polywrap/incorrect-version-format/polywrap.yaml"; - const manifest = fs.readFileSync(manifestPath, "utf-8"); - - expect(() => deserializePolywrapManifest(manifest)).toThrowError(/Unrecognized PolywrapManifest schema format/); - }); - it("Should throw not accepted field error", async () => { - const manifestPath = __dirname + "/manifest/polywrap/not-accepted-field/polywrap.yaml"; - const manifest = fs.readFileSync(manifestPath, "utf-8"); - - expect(() => deserializePolywrapManifest(manifest)).toThrowError(/not allowed to have the additional property "not_accepted_field"/); - }); - it("Should throw required field missing error", async () => { - const manifestPath = __dirname + "/manifest/polywrap/required-field-missing/polywrap.yaml"; - const manifest = fs.readFileSync(manifestPath, "utf-8"); - expect(() => deserializePolywrapManifest(manifest)).toThrowError(/instance requires property "schema"/); - }); - it("Should throw wrong type error", async () => { - const manifestPath = __dirname + "/manifest/polywrap/wrong-type/polywrap.yaml"; - const manifest = fs.readFileSync(manifestPath, "utf-8"); - - expect(() => deserializePolywrapManifest(manifest)).toThrowError(/instance.module is not of a type\(s\) string/); - }); -}); diff --git a/packages/js/core/src/__tests__/WrapManifest.spec.ts b/packages/js/core/src/__tests__/WrapManifest.spec.ts new file mode 100644 index 0000000000..1b1bd312d3 --- /dev/null +++ b/packages/js/core/src/__tests__/WrapManifest.spec.ts @@ -0,0 +1,64 @@ +import { + WrapManifest, + deserializeWrapManifest, + msgpackEncode +} from ".."; + +const testManifest: WrapManifest = { + version: "0.0.1", + type: "wasm", + name: "dog-cat", + abi: {} +}; + +describe("Polywrap Manifest Validation", () => { + it("Should succeed", () => { + const manifest = msgpackEncode(testManifest); + expect(deserializeWrapManifest(manifest)).toMatchObject(testManifest); + }); + + it("Should throw incorrect version format error", () => { + const manifest = msgpackEncode({ + ...testManifest, + version: "bad-str" + }); + + expect(() => deserializeWrapManifest(manifest)).toThrowError(/Unrecognized WrapManifest schema version/); + }); + + it("Should throw not accepted field error", () => { + const manifest = msgpackEncode({ + ...testManifest, + not_accepted_field: "not_accepted_field" + }); + + expect(() => deserializeWrapManifest(manifest)).toThrowError(/not allowed to have the additional property "not_accepted_field"/); + }); + + it("Should throw required field missing error", () => { + const manifest = msgpackEncode({ + ...testManifest, + name: undefined + }); + + expect(() => deserializeWrapManifest(manifest)).toThrowError(/instance requires property "name"/); + }); + + it("Should throw if name field incorrect patterh", () => { + const manifest = msgpackEncode({ + ...testManifest, + name: "foo bar baz $%##$@#$@#$@#$#$" + }); + + expect(() => deserializeWrapManifest(manifest)).toThrowError(/instance.name does not match pattern/); + }); + + it("Should throw wrong type error", () => { + const manifest = msgpackEncode({ + ...testManifest, + abi: true + }); + + expect(() => deserializeWrapManifest(manifest)).toThrowError(/instance.abi is not of a type\(s\) object/); + }); +}); diff --git a/packages/js/core/src/__tests__/resolveUri.spec.ts b/packages/js/core/src/__tests__/resolveUri.spec.ts index 157f97e781..04481ab529 100644 --- a/packages/js/core/src/__tests__/resolveUri.spec.ts +++ b/packages/js/core/src/__tests__/resolveUri.spec.ts @@ -6,7 +6,7 @@ import { InvokeResult, WrapManifest, PluginModule, - PluginPackage, + PluginFactory, QueryOptions, QueryResult, Uri, @@ -24,11 +24,12 @@ import { PluginRegistration, SubscribeOptions, Subscription, + msgpackEncode } from ".."; describe("resolveUri", () => { const client = ( - wrappers: Record, + wrappers: Record>, plugins: PluginRegistration[] = [], interfaces: InterfaceImplementations[] = [], redirects: UriRedirect[] = [] @@ -94,7 +95,7 @@ describe("resolveUri", () => { }, } as unknown) as Client); - const createPluginWrapper = (uri: Uri, plugin: PluginPackage): Wrapper => { + const createPluginWrapper = (uri: Uri, plugin: PluginFactory<{}>): Wrapper => { return { invoke: () => Promise.resolve({ @@ -123,11 +124,18 @@ describe("resolveUri", () => { }; }; + const testManifest: WrapManifest = { + version: "0.0.1", + type: "wasm", + name: "dog-cat", + abi: {} + }; + const ensWrapper = { tryResolveUri: ( args: { authority: string; path: string }, _client: Client - ) => { + ): UriResolverInterface.MaybeUriOrManifest => { return { uri: args.authority === "ens" ? "ipfs/QmHash" : undefined, }; @@ -138,12 +146,12 @@ describe("resolveUri", () => { tryResolveUri: ( args: { authority: string; path: string }, _client: Client - ) => { + ): UriResolverInterface.MaybeUriOrManifest => { return { manifest: - args.authority === "ipfs" - ? "format: 0.0.1-prealpha.9\ndog: cat" - : undefined, + args.authority === "ipfs" ? + msgpackEncode(testManifest) : + undefined, }; } }; @@ -152,10 +160,12 @@ describe("resolveUri", () => { tryResolveUri: ( args: { authority: string; path: string }, _client: Client - ) => { + ): UriResolverInterface.MaybeUriOrManifest => { return { manifest: - args.authority === "my" ? "format: 0.0.1-prealpha.9" : undefined, + args.authority === "my" ? + msgpackEncode(testManifest) : + undefined, }; }, }; @@ -164,11 +174,7 @@ describe("resolveUri", () => { { uri: new Uri("ens/my-plugin"), plugin: { - factory: () => ({} as Plugin), - manifest: { - schema: "", - implements: [coreInterfaceUris.uriResolver], - }, + instantiate: () => ({} as PluginModule<{}>), }, }, ]; @@ -184,21 +190,21 @@ describe("resolveUri", () => { }, ]; - const wrappers: Record = { - "wrap://ens/ens": ensWrapper as unknown as PluginModule, - "wrap://ens/ipfs": ipfsWrapper as unknown as PluginModule, - "wrap://ens/my-plugin": pluginWrapper as unknown as PluginModule, + const wrappers: Record> = { + "wrap://ens/ens": ensWrapper as unknown as PluginModule<{}>, + "wrap://ens/ipfs": ipfsWrapper as unknown as PluginModule<{}>, + "wrap://ens/my-plugin": pluginWrapper as unknown as PluginModule<{}>, }; const uriResolvers: UriResolver[] = [ new RedirectsResolver(), - new PluginResolver((uri: Uri, plugin: PluginPackage) => + new PluginResolver((uri: Uri, plugin: PluginFactory<{}>) => createPluginWrapper(uri, plugin) ), new ExtendableUriResolver( ( uri: Uri, - manifest: PolywrapManifest, + manifest: WrapManifest, uriResolver: string, environment: Env | undefined ) => { @@ -237,9 +243,7 @@ describe("resolveUri", () => { expect(wrapperIdentity).toMatchObject({ uri: new Uri("ipfs/QmHash"), - manifest: { - format: "0.0.1-prealpha.9", - }, + manifest: testManifest, uriResolver: "wrap://ens/ipfs", }); }); @@ -261,9 +265,7 @@ describe("resolveUri", () => { expect(wrapperIdentity).toMatchObject({ uri: new Uri("my/something-different"), - manifest: { - format: "0.0.1-prealpha.9", - }, + manifest: testManifest, uriResolver: "wrap://ens/my-plugin", }); }); @@ -285,10 +287,7 @@ describe("resolveUri", () => { expect(wrapperIdentity).toMatchObject({ uri: new Uri("ipfs/QmHash"), - manifest: { - format: "0.0.1-prealpha.9", - dog: "cat", - }, + manifest: testManifest, uriResolver: "wrap://ens/ipfs", }); }); @@ -310,9 +309,7 @@ describe("resolveUri", () => { expect(wrapperIdentity).toMatchObject({ uri: new Uri("my/something-different"), - manifest: { - format: "0.0.1-prealpha.9", - }, + manifest: testManifest, uriResolver: "wrap://ens/my-plugin", }); }); @@ -373,11 +370,7 @@ describe("resolveUri", () => { { uri: new Uri("some/wrapper"), plugin: { - factory: () => ({} as Plugin), - manifest: { - schema: "", - implements: [coreInterfaceUris.uriResolver], - }, + instantiate: () => ({} as PluginModule<{}>), }, }, ]; @@ -419,7 +412,7 @@ describe("resolveUri", () => { client( { ...wrappers, - "wrap://ens/ipfs": faultyIpfsWrapper as unknown as PluginModule + "wrap://ens/ipfs": faultyIpfsWrapper as unknown as PluginModule<{}> }, plugins, interfaces diff --git a/packages/js/core/src/algorithms/find-plugin-package.ts b/packages/js/core/src/algorithms/find-plugin-package.ts deleted file mode 100644 index 162398325d..0000000000 --- a/packages/js/core/src/algorithms/find-plugin-package.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Uri, PluginPackage, PluginRegistration } from "../types"; - -import { Tracer } from "@polywrap/tracing-js"; - -export const findPluginPackage = Tracer.traceFunc( - "core: findPluginPackage", - ( - uri: Uri, - plugins: readonly PluginRegistration[] - ): PluginPackage | undefined => { - const pluginRedirect = plugins.find((x) => Uri.equals(x.uri, uri)); - - return pluginRedirect?.plugin as PluginPackage | undefined; - } -); diff --git a/packages/js/core/src/algorithms/find-plugin-registration.ts b/packages/js/core/src/algorithms/find-plugin-registration.ts new file mode 100644 index 0000000000..00ebf5d02a --- /dev/null +++ b/packages/js/core/src/algorithms/find-plugin-registration.ts @@ -0,0 +1,14 @@ +import { Uri, PluginFactory, PluginRegistration } from "../types"; + +import { Tracer } from "@polywrap/tracing-js"; + +export const findPluginRegistration = Tracer.traceFunc( + "core: findPluginRegistration", + ( + uri: Uri, + plugins: readonly PluginRegistration[] + ): PluginFactory | undefined => { + const pluginRedirect = plugins.find((x) => Uri.equals(x.uri, uri)); + return pluginRedirect?.plugin; + } +); diff --git a/packages/js/core/src/algorithms/index.ts b/packages/js/core/src/algorithms/index.ts index c95ef00eef..a4232e4b34 100644 --- a/packages/js/core/src/algorithms/index.ts +++ b/packages/js/core/src/algorithms/index.ts @@ -1,5 +1,5 @@ export * from "./apply-redirects"; export * from "./combine-paths"; -export * from "./find-plugin-package"; +export * from "./find-plugin-registration"; export * from "./get-implementations"; export * from "./parse-query"; diff --git a/packages/js/core/src/interfaces/uri-resolver.ts b/packages/js/core/src/interfaces/uri-resolver.ts index 4be9431fb6..b261195446 100644 --- a/packages/js/core/src/interfaces/uri-resolver.ts +++ b/packages/js/core/src/interfaces/uri-resolver.ts @@ -5,7 +5,7 @@ import { Tracer } from "@polywrap/tracing-js"; export interface MaybeUriOrManifest { uri?: string; - manifest?: ArrayBuffer; + manifest?: ArrayBufferView; } // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/packages/js/core/src/msgpack/index.ts b/packages/js/core/src/msgpack/index.ts index 8ef3c92a4b..3ae16b6e96 100644 --- a/packages/js/core/src/msgpack/index.ts +++ b/packages/js/core/src/msgpack/index.ts @@ -33,7 +33,7 @@ extensionCodec.register({ }, }); -export function msgpackEncode(object: unknown): ArrayBuffer { +export function msgpackEncode(object: unknown): ArrayBufferView { const encoder = new Encoder( extensionCodec, undefined, // context @@ -45,11 +45,11 @@ export function msgpackEncode(object: unknown): ArrayBuffer { undefined // forceIntegerToFloat ); - return encoder.encode(object).buffer; + return encoder.encode(object); } export function msgpackDecode( - buffer: ArrayLike | BufferSource + buffer: ArrayBufferView ): unknown { const decoder = new Decoder(extensionCodec); return decoder.decode(buffer); diff --git a/packages/js/core/src/types/Plugin.ts b/packages/js/core/src/types/Plugin.ts index 2533e078eb..4e5e35b973 100644 --- a/packages/js/core/src/types/Plugin.ts +++ b/packages/js/core/src/types/Plugin.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import { Uri, Client, MaybeAsync, executeMaybeAsyncFunction } from "."; +import { Client, MaybeAsync, executeMaybeAsyncFunction } from "."; /** * Invocable plugin method. @@ -12,7 +12,10 @@ import { Uri, Client, MaybeAsync, executeMaybeAsyncFunction } from "."; export type PluginMethod< TArgs extends Record = Record, TResult = unknown -> = (args: TArgs, client: Client) => MaybeAsync; +> = ( + args: TArgs, + client: Client +) => MaybeAsync; export abstract class PluginModule< TConfig, @@ -87,20 +90,10 @@ export abstract class PluginModule< } } -/** The plugin package's manifest */ -export interface PluginPackageManifest { - /** The Wrapper's schema */ - schema: string; +export type PluginPackage = ( + config: TConfig +) => PluginFactory; - /** All interface schemas implemented by this plugin. */ - implements: Uri[]; +export interface PluginFactory { + instantiate: () => PluginModule; } - -export type PluginPackage = { - factory: () => PluginModule; - manifest: PluginPackageManifest; -}; - -export type PluginFactory = ( - config: TConfig -) => PluginPackage; diff --git a/packages/js/core/src/types/PluginRegistration.ts b/packages/js/core/src/types/PluginRegistration.ts index 31360836d5..68ef852230 100644 --- a/packages/js/core/src/types/PluginRegistration.ts +++ b/packages/js/core/src/types/PluginRegistration.ts @@ -1,10 +1,10 @@ -import { PluginPackage, Uri } from "."; +import { PluginFactory, Uri } from "."; import { Tracer } from "@polywrap/tracing-js"; -export interface PluginRegistration { +export interface PluginRegistration { uri: TUri; - plugin: PluginPackage; + plugin: PluginFactory; } export const sanitizePluginRegistrations = Tracer.traceFunc( diff --git a/packages/js/core/src/uri-resolution/resolvers/plugin/PluginResolver.ts b/packages/js/core/src/uri-resolution/resolvers/plugin/PluginResolver.ts index 9ed44da207..1dac93ee88 100644 --- a/packages/js/core/src/uri-resolution/resolvers/plugin/PluginResolver.ts +++ b/packages/js/core/src/uri-resolution/resolvers/plugin/PluginResolver.ts @@ -9,16 +9,16 @@ import { WrapperCache, Client, Env, - PluginPackage, + PluginFactory, Uri, } from "../../../types"; -import { findPluginPackage } from "../../../algorithms"; +import { findPluginRegistration } from "../../../algorithms"; export class PluginResolver implements UriResolver { constructor( private readonly createPluginWrapper: ( uri: Uri, - plugin: PluginPackage, + plugin: PluginFactory, environment: Env | undefined ) => Wrapper ) {} @@ -33,7 +33,7 @@ export class PluginResolver implements UriResolver { cache: WrapperCache, resolutionPath: UriResolutionStack ): Promise { - const plugin = findPluginPackage(uri, client.getPlugins({})); + const plugin = findPluginRegistration(uri, client.getPlugins({})); if (plugin) { const environment = getEnvFromUriOrResolutionStack( diff --git a/packages/js/core/src/wrap-manifests/formats/deserialize.ts b/packages/js/core/src/wrap-manifests/formats/deserialize.ts index 41a1c92d37..206b4f3e32 100644 --- a/packages/js/core/src/wrap-manifests/formats/deserialize.ts +++ b/packages/js/core/src/wrap-manifests/formats/deserialize.ts @@ -20,12 +20,15 @@ import { Tracer } from "@polywrap/tracing-js"; export const deserializeWrapManifest = Tracer.traceFunc( "core: deserializeWrapManifest", - (manifest: ArrayBuffer, options?: DeserializeManifestOptions): WrapManifest => { + (manifest: ArrayBufferView, options?: DeserializeManifestOptions): WrapManifest => { let anyWrapManifest: AnyWrapManifest | undefined; try { anyWrapManifest = msgpackDecode(manifest) as AnyWrapManifest; } catch (e) { - throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); + throw Error( + `Unable to parse WrapManifest: ` + + `[${new Uint8Array(manifest.buffer, manifest.byteOffset, manifest.byteLength).toString()}]` + ); } if (!options || !options.noValidate) { From 8181677ea3ed1d6668f1ff70b57afaead1c1b0b1 Mon Sep 17 00:00:00 2001 From: cbrzn Date: Wed, 29 Jun 2022 17:04:01 +0200 Subject: [PATCH 10/46] chore: remove polywrap manifest update in build --- packages/cli/src/lib/Compiler.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/cli/src/lib/Compiler.ts b/packages/cli/src/lib/Compiler.ts index fbb5f16519..55b17361b7 100644 --- a/packages/cli/src/lib/Compiler.ts +++ b/packages/cli/src/lib/Compiler.ts @@ -103,7 +103,7 @@ export class Compiler { await this._generateCode(state); // Compile the Wrapper - await this._buildModules(state); + await this._buildModules(); } // Output all metadata if present @@ -222,9 +222,8 @@ export class Compiler { return writeDirectorySync(binding.outputDirAbs, binding.output); } - private async _buildModules(state: CompilerState): Promise { + private async _buildModules(): Promise { const { outputDir } = this._config; - const { polywrapManifest } = state; if (await this._isInterface()) { throw Error(intlMsg.lib_compiler_cannotBuildInterfaceModules()); @@ -235,10 +234,6 @@ export class Compiler { // Validate the Wasm module await this._validateWasmModule(outputDir); - - // Update the PolywrapManifest - polywrapManifest.module = "./wrap.wasm"; - // polywrapManifest.info = "./wrap.info"; } private async _buildSourcesInDocker(): Promise { From 4283ff2b6073399a09a35d3611d9723ed0556bea Mon Sep 17 00:00:00 2001 From: cbrzn Date: Wed, 29 Jun 2022 21:46:35 +0200 Subject: [PATCH 11/46] chore: trying to fix build --- packages/cli/src/lib/Compiler.ts | 2 +- packages/cli/src/lib/helpers/metadata.ts | 2 +- packages/cli/src/lib/index.ts | 2 - .../cli/src/lib/project-manifests/index.ts | 13 --- packages/cli/src/lib/project/AppProject.ts | 5 +- packages/cli/src/lib/project/PluginProject.ts | 6 +- .../cli/src/lib/project/PolywrapProject.ts | 13 ++- packages/cli/src/lib/project/index.ts | 1 + .../manifests}/app/index.ts | 0 .../manifests}/app/languages.ts | 2 +- .../manifests}/app/load.ts | 7 +- .../cli/src/lib/project/manifests/index.ts | 12 +++ .../manifests}/language.ts | 0 .../manifests}/output.ts | 2 +- .../manifests}/plugin/index.ts | 0 .../manifests}/plugin/languages.ts | 2 +- .../manifests}/plugin/load.ts | 7 +- .../manifests}/polywrap/index.ts | 0 .../manifests}/polywrap/languages.ts | 2 +- .../manifests}/polywrap/load.ts | 18 ++-- .../templates}/index.ts | 2 +- packages/js/client/src/PolywrapClient.ts | 16 ---- .../js/client/src/default-client-config.ts | 2 +- .../js/client/src/plugin/PluginWrapper.ts | 6 +- packages/js/client/src/wasm/WasmWrapper.ts | 36 +++----- .../src/algorithms/find-plugin-package.ts | 15 ++++ .../algorithms/find-plugin-registration.ts | 14 --- packages/js/core/src/algorithms/index.ts | 2 +- packages/js/core/src/msgpack/index.ts | 6 +- packages/js/core/src/types/Client.ts | 7 -- packages/js/core/src/types/Plugin.ts | 27 +++--- .../js/core/src/types/PluginRegistration.ts | 6 +- packages/js/core/src/types/Wrapper.ts | 7 -- .../resolvers/plugin/PluginResolver.ts | 8 +- .../file-system-resolver/src/index.ts | 13 +-- .../uri-resolvers/ipfs-resolver/src/index.ts | 6 +- .../src/types/WasmPackageValidator.ts | 2 +- yarn.lock | 90 +++++++++---------- 38 files changed, 158 insertions(+), 203 deletions(-) delete mode 100644 packages/cli/src/lib/project-manifests/index.ts rename packages/cli/src/lib/{project-manifests => project/manifests}/app/index.ts (100%) rename packages/cli/src/lib/{project-manifests => project/manifests}/app/languages.ts (95%) rename packages/cli/src/lib/{project-manifests => project/manifests}/app/load.ts (87%) create mode 100644 packages/cli/src/lib/project/manifests/index.ts rename packages/cli/src/lib/{project-manifests => project/manifests}/language.ts (100%) rename packages/cli/src/lib/{project-manifests => project/manifests}/output.ts (99%) rename packages/cli/src/lib/{project-manifests => project/manifests}/plugin/index.ts (100%) rename packages/cli/src/lib/{project-manifests => project/manifests}/plugin/languages.ts (95%) rename packages/cli/src/lib/{project-manifests => project/manifests}/plugin/load.ts (87%) rename packages/cli/src/lib/{project-manifests => project/manifests}/polywrap/index.ts (100%) rename packages/cli/src/lib/{project-manifests => project/manifests}/polywrap/languages.ts (96%) rename packages/cli/src/lib/{project-manifests => project/manifests}/polywrap/load.ts (97%) rename packages/cli/src/lib/{project-templates => project/templates}/index.ts (99%) create mode 100644 packages/js/core/src/algorithms/find-plugin-package.ts delete mode 100644 packages/js/core/src/algorithms/find-plugin-registration.ts diff --git a/packages/cli/src/lib/Compiler.ts b/packages/cli/src/lib/Compiler.ts index 55b17361b7..2cca8a599a 100644 --- a/packages/cli/src/lib/Compiler.ts +++ b/packages/cli/src/lib/Compiler.ts @@ -7,7 +7,6 @@ import { PolywrapProject, SchemaComposer, withSpinner, - outputManifest, outputMetadata, generateDockerfile, generateDockerImageName, @@ -16,6 +15,7 @@ import { intlMsg, resetDir, } from "./"; +import { outputManifest } from "./project/manifests"; import { msgpackEncode, WrapManifest } from "@polywrap/core-js"; import { WasmWrapper } from "@polywrap/client-js"; diff --git a/packages/cli/src/lib/helpers/metadata.ts b/packages/cli/src/lib/helpers/metadata.ts index c7017a4cfe..3771c52f59 100644 --- a/packages/cli/src/lib/helpers/metadata.ts +++ b/packages/cli/src/lib/helpers/metadata.ts @@ -2,7 +2,7 @@ import { withSpinner } from "./"; import { displayPath, intlMsg } from "../"; import { normalizePath } from "@polywrap/os-js"; -import { MetaManifest } from "@polywrap/core-js"; +import { MetaManifest } from "polywrap"; import { Ora } from "ora"; import fs from "fs"; import path from "path"; diff --git a/packages/cli/src/lib/index.ts b/packages/cli/src/lib/index.ts index e59273a30c..184da96607 100644 --- a/packages/cli/src/lib/index.ts +++ b/packages/cli/src/lib/index.ts @@ -5,8 +5,6 @@ export * from "./intl"; export * from "./option-parsers"; export * from "./polywrap-manifests"; export * from "./project"; -export * from "./project-manifests"; -export * from "./project-templates"; export * from "./system"; export * from "./test-env"; export * from "./CacheDirectory"; diff --git a/packages/cli/src/lib/project-manifests/index.ts b/packages/cli/src/lib/project-manifests/index.ts deleted file mode 100644 index 13b354feeb..0000000000 --- a/packages/cli/src/lib/project-manifests/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -export * from "./app"; -export * from "./plugin"; -export * from "./polywrap"; -export * from "./language"; -export * from "./output"; - -import { - PolywrapManifest, - PluginManifest, - AppManifest, -} from "../"; - -export type AnyProjectManifest = PolywrapManifest | PluginManifest | AppManifest; diff --git a/packages/cli/src/lib/project/AppProject.ts b/packages/cli/src/lib/project/AppProject.ts index c340378bfb..9965c64f14 100644 --- a/packages/cli/src/lib/project/AppProject.ts +++ b/packages/cli/src/lib/project/AppProject.ts @@ -5,9 +5,10 @@ import { isAppManifestLanguage, loadAppManifest, appManifestLanguageToBindLanguage, -} from ".."; +} from "./manifests"; +import { AppManifest } from "../polywrap-manifests"; -import { AppManifest, Client } from "@polywrap/core-js"; +import { Client } from "@polywrap/core-js"; import { ComposerOutput } from "@polywrap/schema-compose"; import { bindSchema, BindOutput } from "@polywrap/schema-bind"; import { Abi } from "@polywrap/schema-parse"; diff --git a/packages/cli/src/lib/project/PluginProject.ts b/packages/cli/src/lib/project/PluginProject.ts index 173c476856..c24985de86 100644 --- a/packages/cli/src/lib/project/PluginProject.ts +++ b/packages/cli/src/lib/project/PluginProject.ts @@ -5,10 +5,10 @@ import { pluginManifestLanguages, isPluginManifestLanguage, pluginManifestLanguageToBindLanguage, - resetDir, -} from ".."; +} from "./manifests"; +import { PluginManifest } from "../polywrap-manifests"; +import { resetDir } from "../system"; -import { PluginManifest } from "@polywrap/core-js"; import { bindSchema, BindOutput, BindOptions } from "@polywrap/schema-bind"; import { ComposerOutput } from "@polywrap/schema-compose"; import { Abi } from "@polywrap/schema-parse"; diff --git a/packages/cli/src/lib/project/PolywrapProject.ts b/packages/cli/src/lib/project/PolywrapProject.ts index 58ab71858d..839482c36f 100644 --- a/packages/cli/src/lib/project/PolywrapProject.ts +++ b/packages/cli/src/lib/project/PolywrapProject.ts @@ -6,26 +6,25 @@ import { loadPolywrapManifest, loadBuildManifest, loadMetaManifest, - generateDockerImageName, - createUUID, PolywrapManifestLanguage, polywrapManifestLanguages, isPolywrapManifestLanguage, outputManifest, - intlMsg, loadDeployManifest, loadDeployManifestExt, polywrapManifestLanguageToBindLanguage, - resetDir, -} from ".."; +} from "./manifests"; import { Deployer } from "../deploy"; - import { BuildManifest, PolywrapManifest, MetaManifest, DeployManifest, -} from "@polywrap/core-js"; +} from "../polywrap-manifests"; +import { generateDockerImageName, resetDir } from "../system"; +import { createUUID } from "../helpers"; +import { intlMsg } from "../intl"; + import { normalizePath } from "@polywrap/os-js"; import { bindSchema, BindOutput, BindOptions } from "@polywrap/schema-bind"; import { ComposerOutput } from "@polywrap/schema-compose"; diff --git a/packages/cli/src/lib/project/index.ts b/packages/cli/src/lib/project/index.ts index fa69df9540..37fca8f6ca 100644 --- a/packages/cli/src/lib/project/index.ts +++ b/packages/cli/src/lib/project/index.ts @@ -2,3 +2,4 @@ export * from "./Project"; export * from "./PolywrapProject"; export * from "./PluginProject"; export * from "./AppProject"; +export * from "./templates"; diff --git a/packages/cli/src/lib/project-manifests/app/index.ts b/packages/cli/src/lib/project/manifests/app/index.ts similarity index 100% rename from packages/cli/src/lib/project-manifests/app/index.ts rename to packages/cli/src/lib/project/manifests/app/index.ts diff --git a/packages/cli/src/lib/project-manifests/app/languages.ts b/packages/cli/src/lib/project/manifests/app/languages.ts similarity index 95% rename from packages/cli/src/lib/project-manifests/app/languages.ts rename to packages/cli/src/lib/project/manifests/app/languages.ts index ce89cd41e0..ccea1d3b7f 100644 --- a/packages/cli/src/lib/project-manifests/app/languages.ts +++ b/packages/cli/src/lib/project/manifests/app/languages.ts @@ -1,4 +1,4 @@ -import { intlMsg } from "../../intl"; +import { intlMsg } from "../../../intl"; import { BindLanguage } from "@polywrap/schema-bind"; diff --git a/packages/cli/src/lib/project-manifests/app/load.ts b/packages/cli/src/lib/project/manifests/app/load.ts similarity index 87% rename from packages/cli/src/lib/project-manifests/app/load.ts rename to packages/cli/src/lib/project/manifests/app/load.ts index 236902e353..d06eb6d591 100644 --- a/packages/cli/src/lib/project-manifests/app/load.ts +++ b/packages/cli/src/lib/project/manifests/app/load.ts @@ -1,6 +1,9 @@ -import { displayPath, withSpinner, intlMsg } from "../../"; +import { displayPath, withSpinner, intlMsg } from "../../../"; +import { + AppManifest, + deserializeAppManifest, +} from "../../../polywrap-manifests"; -import { AppManifest, deserializeAppManifest } from "@polywrap/core-js"; import fs from "fs"; export const defaultAppManifest = ["polywrap.app.yaml", "polywrap.app.yml"]; diff --git a/packages/cli/src/lib/project/manifests/index.ts b/packages/cli/src/lib/project/manifests/index.ts new file mode 100644 index 0000000000..d61c015990 --- /dev/null +++ b/packages/cli/src/lib/project/manifests/index.ts @@ -0,0 +1,12 @@ +export * from "./app"; +export * from "./plugin"; +export * from "./polywrap"; +export * from "./language"; +export * from "./output"; + +import { PolywrapManifest, PluginManifest, AppManifest } from "../../"; + +export type AnyProjectManifest = + | PolywrapManifest + | PluginManifest + | AppManifest; diff --git a/packages/cli/src/lib/project-manifests/language.ts b/packages/cli/src/lib/project/manifests/language.ts similarity index 100% rename from packages/cli/src/lib/project-manifests/language.ts rename to packages/cli/src/lib/project/manifests/language.ts diff --git a/packages/cli/src/lib/project-manifests/output.ts b/packages/cli/src/lib/project/manifests/output.ts similarity index 99% rename from packages/cli/src/lib/project-manifests/output.ts rename to packages/cli/src/lib/project/manifests/output.ts index 73be298b03..832bf31ca4 100644 --- a/packages/cli/src/lib/project-manifests/output.ts +++ b/packages/cli/src/lib/project/manifests/output.ts @@ -6,7 +6,7 @@ import { PolywrapManifest, MetaManifest, PluginManifest, -} from "../"; +} from "../../"; import { writeFileSync, normalizePath } from "@polywrap/os-js"; import YAML from "js-yaml"; diff --git a/packages/cli/src/lib/project-manifests/plugin/index.ts b/packages/cli/src/lib/project/manifests/plugin/index.ts similarity index 100% rename from packages/cli/src/lib/project-manifests/plugin/index.ts rename to packages/cli/src/lib/project/manifests/plugin/index.ts diff --git a/packages/cli/src/lib/project-manifests/plugin/languages.ts b/packages/cli/src/lib/project/manifests/plugin/languages.ts similarity index 95% rename from packages/cli/src/lib/project-manifests/plugin/languages.ts rename to packages/cli/src/lib/project/manifests/plugin/languages.ts index 3e2b8a7ba6..c89c084ee0 100644 --- a/packages/cli/src/lib/project-manifests/plugin/languages.ts +++ b/packages/cli/src/lib/project/manifests/plugin/languages.ts @@ -1,4 +1,4 @@ -import { intlMsg } from "../../intl"; +import { intlMsg } from "../../../intl"; import { BindLanguage } from "@polywrap/schema-bind"; diff --git a/packages/cli/src/lib/project-manifests/plugin/load.ts b/packages/cli/src/lib/project/manifests/plugin/load.ts similarity index 87% rename from packages/cli/src/lib/project-manifests/plugin/load.ts rename to packages/cli/src/lib/project/manifests/plugin/load.ts index 856a40f683..b721862d0d 100644 --- a/packages/cli/src/lib/project-manifests/plugin/load.ts +++ b/packages/cli/src/lib/project/manifests/plugin/load.ts @@ -1,6 +1,9 @@ -import { displayPath, withSpinner, intlMsg } from "../../"; +import { displayPath, withSpinner, intlMsg } from "../../../"; +import { + PluginManifest, + deserializePluginManifest, +} from "../../../polywrap-manifests"; -import { PluginManifest, deserializePluginManifest } from "@polywrap/core-js"; import fs from "fs"; export const defaultPluginManifest = [ diff --git a/packages/cli/src/lib/project-manifests/polywrap/index.ts b/packages/cli/src/lib/project/manifests/polywrap/index.ts similarity index 100% rename from packages/cli/src/lib/project-manifests/polywrap/index.ts rename to packages/cli/src/lib/project/manifests/polywrap/index.ts diff --git a/packages/cli/src/lib/project-manifests/polywrap/languages.ts b/packages/cli/src/lib/project/manifests/polywrap/languages.ts similarity index 96% rename from packages/cli/src/lib/project-manifests/polywrap/languages.ts rename to packages/cli/src/lib/project/manifests/polywrap/languages.ts index 501c2aded6..e5b4a9fe64 100644 --- a/packages/cli/src/lib/project-manifests/polywrap/languages.ts +++ b/packages/cli/src/lib/project/manifests/polywrap/languages.ts @@ -1,4 +1,4 @@ -import { intlMsg } from "../../intl"; +import { intlMsg } from "../../../intl"; import { BindLanguage } from "@polywrap/schema-bind"; diff --git a/packages/cli/src/lib/project-manifests/polywrap/load.ts b/packages/cli/src/lib/project/manifests/polywrap/load.ts similarity index 97% rename from packages/cli/src/lib/project-manifests/polywrap/load.ts rename to packages/cli/src/lib/project/manifests/polywrap/load.ts index e1e6437917..f2aa6b4f85 100644 --- a/packages/cli/src/lib/project-manifests/polywrap/load.ts +++ b/packages/cli/src/lib/project/manifests/polywrap/load.ts @@ -4,8 +4,7 @@ import { intlMsg, searchOptional, loadEnvironmentVariables, -} from "../../"; - +} from "../../../"; import { PolywrapManifest, BuildManifest, @@ -17,7 +16,8 @@ import { deserializeDeployManifest, InfraManifest, deserializeInfraManifest, -} from "@polywrap/core-js"; +} from "../../../polywrap-manifests"; + import { Schema as JsonSchema } from "jsonschema"; import path from "path"; import fs from "fs"; @@ -54,7 +54,7 @@ export async function loadPolywrapManifest( intlMsg.lib_helpers_manifest_loadText({ path: manifestPath }), intlMsg.lib_helpers_manifest_loadError({ path: manifestPath }), intlMsg.lib_helpers_manifest_loadWarning({ path: manifestPath }), - async (_spinner) => { + async () => { return await run(); } )) as PolywrapManifest; @@ -114,7 +114,7 @@ export async function loadBuildManifest( intlMsg.lib_helpers_manifest_loadText({ path: manifestPath }), intlMsg.lib_helpers_manifest_loadError({ path: manifestPath }), intlMsg.lib_helpers_manifest_loadWarning({ path: manifestPath }), - async (_spinner) => { + async () => { return await run(); } )) as BuildManifest; @@ -159,7 +159,7 @@ export async function loadDeployManifest( intlMsg.lib_helpers_manifest_loadText({ path: manifestPath }), intlMsg.lib_helpers_manifest_loadError({ path: manifestPath }), intlMsg.lib_helpers_manifest_loadWarning({ path: manifestPath }), - async (_spinner) => { + async () => { return await run(); } )) as DeployManifest; @@ -199,7 +199,7 @@ export async function loadDeployManifestExt( intlMsg.lib_helpers_deployManifestExt_loadWarning({ path: manifestExtPath, }), - async (_spinner) => { + async () => { return run(); } ); @@ -238,7 +238,7 @@ export async function loadMetaManifest( intlMsg.lib_helpers_manifest_loadText({ path: manifestPath }), intlMsg.lib_helpers_manifest_loadError({ path: manifestPath }), intlMsg.lib_helpers_manifest_loadWarning({ path: manifestPath }), - async (_spinner) => { + async () => { return await run(); } )) as MetaManifest; @@ -278,7 +278,7 @@ export async function loadInfraManifest( intlMsg.lib_helpers_manifest_loadText({ path: manifestPath }), intlMsg.lib_helpers_manifest_loadError({ path: manifestPath }), intlMsg.lib_helpers_manifest_loadWarning({ path: manifestPath }), - async (_spinner) => { + async () => { return await run(); } )) as InfraManifest; diff --git a/packages/cli/src/lib/project-templates/index.ts b/packages/cli/src/lib/project/templates/index.ts similarity index 99% rename from packages/cli/src/lib/project-templates/index.ts rename to packages/cli/src/lib/project/templates/index.ts index 8be73b323b..cdc1788aaa 100644 --- a/packages/cli/src/lib/project-templates/index.ts +++ b/packages/cli/src/lib/project/templates/index.ts @@ -1,4 +1,4 @@ -import { intlMsg } from "../"; +import { intlMsg } from "../../"; import { execSync, spawn } from "child_process"; import { GluegunFilesystem } from "gluegun"; diff --git a/packages/js/client/src/PolywrapClient.ts b/packages/js/client/src/PolywrapClient.ts index 8a7fefc39b..c0958a45b4 100644 --- a/packages/js/client/src/PolywrapClient.ts +++ b/packages/js/client/src/PolywrapClient.ts @@ -167,16 +167,6 @@ export class PolywrapClient implements Client { ); } - @Tracer.traceMethod("PolywrapClient: getSchema") - public async getSchema( - uri: TUri, - options: GetSchemaOptions = {} - ): Promise { - const wrapper = await this._loadWrapper(this._toUri(uri), options); - const client = contextualizeClient(this, options.contextId); - return await wrapper.getSchema(client); - } - @Tracer.traceMethod("PolywrapClient: getFile") public async getFile( uri: TUri, @@ -829,12 +819,6 @@ const contextualizeClient = ( ) => { return client.getEnvByUri(uri, { ...options, contextId }); }, - getSchema: ( - uri: TUri, - options: GetSchemaOptions = {} - ) => { - return client.getSchema(uri, { ...options, contextId }); - }, getFile: ( uri: TUri, options: GetFileOptions diff --git a/packages/js/client/src/default-client-config.ts b/packages/js/client/src/default-client-config.ts index 136a60d01d..843b0b4941 100644 --- a/packages/js/client/src/default-client-config.ts +++ b/packages/js/client/src/default-client-config.ts @@ -5,13 +5,13 @@ import { Uri, coreInterfaceUris, PluginPackage, - PolywrapManifest, Env, ExtendableUriResolver, CacheResolver, PluginResolver, RedirectsResolver, } from "@polywrap/core-js"; +import { PolywrapManifest } from "polywrap"; import { ipfsPlugin } from "@polywrap/ipfs-plugin-js"; import { ipfsResolverPlugin } from "@polywrap/ipfs-resolver-plugin-js"; import { ethereumPlugin } from "@polywrap/ethereum-plugin-js"; diff --git a/packages/js/client/src/plugin/PluginWrapper.ts b/packages/js/client/src/plugin/PluginWrapper.ts index 6a5d3ded28..a19b7cdc88 100644 --- a/packages/js/client/src/plugin/PluginWrapper.ts +++ b/packages/js/client/src/plugin/PluginWrapper.ts @@ -34,10 +34,6 @@ export class PluginWrapper extends Wrapper { Tracer.endSpan(); } - public async getSchema(_client: Client): Promise { - return Promise.resolve(this._plugin.manifest.schema); - } - public async getFile( _options: GetFileOptions, _client: Client @@ -82,7 +78,7 @@ export class PluginWrapper extends Wrapper { jsArgs = result as Record; } else { - jsArgs = args; + jsArgs = args as Record; } // Invoke the function diff --git a/packages/js/client/src/wasm/WasmWrapper.ts b/packages/js/client/src/wasm/WasmWrapper.ts index 51e04cef5d..71d666eb8a 100644 --- a/packages/js/client/src/wasm/WasmWrapper.ts +++ b/packages/js/client/src/wasm/WasmWrapper.ts @@ -20,7 +20,7 @@ import { Tracer } from "@polywrap/tracing-js"; import { AsyncWasmInstance } from "@polywrap/asyncify-js"; type InvokeResultOrError = - | { type: "InvokeResult"; invokeResult: ArrayBuffer } + | { type: "InvokeResult"; invokeResult: ArrayBufferView } | { type: "InvokeError"; invokeError: string }; const hasExport = (name: string, exports: Record): boolean => { @@ -59,8 +59,6 @@ export interface State { export class WasmWrapper extends Wrapper { public static requiredExports: readonly string[] = ["_wrap_invoke"]; - - private _schema?: string; private _wasm: ArrayBuffer | undefined = undefined; private _sanitizedEnv: ArrayBuffer | undefined = undefined; @@ -143,7 +141,10 @@ export class WasmWrapper extends Wrapper { invokeResult: {} as InvokeResult, method, sanitizeEnv: {}, - args: args instanceof ArrayBuffer ? args : msgpackEncode(args), + args: + args instanceof ArrayBuffer + ? (args as ArrayBuffer) + : msgpackEncode(args), }; const abort = (message: string) => { @@ -191,12 +192,12 @@ export class WasmWrapper extends Wrapper { if (noDecode) { return { data: invokeResult.invokeResult, - } as InvokeResult; + } as InvokeResult; } try { return { - data: msgpackDecode(invokeResult.invokeResult as ArrayBuffer), + data: msgpackDecode(invokeResult.invokeResult as ArrayBufferView), } as InvokeResult; } catch (err) { throw Error( @@ -217,23 +218,6 @@ export class WasmWrapper extends Wrapper { } } - @Tracer.traceMethod("WasmWrapper: getSchema") - public async getSchema(client: Client): Promise { - if (this._schema) { - return this._schema; - } - - // Either the query or mutation module will work, - // as they share the same schema file - const schema = this._manifest.schema; - this._schema = (await this.getFile( - { path: schema, encoding: "utf8" }, - client - )) as string; - - return this._schema; - } - @Tracer.traceMethod("WasmWrapper: _processInvokeResult") private _processInvokeResult( state: State, @@ -268,7 +252,7 @@ export class WasmWrapper extends Wrapper { ): Promise { if (hasExport("_wrap_load_env", exports)) { if (this._sanitizedEnv !== undefined) { - state.env = this._sanitizedEnv as ArrayBuffer; + state.env = this._sanitizedEnv as ArrayBufferView; } else { const clientEnv = this._getClientEnv(); @@ -276,7 +260,7 @@ export class WasmWrapper extends Wrapper { state.sanitizeEnv.args = msgpackEncode({ env: clientEnv }); await exports._wrap_sanitize_env(state.sanitizeEnv.args.byteLength); - state.env = state.sanitizeEnv.result as ArrayBuffer; + state.env = state.sanitizeEnv.result as ArrayBufferView; this._sanitizedEnv = state.env; } else { state.env = msgpackEncode(clientEnv); @@ -302,7 +286,7 @@ export class WasmWrapper extends Wrapper { return this._wasm as ArrayBuffer; } - const moduleManifest = this._manifest.module; + const moduleManifest = "wrap.wasm"; if (!moduleManifest) { throw Error(`Package manifest does not contain a definition for module`); diff --git a/packages/js/core/src/algorithms/find-plugin-package.ts b/packages/js/core/src/algorithms/find-plugin-package.ts new file mode 100644 index 0000000000..d35c7bd723 --- /dev/null +++ b/packages/js/core/src/algorithms/find-plugin-package.ts @@ -0,0 +1,15 @@ +import { Uri, PluginPackage, PluginRegistration } from "../types"; + +import { Tracer } from "@polywrap/tracing-js"; + +export const findPluginPackage = Tracer.traceFunc( + "core: findPluginPackage", + ( + uri: Uri, + plugins: readonly PluginRegistration[] + ): PluginPackage | undefined => { + const pluginRedirect = plugins.find((x) => Uri.equals(x.uri, uri)); + + return pluginRedirect?.plugin as PluginPackage | undefined; + } +); \ No newline at end of file diff --git a/packages/js/core/src/algorithms/find-plugin-registration.ts b/packages/js/core/src/algorithms/find-plugin-registration.ts deleted file mode 100644 index 00ebf5d02a..0000000000 --- a/packages/js/core/src/algorithms/find-plugin-registration.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Uri, PluginFactory, PluginRegistration } from "../types"; - -import { Tracer } from "@polywrap/tracing-js"; - -export const findPluginRegistration = Tracer.traceFunc( - "core: findPluginRegistration", - ( - uri: Uri, - plugins: readonly PluginRegistration[] - ): PluginFactory | undefined => { - const pluginRedirect = plugins.find((x) => Uri.equals(x.uri, uri)); - return pluginRedirect?.plugin; - } -); diff --git a/packages/js/core/src/algorithms/index.ts b/packages/js/core/src/algorithms/index.ts index a4232e4b34..c95ef00eef 100644 --- a/packages/js/core/src/algorithms/index.ts +++ b/packages/js/core/src/algorithms/index.ts @@ -1,5 +1,5 @@ export * from "./apply-redirects"; export * from "./combine-paths"; -export * from "./find-plugin-registration"; +export * from "./find-plugin-package"; export * from "./get-implementations"; export * from "./parse-query"; diff --git a/packages/js/core/src/msgpack/index.ts b/packages/js/core/src/msgpack/index.ts index 3ae16b6e96..c65620f09d 100644 --- a/packages/js/core/src/msgpack/index.ts +++ b/packages/js/core/src/msgpack/index.ts @@ -33,7 +33,7 @@ extensionCodec.register({ }, }); -export function msgpackEncode(object: unknown): ArrayBufferView { +export function msgpackEncode(object: unknown): ArrayBuffer { const encoder = new Encoder( extensionCodec, undefined, // context @@ -48,9 +48,7 @@ export function msgpackEncode(object: unknown): ArrayBufferView { return encoder.encode(object); } -export function msgpackDecode( - buffer: ArrayBufferView -): unknown { +export function msgpackDecode(buffer: ArrayBuffer): unknown { const decoder = new Decoder(extensionCodec); return decoder.decode(buffer); } diff --git a/packages/js/core/src/types/Client.ts b/packages/js/core/src/types/Client.ts index 85069479d8..bd984c035e 100644 --- a/packages/js/core/src/types/Client.ts +++ b/packages/js/core/src/types/Client.ts @@ -30,8 +30,6 @@ export type GetPluginsOptions = Contextualized; export type GetInterfacesOptions = Contextualized; -export type GetSchemaOptions = Contextualized; - export type GetEnvsOptions = Contextualized; export type GetUriResolversOptions = Contextualized; @@ -68,11 +66,6 @@ export interface Client getUriResolvers(options: GetUriResolversOptions): readonly UriResolver[]; - getSchema( - uri: TUri, - options: GetSchemaOptions - ): Promise; - getFile( uri: TUri, options: GetFileOptions diff --git a/packages/js/core/src/types/Plugin.ts b/packages/js/core/src/types/Plugin.ts index 4e5e35b973..f24f747744 100644 --- a/packages/js/core/src/types/Plugin.ts +++ b/packages/js/core/src/types/Plugin.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import { Client, MaybeAsync, executeMaybeAsyncFunction } from "."; +import { Client, MaybeAsync, executeMaybeAsyncFunction, Uri } from "."; /** * Invocable plugin method. @@ -12,10 +12,7 @@ import { Client, MaybeAsync, executeMaybeAsyncFunction } from "."; export type PluginMethod< TArgs extends Record = Record, TResult = unknown -> = ( - args: TArgs, - client: Client -) => MaybeAsync; +> = (args: TArgs, client: Client) => MaybeAsync; export abstract class PluginModule< TConfig, @@ -90,10 +87,20 @@ export abstract class PluginModule< } } -export type PluginPackage = ( - config: TConfig -) => PluginFactory; +/** The plugin package's manifest */ +export interface PluginPackageManifest { + /** The Wrapper's schema */ + schema: string; -export interface PluginFactory { - instantiate: () => PluginModule; + /** All interface schemas implemented by this plugin. */ + implements: Uri[]; } + +export type PluginPackage = { + factory: () => PluginModule; + manifest: PluginPackageManifest; +}; + +export type PluginFactory = ( + config: TConfig +) => PluginPackage; diff --git a/packages/js/core/src/types/PluginRegistration.ts b/packages/js/core/src/types/PluginRegistration.ts index 68ef852230..31360836d5 100644 --- a/packages/js/core/src/types/PluginRegistration.ts +++ b/packages/js/core/src/types/PluginRegistration.ts @@ -1,10 +1,10 @@ -import { PluginFactory, Uri } from "."; +import { PluginPackage, Uri } from "."; import { Tracer } from "@polywrap/tracing-js"; -export interface PluginRegistration { +export interface PluginRegistration { uri: TUri; - plugin: PluginFactory; + plugin: PluginPackage; } export const sanitizePluginRegistrations = Tracer.traceFunc( diff --git a/packages/js/core/src/types/Wrapper.ts b/packages/js/core/src/types/Wrapper.ts index cb212870f4..42c5ecb64b 100644 --- a/packages/js/core/src/types/Wrapper.ts +++ b/packages/js/core/src/types/Wrapper.ts @@ -25,13 +25,6 @@ export abstract class Wrapper { client: Client ): Promise>; - /** - * Get the Wrapper's schema - * - * @param client The client instance the schema. - */ - public abstract getSchema(client: Client): Promise; - /** * Get a file from the Wrapper package. * Not implemented for plugin wrappers. diff --git a/packages/js/core/src/uri-resolution/resolvers/plugin/PluginResolver.ts b/packages/js/core/src/uri-resolution/resolvers/plugin/PluginResolver.ts index 1dac93ee88..9ed44da207 100644 --- a/packages/js/core/src/uri-resolution/resolvers/plugin/PluginResolver.ts +++ b/packages/js/core/src/uri-resolution/resolvers/plugin/PluginResolver.ts @@ -9,16 +9,16 @@ import { WrapperCache, Client, Env, - PluginFactory, + PluginPackage, Uri, } from "../../../types"; -import { findPluginRegistration } from "../../../algorithms"; +import { findPluginPackage } from "../../../algorithms"; export class PluginResolver implements UriResolver { constructor( private readonly createPluginWrapper: ( uri: Uri, - plugin: PluginFactory, + plugin: PluginPackage, environment: Env | undefined ) => Wrapper ) {} @@ -33,7 +33,7 @@ export class PluginResolver implements UriResolver { cache: WrapperCache, resolutionPath: UriResolutionStack ): Promise { - const plugin = findPluginRegistration(uri, client.getPlugins({})); + const plugin = findPluginPackage(uri, client.getPlugins({})); if (plugin) { const environment = getEnvFromUriOrResolutionStack( diff --git a/packages/js/plugins/uri-resolvers/file-system-resolver/src/index.ts b/packages/js/plugins/uri-resolvers/file-system-resolver/src/index.ts index 2b017699ad..6e424fd23a 100644 --- a/packages/js/plugins/uri-resolvers/file-system-resolver/src/index.ts +++ b/packages/js/plugins/uri-resolvers/file-system-resolver/src/index.ts @@ -26,7 +26,7 @@ export class FileSystemResolverPlugin extends Module { const manifestSearchPatterns = ["polywrap.json"]; - let manifest: string | undefined; + let manifest: Bytes | undefined; for (const manifestSearchPattern of manifestSearchPatterns) { const manifestPath = path.resolve(args.path, manifestSearchPattern); @@ -37,8 +37,8 @@ export class FileSystemResolverPlugin extends Module { if (manifestExistsResult.data) { try { - const manifestResult = await FileSystem_Module.readFileAsString( - { path: manifestPath, encoding: FileSystem_EncodingEnum.UTF8 }, + const manifestResult = await FileSystem_Module.readFile( + { path: manifestPath, encoding: FileSystem_EncodingEnum.BINARY }, _client ); if (manifestResult.error) { @@ -51,12 +51,7 @@ export class FileSystemResolverPlugin extends Module { } } - if (manifest) { - return { uri: null, manifest }; - } else { - // Nothing found - return { uri: null, manifest: null }; - } + return { uri: null, manifest }; } async getFile(args: Args_getFile, _client: Client): Promise { diff --git a/packages/js/plugins/uri-resolvers/ipfs-resolver/src/index.ts b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/index.ts index 9696cffde8..a63a9f57d2 100644 --- a/packages/js/plugins/uri-resolvers/ipfs-resolver/src/index.ts +++ b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/index.ts @@ -36,7 +36,7 @@ export class IpfsResolverPlugin extends Module { const manifestSearchPatterns = ["polywrap.json"]; - let manifest: string | undefined; + let manifest: Buffer | undefined; for (const manifestSearchPattern of manifestSearchPatterns) { try { @@ -51,9 +51,9 @@ export class IpfsResolverPlugin extends Module { ); if (manifestResult.data) { - manifest = Buffer.from(manifestResult.data).toString("utf-8"); + manifest = Buffer.from(manifestResult.data); } else { - throw manifestResult.error; + throw new Error(); } } catch (e) { // TODO: logging diff --git a/packages/js/validation/src/types/WasmPackageValidator.ts b/packages/js/validation/src/types/WasmPackageValidator.ts index 86211ca93c..81daf0b1e7 100644 --- a/packages/js/validation/src/types/WasmPackageValidator.ts +++ b/packages/js/validation/src/types/WasmPackageValidator.ts @@ -12,7 +12,7 @@ import { deserializeBuildManifest, deserializeMetaManifest, PolywrapManifest, -} from "@polywrap/core-js"; +} from "polywrap"; import path from "path"; export class WasmPackageValidator { diff --git a/yarn.lock b/yarn.lock index 14a5550443..6ee0a034f5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -164,12 +164,12 @@ semver "^6.3.0" "@babel/generator@^7.18.6", "@babel/generator@^7.4.0", "@babel/generator@^7.9.0": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.18.6.tgz#9ab2d46d3cbf631f0e80f72e72874a04c3fc12a9" - integrity sha512-AIwwoOS8axIC5MZbhNHRLKi3D+DMpvDf9XUcu3pIVAfOHFT45f4AoDAltRbHIQomCipkCZxrNkfpOEHhJz/VKw== + version "7.18.7" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.18.7.tgz#2aa78da3c05aadfc82dbac16c99552fc802284bd" + integrity sha512-shck+7VLlY72a2w9c3zYWuE1pwOKEiQHV7GTUbSnhyl5eu3i04t30tBY82ZRWrDfo3gkakCFtevExnxbkf2a3A== dependencies: - "@babel/types" "^7.18.6" - "@jridgewell/gen-mapping" "^0.3.0" + "@babel/types" "^7.18.7" + "@jridgewell/gen-mapping" "^0.3.2" jsesc "^2.5.1" "@babel/helper-annotate-as-pure@^7.18.6": @@ -1294,10 +1294,10 @@ debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.18.6", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.7.0", "@babel/types@^7.9.0": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.18.6.tgz#5d781dd10a3f0c9f1f931bd19de5eb26ec31acf0" - integrity sha512-NdBNzPDwed30fZdDQtVR7ZgaO4UKjuaQFH9VArS+HMnurlOY0JWN+4ROlu/iapMFwjRQU4pOG4StZfDmulEwGA== +"@babel/types@^7.0.0", "@babel/types@^7.18.6", "@babel/types@^7.18.7", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.7.0", "@babel/types@^7.9.0": + version "7.18.7" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.18.7.tgz#a4a2c910c15040ea52cdd1ddb1614a65c8041726" + integrity sha512-QG3yxTcTIBoAcQmkCs+wAPYZhu7Dk9rXKacINfNbdJDNERTbLQbHGyVG8q/YGMPeCJRIhSY0+fTc5+xuh6WPSQ== dependencies: "@babel/helper-validator-identifier" "^7.18.6" to-fast-properties "^2.0.0" @@ -2228,7 +2228,7 @@ "@jridgewell/set-array" "^1.0.0" "@jridgewell/sourcemap-codec" "^1.4.10" -"@jridgewell/gen-mapping@^0.3.0": +"@jridgewell/gen-mapping@^0.3.2": version "0.3.2" resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz#c1aedc61e853f2bb9f5dfe6d4442d3b565b253b9" integrity sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A== @@ -3083,10 +3083,10 @@ "@octokit/types" "^6.0.3" universal-user-agent "^6.0.0" -"@octokit/openapi-types@^12.4.0": - version "12.4.0" - resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-12.4.0.tgz#fd8bf5db72bd566c5ba2cb76754512a9ebe66e71" - integrity sha512-Npcb7Pv30b33U04jvcD7l75yLU0mxhuX2Xqrn51YyZ5WTkF04bpbxLaZ6GcaTqu03WZQHoO/Gbfp95NGRueDUA== +"@octokit/openapi-types@^12.5.0": + version "12.5.0" + resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-12.5.0.tgz#e10b256237c877fa6f0a21922151dc03d9c57510" + integrity sha512-VatvE5wtRkJq6hAWGTBZ62WkrdlCiy0G0u27cVOYTfAWVZi7QqTurVcjpsyc5+9hXLPRP5O/DaNEs4TgAp4Mqg== "@octokit/plugin-enterprise-rest@^6.0.1": version "6.0.1" @@ -3094,11 +3094,11 @@ integrity sha512-93uGjlhUD+iNg1iWhUENAtJata6w5nE+V4urXOAlIXdco6xNZtUSfYY8dzp3Udy74aqO/B5UZL80x/YMa5PKRw== "@octokit/plugin-paginate-rest@^2.16.8": - version "2.19.0" - resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.19.0.tgz#b52eae6ecacfa1f5583dc2cc0985cfbed3ca78b0" - integrity sha512-hQ4Qysg2hNmEMuZeJkvyzM4eSZiTifOKqYAMsW8FnxFKowhuwWICSgBQ9Gn9GpUmgKB7qaf1hFvMjYaTAg5jQA== + version "2.20.0" + resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.20.0.tgz#874f9d0cd500bfa0f0901a44de834e3de115d28b" + integrity sha512-LbemX86JEmOCFo9eRwrtdP5Isq69TefLS1J7w0DO4PMhfpvRfqYVzq9c0eH1xgcx2PSA7/VJHu9SwvNhD9FjVg== dependencies: - "@octokit/types" "^6.36.0" + "@octokit/types" "^6.38.1" "@octokit/plugin-request-log@^1.0.4": version "1.0.4" @@ -3106,11 +3106,11 @@ integrity sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA== "@octokit/plugin-rest-endpoint-methods@^5.12.0": - version "5.15.0" - resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.15.0.tgz#6c8251b55c33315a6e53e5b55654f72023ed5049" - integrity sha512-Gsw9+Xm56jVhfbJoy4pt6eOOyf8/3K6CAnx1Sl7U2GhZWcg8MR6YgXWnpfdF69S2ViMXLA7nfvTDAsZpFlkLRw== + version "5.16.0" + resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.16.0.tgz#e0a774d78bb17fb9b6b9ae48d5517940f7f61e90" + integrity sha512-mvdwq+LvhR2GRDY82FgSZ52xX6wkOCpjiI3amiKbzKHd9nyKeFdXLsIQ3Go12tWRtvo+HwqoypLHDjRrgMFDQA== dependencies: - "@octokit/types" "^6.36.0" + "@octokit/types" "^6.38.0" deprecation "^2.3.1" "@octokit/request-error@^2.0.5", "@octokit/request-error@^2.1.0": @@ -3144,12 +3144,12 @@ "@octokit/plugin-request-log" "^1.0.4" "@octokit/plugin-rest-endpoint-methods" "^5.12.0" -"@octokit/types@^6.0.3", "@octokit/types@^6.16.1", "@octokit/types@^6.36.0": - version "6.37.1" - resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.37.1.tgz#600a9c9643f696ba68f229c8d71abbc1040ad6a6" - integrity sha512-Q1hXSP2YumHkDdD+V4wFKr7vJ9+8tjocixrTSb75JzJ4GpjSyu5B4kpgrXxO6GOs4nOmVyRwRgS4/RO/Lf9oEA== +"@octokit/types@^6.0.3", "@octokit/types@^6.16.1", "@octokit/types@^6.38.0", "@octokit/types@^6.38.1": + version "6.38.1" + resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.38.1.tgz#03d70745564954dfdae32df23d5f1578f958474f" + integrity sha512-kWMohLCIvnwApRmxRFDOqve7puiNNdtVfgwdDOm6QyJNorWOgKv2/AodCcGqx63o28kF7Dr4/nJCatrwwqhULg== dependencies: - "@octokit/openapi-types" "^12.4.0" + "@octokit/openapi-types" "^12.5.0" "@opentelemetry/api-metrics@0.20.0": version "0.20.0" @@ -5330,14 +5330,14 @@ browserslist@4.10.0: pkg-up "^3.1.0" browserslist@^4.0.0, browserslist@^4.12.0, browserslist@^4.20.2, browserslist@^4.21.0, browserslist@^4.6.2, browserslist@^4.6.4, browserslist@^4.9.1: - version "4.21.0" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.0.tgz#7ab19572361a140ecd1e023e2c1ed95edda0cefe" - integrity sha512-UQxE0DIhRB5z/zDz9iA03BOfxaN2+GQdBYH/2WrSIWEUrnpzTPJbhqt+umq6r3acaPRTW1FNTkrcp0PXgtFkvA== + version "4.21.1" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.1.tgz#c9b9b0a54c7607e8dc3e01a0d311727188011a00" + integrity sha512-Nq8MFCSrnJXSc88yliwlzQe3qNe3VntIjhsArW9IJOEPSHNx23FalwApUVbzAWABLhYJJ7y8AynWI/XM8OdfjQ== dependencies: - caniuse-lite "^1.0.30001358" - electron-to-chromium "^1.4.164" + caniuse-lite "^1.0.30001359" + electron-to-chromium "^1.4.172" node-releases "^2.0.5" - update-browserslist-db "^1.0.0" + update-browserslist-db "^1.0.4" bs-logger@0.x: version "0.2.6" @@ -5606,10 +5606,10 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" 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.30001358: - version "1.0.30001359" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001359.tgz#a1c1cbe1c2da9e689638813618b4219acbd4925e" - integrity sha512-Xln/BAsPzEuiVLgJ2/45IaqD9jShtk3Y33anKb4+yLwQzws3+v6odKfpgES/cDEaZMLzSChpIGdbOYtH9MyuHw== +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001035, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001359: + version "1.0.30001361" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001361.tgz#ba2adb2527566fb96f3ac7c67698ae7fc495a28d" + integrity sha512-ybhCrjNtkFji1/Wto6SSJKkWk6kZgVQsDq5QI83SafsF6FXv2JB4df9eEdH6g8sdGgqTXrFLjAxqBGgYoU3azQ== capture-exit@^2.0.0: version "2.0.0" @@ -7286,10 +7286,10 @@ electron-fetch@^1.7.2: dependencies: encoding "^0.1.13" -electron-to-chromium@^1.3.378, electron-to-chromium@^1.4.164: - version "1.4.172" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.172.tgz#87335795a3dc19e7b6dd5af291038477d81dc6b1" - integrity sha512-yDoFfTJnqBAB6hSiPvzmsBJSrjOXJtHSJoqJdI/zSIh7DYupYnIOHt/bbPw/WE31BJjNTybDdNAs21gCMnTh0Q== +electron-to-chromium@^1.3.378, electron-to-chromium@^1.4.172: + version "1.4.173" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.173.tgz#48f128dda49cd7f6317e65ac0085bd3a6b9b6e3b" + integrity sha512-Qo3LnVW6JRNhD32viSdPebxKI7K+3WeBDjU1+Q2yZS83zAh8C2LyPpzTimlciv6U74KpY9n/0ESAhUByRke0jw== elliptic@6.5.4, elliptic@^6.5.3: version "6.5.4" @@ -12514,9 +12514,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.3.3" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.3.3.tgz#fd1f0e6c06449c10dadda72618b59c00f3d6378d" - integrity sha512-N0BOsdFAlNRfmwMhjAsLVWOk7Ljmeb39iqFlsV1At+jqRhSUP9yeof8FyJu4imaJiSUp8vQebWD/guZwGQC8iA== + version "3.3.4" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.3.4.tgz#ca99f95dd77c43c7a76bf51e6d200025eee0ffae" + integrity sha512-I9WPbWHCGu8W+6k1ZiGpPu0GkoKBeorkfKNuAFBNS1HNFJvke82sxvI5bzcCNpWPorkOO5QQ+zomzzwRxejXiw== dependencies: yallist "^4.0.0" @@ -17632,7 +17632,7 @@ upath@^2.0.1: resolved "https://registry.yarnpkg.com/upath/-/upath-2.0.1.tgz#50c73dea68d6f6b990f51d279ce6081665d61a8b" integrity sha512-1uEe95xksV1O0CYKXo8vQvN1JEbtJp7lb7C5U9HMsIp6IVwntkH/oNUzyVNQSd4S1sYk2FpSSW44FqMc8qee5w== -update-browserslist-db@^1.0.0: +update-browserslist-db@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.4.tgz#dbfc5a789caa26b1db8990796c2c8ebbce304824" integrity sha512-jnmO2BEGUjsMOe/Fg9u0oczOe/ppIDZPebzccl1yDWGLFP16Pa1/RM5wEoKYPG2zstNcDuAStejyxsOuKINdGA== From d856fb672f53c768c063ff02edb392d26a34ac0c Mon Sep 17 00:00:00 2001 From: cbrzn Date: Wed, 29 Jun 2022 22:46:46 +0200 Subject: [PATCH 12/46] chore: client building and cli almost there --- .../scripts/generatePolywrapManifestTypes.ts | 56 +++++++++---------- .../scripts/templates/validate-ts.mustache | 2 +- packages/cli/src/lib/SchemaComposer.ts | 2 +- .../defaults/build-images/wasm/rust/index.ts | 2 +- packages/cli/src/lib/helpers/metadata.ts | 2 +- packages/cli/src/lib/infra/Infra.ts | 2 +- packages/cli/src/lib/option-parsers/app.ts | 2 +- packages/cli/src/lib/option-parsers/plugin.ts | 2 +- packages/cli/src/lib/option-parsers/wasm.ts | 2 +- .../formats/polywrap.app/validate.ts | 4 +- .../formats/polywrap.build/validate.ts | 6 +- .../formats/polywrap.deploy/validate.ts | 2 +- .../formats/polywrap.infra/validate.ts | 4 +- .../formats/polywrap.meta/validate.ts | 6 +- .../formats/polywrap.plugin/validate.ts | 6 +- .../formats/polywrap/validate.ts | 18 +++--- packages/cli/src/lib/project/index.ts | 1 + packages/js/client/src/PolywrapClient.ts | 18 +++++- .../js/client/src/default-client-config.ts | 4 +- .../js/client/src/plugin/PluginWrapper.ts | 8 +++ packages/js/client/src/wasm/WasmWrapper.ts | 46 +++++++++++++-- .../scripts/templates/deserialize-ts.mustache | 7 +-- packages/js/core/src/__tests__/Plugin.spec.ts | 10 +--- .../js/core/src/__tests__/resolveUri.spec.ts | 12 ++-- .../js/core/src/interfaces/uri-resolver.ts | 4 +- packages/js/core/src/types/Client.ts | 9 +++ packages/js/core/src/types/Wrapper.ts | 20 ++++--- .../extendable/UriResolverWrapper.ts | 2 +- .../src/wrap-manifests/formats/deserialize.ts | 7 +-- 29 files changed, 166 insertions(+), 100 deletions(-) diff --git a/packages/cli/scripts/generatePolywrapManifestTypes.ts b/packages/cli/scripts/generatePolywrapManifestTypes.ts index 2be81c452b..4aa1dedc91 100644 --- a/packages/cli/scripts/generatePolywrapManifestTypes.ts +++ b/packages/cli/scripts/generatePolywrapManifestTypes.ts @@ -1,4 +1,4 @@ -import path from "path" +import path from "path"; import fs, { Dirent } from "fs"; import * as os from "@polywrap/os-js"; import Mustache from "mustache"; @@ -12,15 +12,18 @@ async function generateFormatTypes() { ); // Get all format types (wasm, build, infra, app, plugin, etc) - const formatTypes = fs.readdirSync( - formatsDir, { withFileTypes: true } - ).filter((dirent: Dirent) => dirent.isDirectory); + const formatTypes = fs + .readdirSync(formatsDir, { withFileTypes: true }) + .filter((dirent: Dirent) => dirent.isDirectory); // For each format type for (let i = 0; i < formatTypes.length; ++i) { const formatTypeName = formatTypes[i].name; const formatTypeDir = path.join(formatsDir, formatTypeName); - const formatOutputDir = path.join(__dirname, `/../src/lib/polywrap-manifests/formats/${formatTypeName}`); + const formatOutputDir = path.join( + __dirname, + `/../src/lib/polywrap-manifests/formats/${formatTypeName}` + ); const formatModules = []; // Get all JSON schemas for this format type (v1, v2, etc) @@ -41,20 +44,14 @@ async function generateFormatTypes() { // Insert the __type property for introspection formatSchema.properties["__type"] = { type: "string", - const: formatSchema.id + const: formatSchema.id, }; - formatSchema.required = [ - ...formatSchema.required, - "__type" - ]; + formatSchema.required = [...formatSchema.required, "__type"]; formatSchemas.push(formatSchema); // Convert it to a TypeScript interface - const tsFile = await JsonSchema.compile( - formatSchema, - formatSchema.id - ); + const tsFile = await JsonSchema.compile(formatSchema, formatSchema.id); // Emit the result const tsOutputPath = path.join(formatOutputDir, `${formatVersion}.ts`); @@ -67,10 +64,13 @@ async function generateFormatTypes() { // Add metadata for the root index.ts file to use formatModules.push({ interface: formatSchema.id, - version: formatVersion + version: formatVersion, }); } catch (error) { - console.error(`Error generating the Manifest file ${formatSchemaPath}: `, error); + console.error( + `Error generating the Manifest file ${formatSchemaPath}: `, + error + ); throw error; } } @@ -88,7 +88,7 @@ async function generateFormatTypes() { const tsOutputPath = path.join(formatOutputDir, `${name}.ts`); fs.mkdirSync(path.dirname(tsOutputPath), { recursive: true }); os.writeFileSync(tsOutputPath, tsSrc); - } + }; const lastItem = (arr: Array) => arr[arr.length - 1]; const versionToTs = (version: string) => @@ -98,15 +98,15 @@ async function generateFormatTypes() { return { type: module.interface, version: module.version, - tsVersion: versionToTs(module.version) - } + tsVersion: versionToTs(module.version), + }; }); const latest = lastItem(formats); // Generate an index.ts file that exports root types that aggregate all versions const indexContext = { formats, - latest + latest, }; renderTemplate("index", indexContext); @@ -114,7 +114,7 @@ async function generateFormatTypes() { // Generate a migrate.ts file that exports a migration function from all version to the latest version const migrateContext = { prevFormats: [...formats], - latest: latest + latest: latest, }; migrateContext.prevFormats.pop(); @@ -122,7 +122,7 @@ async function generateFormatTypes() { // Generate a deserialize.ts file that exports a deserialization function for the latest format version const deserializeContext = { - type: migrateContext.latest.type + type: migrateContext.latest.type, }; renderTemplate("deserialize", deserializeContext); @@ -133,14 +133,14 @@ async function generateFormatTypes() { type: module.interface, version: module.version, tsVersion: versionToTs(module.version), - dir: formatTypeName + dir: formatTypeName, }; }); const validateContext = { formats: validateFormats, latest: lastItem(validateFormats), - validators: [] as string[] + validators: [] as string[], }; // Extract all validators @@ -162,7 +162,7 @@ async function generateFormatTypes() { for (let j = 0; j < keys.length; ++j) { getValidator(obj[keys[j]] as Record); } - } + }; getValidator(formatSchema); } @@ -171,13 +171,13 @@ async function generateFormatTypes() { } return Promise.resolve(); -}; +} generateFormatTypes() - .then(text => { + .then(() => { process.exit(); }) - .catch(err => { + .catch((err) => { console.error(err); process.abort(); }); diff --git a/packages/cli/scripts/templates/validate-ts.mustache b/packages/cli/scripts/templates/validate-ts.mustache index 87ca05b555..635e024f27 100644 --- a/packages/cli/scripts/templates/validate-ts.mustache +++ b/packages/cli/scripts/templates/validate-ts.mustache @@ -10,7 +10,7 @@ import { } from "."; {{#validators.length}}import * as Validators from "../../validators";{{/validators.length}} {{#formats}} -import schema_{{tsVersion}} from "@polywrap/manifest-schemas/polywrap/{{dir}}/{{version}}.json"; +import schema_{{tsVersion}} from "@polywrap/polywrap-manifest-schemas/formats/{{dir}}/{{version}}.json"; {{/formats}} import { Tracer } from "@polywrap/tracing-js" diff --git a/packages/cli/src/lib/SchemaComposer.ts b/packages/cli/src/lib/SchemaComposer.ts index 7f3a0ced49..bac79303d6 100644 --- a/packages/cli/src/lib/SchemaComposer.ts +++ b/packages/cli/src/lib/SchemaComposer.ts @@ -100,7 +100,7 @@ export class SchemaComposer { } try { - return await this._client.getSchema(new Uri(uri)); + return await this._client.getManifest(new Uri(uri), { abi: true }); } catch (e) { gluegun.print.error(e); throw e; diff --git a/packages/cli/src/lib/defaults/build-images/wasm/rust/index.ts b/packages/cli/src/lib/defaults/build-images/wasm/rust/index.ts index fab0ac6679..3c16c259a1 100644 --- a/packages/cli/src/lib/defaults/build-images/wasm/rust/index.ts +++ b/packages/cli/src/lib/defaults/build-images/wasm/rust/index.ts @@ -1,7 +1,7 @@ import { CompilerOverrides } from "../../../../Compiler"; import { intlMsg } from "../../../../intl"; -import { PolywrapManifest } from "@polywrap/core-js"; +import { PolywrapManifest } from "../../../../polywrap-manifests"; export function getCompilerOverrides(): CompilerOverrides { return { diff --git a/packages/cli/src/lib/helpers/metadata.ts b/packages/cli/src/lib/helpers/metadata.ts index 3771c52f59..934f2d244e 100644 --- a/packages/cli/src/lib/helpers/metadata.ts +++ b/packages/cli/src/lib/helpers/metadata.ts @@ -2,7 +2,7 @@ import { withSpinner } from "./"; import { displayPath, intlMsg } from "../"; import { normalizePath } from "@polywrap/os-js"; -import { MetaManifest } from "polywrap"; +import { MetaManifest } from "../polywrap-manifests"; import { Ora } from "ora"; import fs from "fs"; import path from "path"; diff --git a/packages/cli/src/lib/infra/Infra.ts b/packages/cli/src/lib/infra/Infra.ts index d3bf286d2d..19260be911 100644 --- a/packages/cli/src/lib/infra/Infra.ts +++ b/packages/cli/src/lib/infra/Infra.ts @@ -6,7 +6,7 @@ import { CacheDirectory, } from "../"; -import { InfraManifest } from "@polywrap/core-js"; +import { InfraManifest } from "../polywrap-manifests"; import path from "path"; import fs, { lstatSync, readdirSync } from "fs"; import YAML from "js-yaml"; diff --git a/packages/cli/src/lib/option-parsers/app.ts b/packages/cli/src/lib/option-parsers/app.ts index d783f93ec0..aa72f15272 100644 --- a/packages/cli/src/lib/option-parsers/app.ts +++ b/packages/cli/src/lib/option-parsers/app.ts @@ -1,5 +1,5 @@ import { intlMsg } from "../intl"; -import { defaultAppManifest } from "../manifest"; +import { defaultAppManifest } from "../"; import { resolvePathIfExists } from "../system"; import path from "path"; diff --git a/packages/cli/src/lib/option-parsers/plugin.ts b/packages/cli/src/lib/option-parsers/plugin.ts index 7fc835d801..8d3d9376ce 100644 --- a/packages/cli/src/lib/option-parsers/plugin.ts +++ b/packages/cli/src/lib/option-parsers/plugin.ts @@ -1,5 +1,5 @@ import { intlMsg } from "../intl"; -import { defaultPluginManifest } from "../manifest"; +import { defaultPluginManifest } from "../"; import { resolvePathIfExists } from "../system"; import path from "path"; diff --git a/packages/cli/src/lib/option-parsers/wasm.ts b/packages/cli/src/lib/option-parsers/wasm.ts index 7634936a0e..8cfd5f3019 100644 --- a/packages/cli/src/lib/option-parsers/wasm.ts +++ b/packages/cli/src/lib/option-parsers/wasm.ts @@ -1,5 +1,5 @@ import { intlMsg } from "../intl"; -import { defaultPolywrapManifest } from "../manifest"; +import { defaultPolywrapManifest } from "../"; import { resolvePathIfExists } from "../system"; export function parseWasmManifestFileOption( diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/validate.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/validate.ts index 7a97f6a7ce..77a61dc5cf 100644 --- a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/validate.ts +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/validate.ts @@ -9,8 +9,8 @@ import { AppManifestFormats } from "."; import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/manifest-schemas/polywrap/polywrap.app/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/manifest-schemas/polywrap/polywrap.app/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.app/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.app/0.0.1-prealpha.2.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/validate.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/validate.ts index e1cb9f0ab1..1c7f950b8e 100644 --- a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/validate.ts +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/validate.ts @@ -9,9 +9,9 @@ import { BuildManifestFormats } from "."; import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/manifest-schemas/polywrap/polywrap.build/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/manifest-schemas/polywrap/polywrap.build/0.0.1-prealpha.2.json"; -import schema_0_0_1_prealpha_3 from "@polywrap/manifest-schemas/polywrap/polywrap.build/0.0.1-prealpha.3.json"; +import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.build/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.build/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_3 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.build/0.0.1-prealpha.3.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/validate.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/validate.ts index 6da8234512..88917c33e6 100644 --- a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/validate.ts +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/validate.ts @@ -9,7 +9,7 @@ import { DeployManifestFormats } from "."; import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/manifest-schemas/polywrap/polywrap.deploy/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.deploy/0.0.1-prealpha.1.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/validate.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/validate.ts index 4fb410117b..2bead1d7e0 100644 --- a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/validate.ts +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/validate.ts @@ -9,8 +9,8 @@ import { InfraManifestFormats } from "."; -import schema_0_0_1_prealpha_1 from "@polywrap/manifest-schemas/polywrap/polywrap.infra/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/manifest-schemas/polywrap/polywrap.infra/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.infra/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.infra/0.0.1-prealpha.2.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/validate.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/validate.ts index 37b2e3e5fc..fc146009e5 100644 --- a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/validate.ts +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/validate.ts @@ -9,9 +9,9 @@ import { MetaManifestFormats } from "."; import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/manifest-schemas/polywrap/polywrap.meta/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/manifest-schemas/polywrap/polywrap.meta/0.0.1-prealpha.2.json"; -import schema_0_0_1_prealpha_3 from "@polywrap/manifest-schemas/polywrap/polywrap.meta/0.0.1-prealpha.3.json"; +import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_3 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.3.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/validate.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/validate.ts index cc287a86c2..f489afae30 100644 --- a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/validate.ts +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/validate.ts @@ -9,9 +9,9 @@ import { PluginManifestFormats } from "."; import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/manifest-schemas/polywrap/polywrap.plugin/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/manifest-schemas/polywrap/polywrap.plugin/0.0.1-prealpha.2.json"; -import schema_0_0_1_prealpha_3 from "@polywrap/manifest-schemas/polywrap/polywrap.plugin/0.0.1-prealpha.3.json"; +import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_3 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.3.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/validate.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/validate.ts index 6c4576930b..554464f79c 100644 --- a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/validate.ts +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/validate.ts @@ -9,15 +9,15 @@ import { PolywrapManifestFormats } from "."; import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.2.json"; -import schema_0_0_1_prealpha_3 from "@polywrap/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.3.json"; -import schema_0_0_1_prealpha_4 from "@polywrap/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.4.json"; -import schema_0_0_1_prealpha_5 from "@polywrap/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.5.json"; -import schema_0_0_1_prealpha_6 from "@polywrap/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.6.json"; -import schema_0_0_1_prealpha_7 from "@polywrap/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.7.json"; -import schema_0_0_1_prealpha_8 from "@polywrap/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.8.json"; -import schema_0_0_1_prealpha_9 from "@polywrap/manifest-schemas/polywrap/polywrap/0.0.1-prealpha.9.json"; +import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_3 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.3.json"; +import schema_0_0_1_prealpha_4 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.4.json"; +import schema_0_0_1_prealpha_5 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.5.json"; +import schema_0_0_1_prealpha_6 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.6.json"; +import schema_0_0_1_prealpha_7 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.7.json"; +import schema_0_0_1_prealpha_8 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.8.json"; +import schema_0_0_1_prealpha_9 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.9.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/cli/src/lib/project/index.ts b/packages/cli/src/lib/project/index.ts index 37fca8f6ca..892a39206e 100644 --- a/packages/cli/src/lib/project/index.ts +++ b/packages/cli/src/lib/project/index.ts @@ -3,3 +3,4 @@ export * from "./PolywrapProject"; export * from "./PluginProject"; export * from "./AppProject"; export * from "./templates"; +export * from "./manifests"; diff --git a/packages/js/client/src/PolywrapClient.ts b/packages/js/client/src/PolywrapClient.ts index c0958a45b4..35609553df 100644 --- a/packages/js/client/src/PolywrapClient.ts +++ b/packages/js/client/src/PolywrapClient.ts @@ -9,11 +9,11 @@ import { Env, GetEnvsOptions, GetFileOptions, + GetManifestOptions, GetImplementationsOptions, GetInterfacesOptions, GetPluginsOptions, GetRedirectsOptions, - GetSchemaOptions, InterfaceImplementations, InvokeOptions, InvokeResult, @@ -167,6 +167,16 @@ export class PolywrapClient implements Client { ); } + @Tracer.traceMethod("PolywrapClient: getManifest") + public async getManifest( + uri: TUri, + options: GetManifestOptions + ): Promise { + const wrapper = await this._loadWrapper(this._toUri(uri), options); + const client = contextualizeClient(this, options.contextId); + return await wrapper.getManifest(options, client); + } + @Tracer.traceMethod("PolywrapClient: getFile") public async getFile( uri: TUri, @@ -825,6 +835,12 @@ const contextualizeClient = ( ) => { return client.getFile(uri, options); }, + getManifest: ( + uri: TUri, + options: GetManifestOptions + ) => { + return client.getManifest(uri, options); + }, getImplementations: ( uri: TUri, options: GetImplementationsOptions = {} diff --git a/packages/js/client/src/default-client-config.ts b/packages/js/client/src/default-client-config.ts index 843b0b4941..87d63c42cc 100644 --- a/packages/js/client/src/default-client-config.ts +++ b/packages/js/client/src/default-client-config.ts @@ -10,8 +10,8 @@ import { CacheResolver, PluginResolver, RedirectsResolver, + WrapManifest, } from "@polywrap/core-js"; -import { PolywrapManifest } from "polywrap"; import { ipfsPlugin } from "@polywrap/ipfs-plugin-js"; import { ipfsResolverPlugin } from "@polywrap/ipfs-resolver-plugin-js"; import { ethereumPlugin } from "@polywrap/ethereum-plugin-js"; @@ -121,7 +121,7 @@ export const getDefaultClientConfig = Tracer.traceFunc( new ExtendableUriResolver( ( uri: Uri, - manifest: PolywrapManifest, + manifest: WrapManifest, uriResolver: string, environment: Env | undefined ) => { diff --git a/packages/js/client/src/plugin/PluginWrapper.ts b/packages/js/client/src/plugin/PluginWrapper.ts index a19b7cdc88..53a9bd27b8 100644 --- a/packages/js/client/src/plugin/PluginWrapper.ts +++ b/packages/js/client/src/plugin/PluginWrapper.ts @@ -10,6 +10,7 @@ import { Env, msgpackEncode, msgpackDecode, + GetManifestOptions, } from "@polywrap/core-js"; import { Tracer } from "@polywrap/tracing-js"; @@ -41,6 +42,13 @@ export class PluginWrapper extends Wrapper { throw Error("client.getFile(...) is not implemented for Plugins."); } + public async getManifest( + _options: GetManifestOptions, + _client: Client + ): Promise { + throw Error("client.getManifest(...) is not implemented for Plugins."); + } + @Tracer.traceMethod("PluginWrapper: invoke") public async invoke( options: InvokeOptions, diff --git a/packages/js/client/src/wasm/WasmWrapper.ts b/packages/js/client/src/wasm/WasmWrapper.ts index 71d666eb8a..b0fc70547c 100644 --- a/packages/js/client/src/wasm/WasmWrapper.ts +++ b/packages/js/client/src/wasm/WasmWrapper.ts @@ -15,12 +15,13 @@ import { GetFileOptions, msgpackEncode, msgpackDecode, + GetManifestOptions, } from "@polywrap/core-js"; import { Tracer } from "@polywrap/tracing-js"; import { AsyncWasmInstance } from "@polywrap/asyncify-js"; type InvokeResultOrError = - | { type: "InvokeResult"; invokeResult: ArrayBufferView } + | { type: "InvokeResult"; invokeResult: ArrayBuffer } | { type: "InvokeError"; invokeError: string }; const hasExport = (name: string, exports: Record): boolean => { @@ -60,6 +61,7 @@ export interface State { export class WasmWrapper extends Wrapper { public static requiredExports: readonly string[] = ["_wrap_invoke"]; private _wasm: ArrayBuffer | undefined = undefined; + private _info: string | undefined = undefined; private _sanitizedEnv: ArrayBuffer | undefined = undefined; constructor( @@ -86,7 +88,7 @@ export class WasmWrapper extends Wrapper { client: Client ): Promise { const { path, encoding } = options; - const { data, error } = await UriResolverInterface.Query.getFile( + const { data, error } = await UriResolverInterface.Method.getFile( ( options: InvokeOptions ): Promise> => client.invoke(options), @@ -120,6 +122,38 @@ export class WasmWrapper extends Wrapper { return data; } + @Tracer.traceMethod("WasmWrapper: getManifest") + public async getManifest( + options: GetManifestOptions, + client: Client + ): Promise { + if (this._info !== undefined) { + return this._info; + } + + const moduleManifest = "wrap.info"; + + if (!moduleManifest) { + throw Error(`Package manifest does not contain information`); + } + + const data = (await this.getFile( + { path: moduleManifest, encoding: "utf-8" }, + client + )) as string; + + if (options.abi) { + try { + const { abi } = JSON.parse(data); + return JSON.stringify(abi); + } catch (e) { + console.log("Package information is not well formatted"); + } + } + + return data; + } + @Tracer.traceMethod("WasmWrapper: invoke") public async invoke( options: InvokeOptions, @@ -192,12 +226,12 @@ export class WasmWrapper extends Wrapper { if (noDecode) { return { data: invokeResult.invokeResult, - } as InvokeResult; + } as InvokeResult; } try { return { - data: msgpackDecode(invokeResult.invokeResult as ArrayBufferView), + data: msgpackDecode(invokeResult.invokeResult as ArrayBuffer), } as InvokeResult; } catch (err) { throw Error( @@ -252,7 +286,7 @@ export class WasmWrapper extends Wrapper { ): Promise { if (hasExport("_wrap_load_env", exports)) { if (this._sanitizedEnv !== undefined) { - state.env = this._sanitizedEnv as ArrayBufferView; + state.env = this._sanitizedEnv as ArrayBuffer; } else { const clientEnv = this._getClientEnv(); @@ -260,7 +294,7 @@ export class WasmWrapper extends Wrapper { state.sanitizeEnv.args = msgpackEncode({ env: clientEnv }); await exports._wrap_sanitize_env(state.sanitizeEnv.args.byteLength); - state.env = state.sanitizeEnv.result as ArrayBufferView; + state.env = state.sanitizeEnv.result as ArrayBuffer; this._sanitizedEnv = state.env; } else { state.env = msgpackEncode(clientEnv); diff --git a/packages/js/core/scripts/templates/deserialize-ts.mustache b/packages/js/core/scripts/templates/deserialize-ts.mustache index 206b4f3e32..41a1c92d37 100644 --- a/packages/js/core/scripts/templates/deserialize-ts.mustache +++ b/packages/js/core/scripts/templates/deserialize-ts.mustache @@ -20,15 +20,12 @@ import { Tracer } from "@polywrap/tracing-js"; export const deserializeWrapManifest = Tracer.traceFunc( "core: deserializeWrapManifest", - (manifest: ArrayBufferView, options?: DeserializeManifestOptions): WrapManifest => { + (manifest: ArrayBuffer, options?: DeserializeManifestOptions): WrapManifest => { let anyWrapManifest: AnyWrapManifest | undefined; try { anyWrapManifest = msgpackDecode(manifest) as AnyWrapManifest; } catch (e) { - throw Error( - `Unable to parse WrapManifest: ` + - `[${new Uint8Array(manifest.buffer, manifest.byteOffset, manifest.byteLength).toString()}]` - ); + throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); } if (!options || !options.noValidate) { diff --git a/packages/js/core/src/__tests__/Plugin.spec.ts b/packages/js/core/src/__tests__/Plugin.spec.ts index 5800986988..119767b3f6 100644 --- a/packages/js/core/src/__tests__/Plugin.spec.ts +++ b/packages/js/core/src/__tests__/Plugin.spec.ts @@ -1,15 +1,12 @@ import { Client, - PluginModule, + PluginModule } from ".."; class TestPluginModule extends PluginModule<{}> { - testQuery(args: { value: number }, _client: Client): number { + testMethod(args: { value: number }, _client: Client): number { return 5 + args.value; } - testMutation(_args: unknown, _client: Client): Promise { - return Promise.resolve(true); - } } describe("Plugin", () => { @@ -17,9 +14,8 @@ describe("Plugin", () => { it("sanity", async () => { expect(plugin).toBeTruthy(); - expect(plugin.getMethod("testMutation")).toBeTruthy(); expect ( - await plugin._wrap_invoke("testQuery", { value: 5 }, {} as Client) + await plugin._wrap_invoke("testMethod", { value: 5 }, {} as Client) ).toBe(10); }); }); diff --git a/packages/js/core/src/__tests__/resolveUri.spec.ts b/packages/js/core/src/__tests__/resolveUri.spec.ts index 04481ab529..bdd31d2367 100644 --- a/packages/js/core/src/__tests__/resolveUri.spec.ts +++ b/packages/js/core/src/__tests__/resolveUri.spec.ts @@ -24,7 +24,7 @@ import { PluginRegistration, SubscribeOptions, Subscription, - msgpackEncode + msgpackEncode, } from ".."; describe("resolveUri", () => { @@ -102,7 +102,6 @@ describe("resolveUri", () => { uri, plugin, } as InvokeResult), - getSchema: (_client: Client): Promise => Promise.resolve(""), getFile: (options: GetFileOptions, client: Client) => Promise.resolve(""), }; }; @@ -119,7 +118,6 @@ describe("resolveUri", () => { manifest, uriResolver, } as InvokeResult), - getSchema: (_client: Client): Promise => Promise.resolve(""), getFile: (options: GetFileOptions, client: Client) => Promise.resolve(""), }; }; @@ -174,7 +172,11 @@ describe("resolveUri", () => { { uri: new Uri("ens/my-plugin"), plugin: { - instantiate: () => ({} as PluginModule<{}>), + factory: () => ({} as Plugin), + manifest: { + schema: "", + implements: [coreInterfaceUris.uriResolver], + }, }, }, ]; @@ -219,7 +221,7 @@ describe("resolveUri", () => { const wrapper = new Uri("wrap://ens/ens"); const file = new Uri("wrap/some-file"); const path = "wrap/some-path"; - const query = UriResolverInterface.Query; + const query = UriResolverInterface.Method; const uri = new Uri("wrap/some-uri"); expect(query.tryResolveUri(client(wrappers).invoke, wrapper, uri)).toBeDefined(); diff --git a/packages/js/core/src/interfaces/uri-resolver.ts b/packages/js/core/src/interfaces/uri-resolver.ts index b261195446..6641d16df9 100644 --- a/packages/js/core/src/interfaces/uri-resolver.ts +++ b/packages/js/core/src/interfaces/uri-resolver.ts @@ -5,11 +5,11 @@ import { Tracer } from "@polywrap/tracing-js"; export interface MaybeUriOrManifest { uri?: string; - manifest?: ArrayBufferView; + manifest?: ArrayBuffer; } // eslint-disable-next-line @typescript-eslint/naming-convention -export const Query = { +export const Method = { tryResolveUri: Tracer.traceFunc( "core: uri-resolver: tryResolveUri", async ( diff --git a/packages/js/core/src/types/Client.ts b/packages/js/core/src/types/Client.ts index bd984c035e..318cfcccec 100644 --- a/packages/js/core/src/types/Client.ts +++ b/packages/js/core/src/types/Client.ts @@ -34,6 +34,10 @@ export type GetEnvsOptions = Contextualized; export type GetUriResolversOptions = Contextualized; +export type GetManifestOptions = { + abi?: boolean; +} & Contextualized; + export interface GetFileOptions extends Contextualized { path: string; encoding?: "utf-8" | string; @@ -75,4 +79,9 @@ export interface Client uri: TUri, options: GetImplementationsOptions ): TUri[]; + + getManifest( + uri: TUri, + options: GetManifestOptions + ): Promise; } diff --git a/packages/js/core/src/types/Wrapper.ts b/packages/js/core/src/types/Wrapper.ts index 42c5ecb64b..7ae579b71d 100644 --- a/packages/js/core/src/types/Wrapper.ts +++ b/packages/js/core/src/types/Wrapper.ts @@ -1,10 +1,4 @@ -import { - Uri, - Client, - GetFileOptions, - InvokeOptions, - InvokeResult, -} from "."; +import {Uri, Client, GetFileOptions, InvokeOptions, InvokeResult, GetManifestOptions} from "."; /** * The Wrapper definition, which can be used to spawn @@ -36,6 +30,18 @@ export abstract class Wrapper { options: GetFileOptions, client: Client ): Promise; + + /** + * Get a manifest from the Wrapper package. + * Not implemented for plugin wrappers. + * + * @param options Configuration options for manifest retrieval + * @param client The client instance requesting the manifest. + */ + public abstract getManifest( + options: GetManifestOptions, + client: Client + ): Promise; } /** Cache of Wrapper definitions, mapping the Wrapper's URI to its definition */ diff --git a/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts b/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts index 3a4e48f162..687819ebc1 100644 --- a/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts +++ b/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts @@ -85,7 +85,7 @@ const tryResolveUriWithImplementation = async ( implementationUri: Uri, invoke: InvokeHandler["invoke"] ): Promise => { - const { data } = await UriResolverInterface.Query.tryResolveUri( + const { data } = await UriResolverInterface.Method.tryResolveUri( invoke, implementationUri, uri diff --git a/packages/js/core/src/wrap-manifests/formats/deserialize.ts b/packages/js/core/src/wrap-manifests/formats/deserialize.ts index 206b4f3e32..41a1c92d37 100644 --- a/packages/js/core/src/wrap-manifests/formats/deserialize.ts +++ b/packages/js/core/src/wrap-manifests/formats/deserialize.ts @@ -20,15 +20,12 @@ import { Tracer } from "@polywrap/tracing-js"; export const deserializeWrapManifest = Tracer.traceFunc( "core: deserializeWrapManifest", - (manifest: ArrayBufferView, options?: DeserializeManifestOptions): WrapManifest => { + (manifest: ArrayBuffer, options?: DeserializeManifestOptions): WrapManifest => { let anyWrapManifest: AnyWrapManifest | undefined; try { anyWrapManifest = msgpackDecode(manifest) as AnyWrapManifest; } catch (e) { - throw Error( - `Unable to parse WrapManifest: ` + - `[${new Uint8Array(manifest.buffer, manifest.byteOffset, manifest.byteLength).toString()}]` - ); + throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); } if (!options || !options.noValidate) { From bcd58ddc7d0596bde56eed1bc4af0363b0869c69 Mon Sep 17 00:00:00 2001 From: cbrzn Date: Wed, 29 Jun 2022 22:56:37 +0200 Subject: [PATCH 13/46] chore: cli building --- .../0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts | 13 +++++++++++++ .../0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts | 12 ++++++++++++ .../0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts | 12 ++++++++++++ .../0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts | 11 +++++++++++ .../0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts | 19 +++++++++++++++++++ .../0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts | 12 ++++++++++++ .../0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts | 10 ++++++++++ .../0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts | 10 ++++++++++ .../0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts | 10 ++++++++++ .../0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts | 10 ++++++++++ .../0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts | 10 ++++++++++ .../0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts | 10 ++++++++++ .../0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts | 10 ++++++++++ .../0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts | 10 ++++++++++ .../0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts | 10 ++++++++++ .../0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts | 10 ++++++++++ 16 files changed, 179 insertions(+) create mode 100644 packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts create mode 100644 packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts create mode 100644 packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts create mode 100644 packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts create mode 100644 packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts create mode 100644 packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts create mode 100644 packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts create mode 100644 packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts create mode 100644 packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts create mode 100644 packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts create mode 100644 packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts create mode 100644 packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts create mode 100644 packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts create mode 100644 packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts create mode 100644 packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts create mode 100644 packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts new file mode 100644 index 0000000000..adeb6ff8f3 --- /dev/null +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +import { AppManifest as OldManifest } from "../0.0.1-prealpha.1"; +import { AppManifest as NewManifest } from "../0.0.1-prealpha.2"; + +export function migrate(old: OldManifest): NewManifest { + return { + ...old, + __type: "AppManifest", + format: "0.0.1-prealpha.2", + name: "Unnamed", + }; +} diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts new file mode 100644 index 0000000000..0b2952f5f1 --- /dev/null +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts @@ -0,0 +1,12 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +import { BuildManifest as OldManifest } from "../0.0.1-prealpha.1"; +import { BuildManifest as NewManifest } from "../0.0.1-prealpha.3"; + +export function migrate(old: OldManifest): NewManifest { + return { + ...old, + __type: "BuildManifest", + format: "0.0.1-prealpha.3", + }; +} diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts new file mode 100644 index 0000000000..0b2952f5f1 --- /dev/null +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts @@ -0,0 +1,12 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +import { BuildManifest as OldManifest } from "../0.0.1-prealpha.1"; +import { BuildManifest as NewManifest } from "../0.0.1-prealpha.3"; + +export function migrate(old: OldManifest): NewManifest { + return { + ...old, + __type: "BuildManifest", + format: "0.0.1-prealpha.3", + }; +} diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts new file mode 100644 index 0000000000..a0732788eb --- /dev/null +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts @@ -0,0 +1,11 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +import { InfraManifest as OldManifest } from "../0.0.1-prealpha.1"; +import { InfraManifest as NewManifest } from "../0.0.1-prealpha.2"; + +export function migrate(old: OldManifest): NewManifest { + return { + ...old, + format: "0.0.1-prealpha.2", + }; +} diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts new file mode 100644 index 0000000000..6474bb7fe4 --- /dev/null +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts @@ -0,0 +1,19 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +import { MetaManifest as OldManifest } from "../0.0.1-prealpha.1"; +import { MetaManifest as NewManifest } from "../0.0.1-prealpha.3"; + +export function migrate(old: OldManifest): NewManifest { + const manifest: Record = { + ...old, + }; + + delete manifest.name; + + return { + ...manifest, + __type: "MetaManifest", + format: "0.0.1-prealpha.3", + displayName: old.name, + }; +} diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts new file mode 100644 index 0000000000..dd3f7132b5 --- /dev/null +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts @@ -0,0 +1,12 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +import { MetaManifest as OldManifest } from "../0.0.1-prealpha.2"; +import { MetaManifest as NewManifest } from "../0.0.1-prealpha.3"; + +export function migrate(old: OldManifest): NewManifest { + return { + ...old, + __type: "MetaManifest", + format: "0.0.1-prealpha.3", + }; +} diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts new file mode 100644 index 0000000000..da97165078 --- /dev/null +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts @@ -0,0 +1,10 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +import { PluginManifest as OldManifest } from "../0.0.1-prealpha.1"; +import { PluginManifest as NewManifest } from "../0.0.1-prealpha.3"; + +export function migrate(_: OldManifest): NewManifest { + throw new Error( + "Plugin manifest file is deprecated. Please update to 0.0.1-prealpha.3" + ); +} diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts new file mode 100644 index 0000000000..52d03dc256 --- /dev/null +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts @@ -0,0 +1,10 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +import { PluginManifest as OldManifest } from "../0.0.1-prealpha.2"; +import { PluginManifest as NewManifest } from "../0.0.1-prealpha.3"; + +export function migrate(_: OldManifest): NewManifest { + throw new Error( + "Plugin manifest file is deprecated. Please update to 0.0.1-prealpha.3" + ); +} diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts new file mode 100644 index 0000000000..877fcae7b2 --- /dev/null +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts @@ -0,0 +1,10 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +import { PolywrapManifest as OldManifest } from "../0.0.1-prealpha.1"; +import { PolywrapManifest as NewManifest } from "../0.0.1-prealpha.9"; + +export function migrate(_: OldManifest): NewManifest { + throw new Error( + "Manifest file is deprecated. Please update to 0.0.1-prealpha.9" + ); +} diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts new file mode 100644 index 0000000000..feb614ae29 --- /dev/null +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts @@ -0,0 +1,10 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +import { PolywrapManifest as OldManifest } from "../0.0.1-prealpha.2"; +import { PolywrapManifest as NewManifest } from "../0.0.1-prealpha.9"; + +export function migrate(_: OldManifest): NewManifest { + throw new Error( + "Manifest file is deprecated. Please update to 0.0.1-prealpha.9" + ); +} diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts new file mode 100644 index 0000000000..f18ff04d05 --- /dev/null +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts @@ -0,0 +1,10 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +import { PolywrapManifest as OldManifest } from "../0.0.1-prealpha.3"; +import { PolywrapManifest as NewManifest } from "../0.0.1-prealpha.9"; + +export function migrate(_: OldManifest): NewManifest { + throw new Error( + "Manifest file is deprecated. Please update to 0.0.1-prealpha.9" + ); +} diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts new file mode 100644 index 0000000000..ed81776103 --- /dev/null +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts @@ -0,0 +1,10 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +import { PolywrapManifest as OldManifest } from "../0.0.1-prealpha.4"; +import { PolywrapManifest as NewManifest } from "../0.0.1-prealpha.9"; + +export function migrate(_: OldManifest): NewManifest { + throw new Error( + "Manifest file is deprecated. Please update to 0.0.1-prealpha.9" + ); +} diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts new file mode 100644 index 0000000000..4356bd3545 --- /dev/null +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts @@ -0,0 +1,10 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +import { PolywrapManifest as OldManifest } from "../0.0.1-prealpha.5"; +import { PolywrapManifest as NewManifest } from "../0.0.1-prealpha.9"; + +export function migrate(_: OldManifest): NewManifest { + throw new Error( + "Manifest file is deprecated. Please update to 0.0.1-prealpha.9" + ); +} diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts new file mode 100644 index 0000000000..dcdc22e593 --- /dev/null +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts @@ -0,0 +1,10 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +import { PolywrapManifest as OldManifest } from "../0.0.1-prealpha.6"; +import { PolywrapManifest as NewManifest } from "../0.0.1-prealpha.9"; + +export function migrate(_: OldManifest): NewManifest { + throw new Error( + "Manifest file is deprecated. Please update to 0.0.1-prealpha.9" + ); +} diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts new file mode 100644 index 0000000000..fa157c927d --- /dev/null +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts @@ -0,0 +1,10 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +import { PolywrapManifest as OldManifest } from "../0.0.1-prealpha.7"; +import { PolywrapManifest as NewManifest } from "../0.0.1-prealpha.9"; + +export function migrate(_: OldManifest): NewManifest { + throw new Error( + "Manifest file is deprecated. Please update to 0.0.1-prealpha.9" + ); +} diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts new file mode 100644 index 0000000000..6821a4761f --- /dev/null +++ b/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts @@ -0,0 +1,10 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +import { PolywrapManifest as OldManifest } from "../0.0.1-prealpha.8"; +import { PolywrapManifest as NewManifest } from "../0.0.1-prealpha.9"; + +export function migrate(_: OldManifest): NewManifest { + throw new Error( + "Manifest file is deprecated. Please update to 0.0.1-prealpha.9" + ); +} From 53b106039f018602ee5e984aeaed6f44cad3251d Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Wed, 29 Jun 2022 15:30:57 -0700 Subject: [PATCH 14/46] revert compiler changes --- packages/cli/src/lib/Compiler.ts | 102 +++++++++++++++++++------------ todo | 11 +++- 2 files changed, 72 insertions(+), 41 deletions(-) diff --git a/packages/cli/src/lib/Compiler.ts b/packages/cli/src/lib/Compiler.ts index 2cca8a599a..038e5fe15d 100644 --- a/packages/cli/src/lib/Compiler.ts +++ b/packages/cli/src/lib/Compiler.ts @@ -3,7 +3,6 @@ import { PolywrapManifest, - MetaManifest, PolywrapProject, SchemaComposer, withSpinner, @@ -14,13 +13,13 @@ import { copyArtifactsFromBuildImage, intlMsg, resetDir, + outputManifest, } from "./"; -import { outputManifest } from "./project/manifests"; -import { msgpackEncode, WrapManifest } from "@polywrap/core-js"; +import { msgpackEncode, WrapManifest, WrapImports } from "@polywrap/core-js"; import { WasmWrapper } from "@polywrap/client-js"; -import { WrapImports } from "@polywrap/client-js/build/wasm/types"; import { AsyncWasmInstance } from "@polywrap/asyncify-js"; +import { Abi } from "@polywrap/schema-parse"; import { ComposerOutput } from "@polywrap/schema-compose"; import { writeFileSync, writeDirectorySync } from "@polywrap/os-js"; import * as gluegun from "gluegun"; @@ -28,7 +27,6 @@ import fs from "fs"; import path from "path"; interface CompilerState { - polywrapManifest: PolywrapManifest; composerOutput: ComposerOutput; compilerOverrides?: CompilerOverrides; } @@ -96,7 +94,11 @@ export class Compiler { // Init & clean output directory resetDir(this._config.outputDir); - await this._outputInfo(state); + // Output: schema.graphql + await this._outputComposedSchema(state); + + // Output: wrap.info + await this._outputWrapManifest(state); if (!(await this._isInterface())) { // Generate the bindings @@ -106,10 +108,8 @@ export class Compiler { await this._buildModules(); } - // Output all metadata if present - const metaManifest = await this._outputMetadata(); - - await this._outputManifests(metaManifest); + // Output Polywrap Metadata + await this._outputPolywrapMetadata(); }; if (project.quiet) { @@ -179,7 +179,6 @@ export class Compiler { } const state: CompilerState = { - polywrapManifest: Object.assign({}, polywrapManifest), composerOutput, compilerOverrides, }; @@ -191,8 +190,9 @@ export class Compiler { } private async _isInterface(): Promise { - const state = await this._getCompilerState(); - return state.polywrapManifest.language === "interface"; + const { project } = this._config; + const manifest = await project.getManifest(); + return manifest.language === "interface"; } private async _composeSchema(): Promise { @@ -319,64 +319,86 @@ export class Compiler { return dockerImageId; } - private async _outputInfo(state: CompilerState): Promise { + private async _outputComposedSchema(state: CompilerState): Promise { const { outputDir } = this._config; - const info: WrapManifest = { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - abi: state.composerOutput.abi as unknown, - name: state.polywrapManifest.name, - type: state.polywrapManifest.module ? "wasm" : "interface", - version: "0.0.1", - __type: "WrapManifest", - }; + if (!state.composerOutput.schema) { + throw Error("Compiler.outputComposedSchema: no schema found"); + } - writeFileSync(`${outputDir}/wrap.info`, msgpackEncode(info)); + writeFileSync( + `${outputDir}/schema.graphql`, + state.composerOutput.schema, + "utf-8" + ); } - private async _outputManifests(metaManifest?: MetaManifest): Promise { + private async _outputWrapManifest(state: CompilerState): Promise { const { outputDir, project } = this._config; - if (metaManifest) { - await outputManifest( - metaManifest, - path.join(outputDir, "polywrap.meta.json"), - project.quiet - ); + if (!state.composerOutput.abi) { + throw Error("Compiler.outputWrapManifest: no WRAP ABI found"); } + + const manifest = await project.getManifest(); + + const abi: Abi = { + ...state.composerOutput.abi + }; + + const info: WrapManifest = { + abi: { ...abi }, + name: manifest.name, + type: await this._isInterface() ? "interface" : "wasm", + version: "0.0.1", + }; + + writeFileSync( + `${outputDir}/wrap.info`, + msgpackEncode(info), + { encoding: "binary" } + ); } - private async _outputMetadata(): Promise { + private async _outputPolywrapMetadata(): Promise { const { outputDir, project } = this._config; - const metaManifest = await project.getMetaManifest(); - if (!metaManifest) { + const projectMetaManifest = await project.getMetaManifest(); + + if (!projectMetaManifest) { return undefined; } - return await outputMetadata( - metaManifest, + const builtMetaManifest = await outputMetadata( + projectMetaManifest, outputDir, project.getManifestDir(), project.quiet ); + + await outputManifest( + builtMetaManifest, + path.join(outputDir, "polywrap.meta.json"), + project.quiet + ); } - private _validateState(state: CompilerState) { - const { composerOutput, polywrapManifest } = state; + private async _validateState(state: CompilerState): Promise { + const { composerOutput } = state; + const { project } = this._config; + const manifest = await project.getManifest(); if (!composerOutput.schema) { const missingSchemaMessage = intlMsg.lib_compiler_missingSchema(); throw Error(missingSchemaMessage); } - if (polywrapManifest.language !== "interface" && !polywrapManifest.module) { + if (manifest.language !== "interface" && !manifest.module) { const missingModuleMessage = intlMsg.lib_compiler_missingModule(); throw Error(missingModuleMessage); } - if (polywrapManifest.language === "interface" && polywrapManifest.module) { + if (manifest.language === "interface" && manifest.module) { const noInterfaceModule = intlMsg.lib_compiler_noInterfaceModule(); throw Error(noInterfaceModule); } diff --git a/todo b/todo index 53e649d1a5..2ed41fd142 100644 --- a/todo +++ b/todo @@ -1,3 +1,12 @@ 1- update invocation to support wrap.info instead of polywrap.json 2- update uri resolvers to search for wrap.info -3- \ No newline at end of file + + +# Jordan +- Review: +- - manifests +- - core +- - client +- - wasmwrapper +- - pluginwrapper +- Add wrapper side of "getManifest" From 2014a7afcfa8540e5c581898e99b883de19daa99 Mon Sep 17 00:00:00 2001 From: cbrzn Date: Thu, 30 Jun 2022 00:34:04 +0200 Subject: [PATCH 15/46] chore(validation): update to wrap manifest in progress --- .../file-size-over-100-kb/polywrap.build.json | 6 - .../file-size-over-100-kb/polywrap.json | 9 - .../wrappers/file-size-over-100-kb/wrap.info | 0 .../{module.wasm => wrap.wasm} | Bin .../module-size-over-100-kb/wrap.info | Bin 0 -> 2048 bytes .../wrappers/more-than-6-files/polywrap.json | 9 - .../wrappers/more-than-6-files/wrap.info | Bin 0 -> 2048 bytes .../__tests__/wrappers/valid/schema.graphql | 382 ++++++++++++++++++ .../src/__tests__/wrappers/valid/wrap.info | Bin 7131 -> 2048 bytes .../src/types/WasmPackageValidator.ts | 80 +--- 10 files changed, 399 insertions(+), 87 deletions(-) delete mode 100644 packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/polywrap.build.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/polywrap.json create mode 100644 packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/wrap.info rename packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/{module.wasm => wrap.wasm} (100%) create mode 100644 packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/wrap.info delete mode 100644 packages/js/validation/src/__tests__/wrappers/more-than-6-files/polywrap.json create mode 100644 packages/js/validation/src/__tests__/wrappers/more-than-6-files/wrap.info create mode 100644 packages/js/validation/src/__tests__/wrappers/valid/schema.graphql 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 deleted file mode 100644 index fb006acf11..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/polywrap.build.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "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 deleted file mode 100644 index ab7f052a11..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/polywrap.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "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/wrap.info b/packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/wrap.info new file mode 100644 index 0000000000..e69de29bb2 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/wrap.wasm similarity index 100% rename from packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/module.wasm rename to packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/wrap.wasm diff --git a/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/wrap.info b/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/wrap.info new file mode 100644 index 0000000000000000000000000000000000000000..da72ff379355090fdeb7c4056de37f68d19ef2cc GIT binary patch literal 2048 zcmZo!l9!m9y45YSsJKKSsWdYuMIkdUEngwEEVXDk5Ep0W=PfnRGte_!Qc_uvx}-d@ gICpVkQf33gC>RZa(GVC7fzc2c4S~@R7^)!v0Gp~8r2qf` literal 0 HcmV?d00001 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 deleted file mode 100644 index ab7f052a11..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/more-than-6-files/polywrap.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "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/wrap.info b/packages/js/validation/src/__tests__/wrappers/more-than-6-files/wrap.info new file mode 100644 index 0000000000000000000000000000000000000000..da72ff379355090fdeb7c4056de37f68d19ef2cc GIT binary patch literal 2048 zcmZo!l9!m9y45YSsJKKSsWdYuMIkdUEngwEEVXDk5Ep0W=PfnRGte_!Qc_uvx}-d@ gICpVkQf33gC>RZa(GVC7fzc2c4S~@R7^)!v0Gp~8r2qf` literal 0 HcmV?d00001 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..68640325f5 --- /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/valid/wrap.info b/packages/js/validation/src/__tests__/wrappers/valid/wrap.info index baf49860bedf97216710d003cd5303b03cd9be77..da72ff379355090fdeb7c4056de37f68d19ef2cc 100644 GIT binary patch literal 2048 zcmZo!l9!m9y45YSsJKKSsWdYuMIkdUEngwEEVXDk5Ep0W=PfnRGte_!Qc_uvx}-d@ gICpVkQf33gC>RZa(GVC7fzc2c4S~@R7^)!v0Gp~8r2qf` literal 7131 zcmc&(OHUj*5Wdf^FmOqvRiaI_(TdZ;gd`*|pfK4SR#9ZSi@{5e-D|sNGW+=NTYk3P z-H=9Mk`vQ@RF&)T`75)xw@1!JwOLDAlQ%$1kmO>1@P1DA_Vy;KpcR$m!!g(C?_bl8 zpI@Y3&!2^_WDov~Tkv^@|RL;!xxn&l(t0u}nS?^K z6_DT9vKCT9`Dj8&BiTN=(30`R4t{dF1Xa@l@)cKG&aIw${tRHN9jN)0?m_wc_iRJ|+@spqgG*(3+R20B$DB&x~u3 zS9s1_)=|!drWzg@>!TIc@K?u2Cod-xjD9aKj%F`yR!qz;aw^IO4e{>Ie1UEuWcNs4 zgM?=J*{$6DsWUtkoST>l-kX|#Ia`60tOV7YyFkNPG5_)&R8#5Rw3+y;0W~~R0IT~m zCt}f)bF>1kXF{_pR-nQGBWIx3Lf-UtTGML574)VKiUO3{MMr$XH2DYrE1rXyB`=BugLVzT?mvABTs;L} z7*A>syiah%=1PK3v3&eQi&4A2o_q!&L|5U6zcX0hkxEO{Bg#Czs9dD*H9qAMKc^0+Pwduenwy7g8Q@IsVu zP9duSj9i=bX-v$`g*Bcy+=+VCa0{Q#@NvP-?3Wi0B=6#ye!DOX@&#LPkOvN7oo)Am0*pbFk|oT85~Kf#BuVt$_vn=_3MNQ>K%^ zgs8lsDwA$~aK$9X5mO9N#&G-R&s?A|ydWB#501)`h_HtISdwK=X^eU$q~%i1q5;nk z0)}g)K0qooa4mJr8=qUzx*n+uSAgeo&c^$l*l)Fx(u?pE<0@^|V-M-1K_LHp6>w^^oumjkK)jevBUuR7W?N9k`x!Axm;!XYAyy<}c8m)JiWhLMjB z71F2#Pw0liyYmzq6T0vu3AW%9`dHap>tcflADpAugw5+QlGkX3{fj4^gkOO9R) zWu)f`-@!BP(Z|lwp&QrDPo#4v5%3Ot(&2R2hU9+>$tF9DIhrA|_am>ABZ9~59c z1|mmDB^K(i5^W$lBD*}ztViUF6^u_*JNULph;0SjV`wVh4tIs%X@;p@(JY$^8Q=<# zS9eW?t1I`EigUJG$nxMW3ezRx5Zvz#F3wscSW2U7;uvpdsJ&eHHP)pKv2pBHIi`SDpLa@Bz?^Ply zyMwS=?eqHyQwY{Aw7N(6olpJPx|uD { - let manifest: PolywrapManifest | undefined; + const WRAP_INFO = "wrap.info"; + if (!(await reader.exists(WRAP_INFO))) { + return this.fail(ValidationFailReason.WrapManifestNotFound); + } + + const info = await reader.readFile(WRAP_INFO); + const manifest: WrapManifest | undefined = deserializeWrapManifest(info); // 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) { @@ -126,27 +127,25 @@ export class WasmPackageValidator { 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.MultipleWrapManifests); + // } + // try { + // } catch (err) { + // return this.fail(ValidationFailReason.InvalidWrapManifest, err); + // } } if (!manifest) { return this.fail(ValidationFailReason.WrapManifestNotFound); } - const schemaResult = await this.validateSchema(reader, manifest.schema); + const schemaResult = await this.validateSchema(reader, "schema.graphql"); if (!schemaResult.valid) { return schemaResult; } - const moduleResult = await this.validateModule(reader, manifest.module); + const moduleResult = await this.validateModule(reader, "wrap.wasm"); if (!moduleResult.valid) { return moduleResult; } @@ -203,51 +202,6 @@ export class WasmPackageValidator { 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, From e11da172f045ff552db3a5fde5592cac73a732e1 Mon Sep 17 00:00:00 2001 From: cbrzn Date: Thu, 30 Jun 2022 02:08:08 +0200 Subject: [PATCH 16/46] chore(validation): builds! --- .../scripts/templates/deserialize-ts.mustache | 1 + .../src/wrap-manifests/formats/deserialize.ts | 1 + packages/js/validation/src/constants.ts | 12 +- .../src/types/WasmPackageValidator.ts | 104 ++++++++---------- 4 files changed, 57 insertions(+), 61 deletions(-) diff --git a/packages/js/core/scripts/templates/deserialize-ts.mustache b/packages/js/core/scripts/templates/deserialize-ts.mustache index 41a1c92d37..d5766ce5da 100644 --- a/packages/js/core/scripts/templates/deserialize-ts.mustache +++ b/packages/js/core/scripts/templates/deserialize-ts.mustache @@ -25,6 +25,7 @@ export const deserializeWrapManifest = Tracer.traceFunc( try { anyWrapManifest = msgpackDecode(manifest) as AnyWrapManifest; } catch (e) { + console.log({ e }) throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); } diff --git a/packages/js/core/src/wrap-manifests/formats/deserialize.ts b/packages/js/core/src/wrap-manifests/formats/deserialize.ts index 41a1c92d37..d5766ce5da 100644 --- a/packages/js/core/src/wrap-manifests/formats/deserialize.ts +++ b/packages/js/core/src/wrap-manifests/formats/deserialize.ts @@ -25,6 +25,7 @@ export const deserializeWrapManifest = Tracer.traceFunc( try { anyWrapManifest = msgpackDecode(manifest) as AnyWrapManifest; } catch (e) { + console.log({ e }) throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); } diff --git a/packages/js/validation/src/constants.ts b/packages/js/validation/src/constants.ts index 44a84597bd..b23260071b 100644 --- a/packages/js/validation/src/constants.ts +++ b/packages/js/validation/src/constants.ts @@ -1 +1,11 @@ -export const VALID_WRAP_MANIFEST_NAMES = ["polywrap.json"]; +export const WRAP_INFO = "wrap.info"; +export const WRAP_WASM = "wrap.wasm"; +export const GRAPHQL_SCHEMA = "schema.graphql"; +export const META_MANIFEST = "polywrap.meta.json"; + +export const VALID_WRAP_FILE_NAMES = [ + WRAP_INFO, + WRAP_WASM, + GRAPHQL_SCHEMA, + META_MANIFEST, +]; diff --git a/packages/js/validation/src/types/WasmPackageValidator.ts b/packages/js/validation/src/types/WasmPackageValidator.ts index 0782c0698a..89cc92a8de 100644 --- a/packages/js/validation/src/types/WasmPackageValidator.ts +++ b/packages/js/validation/src/types/WasmPackageValidator.ts @@ -1,4 +1,4 @@ -import { VALID_WRAP_MANIFEST_NAMES } from ".."; +import { GRAPHQL_SCHEMA, META_MANIFEST, WRAP_INFO, WRAP_WASM } from ".."; import { WasmPackageConstraints, PackageReader, @@ -7,30 +7,41 @@ import { } from "."; import { parseSchema } from "@polywrap/schema-parse"; -import path from "path"; import { WrapManifest, deserializeWrapManifest } from "@polywrap/core-js"; +import { deserializeMetaManifest } from "polywrap/src/lib"; +import * as 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; + const infoResult = await this.validateInfo(reader, WRAP_INFO); + if (!infoResult.valid) { + return infoResult; } - result = await this.validateStructure(reader); - if (!result.valid) { - return result; + const schemaResult = await this.validateSchema(reader, GRAPHQL_SCHEMA); + if (!schemaResult.valid) { + return schemaResult; } + const moduleResult = await this.validateModule(reader, WRAP_WASM); + if (!moduleResult.valid) { + return moduleResult; + } + + const metaResult = await this.validateMetaManifest(reader, META_MANIFEST); + if (!metaResult.valid) { + return metaResult; + } return this.success(); } private async validateStructure( - reader: PackageReader + reader: PackageReader, + path: string ): Promise { - const { result: pathResult } = await this.validatePath(reader, "./", 0, 0); + const { result: pathResult } = await this.validatePath(reader, path, 0, 0); if (!pathResult.valid) { return pathResult; @@ -110,62 +121,16 @@ export class WasmPackageValidator { }; } - private async validateManifests( - reader: PackageReader + private async validateInfo( + reader: PackageReader, + name: string ): Promise { - const WRAP_INFO = "wrap.info"; - if (!(await reader.exists(WRAP_INFO))) { - return this.fail(ValidationFailReason.WrapManifestNotFound); - } - - const info = await reader.readFile(WRAP_INFO); + const info = await reader.readFile(name); const manifest: WrapManifest | undefined = deserializeWrapManifest(info); - // 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); - // } - // try { - // } catch (err) { - // return this.fail(ValidationFailReason.InvalidWrapManifest, err); - // } - } if (!manifest) { return this.fail(ValidationFailReason.WrapManifestNotFound); } - - const schemaResult = await this.validateSchema(reader, "schema.graphql"); - if (!schemaResult.valid) { - return schemaResult; - } - - const moduleResult = await this.validateModule(reader, "wrap.wasm"); - 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(); } @@ -202,6 +167,25 @@ export class WasmPackageValidator { return this.success(); } + private async validateMetaManifest( + reader: PackageReader, + path: string + ): Promise { + if (await reader.exists(path)) { + const metaManifestFile = await reader.readFileAsString(path); + try { + deserializeMetaManifest(metaManifestFile); + // If folder manifest exists, check it + if (await reader.exists("./meta")) { + return await this.validateStructure(reader, "./meta"); + } + } catch (err) { + return this.fail(ValidationFailReason.InvalidMetaManifest, err); + } + } + return this.success(); + } + private success(): ValidationResult { return { valid: true, From e61c00a54a5fad624d7d895001f3eafe44a6b979 Mon Sep 17 00:00:00 2001 From: cbrzn Date: Thu, 30 Jun 2022 21:45:18 +0200 Subject: [PATCH 17/46] chore(js/validation): first test pass :-D --- .../scripts/templates/deserialize-ts.mustache | 5 ++--- packages/js/core/src/interfaces/uri-resolver.ts | 2 +- packages/js/core/src/msgpack/index.ts | 4 +++- .../resolvers/extendable/UriResolverWrapper.ts | 5 ++++- .../src/wrap-manifests/formats/deserialize.ts | 2 +- .../src/__tests__/wrappers/valid/wrap.info | Bin 2048 -> 45 bytes 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/js/core/scripts/templates/deserialize-ts.mustache b/packages/js/core/scripts/templates/deserialize-ts.mustache index d5766ce5da..16581e6be7 100644 --- a/packages/js/core/scripts/templates/deserialize-ts.mustache +++ b/packages/js/core/scripts/templates/deserialize-ts.mustache @@ -2,7 +2,7 @@ /** * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, - * and run node ./scripts/manifest/generateTypes.js to regenerate this file. + * and run ts-node ./scripts/generateWrapManifestTypes.ts to regenerate this file. */ import { @@ -20,12 +20,11 @@ import { Tracer } from "@polywrap/tracing-js"; export const deserializeWrapManifest = Tracer.traceFunc( "core: deserializeWrapManifest", - (manifest: ArrayBuffer, options?: DeserializeManifestOptions): WrapManifest => { + (manifest: Uint8Array, options?: DeserializeManifestOptions): WrapManifest => { let anyWrapManifest: AnyWrapManifest | undefined; try { anyWrapManifest = msgpackDecode(manifest) as AnyWrapManifest; } catch (e) { - console.log({ e }) throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); } diff --git a/packages/js/core/src/interfaces/uri-resolver.ts b/packages/js/core/src/interfaces/uri-resolver.ts index 1e3fc78c83..3f6649106e 100644 --- a/packages/js/core/src/interfaces/uri-resolver.ts +++ b/packages/js/core/src/interfaces/uri-resolver.ts @@ -5,7 +5,7 @@ import { Tracer } from "@polywrap/tracing-js"; export interface MaybeUriOrManifest { uri?: string; - manifest?: ArrayBuffer; + manifest?: Uint8Array; } // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/packages/js/core/src/msgpack/index.ts b/packages/js/core/src/msgpack/index.ts index b56cf45f63..e5e28ee00d 100644 --- a/packages/js/core/src/msgpack/index.ts +++ b/packages/js/core/src/msgpack/index.ts @@ -48,7 +48,9 @@ export function msgpackEncode(object: unknown): Uint8Array { return encoder.encode(object); } -export function msgpackDecode(buffer: ArrayBuffer): unknown { +export function msgpackDecode( + buffer: ArrayLike | BufferSource +): unknown { const decoder = new Decoder(extensionCodec); return decoder.decode(buffer); } diff --git a/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts b/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts index b8256786a6..a59db4a103 100644 --- a/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts +++ b/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts @@ -7,7 +7,10 @@ import { } from "../../core"; import { CreateWrapperFunc } from "./types/CreateWrapperFunc"; import { getEnvFromUriOrResolutionStack } from "../getEnvFromUriOrResolutionStack"; -import { DeserializeManifestOptions, deserializeWrapManifest } from "../../../wrap-manifests"; +import { + DeserializeManifestOptions, + deserializeWrapManifest, +} from "../../../wrap-manifests"; import { Tracer } from "@polywrap/tracing-js"; diff --git a/packages/js/core/src/wrap-manifests/formats/deserialize.ts b/packages/js/core/src/wrap-manifests/formats/deserialize.ts index d5766ce5da..2c23e39343 100644 --- a/packages/js/core/src/wrap-manifests/formats/deserialize.ts +++ b/packages/js/core/src/wrap-manifests/formats/deserialize.ts @@ -20,7 +20,7 @@ import { Tracer } from "@polywrap/tracing-js"; export const deserializeWrapManifest = Tracer.traceFunc( "core: deserializeWrapManifest", - (manifest: ArrayBuffer, options?: DeserializeManifestOptions): WrapManifest => { + (manifest: Uint8Array, options?: DeserializeManifestOptions): WrapManifest => { let anyWrapManifest: AnyWrapManifest | undefined; try { anyWrapManifest = msgpackDecode(manifest) as AnyWrapManifest; diff --git a/packages/js/validation/src/__tests__/wrappers/valid/wrap.info b/packages/js/validation/src/__tests__/wrappers/valid/wrap.info index da72ff379355090fdeb7c4056de37f68d19ef2cc..ae49b1b3493edb064de4bb3b6ee03477dc0ec7a0 100644 GIT binary patch delta 23 ecmZn=&=qJ|l9!m9x-vOGKPSGtD6wFoj4S|YH3-lE literal 2048 zcmZo!l9!m9y45YSsJKKSsWdYuMIkdUEngwEEVXDk5Ep0W=PfnRGte_!Qc_uvx}-d@ gICpVkQf33gC>RZa(GVC7fzc2c4S~@R7^)!v0Gp~8r2qf` From 5ebd9106678470aebd7a01ca52873135847fd84c Mon Sep 17 00:00:00 2001 From: cbrzn Date: Fri, 1 Jul 2022 01:09:03 +0200 Subject: [PATCH 18/46] chore(js/validation): update with wrap manifest --- packages/cli/src/lib/Compiler.ts | 16 +- packages/cli/src/lib/SchemaComposer.ts | 2 +- .../extendable/ExtendableUriResolver.ts | 1 + .../extendable/UriResolverWrapper.ts | 1 + packages/js/test-env/src/index.ts | 9 +- packages/js/validation/package.json | 2 +- .../__tests__/{schema.spec.ts => abi.spec.ts} | 14 +- .../src/__tests__/manifests.spec.ts | 25 -- .../js/validation/src/__tests__/sizes.spec.ts | 10 +- .../wrappers/file-size-over-100-kb/wrap.info | Bin 0 -> 165 bytes .../__tests__/wrappers/invalid-abi/wrap.info | 1 + .../module.wasm => invalid-abi/wrap.wasm} | Bin .../polywrap.build.json | 1 - .../invalid-build-manifest/polywrap.json | 9 - .../invalid-meta-manifest/polywrap.build.json | 6 - .../invalid-meta-manifest/polywrap.json | 9 - .../invalid-meta-manifest/polywrap.meta.json | 1 - .../invalid-meta-manifest/schema.graphql | 382 ------------------ .../invalid-schema/polywrap.build.json | 6 - .../wrappers/invalid-schema/polywrap.json | 9 - .../invalid-schema/polywrap.meta.json | 8 - .../wrappers/invalid-schema/schema.graphql | 1 - .../invalid-wrap-manifest/polywrap.build.json | 6 - .../invalid-wrap-manifest/polywrap.json | 4 - .../invalid-wrap-manifest/polywrap.meta.json | 8 - .../wrappers/invalid-wrap-manifest/wrap.info | Bin 0 -> 160 bytes .../wrap.wasm} | Bin .../__tests__/wrappers/missing-abi/wrap.info | 1 + .../module.wasm => missing-abi/wrap.wasm} | Bin .../missing-schema/polywrap.build.json | 6 - .../wrappers/missing-schema/polywrap.json | 9 - .../missing-schema/polywrap.meta.json | 8 - .../missing-wrap-manifest/polywrap.build.json | 6 - .../missing-wrap-manifest/schema.graphql | 382 ------------------ .../polywrap.build.json | 6 - .../module-size-over-100-kb/polywrap.json | 9 - .../polywrap.meta.json | 8 - .../module-size-over-100-kb/wrap.info | Bin 2048 -> 165 bytes .../wrap.wasm} | Bin .../wrappers/more-than-6-files/module.wasm | Bin 101034 -> 0 bytes .../wrappers/more-than-6-files/wrap.info | Bin 2048 -> 165 bytes .../wrap.wasm} | Bin .../polywrap.meta.json | 0 .../schema.graphql | 0 .../package-size-over-100-kb/wrap.info | Bin 0 -> 165 bytes .../wrap.wasm} | Bin .../valid-interface/polywrap.build.json | 6 - .../wrappers/valid-interface/polywrap.json | 8 - .../valid-interface/polywrap.meta.json | 8 - .../wrappers/valid-interface/wrap.info | Bin 0 -> 175 bytes .../src/__tests__/wrappers/valid/wrap.info | Bin 45 -> 165 bytes .../wrapper-size-over-100-kb/module.wasm | Bin 101034 -> 0 bytes .../polywrap.build.json | 6 - .../wrapper-size-over-100-kb/polywrap.json | 9 - .../polywrap.meta.json | 8 - .../wrapper-size-over-100-kb/schema.graphql | 382 ------------------ packages/js/validation/src/constants.ts | 9 - .../src/types/ValidationFailReason.ts | 6 +- .../src/types/WasmPackageValidator.ts | 102 ++--- 59 files changed, 79 insertions(+), 1431 deletions(-) rename packages/js/validation/src/__tests__/{schema.spec.ts => abi.spec.ts} (70%) create mode 100644 packages/js/validation/src/__tests__/wrappers/invalid-abi/wrap.info rename packages/js/validation/src/__tests__/wrappers/{invalid-build-manifest/module.wasm => invalid-abi/wrap.wasm} (100%) delete mode 100644 packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/polywrap.build.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/polywrap.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/polywrap.build.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/polywrap.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/polywrap.meta.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/schema.graphql delete mode 100644 packages/js/validation/src/__tests__/wrappers/invalid-schema/polywrap.build.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/invalid-schema/polywrap.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/invalid-schema/polywrap.meta.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/invalid-schema/schema.graphql delete mode 100644 packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/polywrap.build.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/polywrap.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/polywrap.meta.json create mode 100644 packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/wrap.info rename packages/js/validation/src/__tests__/wrappers/{invalid-meta-manifest/module.wasm => invalid-wrap-manifest/wrap.wasm} (100%) create mode 100644 packages/js/validation/src/__tests__/wrappers/missing-abi/wrap.info rename packages/js/validation/src/__tests__/wrappers/{invalid-schema/module.wasm => missing-abi/wrap.wasm} (100%) delete mode 100644 packages/js/validation/src/__tests__/wrappers/missing-schema/polywrap.build.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/missing-schema/polywrap.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/missing-schema/polywrap.meta.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/missing-wrap-manifest/polywrap.build.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/missing-wrap-manifest/schema.graphql delete mode 100644 packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/polywrap.build.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/polywrap.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/polywrap.meta.json rename packages/js/validation/src/__tests__/wrappers/{invalid-wrap-manifest/module.wasm => module-size-over-100-kb/wrap.wasm} (100%) delete mode 100644 packages/js/validation/src/__tests__/wrappers/more-than-6-files/module.wasm rename packages/js/validation/src/__tests__/wrappers/{missing-schema/module.wasm => more-than-6-files/wrap.wasm} (100%) rename packages/js/validation/src/__tests__/wrappers/{invalid-build-manifest => package-size-over-100-kb}/polywrap.meta.json (100%) rename packages/js/validation/src/__tests__/wrappers/{invalid-build-manifest => package-size-over-100-kb}/schema.graphql (100%) create mode 100644 packages/js/validation/src/__tests__/wrappers/package-size-over-100-kb/wrap.info rename packages/js/validation/src/__tests__/wrappers/{module-size-over-100-kb/module.wasm => package-size-over-100-kb/wrap.wasm} (100%) delete mode 100644 packages/js/validation/src/__tests__/wrappers/valid-interface/polywrap.build.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/valid-interface/polywrap.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/valid-interface/polywrap.meta.json create mode 100644 packages/js/validation/src/__tests__/wrappers/valid-interface/wrap.info delete mode 100644 packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/module.wasm delete mode 100644 packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/polywrap.build.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/polywrap.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/polywrap.meta.json delete mode 100644 packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/schema.graphql diff --git a/packages/cli/src/lib/Compiler.ts b/packages/cli/src/lib/Compiler.ts index 0ad24606e2..fd52c91f96 100644 --- a/packages/cli/src/lib/Compiler.ts +++ b/packages/cli/src/lib/Compiler.ts @@ -327,6 +327,8 @@ export class Compiler { throw Error("Compiler.outputComposedSchema: no schema found"); } + console.log("HERE"); + console.log(state.composerOutput); writeFileSync( `${outputDir}/schema.graphql`, state.composerOutput.schema, @@ -344,21 +346,21 @@ export class Compiler { const manifest = await project.getManifest(); const abi: Abi = { - ...state.composerOutput.abi + ...state.composerOutput.abi, }; + console.log({ manifest }); + console.log({ abi }); const info: WrapManifest = { abi: { ...abi }, name: manifest.name, - type: await this._isInterface() ? "interface" : "wasm", + type: (await this._isInterface()) ? "interface" : "wasm", version: "0.0.1", }; - writeFileSync( - `${outputDir}/wrap.info`, - msgpackEncode(info), - { encoding: "binary" } - ); + writeFileSync(`${outputDir}/wrap.info`, msgpackEncode(info), { + encoding: "binary", + }); } private async _outputPolywrapMetadata(): Promise { diff --git a/packages/cli/src/lib/SchemaComposer.ts b/packages/cli/src/lib/SchemaComposer.ts index 6106478000..2382f5ec71 100644 --- a/packages/cli/src/lib/SchemaComposer.ts +++ b/packages/cli/src/lib/SchemaComposer.ts @@ -66,7 +66,7 @@ export class SchemaComposer { options.schemas.push(schemaFile); this._composerOutput = await composeSchema(options); - + console.log(this._composerOutput); return this._composerOutput; } diff --git a/packages/js/core/src/uri-resolution/resolvers/extendable/ExtendableUriResolver.ts b/packages/js/core/src/uri-resolution/resolvers/extendable/ExtendableUriResolver.ts index abd0c89fca..174177ee97 100644 --- a/packages/js/core/src/uri-resolution/resolvers/extendable/ExtendableUriResolver.ts +++ b/packages/js/core/src/uri-resolution/resolvers/extendable/ExtendableUriResolver.ts @@ -68,6 +68,7 @@ export class ExtendableUriResolver implements UriResolver { ); for (const resolver of resolvers) { + console.log({ resolvers }) const result = await resolver.resolveUri( uri, client, diff --git a/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts b/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts index a59db4a103..39607dfe8f 100644 --- a/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts +++ b/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts @@ -50,6 +50,7 @@ export class UriResolverWrapper implements UriResolver { } else if (result.manifest) { // We've found our manifest at the current implementation, // meaning the URI resolver can also be used as an Wrapper resolver + console.log({ result }); const manifest = deserializeWrapManifest( result.manifest, this.deserializeOptions diff --git a/packages/js/test-env/src/index.ts b/packages/js/test-env/src/index.ts index 46ac2038fa..fc45dcb8d5 100644 --- a/packages/js/test-env/src/index.ts +++ b/packages/js/test-env/src/index.ts @@ -1,12 +1,14 @@ /* eslint-disable @typescript-eslint/naming-convention */ import { generateName } from "./generate-name"; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore +import * as polywrapManifests from "../../../cli/build/lib/polywrap-manifests"; import path from "path"; import spawn from "spawn-command"; import axios from "axios"; import fs from "fs"; import yaml from "js-yaml"; -import { deserializePolywrapManifest } from "polywrap"; import { Uri } from "@polywrap/core-js"; import { PolywrapClient } from "@polywrap/client-js"; import { ethereumPlugin } from "@polywrap/ethereum-plugin-js"; @@ -318,7 +320,10 @@ export async function buildAndDeployWrapper({ // manually configure manifests - const { __type, ...polywrapManifest } = deserializePolywrapManifest( + const { + __type, + ...polywrapManifest + } = polywrapManifests.deserializePolywrapManifest( fs.readFileSync(manifestPath, "utf-8") ); diff --git a/packages/js/validation/package.json b/packages/js/validation/package.json index 8a1aab2ce0..48d08e9c0b 100644 --- a/packages/js/validation/package.json +++ b/packages/js/validation/package.json @@ -20,7 +20,7 @@ }, "dependencies": { "@polywrap/core-js": "0.0.1-prealpha.90", - "@polywrap/schema-parse": "0.0.1-prealpha.90", + "@polywrap/compose-parse": "0.0.1-prealpha.90", "polywrap": "0.0.1-prealpha.90" }, "devDependencies": { diff --git a/packages/js/validation/src/__tests__/schema.spec.ts b/packages/js/validation/src/__tests__/abi.spec.ts similarity index 70% rename from packages/js/validation/src/__tests__/schema.spec.ts rename to packages/js/validation/src/__tests__/abi.spec.ts index 70d9c76ddf..989166ad89 100644 --- a/packages/js/validation/src/__tests__/schema.spec.ts +++ b/packages/js/validation/src/__tests__/abi.spec.ts @@ -9,7 +9,7 @@ jest.setTimeout(200000); const testWrappersPath = path.join(__dirname, "./wrappers"); -describe("schema", () => { +describe("abi", () => { let validator: WasmPackageValidator; beforeAll(async () => { @@ -21,25 +21,25 @@ describe("schema", () => { }); }); - it("fails validating wrapper with missing schema", async () => { + it("fails validating wrapper with missing abi", async () => { const reader = new FileSystemPackageReader( - path.join(testWrappersPath, "missing-schema") + path.join(testWrappersPath, "missing-abi") ); const result = await validator.validate(reader); expect(result.valid).toBeFalsy(); - expect(result.failReason).toEqual(ValidationFailReason.SchemaNotFound); + expect(result.failReason).toEqual(ValidationFailReason.AbiNotFound); }); - it("fails validating invalid schema file", async () => { + it("fails validating invalid abi format", async () => { const reader = new FileSystemPackageReader( - path.join(testWrappersPath, "invalid-schema") + path.join(testWrappersPath, "invalid-abi") ); const result = await validator.validate(reader); expect(result.valid).toBeFalsy(); - expect(result.failReason).toEqual(ValidationFailReason.InvalidSchema); + expect(result.failReason).toEqual(ValidationFailReason.InvalidAbi); }); }); diff --git a/packages/js/validation/src/__tests__/manifests.spec.ts b/packages/js/validation/src/__tests__/manifests.spec.ts index ffaa323250..9277680853 100644 --- a/packages/js/validation/src/__tests__/manifests.spec.ts +++ b/packages/js/validation/src/__tests__/manifests.spec.ts @@ -27,7 +27,6 @@ describe("manifests", () => { ); const result = await validator.validate(reader); - expect(result.valid).toBeFalsy(); expect(result.failReason).toEqual(ValidationFailReason.InvalidWrapManifest); }); @@ -44,28 +43,4 @@ describe("manifests", () => { 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__/sizes.spec.ts b/packages/js/validation/src/__tests__/sizes.spec.ts index 51d375d6e5..0f1d3c08d6 100644 --- a/packages/js/validation/src/__tests__/sizes.spec.ts +++ b/packages/js/validation/src/__tests__/sizes.spec.ts @@ -20,7 +20,6 @@ const assertValidWrapper = async (wrapperPath: string) => { }); const result = await validator.validate(reader); - expect(result.valid).toBeTruthy(); expect(result.failReason).toEqual(undefined); }; @@ -28,7 +27,7 @@ const assertValidWrapper = async (wrapperPath: string) => { describe("manifests", () => { it("sanity", async () => { await assertValidWrapper( - path.join(testWrappersPath, "wrapper-size-over-100-kb") + path.join(testWrappersPath, "package-size-over-100-kb") ); await assertValidWrapper( path.join(testWrappersPath, "file-size-over-100-kb") @@ -38,9 +37,9 @@ describe("manifests", () => { ); }); - it("fails validating a large wrapper", async () => { + it("fails validating a large package", async () => { const reader = new FileSystemPackageReader( - path.join(testWrappersPath, "wrapper-size-over-100-kb") + path.join(testWrappersPath, "package-size-over-100-kb") ); const validator = new WasmPackageValidator({ @@ -53,7 +52,7 @@ describe("manifests", () => { const result = await validator.validate(reader); expect(result.valid).toBeFalsy(); - expect(result.failReason).toEqual(ValidationFailReason.WrapperTooLarge); + expect(result.failReason).toEqual(ValidationFailReason.PackageTooLarge); }); it("fails validating a large file", async () => { @@ -69,7 +68,6 @@ describe("manifests", () => { }); const result = await validator.validate(reader); - expect(result.valid).toBeFalsy(); expect(result.failReason).toEqual(ValidationFailReason.FileTooLarge); }); diff --git a/packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/wrap.info b/packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/wrap.info index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..544f2491b2f1ed36fbbcd1e83d1c7f70fd4b7b4a 100644 GIT binary patch literal 165 zcmZo!l9!m9x-vOGKPSGtD6wF9S!z*nW`5pM13d#h!zCq^1*uEQ6N_^fCnjaKug*`( zN=+^a0SXpRSecqvnhRmB%gifDElNvFPKEF{XXX~<7nP)@_#>%@3;O1#l;%KHZiK0H Yg&Vd!HLnb0OyiR5%)FFy42%p60C~Pg4gdfE literal 0 HcmV?d00001 diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-abi/wrap.info b/packages/js/validation/src/__tests__/wrappers/invalid-abi/wrap.info new file mode 100644 index 0000000000..c4318700c3 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/invalid-abi/wrap.info @@ -0,0 +1 @@ +„¤name©cool_wrap§version¥0.0.1¤type¤wasm£abi¥wrong¥value \ No newline at end of file diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/module.wasm b/packages/js/validation/src/__tests__/wrappers/invalid-abi/wrap.wasm similarity index 100% rename from packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/module.wasm rename to packages/js/validation/src/__tests__/wrappers/invalid-abi/wrap.wasm 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 deleted file mode 100644 index 51e5257f03..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/polywrap.build.json +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index ab7f052a11..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/polywrap.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "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.build.json b/packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/polywrap.build.json deleted file mode 100644 index fb006acf11..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/polywrap.build.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "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 deleted file mode 100644 index ab7f052a11..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/polywrap.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "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 deleted file mode 100644 index f19ddb8aba..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/polywrap.meta.json +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index baf49860be..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/schema.graphql +++ /dev/null @@ -1,382 +0,0 @@ -### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @capability( - type: String! - uri: String! - namespace: String! -) repeatable on OBJECT - -directive @enabled_interface on OBJECT - -directive @annotate(type: String!) on FIELD - -### 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/polywrap.build.json b/packages/js/validation/src/__tests__/wrappers/invalid-schema/polywrap.build.json deleted file mode 100644 index fb006acf11..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/invalid-schema/polywrap.build.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "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 deleted file mode 100644 index ab7f052a11..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/invalid-schema/polywrap.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "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 deleted file mode 100644 index 4ed15fa713..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/invalid-schema/polywrap.meta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "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 deleted file mode 100644 index e9e90fa4c9..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/invalid-schema/schema.graphql +++ /dev/null @@ -1 +0,0 @@ -Some Invalid Schema \ No newline at end of file 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 deleted file mode 100644 index fb006acf11..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/polywrap.build.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "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 deleted file mode 100644 index 9efbd4ac9a..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/polywrap.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "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 deleted file mode 100644 index 4ed15fa713..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/polywrap.meta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "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/wrap.info b/packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/wrap.info new file mode 100644 index 0000000000000000000000000000000000000000..096617092c79816602fe60b0334dd206fd7d61a7 GIT binary patch literal 160 zcmZo(l9!m9x-L0CKPNsjuOzi7EipNDd0A>vab|wrQUg5$J;TL`Ntx}d^OLetlS@J> z3sQ?GtW3=-&4n=6!8Jknn=^9@@{3ARQ~Z(C!v%fwQ%ZAEAu2b*RJy_qTb`O%29j)C OlAW2Ca*lzKfdK%_UqnX$ literal 0 HcmV?d00001 diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/module.wasm b/packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/wrap.wasm similarity index 100% rename from packages/js/validation/src/__tests__/wrappers/invalid-meta-manifest/module.wasm rename to packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/wrap.wasm diff --git a/packages/js/validation/src/__tests__/wrappers/missing-abi/wrap.info b/packages/js/validation/src/__tests__/wrappers/missing-abi/wrap.info new file mode 100644 index 0000000000..92cc9321f1 --- /dev/null +++ b/packages/js/validation/src/__tests__/wrappers/missing-abi/wrap.info @@ -0,0 +1 @@ +ƒ¤name©cool_wrap§version¥0.0.1¤type¤wasm \ No newline at end of file diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-schema/module.wasm b/packages/js/validation/src/__tests__/wrappers/missing-abi/wrap.wasm similarity index 100% rename from packages/js/validation/src/__tests__/wrappers/invalid-schema/module.wasm rename to packages/js/validation/src/__tests__/wrappers/missing-abi/wrap.wasm 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 deleted file mode 100644 index fb006acf11..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/missing-schema/polywrap.build.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "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 deleted file mode 100644 index ab7f052a11..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/missing-schema/polywrap.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "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 deleted file mode 100644 index 4ed15fa713..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/missing-schema/polywrap.meta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "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/polywrap.build.json b/packages/js/validation/src/__tests__/wrappers/missing-wrap-manifest/polywrap.build.json deleted file mode 100644 index fb006acf11..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/missing-wrap-manifest/polywrap.build.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "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/schema.graphql b/packages/js/validation/src/__tests__/wrappers/missing-wrap-manifest/schema.graphql deleted file mode 100644 index baf49860be..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/missing-wrap-manifest/schema.graphql +++ /dev/null @@ -1,382 +0,0 @@ -### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @capability( - type: String! - uri: String! - namespace: String! -) repeatable on OBJECT - -directive @enabled_interface on OBJECT - -directive @annotate(type: String!) on FIELD - -### 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/polywrap.build.json b/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/polywrap.build.json deleted file mode 100644 index fb006acf11..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/polywrap.build.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "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 deleted file mode 100644 index ab7f052a11..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/polywrap.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "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 deleted file mode 100644 index 4ed15fa713..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/polywrap.meta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "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/wrap.info b/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/wrap.info index da72ff379355090fdeb7c4056de37f68d19ef2cc..544f2491b2f1ed36fbbcd1e83d1c7f70fd4b7b4a 100644 GIT binary patch literal 165 zcmZo!l9!m9x-vOGKPSGtD6wF9S!z*nW`5pM13d#h!zCq^1*uEQ6N_^fCnjaKug*`( zN=+^a0SXpRSecqvnhRmB%gifDElNvFPKEF{XXX~<7nP)@_#>%@3;O1#l;%KHZiK0H Yg&Vd!HLnb0OyiR5%)FFy42%p60C~Pg4gdfE literal 2048 zcmZo!l9!m9y45YSsJKKSsWdYuMIkdUEngwEEVXDk5Ep0W=PfnRGte_!Qc_uvx}-d@ gICpVkQf33gC>RZa(GVC7fzc2c4S~@R7^)!v0Gp~8r2qf` diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/module.wasm b/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/wrap.wasm similarity index 100% rename from packages/js/validation/src/__tests__/wrappers/invalid-wrap-manifest/module.wasm rename to packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/wrap.wasm 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 deleted file mode 100644 index 6b497232cb7754ae5653ffc297e19989e00f9b86..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 101034 zcmeFa36NdadEa^OeXkevYXA=}@r3zgVT6xoSLiO>R2 zTtEntJTlQPDT?FJF;Y=7j*C-4#fjyap~^^&XUa2Ss-VTPB*Qjj%aUc&5+vD{WYY=8 zjy;(wjyb>och9&-+s=m?tkn(byZdM_inncK3pHZuQ`0U z(jPu{4yQ}S!|J|@n-qHdzN)&f%R_F>>Qa2LYLD}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|(M7QLyj7&;JOZE>|K m)>6Fd*l1nzmgx#y>_@~_g<;%XNiZ>E6_brF4ptkIjo$yoryBwQ diff --git a/packages/js/validation/src/__tests__/wrappers/more-than-6-files/wrap.info b/packages/js/validation/src/__tests__/wrappers/more-than-6-files/wrap.info index da72ff379355090fdeb7c4056de37f68d19ef2cc..544f2491b2f1ed36fbbcd1e83d1c7f70fd4b7b4a 100644 GIT binary patch literal 165 zcmZo!l9!m9x-vOGKPSGtD6wF9S!z*nW`5pM13d#h!zCq^1*uEQ6N_^fCnjaKug*`( zN=+^a0SXpRSecqvnhRmB%gifDElNvFPKEF{XXX~<7nP)@_#>%@3;O1#l;%KHZiK0H Yg&Vd!HLnb0OyiR5%)FFy42%p60C~Pg4gdfE literal 2048 zcmZo!l9!m9y45YSsJKKSsWdYuMIkdUEngwEEVXDk5Ep0W=PfnRGte_!Qc_uvx}-d@ gICpVkQf33gC>RZa(GVC7fzc2c4S~@R7^)!v0Gp~8r2qf` diff --git a/packages/js/validation/src/__tests__/wrappers/missing-schema/module.wasm b/packages/js/validation/src/__tests__/wrappers/more-than-6-files/wrap.wasm similarity index 100% rename from packages/js/validation/src/__tests__/wrappers/missing-schema/module.wasm rename to packages/js/validation/src/__tests__/wrappers/more-than-6-files/wrap.wasm diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/polywrap.meta.json b/packages/js/validation/src/__tests__/wrappers/package-size-over-100-kb/polywrap.meta.json similarity index 100% rename from packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/polywrap.meta.json rename to packages/js/validation/src/__tests__/wrappers/package-size-over-100-kb/polywrap.meta.json diff --git a/packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/schema.graphql b/packages/js/validation/src/__tests__/wrappers/package-size-over-100-kb/schema.graphql similarity index 100% rename from packages/js/validation/src/__tests__/wrappers/invalid-build-manifest/schema.graphql rename to packages/js/validation/src/__tests__/wrappers/package-size-over-100-kb/schema.graphql diff --git a/packages/js/validation/src/__tests__/wrappers/package-size-over-100-kb/wrap.info b/packages/js/validation/src/__tests__/wrappers/package-size-over-100-kb/wrap.info new file mode 100644 index 0000000000000000000000000000000000000000..544f2491b2f1ed36fbbcd1e83d1c7f70fd4b7b4a GIT binary patch literal 165 zcmZo!l9!m9x-vOGKPSGtD6wF9S!z*nW`5pM13d#h!zCq^1*uEQ6N_^fCnjaKug*`( zN=+^a0SXpRSecqvnhRmB%gifDElNvFPKEF{XXX~<7nP)@_#>%@3;O1#l;%KHZiK0H Yg&Vd!HLnb0OyiR5%)FFy42%p60C~Pg4gdfE literal 0 HcmV?d00001 diff --git a/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/module.wasm b/packages/js/validation/src/__tests__/wrappers/package-size-over-100-kb/wrap.wasm similarity index 100% rename from packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/module.wasm rename to packages/js/validation/src/__tests__/wrappers/package-size-over-100-kb/wrap.wasm 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 deleted file mode 100644 index fb006acf11..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/valid-interface/polywrap.build.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "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 deleted file mode 100644 index 159132cb04..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/valid-interface/polywrap.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "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 deleted file mode 100644 index f0c205477c..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/valid-interface/polywrap.meta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "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/wrap.info b/packages/js/validation/src/__tests__/wrappers/valid-interface/wrap.info new file mode 100644 index 0000000000000000000000000000000000000000..818432785b3e18c6ed84d22bcb74e509d26b1cb8 GIT binary patch literal 175 zcmZo!l9!m9x-L0CKPNsjuOzi7EipNDd0A>vab|wrQUg5$J;Nm>l?ACQ;gX9JlQP>^ z=O<;QCYOW&Wr`=POwB9Jg)rB_l|lHMGjj{_i%L>c{E^hd1%2~VN^?>nDmTJZy21@x Vo|;z%l5AX(otc+%j)9SZ0RSrNO9%h} literal 0 HcmV?d00001 diff --git a/packages/js/validation/src/__tests__/wrappers/valid/wrap.info b/packages/js/validation/src/__tests__/wrappers/valid/wrap.info index ae49b1b3493edb064de4bb3b6ee03477dc0ec7a0..544f2491b2f1ed36fbbcd1e83d1c7f70fd4b7b4a 100644 GIT binary patch delta 127 zcmdO0$~Zx%vVC=aQdVkmNl0ZuYVm}Xsd=Tj5aznfypq(Sw8Z382!C^CZb5!gNotBe nl6ttHZ+=Q?4pikvm`Yc;VarqV%0R|6F3HZ!OF75D$iM&q!gV$d delta 7 OcmZ3=s5?Q2u>k-Gw*nCW 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 deleted file mode 100644 index 6b497232cb7754ae5653ffc297e19989e00f9b86..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 101034 zcmeFa36NdadEa^OeXkevYXA=}@r3zgVT6xoSLiO>R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o5 z43#W99KKD-xO&GVa7^FrX0p|*xgNoacU)g~iO+sihqCs&UI;xJE+R<(O-Br8&>YmZ z;Wp{-^yKi`;0|T?9He;55yRQV_O)5yvWJXSO#Z_}52~E5ju~#E(hbvYX%$?!TdMKK zZ+G;dGpb6Rqx%G@p?~MS|(M7QLyj7&;JOZE>|K m)>6Fd*l1nzmgx#y>_@~_g<;%XNiZ>E6_brF4ptkIjo$yoryBwQ 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 deleted file mode 100644 index fb006acf11..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/polywrap.build.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "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 deleted file mode 100644 index ab7f052a11..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/polywrap.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "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 deleted file mode 100644 index 4ed15fa713..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/polywrap.meta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "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 deleted file mode 100644 index baf49860be..0000000000 --- a/packages/js/validation/src/__tests__/wrappers/wrapper-size-over-100-kb/schema.graphql +++ /dev/null @@ -1,382 +0,0 @@ -### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @capability( - type: String! - uri: String! - namespace: String! -) repeatable on OBJECT - -directive @enabled_interface on OBJECT - -directive @annotate(type: String!) on FIELD - -### 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 index b23260071b..1192aace3c 100644 --- a/packages/js/validation/src/constants.ts +++ b/packages/js/validation/src/constants.ts @@ -1,11 +1,2 @@ export const WRAP_INFO = "wrap.info"; export const WRAP_WASM = "wrap.wasm"; -export const GRAPHQL_SCHEMA = "schema.graphql"; -export const META_MANIFEST = "polywrap.meta.json"; - -export const VALID_WRAP_FILE_NAMES = [ - WRAP_INFO, - WRAP_WASM, - GRAPHQL_SCHEMA, - META_MANIFEST, -]; diff --git a/packages/js/validation/src/types/ValidationFailReason.ts b/packages/js/validation/src/types/ValidationFailReason.ts index e6a8ed95b7..14b7e0155c 100644 --- a/packages/js/validation/src/types/ValidationFailReason.ts +++ b/packages/js/validation/src/types/ValidationFailReason.ts @@ -5,9 +5,9 @@ export enum ValidationFailReason { InvalidBuildManifest, InvalidMetaManifest, FileTooLarge, - WrapperTooLarge, + PackageTooLarge, ModuleTooLarge, - InvalidSchema, - SchemaNotFound, + InvalidAbi, + AbiNotFound, TooManyFiles, } diff --git a/packages/js/validation/src/types/WasmPackageValidator.ts b/packages/js/validation/src/types/WasmPackageValidator.ts index 7758698623..67f3931b5d 100644 --- a/packages/js/validation/src/types/WasmPackageValidator.ts +++ b/packages/js/validation/src/types/WasmPackageValidator.ts @@ -1,14 +1,14 @@ -import { GRAPHQL_SCHEMA, META_MANIFEST, WRAP_INFO, WRAP_WASM } from ".."; import { - WasmPackageConstraints, PackageReader, - ValidationResult, ValidationFailReason, -} from "."; + ValidationResult, + WasmPackageConstraints, + WRAP_INFO, + WRAP_WASM, +} from ".."; -import { parseSchema } from "@polywrap/schema-parse"; -import { WrapManifest, deserializeWrapManifest } from "@polywrap/core-js"; -// import { deserializeMetaManifest } from "polywrap"; +import { deserializeWrapManifest, WrapManifest } from "@polywrap/core-js"; +import { renderSchema } from "@polywrap/schema-compose"; import * as path from "path"; export class WasmPackageValidator { @@ -20,28 +20,24 @@ export class WasmPackageValidator { return infoResult; } - const schemaResult = await this.validateSchema(reader, GRAPHQL_SCHEMA); - if (!schemaResult.valid) { - return schemaResult; + const manifest = infoResult.manifest as WrapManifest; + const abiResult = await this.validateAbi(manifest); + if (!abiResult.valid) { + return abiResult; } - const moduleResult = await this.validateModule(reader, WRAP_WASM); + const moduleResult = await this.validateModule(reader, manifest); if (!moduleResult.valid) { return moduleResult; } - const metaResult = await this.validateMetaManifest(reader, META_MANIFEST); - if (!metaResult.valid) { - return metaResult; - } return this.success(); } private async validateStructure( - reader: PackageReader, - path: string + reader: PackageReader ): Promise { - const { result: pathResult } = await this.validatePath(reader, path, 0, 0); + const { result: pathResult } = await this.validatePath(reader, "./", 0, 0); if (!pathResult.valid) { return pathResult; @@ -67,7 +63,7 @@ export class WasmPackageValidator { currentSize += stats.size; if (currentSize > this.constraints.maxSize) { return { - result: this.fail(ValidationFailReason.WrapperTooLarge), + result: this.fail(ValidationFailReason.PackageTooLarge), currentSize, currentFileCnt, }; @@ -124,27 +120,36 @@ export class WasmPackageValidator { private async validateInfo( reader: PackageReader, name: string - ): Promise { - const info = await reader.readFile(name); - const manifest: WrapManifest | undefined = deserializeWrapManifest(info); - - if (!manifest) { + ): Promise { + if (!(await reader.exists(name))) { return this.fail(ValidationFailReason.WrapManifestNotFound); } - return this.success(); - } - private async validateSchema( - reader: PackageReader, - schemaFilePath: string - ): Promise { - if (!(await reader.exists(schemaFilePath))) { - return this.fail(ValidationFailReason.SchemaNotFound); + const structureResult = await this.validateStructure(reader); + if (!structureResult.valid) { + return structureResult; } + try { - parseSchema(await reader.readFileAsString(schemaFilePath)); + const info = await reader.readFile(name); + return { + valid: true, + manifest: deserializeWrapManifest(info), + }; + } catch (e) { + if (e.message.includes('instance requires property "abi"')) { + return this.fail(ValidationFailReason.AbiNotFound); + } + return this.fail(ValidationFailReason.InvalidWrapManifest); + } + } + + private async validateAbi(manifest: WrapManifest): Promise { + try { + // TODO(cbrzn): Just validate the structure of Abi with the JSON Schema and remove never + renderSchema(manifest.abi as never, false); } catch (err) { - return this.fail(ValidationFailReason.InvalidSchema, err); + return this.fail(ValidationFailReason.InvalidAbi, err); } return this.success(); @@ -152,41 +157,20 @@ export class WasmPackageValidator { private async validateModule( reader: PackageReader, - moduleFilePath: string | undefined + manifest: WrapManifest ): Promise { - if (!moduleFilePath) { + if (manifest.type === "interface") { return this.success(); } - const moduleSize = (await reader.getStats(moduleFilePath)).size; - - if (moduleSize > this.constraints.maxModuleSize) { + const module = await reader.getStats(WRAP_WASM); + if (module.size > this.constraints.maxModuleSize) { return this.fail(ValidationFailReason.ModuleTooLarge); } return this.success(); } - private async validateMetaManifest( - reader: PackageReader, - path: string - ): Promise { - if (await reader.exists(path)) { - const metaManifestFile = await reader.readFileAsString(path); - try { - console.log({ metaManifestFile }) - // deserializeMetaManifest(metaManifestFile); - // If folder manifest exists, check it - if (await reader.exists("./meta")) { - return await this.validateStructure(reader, "./meta"); - } - } catch (err) { - return this.fail(ValidationFailReason.InvalidMetaManifest, err); - } - } - return this.success(); - } - private success(): ValidationResult { return { valid: true, From 2d4b6a863e8d3756149221e6760179ee4274d2a9 Mon Sep 17 00:00:00 2001 From: cbrzn Date: Fri, 1 Jul 2022 16:50:38 +0200 Subject: [PATCH 19/46] chore: scripts & generate manifests moved into manifest-schema package --- packages/cli/package.json | 1 - packages/js/core/package.json | 3 +-- packages/js/core/src/wrap-manifests/deserialize.ts | 3 --- packages/js/core/src/wrap-manifests/index.ts | 2 -- .../polywrap/formats}/deserialize.ts | 0 .../polywrap/formats}/index.ts | 0 .../polywrap/formats/interfaces}/index.ts | 0 .../interfaces}/polywrap.app/0.0.1-prealpha.1.ts | 0 .../interfaces}/polywrap.app/0.0.1-prealpha.2.ts | 0 .../formats/interfaces}/polywrap.app/deserialize.ts | 0 .../formats/interfaces}/polywrap.app/index.ts | 0 .../formats/interfaces}/polywrap.app/migrate.ts | 0 .../0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts | 0 .../formats/interfaces}/polywrap.app/validate.ts | 0 .../interfaces}/polywrap.build/0.0.1-prealpha.1.ts | 0 .../interfaces}/polywrap.build/0.0.1-prealpha.2.ts | 0 .../interfaces}/polywrap.build/0.0.1-prealpha.3.ts | 0 .../interfaces}/polywrap.build/deserialize.ts | 0 .../formats/interfaces}/polywrap.build/index.ts | 0 .../formats/interfaces}/polywrap.build/migrate.ts | 0 .../0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts | 0 .../0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts | 0 .../formats/interfaces}/polywrap.build/validate.ts | 0 .../interfaces}/polywrap.deploy/0.0.1-prealpha.1.ts | 0 .../interfaces}/polywrap.deploy/deserialize.ts | 0 .../formats/interfaces}/polywrap.deploy/index.ts | 0 .../formats/interfaces}/polywrap.deploy/migrate.ts | 0 .../formats/interfaces}/polywrap.deploy/validate.ts | 0 .../interfaces}/polywrap.infra/0.0.1-prealpha.1.ts | 0 .../interfaces}/polywrap.infra/0.0.1-prealpha.2.ts | 0 .../interfaces}/polywrap.infra/deserialize.ts | 0 .../formats/interfaces}/polywrap.infra/index.ts | 0 .../formats/interfaces}/polywrap.infra/migrate.ts | 0 .../0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts | 0 .../formats/interfaces}/polywrap.infra/validate.ts | 0 .../interfaces}/polywrap.meta/0.0.1-prealpha.1.ts | 0 .../interfaces}/polywrap.meta/0.0.1-prealpha.2.ts | 0 .../interfaces}/polywrap.meta/0.0.1-prealpha.3.ts | 0 .../formats/interfaces}/polywrap.meta/deserialize.ts | 0 .../formats/interfaces}/polywrap.meta/index.ts | 0 .../formats/interfaces}/polywrap.meta/migrate.ts | 0 .../0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts | 0 .../0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts | 0 .../formats/interfaces}/polywrap.meta/validate.ts | 0 .../interfaces}/polywrap.plugin/0.0.1-prealpha.1.ts | 0 .../interfaces}/polywrap.plugin/0.0.1-prealpha.2.ts | 0 .../interfaces}/polywrap.plugin/0.0.1-prealpha.3.ts | 0 .../interfaces}/polywrap.plugin/deserialize.ts | 0 .../formats/interfaces}/polywrap.plugin/index.ts | 0 .../formats/interfaces}/polywrap.plugin/migrate.ts | 0 .../0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts | 0 .../0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts | 0 .../formats/interfaces}/polywrap.plugin/validate.ts | 0 .../formats/interfaces}/polywrap/0.0.1-prealpha.1.ts | 0 .../formats/interfaces}/polywrap/0.0.1-prealpha.2.ts | 0 .../formats/interfaces}/polywrap/0.0.1-prealpha.3.ts | 0 .../formats/interfaces}/polywrap/0.0.1-prealpha.4.ts | 0 .../formats/interfaces}/polywrap/0.0.1-prealpha.5.ts | 0 .../formats/interfaces}/polywrap/0.0.1-prealpha.6.ts | 0 .../formats/interfaces}/polywrap/0.0.1-prealpha.7.ts | 0 .../formats/interfaces}/polywrap/0.0.1-prealpha.8.ts | 0 .../formats/interfaces}/polywrap/0.0.1-prealpha.9.ts | 0 .../formats/interfaces}/polywrap/deserialize.ts | 0 .../polywrap/formats/interfaces}/polywrap/index.ts | 0 .../polywrap/formats/interfaces}/polywrap/migrate.ts | 0 .../0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts | 0 .../formats/interfaces}/polywrap/validate.ts | 0 .../{ => schemas}/polywrap.app/0.0.1-prealpha.1.json | 0 .../{ => schemas}/polywrap.app/0.0.1-prealpha.2.json | 0 .../polywrap.build/0.0.1-prealpha.1.json | 0 .../polywrap.build/0.0.1-prealpha.2.json | 0 .../polywrap.build/0.0.1-prealpha.3.json | 0 .../polywrap.deploy/0.0.1-prealpha.1.json | 0 .../polywrap.infra/0.0.1-prealpha.1.json | 0 .../polywrap.infra/0.0.1-prealpha.2.json | 0 .../polywrap.meta/0.0.1-prealpha.1.json | 0 .../polywrap.meta/0.0.1-prealpha.2.json | 0 .../polywrap.meta/0.0.1-prealpha.3.json | 0 .../polywrap.plugin/0.0.1-prealpha.1.json | 0 .../polywrap.plugin/0.0.1-prealpha.2.json | 0 .../polywrap.plugin/0.0.1-prealpha.3.json | 0 .../{ => schemas}/polywrap/0.0.1-prealpha.1.json | 0 .../{ => schemas}/polywrap/0.0.1-prealpha.2.json | 0 .../{ => schemas}/polywrap/0.0.1-prealpha.3.json | 0 .../{ => schemas}/polywrap/0.0.1-prealpha.4.json | 0 .../{ => schemas}/polywrap/0.0.1-prealpha.5.json | 0 .../{ => schemas}/polywrap/0.0.1-prealpha.6.json | 0 .../{ => schemas}/polywrap/0.0.1-prealpha.7.json | 0 .../{ => schemas}/polywrap/0.0.1-prealpha.8.json | 0 .../{ => schemas}/polywrap/0.0.1-prealpha.9.json | 0 .../polywrap/formats}/validators.ts | 0 .../polywrap/generateInterfaces.ts} | 9 +++------ packages/manifest-schemas/polywrap/package.json | 3 ++- .../polywrap}/templates/deserialize-ts.mustache | 0 .../polywrap}/templates/index-ts.mustache | 0 .../polywrap}/templates/migrate-ts.mustache | 0 .../polywrap}/templates/validate-ts.mustache | 0 .../wrap/formats/interfaces}/0.0.1.ts | 0 .../wrap/formats/interfaces}/deserialize.ts | 0 .../wrap/formats/interfaces}/index.ts | 0 .../wrap/formats/interfaces}/migrate.ts | 0 .../wrap/formats/interfaces}/validate.ts | 0 .../wrap/formats/{ => schemas}/wrap.info/0.0.1.json | 0 .../wrap/generateInterfaces.ts} | 8 ++------ packages/manifest-schemas/wrap/package.json | 3 ++- .../wrap}/templates/deserialize-ts.mustache | 0 .../wrap}/templates/index-ts.mustache | 0 .../wrap}/templates/migrate-ts.mustache | 0 .../wrap}/templates/validate-ts.mustache | 0 todo | 12 ------------ 117 files changed, 10 insertions(+), 34 deletions(-) delete mode 100644 packages/js/core/src/wrap-manifests/deserialize.ts delete mode 100644 packages/js/core/src/wrap-manifests/index.ts rename packages/{cli/src/lib/polywrap-manifests => manifest-schemas/polywrap/formats}/deserialize.ts (100%) rename packages/{cli/src/lib/polywrap-manifests => manifest-schemas/polywrap/formats}/index.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/index.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.app/0.0.1-prealpha.1.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.app/0.0.1-prealpha.2.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.app/deserialize.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.app/index.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.app/migrate.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.app/validate.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.build/0.0.1-prealpha.1.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.build/0.0.1-prealpha.2.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.build/0.0.1-prealpha.3.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.build/deserialize.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.build/index.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.build/migrate.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.build/validate.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.deploy/0.0.1-prealpha.1.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.deploy/deserialize.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.deploy/index.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.deploy/migrate.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.deploy/validate.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.infra/0.0.1-prealpha.1.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.infra/0.0.1-prealpha.2.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.infra/deserialize.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.infra/index.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.infra/migrate.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.infra/validate.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.meta/0.0.1-prealpha.1.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.meta/0.0.1-prealpha.2.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.meta/0.0.1-prealpha.3.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.meta/deserialize.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.meta/index.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.meta/migrate.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.meta/validate.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.plugin/0.0.1-prealpha.1.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.plugin/0.0.1-prealpha.2.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.plugin/0.0.1-prealpha.3.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.plugin/deserialize.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.plugin/index.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.plugin/migrate.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap.plugin/validate.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap/0.0.1-prealpha.1.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap/0.0.1-prealpha.2.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap/0.0.1-prealpha.3.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap/0.0.1-prealpha.4.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap/0.0.1-prealpha.5.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap/0.0.1-prealpha.6.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap/0.0.1-prealpha.7.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap/0.0.1-prealpha.8.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap/0.0.1-prealpha.9.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap/deserialize.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap/index.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap/migrate.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts (100%) rename packages/{cli/src/lib/polywrap-manifests/formats => manifest-schemas/polywrap/formats/interfaces}/polywrap/validate.ts (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap.app/0.0.1-prealpha.1.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap.app/0.0.1-prealpha.2.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap.build/0.0.1-prealpha.1.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap.build/0.0.1-prealpha.2.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap.build/0.0.1-prealpha.3.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap.deploy/0.0.1-prealpha.1.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap.infra/0.0.1-prealpha.1.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap.infra/0.0.1-prealpha.2.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap.meta/0.0.1-prealpha.1.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap.meta/0.0.1-prealpha.2.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap.meta/0.0.1-prealpha.3.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap.plugin/0.0.1-prealpha.1.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap.plugin/0.0.1-prealpha.2.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap.plugin/0.0.1-prealpha.3.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap/0.0.1-prealpha.1.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap/0.0.1-prealpha.2.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap/0.0.1-prealpha.3.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap/0.0.1-prealpha.4.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap/0.0.1-prealpha.5.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap/0.0.1-prealpha.6.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap/0.0.1-prealpha.7.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap/0.0.1-prealpha.8.json (100%) rename packages/manifest-schemas/polywrap/formats/{ => schemas}/polywrap/0.0.1-prealpha.9.json (100%) rename packages/{cli/src/lib/polywrap-manifests => manifest-schemas/polywrap/formats}/validators.ts (100%) rename packages/{cli/scripts/generatePolywrapManifestTypes.ts => manifest-schemas/polywrap/generateInterfaces.ts} (96%) rename packages/{cli/scripts => manifest-schemas/polywrap}/templates/deserialize-ts.mustache (100%) rename packages/{cli/scripts => manifest-schemas/polywrap}/templates/index-ts.mustache (100%) rename packages/{cli/scripts => manifest-schemas/polywrap}/templates/migrate-ts.mustache (100%) rename packages/{cli/scripts => manifest-schemas/polywrap}/templates/validate-ts.mustache (100%) rename packages/{js/core/src/wrap-manifests/formats => manifest-schemas/wrap/formats/interfaces}/0.0.1.ts (100%) rename packages/{js/core/src/wrap-manifests/formats => manifest-schemas/wrap/formats/interfaces}/deserialize.ts (100%) rename packages/{js/core/src/wrap-manifests/formats => manifest-schemas/wrap/formats/interfaces}/index.ts (100%) rename packages/{js/core/src/wrap-manifests/formats => manifest-schemas/wrap/formats/interfaces}/migrate.ts (100%) rename packages/{js/core/src/wrap-manifests/formats => manifest-schemas/wrap/formats/interfaces}/validate.ts (100%) rename packages/manifest-schemas/wrap/formats/{ => schemas}/wrap.info/0.0.1.json (100%) rename packages/{js/core/scripts/generateWrapManifestTypes.ts => manifest-schemas/wrap/generateInterfaces.ts} (95%) rename packages/{js/core/scripts => manifest-schemas/wrap}/templates/deserialize-ts.mustache (100%) rename packages/{js/core/scripts => manifest-schemas/wrap}/templates/index-ts.mustache (100%) rename packages/{js/core/scripts => manifest-schemas/wrap}/templates/migrate-ts.mustache (100%) rename packages/{js/core/scripts => manifest-schemas/wrap}/templates/validate-ts.mustache (100%) delete mode 100644 todo diff --git a/packages/cli/package.json b/packages/cli/package.json index c079acede0..9747e7f5f4 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -17,7 +17,6 @@ }, "scripts": { "build": "rimraf ./build && tsc --project tsconfig.build.json && yarn build:build-images && yarn build:deploy-modules && yarn build:infra-modules", - "build:polywrap-manifests": "ts-node ./scripts/generatePolywrapManifestTypes.ts", "build:build-images": "copyfiles ./src/lib/defaults/build-images/**/**/* ./build/lib/defaults/build-images/ -u 4", "build:deploy-modules": "copyfiles ./src/lib/defaults/deploy-modules/**/polywrap.deploy.ext.json ./build/lib/defaults/deploy-modules -u 4", "build:infra-modules": "ts-node ./scripts/copyfiles ./src/lib/defaults/infra-modules ./build/lib/defaults/infra-modules", diff --git a/packages/js/core/package.json b/packages/js/core/package.json index 33e866ef4d..8e5b7e4b69 100644 --- a/packages/js/core/package.json +++ b/packages/js/core/package.json @@ -12,8 +12,7 @@ "build" ], "scripts": { - "build": "rimraf ./build && yarn build:wrap-manifests && tsc --project tsconfig.build.json", - "build:wrap-manifests": "ts-node ./scripts/generateWrapManifestTypes.ts", + "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", diff --git a/packages/js/core/src/wrap-manifests/deserialize.ts b/packages/js/core/src/wrap-manifests/deserialize.ts deleted file mode 100644 index 8f9cc63150..0000000000 --- a/packages/js/core/src/wrap-manifests/deserialize.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface DeserializeManifestOptions { - noValidate?: boolean; -} diff --git a/packages/js/core/src/wrap-manifests/index.ts b/packages/js/core/src/wrap-manifests/index.ts deleted file mode 100644 index 041f37b508..0000000000 --- a/packages/js/core/src/wrap-manifests/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./formats"; -export * from "./deserialize"; diff --git a/packages/cli/src/lib/polywrap-manifests/deserialize.ts b/packages/manifest-schemas/polywrap/formats/deserialize.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/deserialize.ts rename to packages/manifest-schemas/polywrap/formats/deserialize.ts diff --git a/packages/cli/src/lib/polywrap-manifests/index.ts b/packages/manifest-schemas/polywrap/formats/index.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/index.ts rename to packages/manifest-schemas/polywrap/formats/index.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/index.ts b/packages/manifest-schemas/polywrap/formats/interfaces/index.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/index.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/index.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/0.0.1-prealpha.1.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/0.0.1-prealpha.1.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/0.0.1-prealpha.1.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/0.0.1-prealpha.1.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/0.0.1-prealpha.2.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/0.0.1-prealpha.2.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/0.0.1-prealpha.2.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/0.0.1-prealpha.2.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/deserialize.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/deserialize.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/deserialize.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/deserialize.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/index.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/index.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/index.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/index.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/migrate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/migrate.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/migrate.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/migrate.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/validate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/validate.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.app/validate.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/validate.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/0.0.1-prealpha.1.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/0.0.1-prealpha.1.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/0.0.1-prealpha.1.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/0.0.1-prealpha.1.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/0.0.1-prealpha.2.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/0.0.1-prealpha.2.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/0.0.1-prealpha.2.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/0.0.1-prealpha.2.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/0.0.1-prealpha.3.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/0.0.1-prealpha.3.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/0.0.1-prealpha.3.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/0.0.1-prealpha.3.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/deserialize.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/deserialize.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/deserialize.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/deserialize.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/index.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/index.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/index.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/index.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/migrate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/migrate.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/migrate.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/migrate.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/validate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/validate.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.build/validate.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/validate.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/0.0.1-prealpha.1.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/0.0.1-prealpha.1.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/0.0.1-prealpha.1.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/0.0.1-prealpha.1.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/deserialize.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/deserialize.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/deserialize.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/deserialize.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/index.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/index.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/index.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/index.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/migrate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/migrate.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/migrate.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/migrate.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/validate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/validate.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.deploy/validate.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/validate.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/0.0.1-prealpha.1.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/0.0.1-prealpha.1.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/0.0.1-prealpha.1.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/0.0.1-prealpha.1.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/0.0.1-prealpha.2.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/0.0.1-prealpha.2.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/0.0.1-prealpha.2.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/0.0.1-prealpha.2.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/deserialize.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/deserialize.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/deserialize.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/deserialize.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/index.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/index.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/index.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/index.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/migrate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/migrate.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/migrate.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/migrate.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/validate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/validate.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.infra/validate.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/validate.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/0.0.1-prealpha.1.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/0.0.1-prealpha.1.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/0.0.1-prealpha.1.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/0.0.1-prealpha.1.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/0.0.1-prealpha.2.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/0.0.1-prealpha.2.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/0.0.1-prealpha.2.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/0.0.1-prealpha.2.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/0.0.1-prealpha.3.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/0.0.1-prealpha.3.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/0.0.1-prealpha.3.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/0.0.1-prealpha.3.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/deserialize.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/deserialize.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/deserialize.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/deserialize.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/index.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/index.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/index.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/index.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/migrate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/migrate.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/migrate.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/migrate.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/validate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/validate.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.meta/validate.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/validate.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/0.0.1-prealpha.1.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/0.0.1-prealpha.1.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/0.0.1-prealpha.1.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/0.0.1-prealpha.1.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/0.0.1-prealpha.2.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/0.0.1-prealpha.2.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/0.0.1-prealpha.2.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/0.0.1-prealpha.2.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/0.0.1-prealpha.3.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/0.0.1-prealpha.3.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/0.0.1-prealpha.3.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/0.0.1-prealpha.3.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/deserialize.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/deserialize.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/deserialize.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/deserialize.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/index.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/index.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/index.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/index.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/migrate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/migrate.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/migrate.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/migrate.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/validate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/validate.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap.plugin/validate.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/validate.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.1.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.1.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.1.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.1.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.2.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.2.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.2.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.2.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.3.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.3.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.3.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.3.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.4.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.4.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.4.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.4.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.5.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.5.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.5.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.5.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.6.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.6.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.6.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.6.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.7.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.7.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.7.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.7.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.8.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.8.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.8.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.8.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.9.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.9.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap/0.0.1-prealpha.9.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.9.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/deserialize.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/deserialize.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap/deserialize.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap/deserialize.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/index.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/index.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap/index.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap/index.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrate.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrate.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrate.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts diff --git a/packages/cli/src/lib/polywrap-manifests/formats/polywrap/validate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/validate.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/formats/polywrap/validate.ts rename to packages/manifest-schemas/polywrap/formats/interfaces/polywrap/validate.ts diff --git a/packages/manifest-schemas/polywrap/formats/polywrap.app/0.0.1-prealpha.1.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap.app/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap.app/0.0.1-prealpha.1.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap.app/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap.app/0.0.1-prealpha.2.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap.app/0.0.1-prealpha.2.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap.app/0.0.1-prealpha.2.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap.app/0.0.1-prealpha.2.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap.build/0.0.1-prealpha.1.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap.build/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap.build/0.0.1-prealpha.1.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap.build/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap.build/0.0.1-prealpha.2.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap.build/0.0.1-prealpha.2.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap.build/0.0.1-prealpha.2.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap.build/0.0.1-prealpha.2.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap.build/0.0.1-prealpha.3.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap.build/0.0.1-prealpha.3.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap.build/0.0.1-prealpha.3.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap.build/0.0.1-prealpha.3.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap.deploy/0.0.1-prealpha.1.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap.deploy/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap.deploy/0.0.1-prealpha.1.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap.deploy/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap.infra/0.0.1-prealpha.1.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap.infra/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap.infra/0.0.1-prealpha.1.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap.infra/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap.infra/0.0.1-prealpha.2.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap.infra/0.0.1-prealpha.2.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap.infra/0.0.1-prealpha.2.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap.infra/0.0.1-prealpha.2.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap.meta/0.0.1-prealpha.1.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap.meta/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap.meta/0.0.1-prealpha.1.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap.meta/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap.meta/0.0.1-prealpha.2.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap.meta/0.0.1-prealpha.2.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap.meta/0.0.1-prealpha.2.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap.meta/0.0.1-prealpha.2.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap.meta/0.0.1-prealpha.3.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap.meta/0.0.1-prealpha.3.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap.meta/0.0.1-prealpha.3.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap.meta/0.0.1-prealpha.3.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap.plugin/0.0.1-prealpha.1.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap.plugin/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap.plugin/0.0.1-prealpha.1.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap.plugin/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap.plugin/0.0.1-prealpha.2.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap.plugin/0.0.1-prealpha.2.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap.plugin/0.0.1-prealpha.2.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap.plugin/0.0.1-prealpha.2.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap.plugin/0.0.1-prealpha.3.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap.plugin/0.0.1-prealpha.3.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap.plugin/0.0.1-prealpha.3.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap.plugin/0.0.1-prealpha.3.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.1.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.1.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.2.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.2.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.2.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.2.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.3.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.3.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.3.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.3.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.4.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.4.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.4.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.4.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.5.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.5.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.5.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.5.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.6.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.6.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.6.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.6.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.7.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.7.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.7.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.7.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.8.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.8.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.8.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.8.json diff --git a/packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.9.json b/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.9.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/polywrap/0.0.1-prealpha.9.json rename to packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.9.json diff --git a/packages/cli/src/lib/polywrap-manifests/validators.ts b/packages/manifest-schemas/polywrap/formats/validators.ts similarity index 100% rename from packages/cli/src/lib/polywrap-manifests/validators.ts rename to packages/manifest-schemas/polywrap/formats/validators.ts diff --git a/packages/cli/scripts/generatePolywrapManifestTypes.ts b/packages/manifest-schemas/polywrap/generateInterfaces.ts similarity index 96% rename from packages/cli/scripts/generatePolywrapManifestTypes.ts rename to packages/manifest-schemas/polywrap/generateInterfaces.ts index 4aa1dedc91..0212867863 100644 --- a/packages/cli/scripts/generatePolywrapManifestTypes.ts +++ b/packages/manifest-schemas/polywrap/generateInterfaces.ts @@ -5,11 +5,8 @@ import Mustache from "mustache"; import * as JsonSchema from "json-schema-to-typescript"; async function generateFormatTypes() { - // Fetch all schemas within the @polywrap/polywrap-manifest-schemas/formats directory - const formatsDir = path.join( - path.dirname(require.resolve("@polywrap/polywrap-manifest-schemas")), - "formats" - ); + // Fetch all schemas within the @polywrap/polywrap-manifest-schemas/schemas/formats directory + const formatsDir = path.join(__dirname, "formats/schemas"); // Get all format types (wasm, build, infra, app, plugin, etc) const formatTypes = fs @@ -22,7 +19,7 @@ async function generateFormatTypes() { const formatTypeDir = path.join(formatsDir, formatTypeName); const formatOutputDir = path.join( __dirname, - `/../src/lib/polywrap-manifests/formats/${formatTypeName}` + `./interfaces/${formatTypeName}` ); const formatModules = []; diff --git a/packages/manifest-schemas/polywrap/package.json b/packages/manifest-schemas/polywrap/package.json index d0a9e3cfd7..cfe5736dab 100644 --- a/packages/manifest-schemas/polywrap/package.json +++ b/packages/manifest-schemas/polywrap/package.json @@ -9,7 +9,8 @@ }, "main": "./package.json", "scripts": { - "lint": "eslint --color -c ../../.eslintrc.js ." + "lint": "eslint --color -c ../../.eslintrc.js .", + "build": "node generateInterfaces.ts" }, "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", "publishConfig": { diff --git a/packages/cli/scripts/templates/deserialize-ts.mustache b/packages/manifest-schemas/polywrap/templates/deserialize-ts.mustache similarity index 100% rename from packages/cli/scripts/templates/deserialize-ts.mustache rename to packages/manifest-schemas/polywrap/templates/deserialize-ts.mustache diff --git a/packages/cli/scripts/templates/index-ts.mustache b/packages/manifest-schemas/polywrap/templates/index-ts.mustache similarity index 100% rename from packages/cli/scripts/templates/index-ts.mustache rename to packages/manifest-schemas/polywrap/templates/index-ts.mustache diff --git a/packages/cli/scripts/templates/migrate-ts.mustache b/packages/manifest-schemas/polywrap/templates/migrate-ts.mustache similarity index 100% rename from packages/cli/scripts/templates/migrate-ts.mustache rename to packages/manifest-schemas/polywrap/templates/migrate-ts.mustache diff --git a/packages/cli/scripts/templates/validate-ts.mustache b/packages/manifest-schemas/polywrap/templates/validate-ts.mustache similarity index 100% rename from packages/cli/scripts/templates/validate-ts.mustache rename to packages/manifest-schemas/polywrap/templates/validate-ts.mustache diff --git a/packages/js/core/src/wrap-manifests/formats/0.0.1.ts b/packages/manifest-schemas/wrap/formats/interfaces/0.0.1.ts similarity index 100% rename from packages/js/core/src/wrap-manifests/formats/0.0.1.ts rename to packages/manifest-schemas/wrap/formats/interfaces/0.0.1.ts diff --git a/packages/js/core/src/wrap-manifests/formats/deserialize.ts b/packages/manifest-schemas/wrap/formats/interfaces/deserialize.ts similarity index 100% rename from packages/js/core/src/wrap-manifests/formats/deserialize.ts rename to packages/manifest-schemas/wrap/formats/interfaces/deserialize.ts diff --git a/packages/js/core/src/wrap-manifests/formats/index.ts b/packages/manifest-schemas/wrap/formats/interfaces/index.ts similarity index 100% rename from packages/js/core/src/wrap-manifests/formats/index.ts rename to packages/manifest-schemas/wrap/formats/interfaces/index.ts diff --git a/packages/js/core/src/wrap-manifests/formats/migrate.ts b/packages/manifest-schemas/wrap/formats/interfaces/migrate.ts similarity index 100% rename from packages/js/core/src/wrap-manifests/formats/migrate.ts rename to packages/manifest-schemas/wrap/formats/interfaces/migrate.ts diff --git a/packages/js/core/src/wrap-manifests/formats/validate.ts b/packages/manifest-schemas/wrap/formats/interfaces/validate.ts similarity index 100% rename from packages/js/core/src/wrap-manifests/formats/validate.ts rename to packages/manifest-schemas/wrap/formats/interfaces/validate.ts diff --git a/packages/manifest-schemas/wrap/formats/wrap.info/0.0.1.json b/packages/manifest-schemas/wrap/formats/schemas/wrap.info/0.0.1.json similarity index 100% rename from packages/manifest-schemas/wrap/formats/wrap.info/0.0.1.json rename to packages/manifest-schemas/wrap/formats/schemas/wrap.info/0.0.1.json diff --git a/packages/js/core/scripts/generateWrapManifestTypes.ts b/packages/manifest-schemas/wrap/generateInterfaces.ts similarity index 95% rename from packages/js/core/scripts/generateWrapManifestTypes.ts rename to packages/manifest-schemas/wrap/generateInterfaces.ts index 72886ea93e..a12d94020d 100644 --- a/packages/js/core/scripts/generateWrapManifestTypes.ts +++ b/packages/manifest-schemas/wrap/generateInterfaces.ts @@ -6,12 +6,8 @@ import { compile } from "json-schema-to-typescript" async function generateFormatTypes() { // Fetch all schemas within the @polywrap/wrap-manifest-schemas/formats directory - const formatsDir = path.join( - path.dirname(require.resolve("@polywrap/wrap-manifest-schemas")), - "formats/wrap.info" - ); - - const formatOutputDir = path.join(__dirname, `/../src/wrap-manifests/formats`); + const formatsDir = path.join(__dirname, "formats/schemas/wrap.info"); + const formatOutputDir = path.join(__dirname, `./interfaces`); // Get all JSON schemas for this format type (0.0.1, 0.0.2, etc) const formatSchemaFiles = fs.readdirSync(formatsDir); diff --git a/packages/manifest-schemas/wrap/package.json b/packages/manifest-schemas/wrap/package.json index 08166001d2..56812e10e2 100644 --- a/packages/manifest-schemas/wrap/package.json +++ b/packages/manifest-schemas/wrap/package.json @@ -9,7 +9,8 @@ }, "main": "./package.json", "scripts": { - "lint": "eslint --color -c ../../.eslintrc.js ." + "lint": "eslint --color -c ../../.eslintrc.js .", + "build": "node generateInterfaces.ts" }, "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", "publishConfig": { diff --git a/packages/js/core/scripts/templates/deserialize-ts.mustache b/packages/manifest-schemas/wrap/templates/deserialize-ts.mustache similarity index 100% rename from packages/js/core/scripts/templates/deserialize-ts.mustache rename to packages/manifest-schemas/wrap/templates/deserialize-ts.mustache diff --git a/packages/js/core/scripts/templates/index-ts.mustache b/packages/manifest-schemas/wrap/templates/index-ts.mustache similarity index 100% rename from packages/js/core/scripts/templates/index-ts.mustache rename to packages/manifest-schemas/wrap/templates/index-ts.mustache diff --git a/packages/js/core/scripts/templates/migrate-ts.mustache b/packages/manifest-schemas/wrap/templates/migrate-ts.mustache similarity index 100% rename from packages/js/core/scripts/templates/migrate-ts.mustache rename to packages/manifest-schemas/wrap/templates/migrate-ts.mustache diff --git a/packages/js/core/scripts/templates/validate-ts.mustache b/packages/manifest-schemas/wrap/templates/validate-ts.mustache similarity index 100% rename from packages/js/core/scripts/templates/validate-ts.mustache rename to packages/manifest-schemas/wrap/templates/validate-ts.mustache diff --git a/todo b/todo deleted file mode 100644 index 2ed41fd142..0000000000 --- a/todo +++ /dev/null @@ -1,12 +0,0 @@ -1- update invocation to support wrap.info instead of polywrap.json -2- update uri resolvers to search for wrap.info - - -# Jordan -- Review: -- - manifests -- - core -- - client -- - wasmwrapper -- - pluginwrapper -- Add wrapper side of "getManifest" From fb3109610b865cc67c3ece5c75609f0efc9ee8cb Mon Sep 17 00:00:00 2001 From: cbrzn Date: Fri, 1 Jul 2022 17:59:48 +0200 Subject: [PATCH 20/46] chore(manifests/polywrap): script and templates moved to manifests folder --- .../manifest-schemas/polywrap/formats/index.ts | 2 +- .../interfaces/polywrap.app/validate.ts | 4 ++-- .../interfaces/polywrap.build/validate.ts | 6 +++--- .../interfaces/polywrap.deploy/validate.ts | 2 +- .../interfaces/polywrap.infra/validate.ts | 4 ++-- .../interfaces/polywrap.meta/validate.ts | 6 +++--- .../interfaces/polywrap.plugin/validate.ts | 6 +++--- .../formats/interfaces/polywrap/validate.ts | 18 +++++++++--------- .../{generateInterfaces.ts => generator.ts} | 2 +- .../manifest-schemas/polywrap/package.json | 7 +++++-- .../polywrap/templates/validate-ts.mustache | 2 +- .../manifest-schemas/polywrap/tsconfig.json | 12 ++++++++++++ .../{generateInterfaces.ts => generator.ts} | 0 packages/manifest-schemas/wrap/package.json | 9 ++++++--- .../wrap/templates/validate-ts.mustache | 2 +- packages/manifest-schemas/wrap/tsconfig.json | 12 ++++++++++++ 16 files changed, 62 insertions(+), 32 deletions(-) rename packages/manifest-schemas/polywrap/{generateInterfaces.ts => generator.ts} (99%) create mode 100644 packages/manifest-schemas/polywrap/tsconfig.json rename packages/manifest-schemas/wrap/{generateInterfaces.ts => generator.ts} (100%) create mode 100644 packages/manifest-schemas/wrap/tsconfig.json diff --git a/packages/manifest-schemas/polywrap/formats/index.ts b/packages/manifest-schemas/polywrap/formats/index.ts index 041f37b508..7893a41703 100644 --- a/packages/manifest-schemas/polywrap/formats/index.ts +++ b/packages/manifest-schemas/polywrap/formats/index.ts @@ -1,2 +1,2 @@ -export * from "./formats"; +export * from "./interfaces"; export * from "./deserialize"; diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/validate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/validate.ts index 77a61dc5cf..1b44242415 100644 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/validate.ts +++ b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/validate.ts @@ -9,8 +9,8 @@ import { AppManifestFormats } from "."; import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.app/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.app/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.app/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.app/0.0.1-prealpha.2.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/validate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/validate.ts index 1c7f950b8e..65e7dfca84 100644 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/validate.ts +++ b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/validate.ts @@ -9,9 +9,9 @@ import { BuildManifestFormats } from "."; import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.build/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.build/0.0.1-prealpha.2.json"; -import schema_0_0_1_prealpha_3 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.build/0.0.1-prealpha.3.json"; +import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.build/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.build/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_3 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.build/0.0.1-prealpha.3.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/validate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/validate.ts index 88917c33e6..08440e68df 100644 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/validate.ts +++ b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/validate.ts @@ -9,7 +9,7 @@ import { DeployManifestFormats } from "."; import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.deploy/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.deploy/0.0.1-prealpha.1.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/validate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/validate.ts index 2bead1d7e0..3c3552fed3 100644 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/validate.ts +++ b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/validate.ts @@ -9,8 +9,8 @@ import { InfraManifestFormats } from "."; -import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.infra/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.infra/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.infra/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.infra/0.0.1-prealpha.2.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/validate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/validate.ts index fc146009e5..f06b9f802e 100644 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/validate.ts +++ b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/validate.ts @@ -9,9 +9,9 @@ import { MetaManifestFormats } from "."; import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.2.json"; -import schema_0_0_1_prealpha_3 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.3.json"; +import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.meta/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.meta/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_3 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.meta/0.0.1-prealpha.3.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/validate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/validate.ts index f489afae30..6eff52d0c3 100644 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/validate.ts +++ b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/validate.ts @@ -9,9 +9,9 @@ import { PluginManifestFormats } from "."; import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.2.json"; -import schema_0_0_1_prealpha_3 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.3.json"; +import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.plugin/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.plugin/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_3 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.plugin/0.0.1-prealpha.3.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/validate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/validate.ts index 554464f79c..b51300260b 100644 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/validate.ts +++ b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/validate.ts @@ -9,15 +9,15 @@ import { PolywrapManifestFormats } from "."; import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.2.json"; -import schema_0_0_1_prealpha_3 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.3.json"; -import schema_0_0_1_prealpha_4 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.4.json"; -import schema_0_0_1_prealpha_5 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.5.json"; -import schema_0_0_1_prealpha_6 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.6.json"; -import schema_0_0_1_prealpha_7 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.7.json"; -import schema_0_0_1_prealpha_8 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.8.json"; -import schema_0_0_1_prealpha_9 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.9.json"; +import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_3 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap/0.0.1-prealpha.3.json"; +import schema_0_0_1_prealpha_4 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap/0.0.1-prealpha.4.json"; +import schema_0_0_1_prealpha_5 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap/0.0.1-prealpha.5.json"; +import schema_0_0_1_prealpha_6 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap/0.0.1-prealpha.6.json"; +import schema_0_0_1_prealpha_7 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap/0.0.1-prealpha.7.json"; +import schema_0_0_1_prealpha_8 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap/0.0.1-prealpha.8.json"; +import schema_0_0_1_prealpha_9 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap/0.0.1-prealpha.9.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/manifest-schemas/polywrap/generateInterfaces.ts b/packages/manifest-schemas/polywrap/generator.ts similarity index 99% rename from packages/manifest-schemas/polywrap/generateInterfaces.ts rename to packages/manifest-schemas/polywrap/generator.ts index 0212867863..3a5cc9f1dd 100644 --- a/packages/manifest-schemas/polywrap/generateInterfaces.ts +++ b/packages/manifest-schemas/polywrap/generator.ts @@ -19,7 +19,7 @@ async function generateFormatTypes() { const formatTypeDir = path.join(formatsDir, formatTypeName); const formatOutputDir = path.join( __dirname, - `./interfaces/${formatTypeName}` + `./formats/interfaces/${formatTypeName}` ); const formatModules = []; diff --git a/packages/manifest-schemas/polywrap/package.json b/packages/manifest-schemas/polywrap/package.json index cfe5736dab..2609336220 100644 --- a/packages/manifest-schemas/polywrap/package.json +++ b/packages/manifest-schemas/polywrap/package.json @@ -7,10 +7,13 @@ "type": "git", "url": "https://github.com/polywrap/monorepo.git" }, - "main": "./package.json", + "main": "./build/index.js", "scripts": { "lint": "eslint --color -c ../../.eslintrc.js .", - "build": "node generateInterfaces.ts" + "build": "ts-node generator.ts && tsc" + }, + "devDependencies": { + "ts-node": "8.10.2" }, "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", "publishConfig": { diff --git a/packages/manifest-schemas/polywrap/templates/validate-ts.mustache b/packages/manifest-schemas/polywrap/templates/validate-ts.mustache index 635e024f27..8947fdb999 100644 --- a/packages/manifest-schemas/polywrap/templates/validate-ts.mustache +++ b/packages/manifest-schemas/polywrap/templates/validate-ts.mustache @@ -10,7 +10,7 @@ import { } from "."; {{#validators.length}}import * as Validators from "../../validators";{{/validators.length}} {{#formats}} -import schema_{{tsVersion}} from "@polywrap/polywrap-manifest-schemas/formats/{{dir}}/{{version}}.json"; +import schema_{{tsVersion}} from "@polywrap/polywrap-manifest-schemas/formats/schemas/{{dir}}/{{version}}.json"; {{/formats}} import { Tracer } from "@polywrap/tracing-js" diff --git a/packages/manifest-schemas/polywrap/tsconfig.json b/packages/manifest-schemas/polywrap/tsconfig.json new file mode 100644 index 0000000000..dbd71ca0b5 --- /dev/null +++ b/packages/manifest-schemas/polywrap/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "outDir": "build" + }, + "include": [ + "./formats/**/*.ts" + ], + "exclude": [ + "./formats/validators.ts", + "./formats/schemas" + ]} diff --git a/packages/manifest-schemas/wrap/generateInterfaces.ts b/packages/manifest-schemas/wrap/generator.ts similarity index 100% rename from packages/manifest-schemas/wrap/generateInterfaces.ts rename to packages/manifest-schemas/wrap/generator.ts diff --git a/packages/manifest-schemas/wrap/package.json b/packages/manifest-schemas/wrap/package.json index 56812e10e2..8e12e8608a 100644 --- a/packages/manifest-schemas/wrap/package.json +++ b/packages/manifest-schemas/wrap/package.json @@ -1,16 +1,19 @@ { "name": "@polywrap/wrap-manifest-schemas", - "description": "WRAP Manifest Schemas", + "description": "Polywrap Manifest Schemas", "version": "0.0.1-prealpha.91", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/polywrap/monorepo.git" }, - "main": "./package.json", + "main": "./build/index.js", "scripts": { "lint": "eslint --color -c ../../.eslintrc.js .", - "build": "node generateInterfaces.ts" + "build": "ts-node generator.ts && tsc" + }, + "devDependencies": { + "ts-node": "8.10.2" }, "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", "publishConfig": { diff --git a/packages/manifest-schemas/wrap/templates/validate-ts.mustache b/packages/manifest-schemas/wrap/templates/validate-ts.mustache index 1e753ec3aa..52233095c4 100644 --- a/packages/manifest-schemas/wrap/templates/validate-ts.mustache +++ b/packages/manifest-schemas/wrap/templates/validate-ts.mustache @@ -10,7 +10,7 @@ import { } from "."; {{#validators.length}}import * as Validators from "../validators";{{/validators.length}} {{#formats}} -import schema_{{tsVersion}} from "@polywrap/wrap-manifest-schemas/formats/wrap.info/{{version}}.json"; +import schema_{{tsVersion}} from "@polywrap/wrap-manifest-schemas/formats/schemas/wrap.info/{{version}}.json"; {{/formats}} import { Tracer } from "@polywrap/tracing-js" diff --git a/packages/manifest-schemas/wrap/tsconfig.json b/packages/manifest-schemas/wrap/tsconfig.json new file mode 100644 index 0000000000..dbd71ca0b5 --- /dev/null +++ b/packages/manifest-schemas/wrap/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "outDir": "build" + }, + "include": [ + "./formats/**/*.ts" + ], + "exclude": [ + "./formats/validators.ts", + "./formats/schemas" + ]} From fe30a2f89836d398bf05635f8cbcf8c746cf8c6b Mon Sep 17 00:00:00 2001 From: cbrzn Date: Fri, 1 Jul 2022 18:30:07 +0200 Subject: [PATCH 21/46] chore(manifest/wrap): scripts & templates migrated --- packages/cli/src/commands/deploy.ts | 8 ++++---- packages/js/core/package.json | 2 +- .../resolvers/extendable/UriResolverWrapper.ts | 5 ++--- packages/manifest-schemas/wrap/formats/deserialize.ts | 3 +++ packages/manifest-schemas/wrap/formats/index.ts | 2 ++ .../wrap/formats/interfaces/deserialize.ts | 2 +- .../manifest-schemas/wrap/formats/interfaces/validate.ts | 2 +- packages/manifest-schemas/wrap/generator.ts | 2 +- packages/manifest-schemas/wrap/package.json | 3 +++ .../wrap/templates/deserialize-ts.mustache | 2 +- 10 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 packages/manifest-schemas/wrap/formats/deserialize.ts create mode 100644 packages/manifest-schemas/wrap/formats/index.ts diff --git a/packages/cli/src/commands/deploy.ts b/packages/cli/src/commands/deploy.ts index 1f113cecc8..0acb4714b1 100644 --- a/packages/cli/src/commands/deploy.ts +++ b/packages/cli/src/commands/deploy.ts @@ -1,4 +1,7 @@ /* eslint-disable prefer-const */ +import { DeployerHandler } from "../lib/deploy/deployer"; +import { Command, Program } from "./types"; + import { intlMsg, PolywrapProject, @@ -6,10 +9,7 @@ import { DeployPackage, DeployManifest, parseWasmManifestFileOption, -} from "../lib"; -import { DeployerHandler } from "../lib/deploy/deployer"; -import { Command, Program } from "./types"; - +} from "@polywrap/polywrap-manifest-schemas"; import fs from "fs"; import nodePath from "path"; import { print } from "gluegun"; diff --git a/packages/js/core/package.json b/packages/js/core/package.json index 8e5b7e4b69..ba1316da5d 100644 --- a/packages/js/core/package.json +++ b/packages/js/core/package.json @@ -12,7 +12,7 @@ "build" ], "scripts": { - "build": "rimraf ./build && tsc --project tsconfig.build.json", + "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", diff --git a/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts b/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts index 39607dfe8f..09388664e5 100644 --- a/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts +++ b/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts @@ -7,11 +7,11 @@ import { } from "../../core"; import { CreateWrapperFunc } from "./types/CreateWrapperFunc"; import { getEnvFromUriOrResolutionStack } from "../getEnvFromUriOrResolutionStack"; + import { DeserializeManifestOptions, deserializeWrapManifest, -} from "../../../wrap-manifests"; - +} from "@polywrap/wrap-manifest-schemas"; import { Tracer } from "@polywrap/tracing-js"; export class UriResolverWrapper implements UriResolver { @@ -50,7 +50,6 @@ export class UriResolverWrapper implements UriResolver { } else if (result.manifest) { // We've found our manifest at the current implementation, // meaning the URI resolver can also be used as an Wrapper resolver - console.log({ result }); const manifest = deserializeWrapManifest( result.manifest, this.deserializeOptions diff --git a/packages/manifest-schemas/wrap/formats/deserialize.ts b/packages/manifest-schemas/wrap/formats/deserialize.ts new file mode 100644 index 0000000000..6f411a2b97 --- /dev/null +++ b/packages/manifest-schemas/wrap/formats/deserialize.ts @@ -0,0 +1,3 @@ +export interface DeserializeManifestOptions { + noValidate?: boolean; +} \ No newline at end of file diff --git a/packages/manifest-schemas/wrap/formats/index.ts b/packages/manifest-schemas/wrap/formats/index.ts new file mode 100644 index 0000000000..c7460f35d2 --- /dev/null +++ b/packages/manifest-schemas/wrap/formats/index.ts @@ -0,0 +1,2 @@ +export * from "./interfaces"; +export * from "./deserialize"; \ No newline at end of file diff --git a/packages/manifest-schemas/wrap/formats/interfaces/deserialize.ts b/packages/manifest-schemas/wrap/formats/interfaces/deserialize.ts index 16581e6be7..fdf973c283 100644 --- a/packages/manifest-schemas/wrap/formats/interfaces/deserialize.ts +++ b/packages/manifest-schemas/wrap/formats/interfaces/deserialize.ts @@ -13,9 +13,9 @@ import { latestWrapManifestVersion, } from "."; import { DeserializeManifestOptions } from "../"; -import { msgpackDecode } from "../../"; import { compare } from "semver"; +import { msgpackDecode } from "@polywrap/core-js"; import { Tracer } from "@polywrap/tracing-js"; export const deserializeWrapManifest = Tracer.traceFunc( diff --git a/packages/manifest-schemas/wrap/formats/interfaces/validate.ts b/packages/manifest-schemas/wrap/formats/interfaces/validate.ts index 8e71a693fb..81f70acd06 100644 --- a/packages/manifest-schemas/wrap/formats/interfaces/validate.ts +++ b/packages/manifest-schemas/wrap/formats/interfaces/validate.ts @@ -9,7 +9,7 @@ import { WrapManifestVersions } from "."; -import schema_0_0_1 from "@polywrap/wrap-manifest-schemas/formats/wrap.info/0.0.1.json"; +import schema_0_0_1 from "@polywrap/wrap-manifest-schemas/formats/schemas/wrap.info/0.0.1.json"; import { Tracer } from "@polywrap/tracing-js" import { diff --git a/packages/manifest-schemas/wrap/generator.ts b/packages/manifest-schemas/wrap/generator.ts index a12d94020d..88bce43c40 100644 --- a/packages/manifest-schemas/wrap/generator.ts +++ b/packages/manifest-schemas/wrap/generator.ts @@ -7,7 +7,7 @@ import { compile } from "json-schema-to-typescript" async function generateFormatTypes() { // Fetch all schemas within the @polywrap/wrap-manifest-schemas/formats directory const formatsDir = path.join(__dirname, "formats/schemas/wrap.info"); - const formatOutputDir = path.join(__dirname, `./interfaces`); + const formatOutputDir = path.join(__dirname, `./formats/interfaces`); // Get all JSON schemas for this format type (0.0.1, 0.0.2, etc) const formatSchemaFiles = fs.readdirSync(formatsDir); diff --git a/packages/manifest-schemas/wrap/package.json b/packages/manifest-schemas/wrap/package.json index 8e12e8608a..16b09ea5b4 100644 --- a/packages/manifest-schemas/wrap/package.json +++ b/packages/manifest-schemas/wrap/package.json @@ -12,6 +12,9 @@ "lint": "eslint --color -c ../../.eslintrc.js .", "build": "ts-node generator.ts && tsc" }, + "dependencies": { + "@polywrap/core-js": "0.0.1-prealpha.91" + }, "devDependencies": { "ts-node": "8.10.2" }, diff --git a/packages/manifest-schemas/wrap/templates/deserialize-ts.mustache b/packages/manifest-schemas/wrap/templates/deserialize-ts.mustache index 16581e6be7..fdf973c283 100644 --- a/packages/manifest-schemas/wrap/templates/deserialize-ts.mustache +++ b/packages/manifest-schemas/wrap/templates/deserialize-ts.mustache @@ -13,9 +13,9 @@ import { latestWrapManifestVersion, } from "."; import { DeserializeManifestOptions } from "../"; -import { msgpackDecode } from "../../"; import { compare } from "semver"; +import { msgpackDecode } from "@polywrap/core-js"; import { Tracer } from "@polywrap/tracing-js"; export const deserializeWrapManifest = Tracer.traceFunc( From 62b8d567921c97194da99b75d205a1dc149cbd45 Mon Sep 17 00:00:00 2001 From: cbrzn Date: Fri, 1 Jul 2022 18:52:00 +0200 Subject: [PATCH 22/46] chore: refactor in progress --- .../src/lib/defaults/build-images/wasm/rust/index.ts | 2 +- packages/cli/src/lib/helpers/metadata.ts | 2 +- packages/cli/src/lib/index.ts | 1 - packages/cli/src/lib/infra/Infra.ts | 2 +- packages/cli/src/lib/project/AppProject.ts | 2 +- packages/cli/src/lib/project/PluginProject.ts | 2 +- packages/cli/src/lib/project/PolywrapProject.ts | 10 +++++----- packages/cli/src/lib/project/manifests/app/load.ts | 4 ++-- packages/cli/src/lib/project/manifests/plugin/load.ts | 4 ++-- .../cli/src/lib/project/manifests/polywrap/load.ts | 2 +- packages/js/core/package.json | 2 +- packages/js/core/src/index.ts | 1 - packages/js/core/src/types/Client.ts | 3 ++- packages/js/core/src/types/Wrapper.ts | 2 +- packages/js/core/tsconfig.build.json | 2 +- .../wrap/formats/interfaces/deserialize.ts | 5 ++--- packages/manifest-schemas/wrap/package.json | 3 --- .../wrap/templates/deserialize-ts.mustache | 5 ++--- 18 files changed, 24 insertions(+), 30 deletions(-) diff --git a/packages/cli/src/lib/defaults/build-images/wasm/rust/index.ts b/packages/cli/src/lib/defaults/build-images/wasm/rust/index.ts index 3c16c259a1..b3f3749af4 100644 --- a/packages/cli/src/lib/defaults/build-images/wasm/rust/index.ts +++ b/packages/cli/src/lib/defaults/build-images/wasm/rust/index.ts @@ -1,7 +1,7 @@ import { CompilerOverrides } from "../../../../Compiler"; import { intlMsg } from "../../../../intl"; -import { PolywrapManifest } from "../../../../polywrap-manifests"; +import { PolywrapManifest } from "@polywrap/polywrap-manifest-schemas"; export function getCompilerOverrides(): CompilerOverrides { return { diff --git a/packages/cli/src/lib/helpers/metadata.ts b/packages/cli/src/lib/helpers/metadata.ts index 934f2d244e..b9b0727139 100644 --- a/packages/cli/src/lib/helpers/metadata.ts +++ b/packages/cli/src/lib/helpers/metadata.ts @@ -2,7 +2,7 @@ import { withSpinner } from "./"; import { displayPath, intlMsg } from "../"; import { normalizePath } from "@polywrap/os-js"; -import { MetaManifest } from "../polywrap-manifests"; +import { MetaManifest } from "@polywrap/polywrap-manifest-schemas"; import { Ora } from "ora"; import fs from "fs"; import path from "path"; diff --git a/packages/cli/src/lib/index.ts b/packages/cli/src/lib/index.ts index 184da96607..bfb088bdbe 100644 --- a/packages/cli/src/lib/index.ts +++ b/packages/cli/src/lib/index.ts @@ -3,7 +3,6 @@ export * from "./helpers"; export * from "./infra"; export * from "./intl"; export * from "./option-parsers"; -export * from "./polywrap-manifests"; export * from "./project"; export * from "./system"; export * from "./test-env"; diff --git a/packages/cli/src/lib/infra/Infra.ts b/packages/cli/src/lib/infra/Infra.ts index 19260be911..7f99902761 100644 --- a/packages/cli/src/lib/infra/Infra.ts +++ b/packages/cli/src/lib/infra/Infra.ts @@ -6,7 +6,7 @@ import { CacheDirectory, } from "../"; -import { InfraManifest } from "../polywrap-manifests"; +import { InfraManifest } from "@polywrap/polywrap-manifest-schemas"; import path from "path"; import fs, { lstatSync, readdirSync } from "fs"; import YAML from "js-yaml"; diff --git a/packages/cli/src/lib/project/AppProject.ts b/packages/cli/src/lib/project/AppProject.ts index 9965c64f14..f5508399bb 100644 --- a/packages/cli/src/lib/project/AppProject.ts +++ b/packages/cli/src/lib/project/AppProject.ts @@ -6,8 +6,8 @@ import { loadAppManifest, appManifestLanguageToBindLanguage, } from "./manifests"; -import { AppManifest } from "../polywrap-manifests"; +import { AppManifest } from "@polywrap/polywrap-manifest-schemas"; import { Client } from "@polywrap/core-js"; import { ComposerOutput } from "@polywrap/schema-compose"; import { bindSchema, BindOutput } from "@polywrap/schema-bind"; diff --git a/packages/cli/src/lib/project/PluginProject.ts b/packages/cli/src/lib/project/PluginProject.ts index c24985de86..2c681e2b11 100644 --- a/packages/cli/src/lib/project/PluginProject.ts +++ b/packages/cli/src/lib/project/PluginProject.ts @@ -6,9 +6,9 @@ import { isPluginManifestLanguage, pluginManifestLanguageToBindLanguage, } from "./manifests"; -import { PluginManifest } from "../polywrap-manifests"; import { resetDir } from "../system"; +import { PluginManifest } from "@polywrap/polywrap-manifest-schemas"; import { bindSchema, BindOutput, BindOptions } from "@polywrap/schema-bind"; import { ComposerOutput } from "@polywrap/schema-compose"; import { Abi } from "@polywrap/schema-parse"; diff --git a/packages/cli/src/lib/project/PolywrapProject.ts b/packages/cli/src/lib/project/PolywrapProject.ts index 839482c36f..612a3a30a5 100644 --- a/packages/cli/src/lib/project/PolywrapProject.ts +++ b/packages/cli/src/lib/project/PolywrapProject.ts @@ -15,16 +15,16 @@ import { polywrapManifestLanguageToBindLanguage, } from "./manifests"; import { Deployer } from "../deploy"; +import { generateDockerImageName, resetDir } from "../system"; +import { createUUID } from "../helpers"; +import { intlMsg } from "../intl"; + import { BuildManifest, PolywrapManifest, MetaManifest, DeployManifest, -} from "../polywrap-manifests"; -import { generateDockerImageName, resetDir } from "../system"; -import { createUUID } from "../helpers"; -import { intlMsg } from "../intl"; - +} from "@polywrap/polywrap-manifest-schemas"; import { normalizePath } from "@polywrap/os-js"; import { bindSchema, BindOutput, BindOptions } from "@polywrap/schema-bind"; import { ComposerOutput } from "@polywrap/schema-compose"; diff --git a/packages/cli/src/lib/project/manifests/app/load.ts b/packages/cli/src/lib/project/manifests/app/load.ts index d06eb6d591..f9a15cbdd5 100644 --- a/packages/cli/src/lib/project/manifests/app/load.ts +++ b/packages/cli/src/lib/project/manifests/app/load.ts @@ -1,9 +1,9 @@ import { displayPath, withSpinner, intlMsg } from "../../../"; + import { AppManifest, deserializeAppManifest, -} from "../../../polywrap-manifests"; - +} from "@polywrap/polywrap-manifest-schemas"; import fs from "fs"; export const defaultAppManifest = ["polywrap.app.yaml", "polywrap.app.yml"]; diff --git a/packages/cli/src/lib/project/manifests/plugin/load.ts b/packages/cli/src/lib/project/manifests/plugin/load.ts index b721862d0d..0dd496de68 100644 --- a/packages/cli/src/lib/project/manifests/plugin/load.ts +++ b/packages/cli/src/lib/project/manifests/plugin/load.ts @@ -1,9 +1,9 @@ import { displayPath, withSpinner, intlMsg } from "../../../"; + import { PluginManifest, deserializePluginManifest, -} from "../../../polywrap-manifests"; - +} from "@polywrap/polywrap-manifest-schemas"; import fs from "fs"; export const defaultPluginManifest = [ diff --git a/packages/cli/src/lib/project/manifests/polywrap/load.ts b/packages/cli/src/lib/project/manifests/polywrap/load.ts index f2aa6b4f85..64b472419f 100644 --- a/packages/cli/src/lib/project/manifests/polywrap/load.ts +++ b/packages/cli/src/lib/project/manifests/polywrap/load.ts @@ -16,7 +16,7 @@ import { deserializeDeployManifest, InfraManifest, deserializeInfraManifest, -} from "../../../polywrap-manifests"; +} from "@polywrap/polywrap-manifest-schemas"; import { Schema as JsonSchema } from "jsonschema"; import path from "path"; diff --git a/packages/js/core/package.json b/packages/js/core/package.json index ba1316da5d..8e5b7e4b69 100644 --- a/packages/js/core/package.json +++ b/packages/js/core/package.json @@ -12,7 +12,7 @@ "build" ], "scripts": { - "build": "rimraf ./build tsc --project tsconfig.build.json", + "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", diff --git a/packages/js/core/src/index.ts b/packages/js/core/src/index.ts index 601b82512c..285e3af188 100644 --- a/packages/js/core/src/index.ts +++ b/packages/js/core/src/index.ts @@ -1,7 +1,6 @@ export * from "./types"; export * from "./algorithms"; export * from "./interfaces"; -export * from "./wrap-manifests"; export * from "./msgpack"; export * from "./uri-resolution/core"; export * from "./uri-resolution/resolvers"; diff --git a/packages/js/core/src/types/Client.ts b/packages/js/core/src/types/Client.ts index efa57f7846..d78b5631d1 100644 --- a/packages/js/core/src/types/Client.ts +++ b/packages/js/core/src/types/Client.ts @@ -11,7 +11,8 @@ import { } from "./"; import { UriResolver } from "../uri-resolution/core"; import { UriResolverHandler } from "./UriResolver"; -import { WrapManifest } from "../wrap-manifests"; + +import { WrapManifest } from "@polywrap/wrap-manifest-schemas"; export interface ClientConfig { redirects: UriRedirect[]; diff --git a/packages/js/core/src/types/Wrapper.ts b/packages/js/core/src/types/Wrapper.ts index 9c310d62dd..b5d8b38bd1 100644 --- a/packages/js/core/src/types/Wrapper.ts +++ b/packages/js/core/src/types/Wrapper.ts @@ -8,7 +8,7 @@ import { Invoker, InvocableResult, } from "."; -import { WrapManifest } from "../wrap-manifests"; +import { WrapManifest } from "@polywrap/polywrap-manifest-schemas"; /** * The Wrapper definition, which can be used to spawn diff --git a/packages/js/core/tsconfig.build.json b/packages/js/core/tsconfig.build.json index 77aadfdd2f..9708b5768a 100644 --- a/packages/js/core/tsconfig.build.json +++ b/packages/js/core/tsconfig.build.json @@ -6,4 +6,4 @@ "exclude": [ "./src/**/__tests__" ] -} +} \ No newline at end of file diff --git a/packages/manifest-schemas/wrap/formats/interfaces/deserialize.ts b/packages/manifest-schemas/wrap/formats/interfaces/deserialize.ts index fdf973c283..ddf543f03a 100644 --- a/packages/manifest-schemas/wrap/formats/interfaces/deserialize.ts +++ b/packages/manifest-schemas/wrap/formats/interfaces/deserialize.ts @@ -15,15 +15,14 @@ import { import { DeserializeManifestOptions } from "../"; import { compare } from "semver"; -import { msgpackDecode } from "@polywrap/core-js"; import { Tracer } from "@polywrap/tracing-js"; export const deserializeWrapManifest = Tracer.traceFunc( "core: deserializeWrapManifest", - (manifest: Uint8Array, options?: DeserializeManifestOptions): WrapManifest => { + (manifest: Uint8Array, decoder: (m: Uint8Array) => unknown, options?: DeserializeManifestOptions): WrapManifest => { let anyWrapManifest: AnyWrapManifest | undefined; try { - anyWrapManifest = msgpackDecode(manifest) as AnyWrapManifest; + anyWrapManifest = decoder(manifest) as AnyWrapManifest; } catch (e) { throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); } diff --git a/packages/manifest-schemas/wrap/package.json b/packages/manifest-schemas/wrap/package.json index 16b09ea5b4..8e12e8608a 100644 --- a/packages/manifest-schemas/wrap/package.json +++ b/packages/manifest-schemas/wrap/package.json @@ -12,9 +12,6 @@ "lint": "eslint --color -c ../../.eslintrc.js .", "build": "ts-node generator.ts && tsc" }, - "dependencies": { - "@polywrap/core-js": "0.0.1-prealpha.91" - }, "devDependencies": { "ts-node": "8.10.2" }, diff --git a/packages/manifest-schemas/wrap/templates/deserialize-ts.mustache b/packages/manifest-schemas/wrap/templates/deserialize-ts.mustache index fdf973c283..ddf543f03a 100644 --- a/packages/manifest-schemas/wrap/templates/deserialize-ts.mustache +++ b/packages/manifest-schemas/wrap/templates/deserialize-ts.mustache @@ -15,15 +15,14 @@ import { import { DeserializeManifestOptions } from "../"; import { compare } from "semver"; -import { msgpackDecode } from "@polywrap/core-js"; import { Tracer } from "@polywrap/tracing-js"; export const deserializeWrapManifest = Tracer.traceFunc( "core: deserializeWrapManifest", - (manifest: Uint8Array, options?: DeserializeManifestOptions): WrapManifest => { + (manifest: Uint8Array, decoder: (m: Uint8Array) => unknown, options?: DeserializeManifestOptions): WrapManifest => { let anyWrapManifest: AnyWrapManifest | undefined; try { - anyWrapManifest = msgpackDecode(manifest) as AnyWrapManifest; + anyWrapManifest = decoder(manifest) as AnyWrapManifest; } catch (e) { throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); } From ddb2985b90d4d11b977cfb97c192cbdd2628219b Mon Sep 17 00:00:00 2001 From: cbrzn Date: Fri, 1 Jul 2022 18:52:00 +0200 Subject: [PATCH 23/46] chore: refactor in progress --- package.json | 3 ++- packages/cli/src/commands/infra.ts | 3 ++- .../src/lib/defaults/build-images/wasm/rust/index.ts | 2 +- packages/cli/src/lib/helpers/metadata.ts | 2 +- packages/cli/src/lib/index.ts | 1 - packages/cli/src/lib/infra/Infra.ts | 2 +- packages/cli/src/lib/project/AppProject.ts | 2 +- packages/cli/src/lib/project/PluginProject.ts | 2 +- packages/cli/src/lib/project/PolywrapProject.ts | 10 +++++----- packages/cli/src/lib/project/manifests/app/load.ts | 4 ++-- packages/cli/src/lib/project/manifests/plugin/load.ts | 4 ++-- .../cli/src/lib/project/manifests/polywrap/load.ts | 2 +- packages/js/core/package.json | 2 +- packages/js/core/src/index.ts | 1 - packages/js/core/src/types/Client.ts | 3 ++- packages/js/core/src/types/Wrapper.ts | 2 +- .../resolvers/extendable/UriResolverWrapper.ts | 2 ++ packages/js/core/tsconfig.build.json | 2 +- .../js/validation/src/types/WasmPackageValidator.ts | 8 ++++++-- .../wrap/formats/interfaces/deserialize.ts | 5 ++--- packages/manifest-schemas/wrap/package.json | 3 --- .../wrap/templates/deserialize-ts.mustache | 5 ++--- 22 files changed, 36 insertions(+), 34 deletions(-) diff --git a/package.json b/package.json index 40ffd7e77f..7f29868b19 100644 --- a/package.json +++ b/package.json @@ -29,13 +29,14 @@ "link:schema:compose": "cd packages/schema/compose && (yarn unlink || true) && yarn link && cd ../../../dependencies && yarn link @polywrap/schema-compose && cd ../", "link:schema:bind": "cd packages/schema/bind && (yarn unlink || true) && yarn link && cd ../../../dependencies && yarn link @polywrap/schema-bind && cd ../", "preinstall": "yarn dependencies:install", - "build": "yarn build:core && yarn dependencies:link && yarn build:interfaces && yarn build:plugins && yarn build:client && yarn build:test-env && yarn build:cli", + "build": "yarn build:manifests && yarn build:core && yarn dependencies:link && yarn build:interfaces && 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:interfaces": "lerna run build --scope @polywrap/*-interface --concurrency 1", "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:manifests": "lerna run build --scope @polywrap/tracing-js && cd packages/manifest-schemas/polywrap && yarn build && cd ../wrap && yarn build", "lint": "lerna run lint", "lint:fix": "lerna run lint -- --fix", "lint:ci": "yarn lint", diff --git a/packages/cli/src/commands/infra.ts b/packages/cli/src/commands/infra.ts index 3bef7e2a8f..e815387841 100644 --- a/packages/cli/src/commands/infra.ts +++ b/packages/cli/src/commands/infra.ts @@ -1,6 +1,7 @@ -import { intlMsg, Infra, loadInfraManifest, InfraManifest } from "../lib"; +import { intlMsg, Infra, loadInfraManifest } from "../lib"; import { Command, Program } from "./types"; +import { InfraManifest } from "@polywrap/polywrap-manifest-schemas" import { print } from "gluegun"; import path from "path"; import { Argument } from "commander"; diff --git a/packages/cli/src/lib/defaults/build-images/wasm/rust/index.ts b/packages/cli/src/lib/defaults/build-images/wasm/rust/index.ts index 3c16c259a1..b3f3749af4 100644 --- a/packages/cli/src/lib/defaults/build-images/wasm/rust/index.ts +++ b/packages/cli/src/lib/defaults/build-images/wasm/rust/index.ts @@ -1,7 +1,7 @@ import { CompilerOverrides } from "../../../../Compiler"; import { intlMsg } from "../../../../intl"; -import { PolywrapManifest } from "../../../../polywrap-manifests"; +import { PolywrapManifest } from "@polywrap/polywrap-manifest-schemas"; export function getCompilerOverrides(): CompilerOverrides { return { diff --git a/packages/cli/src/lib/helpers/metadata.ts b/packages/cli/src/lib/helpers/metadata.ts index 934f2d244e..b9b0727139 100644 --- a/packages/cli/src/lib/helpers/metadata.ts +++ b/packages/cli/src/lib/helpers/metadata.ts @@ -2,7 +2,7 @@ import { withSpinner } from "./"; import { displayPath, intlMsg } from "../"; import { normalizePath } from "@polywrap/os-js"; -import { MetaManifest } from "../polywrap-manifests"; +import { MetaManifest } from "@polywrap/polywrap-manifest-schemas"; import { Ora } from "ora"; import fs from "fs"; import path from "path"; diff --git a/packages/cli/src/lib/index.ts b/packages/cli/src/lib/index.ts index 184da96607..bfb088bdbe 100644 --- a/packages/cli/src/lib/index.ts +++ b/packages/cli/src/lib/index.ts @@ -3,7 +3,6 @@ export * from "./helpers"; export * from "./infra"; export * from "./intl"; export * from "./option-parsers"; -export * from "./polywrap-manifests"; export * from "./project"; export * from "./system"; export * from "./test-env"; diff --git a/packages/cli/src/lib/infra/Infra.ts b/packages/cli/src/lib/infra/Infra.ts index 19260be911..7f99902761 100644 --- a/packages/cli/src/lib/infra/Infra.ts +++ b/packages/cli/src/lib/infra/Infra.ts @@ -6,7 +6,7 @@ import { CacheDirectory, } from "../"; -import { InfraManifest } from "../polywrap-manifests"; +import { InfraManifest } from "@polywrap/polywrap-manifest-schemas"; import path from "path"; import fs, { lstatSync, readdirSync } from "fs"; import YAML from "js-yaml"; diff --git a/packages/cli/src/lib/project/AppProject.ts b/packages/cli/src/lib/project/AppProject.ts index 9965c64f14..f5508399bb 100644 --- a/packages/cli/src/lib/project/AppProject.ts +++ b/packages/cli/src/lib/project/AppProject.ts @@ -6,8 +6,8 @@ import { loadAppManifest, appManifestLanguageToBindLanguage, } from "./manifests"; -import { AppManifest } from "../polywrap-manifests"; +import { AppManifest } from "@polywrap/polywrap-manifest-schemas"; import { Client } from "@polywrap/core-js"; import { ComposerOutput } from "@polywrap/schema-compose"; import { bindSchema, BindOutput } from "@polywrap/schema-bind"; diff --git a/packages/cli/src/lib/project/PluginProject.ts b/packages/cli/src/lib/project/PluginProject.ts index c24985de86..2c681e2b11 100644 --- a/packages/cli/src/lib/project/PluginProject.ts +++ b/packages/cli/src/lib/project/PluginProject.ts @@ -6,9 +6,9 @@ import { isPluginManifestLanguage, pluginManifestLanguageToBindLanguage, } from "./manifests"; -import { PluginManifest } from "../polywrap-manifests"; import { resetDir } from "../system"; +import { PluginManifest } from "@polywrap/polywrap-manifest-schemas"; import { bindSchema, BindOutput, BindOptions } from "@polywrap/schema-bind"; import { ComposerOutput } from "@polywrap/schema-compose"; import { Abi } from "@polywrap/schema-parse"; diff --git a/packages/cli/src/lib/project/PolywrapProject.ts b/packages/cli/src/lib/project/PolywrapProject.ts index 839482c36f..612a3a30a5 100644 --- a/packages/cli/src/lib/project/PolywrapProject.ts +++ b/packages/cli/src/lib/project/PolywrapProject.ts @@ -15,16 +15,16 @@ import { polywrapManifestLanguageToBindLanguage, } from "./manifests"; import { Deployer } from "../deploy"; +import { generateDockerImageName, resetDir } from "../system"; +import { createUUID } from "../helpers"; +import { intlMsg } from "../intl"; + import { BuildManifest, PolywrapManifest, MetaManifest, DeployManifest, -} from "../polywrap-manifests"; -import { generateDockerImageName, resetDir } from "../system"; -import { createUUID } from "../helpers"; -import { intlMsg } from "../intl"; - +} from "@polywrap/polywrap-manifest-schemas"; import { normalizePath } from "@polywrap/os-js"; import { bindSchema, BindOutput, BindOptions } from "@polywrap/schema-bind"; import { ComposerOutput } from "@polywrap/schema-compose"; diff --git a/packages/cli/src/lib/project/manifests/app/load.ts b/packages/cli/src/lib/project/manifests/app/load.ts index d06eb6d591..f9a15cbdd5 100644 --- a/packages/cli/src/lib/project/manifests/app/load.ts +++ b/packages/cli/src/lib/project/manifests/app/load.ts @@ -1,9 +1,9 @@ import { displayPath, withSpinner, intlMsg } from "../../../"; + import { AppManifest, deserializeAppManifest, -} from "../../../polywrap-manifests"; - +} from "@polywrap/polywrap-manifest-schemas"; import fs from "fs"; export const defaultAppManifest = ["polywrap.app.yaml", "polywrap.app.yml"]; diff --git a/packages/cli/src/lib/project/manifests/plugin/load.ts b/packages/cli/src/lib/project/manifests/plugin/load.ts index b721862d0d..0dd496de68 100644 --- a/packages/cli/src/lib/project/manifests/plugin/load.ts +++ b/packages/cli/src/lib/project/manifests/plugin/load.ts @@ -1,9 +1,9 @@ import { displayPath, withSpinner, intlMsg } from "../../../"; + import { PluginManifest, deserializePluginManifest, -} from "../../../polywrap-manifests"; - +} from "@polywrap/polywrap-manifest-schemas"; import fs from "fs"; export const defaultPluginManifest = [ diff --git a/packages/cli/src/lib/project/manifests/polywrap/load.ts b/packages/cli/src/lib/project/manifests/polywrap/load.ts index f2aa6b4f85..64b472419f 100644 --- a/packages/cli/src/lib/project/manifests/polywrap/load.ts +++ b/packages/cli/src/lib/project/manifests/polywrap/load.ts @@ -16,7 +16,7 @@ import { deserializeDeployManifest, InfraManifest, deserializeInfraManifest, -} from "../../../polywrap-manifests"; +} from "@polywrap/polywrap-manifest-schemas"; import { Schema as JsonSchema } from "jsonschema"; import path from "path"; diff --git a/packages/js/core/package.json b/packages/js/core/package.json index ba1316da5d..8e5b7e4b69 100644 --- a/packages/js/core/package.json +++ b/packages/js/core/package.json @@ -12,7 +12,7 @@ "build" ], "scripts": { - "build": "rimraf ./build tsc --project tsconfig.build.json", + "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", diff --git a/packages/js/core/src/index.ts b/packages/js/core/src/index.ts index 601b82512c..285e3af188 100644 --- a/packages/js/core/src/index.ts +++ b/packages/js/core/src/index.ts @@ -1,7 +1,6 @@ export * from "./types"; export * from "./algorithms"; export * from "./interfaces"; -export * from "./wrap-manifests"; export * from "./msgpack"; export * from "./uri-resolution/core"; export * from "./uri-resolution/resolvers"; diff --git a/packages/js/core/src/types/Client.ts b/packages/js/core/src/types/Client.ts index efa57f7846..d78b5631d1 100644 --- a/packages/js/core/src/types/Client.ts +++ b/packages/js/core/src/types/Client.ts @@ -11,7 +11,8 @@ import { } from "./"; import { UriResolver } from "../uri-resolution/core"; import { UriResolverHandler } from "./UriResolver"; -import { WrapManifest } from "../wrap-manifests"; + +import { WrapManifest } from "@polywrap/wrap-manifest-schemas"; export interface ClientConfig { redirects: UriRedirect[]; diff --git a/packages/js/core/src/types/Wrapper.ts b/packages/js/core/src/types/Wrapper.ts index 9c310d62dd..b5d8b38bd1 100644 --- a/packages/js/core/src/types/Wrapper.ts +++ b/packages/js/core/src/types/Wrapper.ts @@ -8,7 +8,7 @@ import { Invoker, InvocableResult, } from "."; -import { WrapManifest } from "../wrap-manifests"; +import { WrapManifest } from "@polywrap/polywrap-manifest-schemas"; /** * The Wrapper definition, which can be used to spawn diff --git a/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts b/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts index 09388664e5..4eb79acc0d 100644 --- a/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts +++ b/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts @@ -13,6 +13,7 @@ import { deserializeWrapManifest, } from "@polywrap/wrap-manifest-schemas"; import { Tracer } from "@polywrap/tracing-js"; +import { msgpackDecode } from "../../../msgpack"; export class UriResolverWrapper implements UriResolver { constructor( @@ -52,6 +53,7 @@ export class UriResolverWrapper implements UriResolver { // meaning the URI resolver can also be used as an Wrapper resolver const manifest = deserializeWrapManifest( result.manifest, + msgpackDecode, this.deserializeOptions ); diff --git a/packages/js/core/tsconfig.build.json b/packages/js/core/tsconfig.build.json index 77aadfdd2f..9708b5768a 100644 --- a/packages/js/core/tsconfig.build.json +++ b/packages/js/core/tsconfig.build.json @@ -6,4 +6,4 @@ "exclude": [ "./src/**/__tests__" ] -} +} \ No newline at end of file diff --git a/packages/js/validation/src/types/WasmPackageValidator.ts b/packages/js/validation/src/types/WasmPackageValidator.ts index 67f3931b5d..b42e8b845f 100644 --- a/packages/js/validation/src/types/WasmPackageValidator.ts +++ b/packages/js/validation/src/types/WasmPackageValidator.ts @@ -7,7 +7,11 @@ import { WRAP_WASM, } from ".."; -import { deserializeWrapManifest, WrapManifest } from "@polywrap/core-js"; +import { msgpackDecode } from "@polywrap/core-js"; +import { + WrapManifest, + deserializeWrapManifest, +} from "@polywrap/wrap-manifest-schemas"; import { renderSchema } from "@polywrap/schema-compose"; import * as path from "path"; @@ -134,7 +138,7 @@ export class WasmPackageValidator { const info = await reader.readFile(name); return { valid: true, - manifest: deserializeWrapManifest(info), + manifest: deserializeWrapManifest(info, msgpackDecode), }; } catch (e) { if (e.message.includes('instance requires property "abi"')) { diff --git a/packages/manifest-schemas/wrap/formats/interfaces/deserialize.ts b/packages/manifest-schemas/wrap/formats/interfaces/deserialize.ts index fdf973c283..ddf543f03a 100644 --- a/packages/manifest-schemas/wrap/formats/interfaces/deserialize.ts +++ b/packages/manifest-schemas/wrap/formats/interfaces/deserialize.ts @@ -15,15 +15,14 @@ import { import { DeserializeManifestOptions } from "../"; import { compare } from "semver"; -import { msgpackDecode } from "@polywrap/core-js"; import { Tracer } from "@polywrap/tracing-js"; export const deserializeWrapManifest = Tracer.traceFunc( "core: deserializeWrapManifest", - (manifest: Uint8Array, options?: DeserializeManifestOptions): WrapManifest => { + (manifest: Uint8Array, decoder: (m: Uint8Array) => unknown, options?: DeserializeManifestOptions): WrapManifest => { let anyWrapManifest: AnyWrapManifest | undefined; try { - anyWrapManifest = msgpackDecode(manifest) as AnyWrapManifest; + anyWrapManifest = decoder(manifest) as AnyWrapManifest; } catch (e) { throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); } diff --git a/packages/manifest-schemas/wrap/package.json b/packages/manifest-schemas/wrap/package.json index 16b09ea5b4..8e12e8608a 100644 --- a/packages/manifest-schemas/wrap/package.json +++ b/packages/manifest-schemas/wrap/package.json @@ -12,9 +12,6 @@ "lint": "eslint --color -c ../../.eslintrc.js .", "build": "ts-node generator.ts && tsc" }, - "dependencies": { - "@polywrap/core-js": "0.0.1-prealpha.91" - }, "devDependencies": { "ts-node": "8.10.2" }, diff --git a/packages/manifest-schemas/wrap/templates/deserialize-ts.mustache b/packages/manifest-schemas/wrap/templates/deserialize-ts.mustache index fdf973c283..ddf543f03a 100644 --- a/packages/manifest-schemas/wrap/templates/deserialize-ts.mustache +++ b/packages/manifest-schemas/wrap/templates/deserialize-ts.mustache @@ -15,15 +15,14 @@ import { import { DeserializeManifestOptions } from "../"; import { compare } from "semver"; -import { msgpackDecode } from "@polywrap/core-js"; import { Tracer } from "@polywrap/tracing-js"; export const deserializeWrapManifest = Tracer.traceFunc( "core: deserializeWrapManifest", - (manifest: Uint8Array, options?: DeserializeManifestOptions): WrapManifest => { + (manifest: Uint8Array, decoder: (m: Uint8Array) => unknown, options?: DeserializeManifestOptions): WrapManifest => { let anyWrapManifest: AnyWrapManifest | undefined; try { - anyWrapManifest = msgpackDecode(manifest) as AnyWrapManifest; + anyWrapManifest = decoder(manifest) as AnyWrapManifest; } catch (e) { throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); } From a995395d26e652ca73a92c1472d03545db510a71 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Fri, 1 Jul 2022 17:45:13 -0700 Subject: [PATCH 24/46] refactor manifest codebases --- notes | 38 +++++ package.json | 2 +- packages/manifest-schemas/.gitignore | 1 - .../interfaces/polywrap.app/deserialize.ts | 61 -------- .../interfaces/polywrap.app/validate.ts | 67 -------- .../interfaces/polywrap.build/deserialize.ts | 61 -------- .../interfaces/polywrap.build/validate.ts | 69 --------- .../interfaces/polywrap.deploy/deserialize.ts | 61 -------- .../interfaces/polywrap.deploy/migrate.ts | 39 ----- .../interfaces/polywrap.deploy/validate.ts | 61 -------- .../interfaces/polywrap.infra/deserialize.ts | 61 -------- .../interfaces/polywrap.infra/validate.ts | 62 -------- .../interfaces/polywrap.meta/deserialize.ts | 61 -------- .../interfaces/polywrap.meta/validate.ts | 69 --------- .../interfaces/polywrap.plugin/deserialize.ts | 61 -------- .../interfaces/polywrap.plugin/validate.ts | 68 -------- .../interfaces/polywrap/deserialize.ts | 61 -------- .../formats/interfaces/polywrap/validate.ts | 84 ---------- .../polywrap/formats/validators.ts | 146 ------------------ .../templates/deserialize-ts.mustache | 61 -------- .../polywrap/templates/validate-ts.mustache | 67 -------- .../manifest-schemas/polywrap/tsconfig.json | 12 -- .../manifest-schemas/wrap/formats/index.ts | 2 - .../wrap/formats/interfaces/deserialize.ts | 52 ------- .../wrap/formats/interfaces/migrate.ts | 39 ----- .../wrap/formats/interfaces/validate.ts | 60 ------- .../wrap/templates/deserialize-ts.mustache | 52 ------- .../wrap/templates/validate-ts.mustache | 67 -------- packages/manifest-schemas/wrap/tsconfig.json | 12 -- packages/manifest/.gitignore | 1 + .../polywrap.app/0.0.1-prealpha.1.json | 8 +- .../polywrap.app/0.0.1-prealpha.2.json | 10 +- .../polywrap.build/0.0.1-prealpha.1.json | 9 +- .../polywrap.build/0.0.1-prealpha.2.json | 11 +- .../polywrap.build/0.0.1-prealpha.3.json | 13 +- .../polywrap.deploy/0.0.1-prealpha.1.json | 2 +- .../polywrap.infra/0.0.1-prealpha.1.json | 0 .../polywrap.infra/0.0.1-prealpha.2.json | 0 .../polywrap.meta/0.0.1-prealpha.1.json | 12 +- .../polywrap.meta/0.0.1-prealpha.2.json | 12 +- .../polywrap.meta/0.0.1-prealpha.3.json | 14 +- .../polywrap.plugin/0.0.1-prealpha.1.json | 4 +- .../polywrap.plugin/0.0.1-prealpha.2.json | 12 +- .../polywrap.plugin/0.0.1-prealpha.3.json | 8 +- .../formats}/polywrap/0.0.1-prealpha.1.json | 8 +- .../formats}/polywrap/0.0.1-prealpha.2.json | 12 +- .../formats}/polywrap/0.0.1-prealpha.3.json | 12 +- .../formats}/polywrap/0.0.1-prealpha.4.json | 12 +- .../formats}/polywrap/0.0.1-prealpha.5.json | 14 +- .../formats}/polywrap/0.0.1-prealpha.6.json | 14 +- .../formats}/polywrap/0.0.1-prealpha.7.json | 16 +- .../formats}/polywrap/0.0.1-prealpha.8.json | 18 +-- .../formats}/polywrap/0.0.1-prealpha.9.json | 18 +-- .../polywrap/schema}/package.json | 8 +- .../polywrap/types/typescript/package.json | 33 ++++ .../types/typescript/scripts/generate.ts} | 5 +- .../scripts/templates/deserialize-ts.mustache | 60 +++++++ .../scripts}/templates/index-ts.mustache | 0 .../scripts}/templates/migrate-ts.mustache | 44 +++--- .../scripts/templates/validate-ts.mustache | 63 ++++++++ .../types/typescript/src}/deserialize.ts | 0 .../types/typescript/src/formats}/index.ts | 0 .../formats}/polywrap.app/0.0.1-prealpha.1.ts | 0 .../formats}/polywrap.app/0.0.1-prealpha.2.ts | 0 .../src/formats/polywrap.app/deserialize.ts | 60 +++++++ .../src/formats}/polywrap.app/index.ts | 0 .../src/formats}/polywrap.app/migrate.ts | 40 +++-- .../0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts | 0 .../src/formats/polywrap.app/validate.ts | 58 +++++++ .../polywrap.build/0.0.1-prealpha.1.ts | 4 - .../polywrap.build/0.0.1-prealpha.2.ts | 4 - .../polywrap.build/0.0.1-prealpha.3.ts | 4 - .../src/formats/polywrap.build/deserialize.ts | 60 +++++++ .../src/formats}/polywrap.build/index.ts | 0 .../src/formats}/polywrap.build/migrate.ts | 40 +++-- .../0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts | 0 .../0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts | 0 .../src/formats/polywrap.build/validate.ts | 60 +++++++ .../polywrap.deploy/0.0.1-prealpha.1.ts | 0 .../formats/polywrap.deploy/deserialize.ts | 60 +++++++ .../src/formats}/polywrap.deploy/index.ts | 0 .../src/formats/polywrap.deploy/migrate.ts | 37 +++++ .../src/formats/polywrap.deploy/validate.ts | 56 +++++++ .../polywrap.infra/0.0.1-prealpha.1.ts | 0 .../polywrap.infra/0.0.1-prealpha.2.ts | 0 .../src/formats/polywrap.infra/deserialize.ts | 60 +++++++ .../src/formats}/polywrap.infra/index.ts | 0 .../src/formats}/polywrap.infra/migrate.ts | 40 +++-- .../0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts | 0 .../src/formats/polywrap.infra/validate.ts | 58 +++++++ .../polywrap.meta/0.0.1-prealpha.1.ts | 0 .../polywrap.meta/0.0.1-prealpha.2.ts | 0 .../polywrap.meta/0.0.1-prealpha.3.ts | 0 .../src/formats/polywrap.meta/deserialize.ts | 60 +++++++ .../src/formats}/polywrap.meta/index.ts | 0 .../src/formats}/polywrap.meta/migrate.ts | 40 +++-- .../0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts | 0 .../0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts | 0 .../src/formats/polywrap.meta/validate.ts | 60 +++++++ .../polywrap.plugin/0.0.1-prealpha.1.ts | 0 .../polywrap.plugin/0.0.1-prealpha.2.ts | 0 .../polywrap.plugin/0.0.1-prealpha.3.ts | 0 .../formats/polywrap.plugin/deserialize.ts | 60 +++++++ .../src/formats}/polywrap.plugin/index.ts | 0 .../src/formats}/polywrap.plugin/migrate.ts | 40 +++-- .../0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts | 0 .../0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts | 0 .../src/formats/polywrap.plugin/validate.ts | 60 +++++++ .../src/formats}/polywrap/0.0.1-prealpha.1.ts | 0 .../src/formats}/polywrap/0.0.1-prealpha.2.ts | 0 .../src/formats}/polywrap/0.0.1-prealpha.3.ts | 0 .../src/formats}/polywrap/0.0.1-prealpha.4.ts | 0 .../src/formats}/polywrap/0.0.1-prealpha.5.ts | 0 .../src/formats}/polywrap/0.0.1-prealpha.6.ts | 0 .../src/formats}/polywrap/0.0.1-prealpha.7.ts | 0 .../src/formats}/polywrap/0.0.1-prealpha.8.ts | 0 .../src/formats}/polywrap/0.0.1-prealpha.9.ts | 0 .../src/formats/polywrap/deserialize.ts | 60 +++++++ .../typescript/src/formats}/polywrap/index.ts | 0 .../src/formats}/polywrap/migrate.ts | 40 +++-- .../0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts | 0 .../src/formats/polywrap/validate.ts | 72 +++++++++ .../polywrap/types/typescript/src}/index.ts | 2 +- .../polywrap/types/typescript/tsconfig.json | 9 ++ .../wrap/schema/formats}/wrap.info/0.0.1.json | 0 .../wrap/schema}/package.json | 10 +- .../wrap/types/typescript/package.json | 31 ++++ .../types/typescript/scripts/generate.ts} | 5 +- .../scripts/templates/deserialize-ts.mustache | 52 +++++++ .../scripts}/templates/index-ts.mustache | 0 .../scripts}/templates/migrate-ts.mustache | 44 +++--- .../scripts/templates/validate-ts.mustache | 63 ++++++++ .../wrap/types/typescript/src}/deserialize.ts | 0 .../types/typescript/src/formats/index.ts | 1 + .../src/formats/wrap.info}/0.0.1.ts | 0 .../src/formats/wrap.info/deserialize.ts | 52 +++++++ .../src/formats/wrap.info}/index.ts | 0 .../src/formats/wrap.info/migrate.ts | 37 +++++ .../src/formats/wrap.info/validate.ts | 56 +++++++ .../wrap/types/typescript/src/index.ts | 2 + .../wrap/types/typescript/tsconfig.json | 9 ++ yarn.lock | 12 +- 149 files changed, 1675 insertions(+), 1853 deletions(-) create mode 100644 notes delete mode 100644 packages/manifest-schemas/.gitignore delete mode 100644 packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/deserialize.ts delete mode 100644 packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/validate.ts delete mode 100644 packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/deserialize.ts delete mode 100644 packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/validate.ts delete mode 100644 packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/deserialize.ts delete mode 100644 packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/migrate.ts delete mode 100644 packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/validate.ts delete mode 100644 packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/deserialize.ts delete mode 100644 packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/validate.ts delete mode 100644 packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/deserialize.ts delete mode 100644 packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/validate.ts delete mode 100644 packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/deserialize.ts delete mode 100644 packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/validate.ts delete mode 100644 packages/manifest-schemas/polywrap/formats/interfaces/polywrap/deserialize.ts delete mode 100644 packages/manifest-schemas/polywrap/formats/interfaces/polywrap/validate.ts delete mode 100644 packages/manifest-schemas/polywrap/formats/validators.ts delete mode 100644 packages/manifest-schemas/polywrap/templates/deserialize-ts.mustache delete mode 100644 packages/manifest-schemas/polywrap/templates/validate-ts.mustache delete mode 100644 packages/manifest-schemas/polywrap/tsconfig.json delete mode 100644 packages/manifest-schemas/wrap/formats/index.ts delete mode 100644 packages/manifest-schemas/wrap/formats/interfaces/deserialize.ts delete mode 100644 packages/manifest-schemas/wrap/formats/interfaces/migrate.ts delete mode 100644 packages/manifest-schemas/wrap/formats/interfaces/validate.ts delete mode 100644 packages/manifest-schemas/wrap/templates/deserialize-ts.mustache delete mode 100644 packages/manifest-schemas/wrap/templates/validate-ts.mustache delete mode 100644 packages/manifest-schemas/wrap/tsconfig.json create mode 100644 packages/manifest/.gitignore rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap.app/0.0.1-prealpha.1.json (80%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap.app/0.0.1-prealpha.2.json (79%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap.build/0.0.1-prealpha.1.json (77%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap.build/0.0.1-prealpha.2.json (77%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap.build/0.0.1-prealpha.3.json (81%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap.deploy/0.0.1-prealpha.1.json (94%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap.infra/0.0.1-prealpha.1.json (100%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap.infra/0.0.1-prealpha.2.json (100%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap.meta/0.0.1-prealpha.1.json (71%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap.meta/0.0.1-prealpha.2.json (71%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap.meta/0.0.1-prealpha.3.json (72%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap.plugin/0.0.1-prealpha.1.json (91%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap.plugin/0.0.1-prealpha.2.json (84%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap.plugin/0.0.1-prealpha.3.json (84%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap/0.0.1-prealpha.1.json (91%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap/0.0.1-prealpha.2.json (85%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap/0.0.1-prealpha.3.json (85%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap/0.0.1-prealpha.4.json (85%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap/0.0.1-prealpha.5.json (80%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap/0.0.1-prealpha.6.json (80%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap/0.0.1-prealpha.7.json (79%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap/0.0.1-prealpha.8.json (78%) rename packages/{manifest-schemas/polywrap/formats/schemas => manifest/polywrap/schema/formats}/polywrap/0.0.1-prealpha.9.json (70%) rename packages/{manifest-schemas/polywrap => manifest/polywrap/schema}/package.json (67%) create mode 100644 packages/manifest/polywrap/types/typescript/package.json rename packages/{manifest-schemas/polywrap/generator.ts => manifest/polywrap/types/typescript/scripts/generate.ts} (96%) create mode 100644 packages/manifest/polywrap/types/typescript/scripts/templates/deserialize-ts.mustache rename packages/{manifest-schemas/polywrap => manifest/polywrap/types/typescript/scripts}/templates/index-ts.mustache (100%) rename packages/{manifest-schemas/polywrap => manifest/polywrap/types/typescript/scripts}/templates/migrate-ts.mustache (50%) create mode 100644 packages/manifest/polywrap/types/typescript/scripts/templates/validate-ts.mustache rename packages/{manifest-schemas/polywrap/formats => manifest/polywrap/types/typescript/src}/deserialize.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/index.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.app/0.0.1-prealpha.1.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.app/0.0.1-prealpha.2.ts (100%) create mode 100644 packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/deserialize.ts rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.app/index.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.app/migrate.ts (51%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts (100%) create mode 100644 packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/validate.ts rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.build/0.0.1-prealpha.1.ts (90%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.build/0.0.1-prealpha.2.ts (93%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.build/0.0.1-prealpha.3.ts (95%) create mode 100644 packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/deserialize.ts rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.build/index.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.build/migrate.ts (56%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts (100%) create mode 100644 packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/validate.ts rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.deploy/0.0.1-prealpha.1.ts (100%) create mode 100644 packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/deserialize.ts rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.deploy/index.ts (100%) create mode 100644 packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/migrate.ts create mode 100644 packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/validate.ts rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.infra/0.0.1-prealpha.1.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.infra/0.0.1-prealpha.2.ts (100%) create mode 100644 packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/deserialize.ts rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.infra/index.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.infra/migrate.ts (50%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts (100%) create mode 100644 packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/validate.ts rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.meta/0.0.1-prealpha.1.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.meta/0.0.1-prealpha.2.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.meta/0.0.1-prealpha.3.ts (100%) create mode 100644 packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/deserialize.ts rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.meta/index.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.meta/migrate.ts (56%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts (100%) create mode 100644 packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/validate.ts rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.plugin/0.0.1-prealpha.1.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.plugin/0.0.1-prealpha.2.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.plugin/0.0.1-prealpha.3.ts (100%) create mode 100644 packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/deserialize.ts rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.plugin/index.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.plugin/migrate.ts (56%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts (100%) create mode 100644 packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/validate.ts rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap/0.0.1-prealpha.1.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap/0.0.1-prealpha.2.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap/0.0.1-prealpha.3.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap/0.0.1-prealpha.4.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap/0.0.1-prealpha.5.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap/0.0.1-prealpha.6.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap/0.0.1-prealpha.7.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap/0.0.1-prealpha.8.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap/0.0.1-prealpha.9.ts (100%) create mode 100644 packages/manifest/polywrap/types/typescript/src/formats/polywrap/deserialize.ts rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap/index.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap/migrate.ts (74%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts (100%) rename packages/{manifest-schemas/polywrap/formats/interfaces => manifest/polywrap/types/typescript/src/formats}/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts (100%) create mode 100644 packages/manifest/polywrap/types/typescript/src/formats/polywrap/validate.ts rename packages/{manifest-schemas/polywrap/formats => manifest/polywrap/types/typescript/src}/index.ts (50%) create mode 100644 packages/manifest/polywrap/types/typescript/tsconfig.json rename packages/{manifest-schemas/wrap/formats/schemas => manifest/wrap/schema/formats}/wrap.info/0.0.1.json (100%) rename packages/{manifest-schemas/wrap => manifest/wrap/schema}/package.json (59%) create mode 100644 packages/manifest/wrap/types/typescript/package.json rename packages/{manifest-schemas/wrap/generator.ts => manifest/wrap/types/typescript/scripts/generate.ts} (94%) create mode 100644 packages/manifest/wrap/types/typescript/scripts/templates/deserialize-ts.mustache rename packages/{manifest-schemas/wrap => manifest/wrap/types/typescript/scripts}/templates/index-ts.mustache (100%) rename packages/{manifest-schemas/wrap => manifest/wrap/types/typescript/scripts}/templates/migrate-ts.mustache (50%) create mode 100644 packages/manifest/wrap/types/typescript/scripts/templates/validate-ts.mustache rename packages/{manifest-schemas/wrap/formats => manifest/wrap/types/typescript/src}/deserialize.ts (100%) create mode 100644 packages/manifest/wrap/types/typescript/src/formats/index.ts rename packages/{manifest-schemas/wrap/formats/interfaces => manifest/wrap/types/typescript/src/formats/wrap.info}/0.0.1.ts (100%) create mode 100644 packages/manifest/wrap/types/typescript/src/formats/wrap.info/deserialize.ts rename packages/{manifest-schemas/wrap/formats/interfaces => manifest/wrap/types/typescript/src/formats/wrap.info}/index.ts (100%) create mode 100644 packages/manifest/wrap/types/typescript/src/formats/wrap.info/migrate.ts create mode 100644 packages/manifest/wrap/types/typescript/src/formats/wrap.info/validate.ts create mode 100644 packages/manifest/wrap/types/typescript/src/index.ts create mode 100644 packages/manifest/wrap/types/typescript/tsconfig.json diff --git a/notes b/notes new file mode 100644 index 0000000000..8fcabee8f5 --- /dev/null +++ b/notes @@ -0,0 +1,38 @@ +manifest + polywrap/ + schema/ + package.json + formats/ + polywrap.app/ + 0.0.1.json + polywrap.wasm/ + 0.0.1.json + polywrap.plugin/ + 0.0.1.json + binding/ + typescript/ + package.json + scripts/ + templates/ + deserialize-ts.mustache + generate.ts + src/ + index.ts + deserialize.ts + wrap/ + schema/ + package.json + formats/ + 0.0.1.json + binding/ + typescript/ + package.json + scripts/ + templates/ + deserialize-ts.mustache + generate.ts + src/ + index.ts + deserialize.ts + python/ + rust/ diff --git a/package.json b/package.json index 7f29868b19..34b5a5c71c 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "./packages/cli", "./packages/core-interfaces/**", "./packages/js/**", - "./packages/manifest-schemas/**", + "./packages/manifest/**", "./packages/schema/**", "./packages/templates/**", "./packages/test-cases", diff --git a/packages/manifest-schemas/.gitignore b/packages/manifest-schemas/.gitignore deleted file mode 100644 index 119393e708..0000000000 --- a/packages/manifest-schemas/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!wrap diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/deserialize.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/deserialize.ts deleted file mode 100644 index d9fce0ee76..0000000000 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/deserialize.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. - */ - -import { - AppManifest, - AnyAppManifest, - migrateAppManifest, - validateAppManifest, - latestAppManifestFormat, -} from "."; -import { DeserializeManifestOptions } from "../../"; - -import { compare } from "semver"; -import YAML from "js-yaml"; -import { Tracer } from "@polywrap/tracing-js"; - -export const deserializeAppManifest = Tracer.traceFunc( - "core: deserializeAppManifest", - (manifest: string, options?: DeserializeManifestOptions): AppManifest => { - let anyAppManifest: AnyAppManifest | undefined; - try { - anyAppManifest = JSON.parse(manifest) as AnyAppManifest; - } catch (e) { - anyAppManifest = YAML.safeLoad(manifest) as - | AnyAppManifest - | undefined; - } - - if (!anyAppManifest) { - throw Error(`Unable to parse AppManifest: ${manifest}`); - } - - if (!options || !options.noValidate) { - validateAppManifest(anyAppManifest, options?.extSchema); - } - - anyAppManifest.__type = "AppManifest"; - - const versionCompare = compare( - anyAppManifest.format, - latestAppManifestFormat - ); - - if (versionCompare === -1) { - // Upgrade - return migrateAppManifest(anyAppManifest, latestAppManifestFormat); - } else if (versionCompare === 1) { - // Downgrade - throw Error( - `Cannot downgrade Polywrap version ${anyAppManifest.format}, please upgrade your PolywrapClient package.` - ); - } else { - // Latest - return anyAppManifest as AppManifest; - } - } -); diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/validate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/validate.ts deleted file mode 100644 index 1b44242415..0000000000 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/validate.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/validate-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. - */ -import { - AnyAppManifest, - AppManifestFormats -} from "."; -import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.app/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.app/0.0.1-prealpha.2.json"; -import { Tracer } from "@polywrap/tracing-js" - -import { - Schema, - Validator, - ValidationError, - ValidatorResult -} from "jsonschema"; - -type AppManifestSchemas = { - [key in AppManifestFormats]: Schema | undefined -}; - -const schemas: AppManifestSchemas = { - "0.0.1-prealpha.1": schema_0_0_1_prealpha_1, - "0.0.1-prealpha.2": schema_0_0_1_prealpha_2, -}; - -const validator = new Validator(); - -Validator.prototype.customFormats.appLanguage = Validators.appLanguage; -Validator.prototype.customFormats.file = Validators.file; -Validator.prototype.customFormats.polywrapUri = Validators.polywrapUri; -Validator.prototype.customFormats.schemaFile = Validators.schemaFile; -Validator.prototype.customFormats.packageName = Validators.packageName; - -export const validateAppManifest = Tracer.traceFunc( - "core: validateAppManifest", - ( - manifest: AnyAppManifest, - extSchema: Schema | undefined = undefined - ): void => { - const schema = schemas[manifest.format as AppManifestFormats]; - - if (!schema) { - throw Error(`Unrecognized AppManifest schema format "${manifest.format}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); - } - - const throwIfErrors = (result: ValidatorResult) => { - if (result.errors.length) { - throw new Error([ - `Validation errors encountered while sanitizing AppManifest format ${manifest.format}`, - ...result.errors.map((error: ValidationError) => error.toString()) - ].join("\n")); - } - }; - - throwIfErrors(validator.validate(manifest, schema)); - - if (extSchema) { - throwIfErrors(validator.validate(manifest, extSchema)); - } - } -); diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/deserialize.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/deserialize.ts deleted file mode 100644 index afb44828c1..0000000000 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/deserialize.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. - */ - -import { - BuildManifest, - AnyBuildManifest, - migrateBuildManifest, - validateBuildManifest, - latestBuildManifestFormat, -} from "."; -import { DeserializeManifestOptions } from "../../"; - -import { compare } from "semver"; -import YAML from "js-yaml"; -import { Tracer } from "@polywrap/tracing-js"; - -export const deserializeBuildManifest = Tracer.traceFunc( - "core: deserializeBuildManifest", - (manifest: string, options?: DeserializeManifestOptions): BuildManifest => { - let anyBuildManifest: AnyBuildManifest | undefined; - try { - anyBuildManifest = JSON.parse(manifest) as AnyBuildManifest; - } catch (e) { - anyBuildManifest = YAML.safeLoad(manifest) as - | AnyBuildManifest - | undefined; - } - - if (!anyBuildManifest) { - throw Error(`Unable to parse BuildManifest: ${manifest}`); - } - - if (!options || !options.noValidate) { - validateBuildManifest(anyBuildManifest, options?.extSchema); - } - - anyBuildManifest.__type = "BuildManifest"; - - const versionCompare = compare( - anyBuildManifest.format, - latestBuildManifestFormat - ); - - if (versionCompare === -1) { - // Upgrade - return migrateBuildManifest(anyBuildManifest, latestBuildManifestFormat); - } else if (versionCompare === 1) { - // Downgrade - throw Error( - `Cannot downgrade Polywrap version ${anyBuildManifest.format}, please upgrade your PolywrapClient package.` - ); - } else { - // Latest - return anyBuildManifest as BuildManifest; - } - } -); diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/validate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/validate.ts deleted file mode 100644 index 65e7dfca84..0000000000 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/validate.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/validate-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. - */ -import { - AnyBuildManifest, - BuildManifestFormats -} from "."; -import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.build/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.build/0.0.1-prealpha.2.json"; -import schema_0_0_1_prealpha_3 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.build/0.0.1-prealpha.3.json"; -import { Tracer } from "@polywrap/tracing-js" - -import { - Schema, - Validator, - ValidationError, - ValidatorResult -} from "jsonschema"; - -type BuildManifestSchemas = { - [key in BuildManifestFormats]: Schema | undefined -}; - -const schemas: BuildManifestSchemas = { - "0.0.1-prealpha.1": schema_0_0_1_prealpha_1, - "0.0.1-prealpha.2": schema_0_0_1_prealpha_2, - "0.0.1-prealpha.3": schema_0_0_1_prealpha_3, -}; - -const validator = new Validator(); - -Validator.prototype.customFormats.dockerImageName = Validators.dockerImageName; -Validator.prototype.customFormats.dockerfileName = Validators.dockerfileName; -Validator.prototype.customFormats.dockerImageId = Validators.dockerImageId; -Validator.prototype.customFormats.regexString = Validators.regexString; -Validator.prototype.customFormats.directory = Validators.directory; - -export const validateBuildManifest = Tracer.traceFunc( - "core: validateBuildManifest", - ( - manifest: AnyBuildManifest, - extSchema: Schema | undefined = undefined - ): void => { - const schema = schemas[manifest.format as BuildManifestFormats]; - - if (!schema) { - throw Error(`Unrecognized BuildManifest schema format "${manifest.format}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); - } - - const throwIfErrors = (result: ValidatorResult) => { - if (result.errors.length) { - throw new Error([ - `Validation errors encountered while sanitizing BuildManifest format ${manifest.format}`, - ...result.errors.map((error: ValidationError) => error.toString()) - ].join("\n")); - } - }; - - throwIfErrors(validator.validate(manifest, schema)); - - if (extSchema) { - throwIfErrors(validator.validate(manifest, extSchema)); - } - } -); diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/deserialize.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/deserialize.ts deleted file mode 100644 index 29aebd0d5e..0000000000 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/deserialize.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. - */ - -import { - DeployManifest, - AnyDeployManifest, - migrateDeployManifest, - validateDeployManifest, - latestDeployManifestFormat, -} from "."; -import { DeserializeManifestOptions } from "../../"; - -import { compare } from "semver"; -import YAML from "js-yaml"; -import { Tracer } from "@polywrap/tracing-js"; - -export const deserializeDeployManifest = Tracer.traceFunc( - "core: deserializeDeployManifest", - (manifest: string, options?: DeserializeManifestOptions): DeployManifest => { - let anyDeployManifest: AnyDeployManifest | undefined; - try { - anyDeployManifest = JSON.parse(manifest) as AnyDeployManifest; - } catch (e) { - anyDeployManifest = YAML.safeLoad(manifest) as - | AnyDeployManifest - | undefined; - } - - if (!anyDeployManifest) { - throw Error(`Unable to parse DeployManifest: ${manifest}`); - } - - if (!options || !options.noValidate) { - validateDeployManifest(anyDeployManifest, options?.extSchema); - } - - anyDeployManifest.__type = "DeployManifest"; - - const versionCompare = compare( - anyDeployManifest.format, - latestDeployManifestFormat - ); - - if (versionCompare === -1) { - // Upgrade - return migrateDeployManifest(anyDeployManifest, latestDeployManifestFormat); - } else if (versionCompare === 1) { - // Downgrade - throw Error( - `Cannot downgrade Polywrap version ${anyDeployManifest.format}, please upgrade your PolywrapClient package.` - ); - } else { - // Latest - return anyDeployManifest as DeployManifest; - } - } -); diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/migrate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/migrate.ts deleted file mode 100644 index 3288f21e3f..0000000000 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/migrate.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/migrate-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/migrate-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. - */ -import { - AnyDeployManifest, - DeployManifest, - DeployManifestFormats, - latestDeployManifestFormat -} from "."; - - -import { Tracer } from "@polywrap/tracing-js"; - -type Migrator = { - [key in DeployManifestFormats]?: (m: AnyDeployManifest) => DeployManifest; -}; - -export const migrators: Migrator = { -}; - -export const migrateDeployManifest = Tracer.traceFunc( - "core: migrateDeployManifest", - (manifest: AnyDeployManifest, to: DeployManifestFormats): DeployManifest => { - const from = manifest.format as DeployManifestFormats; - - if (from === latestDeployManifestFormat) { - return manifest as DeployManifest; - } - - if (!(from in DeployManifestFormats)) { - throw new Error(`Unrecognized DeployManifestFormat "${manifest.format}"`); - } - - throw new Error(`This should never happen, DeployManifest migrators is empty. from: ${from}, to: ${to}`); - } -); diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/validate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/validate.ts deleted file mode 100644 index 08440e68df..0000000000 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/validate.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/validate-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. - */ -import { - AnyDeployManifest, - DeployManifestFormats -} from "."; -import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.deploy/0.0.1-prealpha.1.json"; -import { Tracer } from "@polywrap/tracing-js" - -import { - Schema, - Validator, - ValidationError, - ValidatorResult -} from "jsonschema"; - -type DeployManifestSchemas = { - [key in DeployManifestFormats]: Schema | undefined -}; - -const schemas: DeployManifestSchemas = { - "0.0.1-prealpha.1": schema_0_0_1_prealpha_1, -}; - -const validator = new Validator(); - -Validator.prototype.customFormats.polywrapUri = Validators.polywrapUri; - -export const validateDeployManifest = Tracer.traceFunc( - "core: validateDeployManifest", - ( - manifest: AnyDeployManifest, - extSchema: Schema | undefined = undefined - ): void => { - const schema = schemas[manifest.format as DeployManifestFormats]; - - if (!schema) { - throw Error(`Unrecognized DeployManifest schema format "${manifest.format}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); - } - - const throwIfErrors = (result: ValidatorResult) => { - if (result.errors.length) { - throw new Error([ - `Validation errors encountered while sanitizing DeployManifest format ${manifest.format}`, - ...result.errors.map((error: ValidationError) => error.toString()) - ].join("\n")); - } - }; - - throwIfErrors(validator.validate(manifest, schema)); - - if (extSchema) { - throwIfErrors(validator.validate(manifest, extSchema)); - } - } -); diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/deserialize.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/deserialize.ts deleted file mode 100644 index fc28d02786..0000000000 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/deserialize.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. - */ - -import { - InfraManifest, - AnyInfraManifest, - migrateInfraManifest, - validateInfraManifest, - latestInfraManifestFormat, -} from "."; -import { DeserializeManifestOptions } from "../../"; - -import { compare } from "semver"; -import YAML from "js-yaml"; -import { Tracer } from "@polywrap/tracing-js"; - -export const deserializeInfraManifest = Tracer.traceFunc( - "core: deserializeInfraManifest", - (manifest: string, options?: DeserializeManifestOptions): InfraManifest => { - let anyInfraManifest: AnyInfraManifest | undefined; - try { - anyInfraManifest = JSON.parse(manifest) as AnyInfraManifest; - } catch (e) { - anyInfraManifest = YAML.safeLoad(manifest) as - | AnyInfraManifest - | undefined; - } - - if (!anyInfraManifest) { - throw Error(`Unable to parse InfraManifest: ${manifest}`); - } - - if (!options || !options.noValidate) { - validateInfraManifest(anyInfraManifest, options?.extSchema); - } - - anyInfraManifest.__type = "InfraManifest"; - - const versionCompare = compare( - anyInfraManifest.format, - latestInfraManifestFormat - ); - - if (versionCompare === -1) { - // Upgrade - return migrateInfraManifest(anyInfraManifest, latestInfraManifestFormat); - } else if (versionCompare === 1) { - // Downgrade - throw Error( - `Cannot downgrade Polywrap version ${anyInfraManifest.format}, please upgrade your PolywrapClient package.` - ); - } else { - // Latest - return anyInfraManifest as InfraManifest; - } - } -); diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/validate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/validate.ts deleted file mode 100644 index 3c3552fed3..0000000000 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/validate.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/validate-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. - */ -import { - AnyInfraManifest, - InfraManifestFormats -} from "."; - -import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.infra/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.infra/0.0.1-prealpha.2.json"; -import { Tracer } from "@polywrap/tracing-js" - -import { - Schema, - Validator, - ValidationError, - ValidatorResult -} from "jsonschema"; - -type InfraManifestSchemas = { - [key in InfraManifestFormats]: Schema | undefined -}; - -const schemas: InfraManifestSchemas = { - "0.0.1-prealpha.1": schema_0_0_1_prealpha_1, - "0.0.1-prealpha.2": schema_0_0_1_prealpha_2, -}; - -const validator = new Validator(); - - -export const validateInfraManifest = Tracer.traceFunc( - "core: validateInfraManifest", - ( - manifest: AnyInfraManifest, - extSchema: Schema | undefined = undefined - ): void => { - const schema = schemas[manifest.format as InfraManifestFormats]; - - if (!schema) { - throw Error(`Unrecognized InfraManifest schema format "${manifest.format}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); - } - - const throwIfErrors = (result: ValidatorResult) => { - if (result.errors.length) { - throw new Error([ - `Validation errors encountered while sanitizing InfraManifest format ${manifest.format}`, - ...result.errors.map((error: ValidationError) => error.toString()) - ].join("\n")); - } - }; - - throwIfErrors(validator.validate(manifest, schema)); - - if (extSchema) { - throwIfErrors(validator.validate(manifest, extSchema)); - } - } -); diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/deserialize.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/deserialize.ts deleted file mode 100644 index 8d9abd7a4a..0000000000 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/deserialize.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. - */ - -import { - MetaManifest, - AnyMetaManifest, - migrateMetaManifest, - validateMetaManifest, - latestMetaManifestFormat, -} from "."; -import { DeserializeManifestOptions } from "../../"; - -import { compare } from "semver"; -import YAML from "js-yaml"; -import { Tracer } from "@polywrap/tracing-js"; - -export const deserializeMetaManifest = Tracer.traceFunc( - "core: deserializeMetaManifest", - (manifest: string, options?: DeserializeManifestOptions): MetaManifest => { - let anyMetaManifest: AnyMetaManifest | undefined; - try { - anyMetaManifest = JSON.parse(manifest) as AnyMetaManifest; - } catch (e) { - anyMetaManifest = YAML.safeLoad(manifest) as - | AnyMetaManifest - | undefined; - } - - if (!anyMetaManifest) { - throw Error(`Unable to parse MetaManifest: ${manifest}`); - } - - if (!options || !options.noValidate) { - validateMetaManifest(anyMetaManifest, options?.extSchema); - } - - anyMetaManifest.__type = "MetaManifest"; - - const versionCompare = compare( - anyMetaManifest.format, - latestMetaManifestFormat - ); - - if (versionCompare === -1) { - // Upgrade - return migrateMetaManifest(anyMetaManifest, latestMetaManifestFormat); - } else if (versionCompare === 1) { - // Downgrade - throw Error( - `Cannot downgrade Polywrap version ${anyMetaManifest.format}, please upgrade your PolywrapClient package.` - ); - } else { - // Latest - return anyMetaManifest as MetaManifest; - } - } -); diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/validate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/validate.ts deleted file mode 100644 index f06b9f802e..0000000000 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/validate.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/validate-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. - */ -import { - AnyMetaManifest, - MetaManifestFormats -} from "."; -import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.meta/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.meta/0.0.1-prealpha.2.json"; -import schema_0_0_1_prealpha_3 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.meta/0.0.1-prealpha.3.json"; -import { Tracer } from "@polywrap/tracing-js" - -import { - Schema, - Validator, - ValidationError, - ValidatorResult -} from "jsonschema"; - -type MetaManifestSchemas = { - [key in MetaManifestFormats]: Schema | undefined -}; - -const schemas: MetaManifestSchemas = { - "0.0.1-prealpha.1": schema_0_0_1_prealpha_1, - "0.0.1-prealpha.2": schema_0_0_1_prealpha_2, - "0.0.1-prealpha.3": schema_0_0_1_prealpha_3, -}; - -const validator = new Validator(); - -Validator.prototype.customFormats.websiteUrl = Validators.websiteUrl; -Validator.prototype.customFormats.imageFile = Validators.imageFile; -Validator.prototype.customFormats.graphqlFile = Validators.graphqlFile; -Validator.prototype.customFormats.jsonFile = Validators.jsonFile; -Validator.prototype.customFormats.packageTag = Validators.packageTag; - -export const validateMetaManifest = Tracer.traceFunc( - "core: validateMetaManifest", - ( - manifest: AnyMetaManifest, - extSchema: Schema | undefined = undefined - ): void => { - const schema = schemas[manifest.format as MetaManifestFormats]; - - if (!schema) { - throw Error(`Unrecognized MetaManifest schema format "${manifest.format}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); - } - - const throwIfErrors = (result: ValidatorResult) => { - if (result.errors.length) { - throw new Error([ - `Validation errors encountered while sanitizing MetaManifest format ${manifest.format}`, - ...result.errors.map((error: ValidationError) => error.toString()) - ].join("\n")); - } - }; - - throwIfErrors(validator.validate(manifest, schema)); - - if (extSchema) { - throwIfErrors(validator.validate(manifest, extSchema)); - } - } -); diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/deserialize.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/deserialize.ts deleted file mode 100644 index 287a94021c..0000000000 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/deserialize.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. - */ - -import { - PluginManifest, - AnyPluginManifest, - migratePluginManifest, - validatePluginManifest, - latestPluginManifestFormat, -} from "."; -import { DeserializeManifestOptions } from "../../"; - -import { compare } from "semver"; -import YAML from "js-yaml"; -import { Tracer } from "@polywrap/tracing-js"; - -export const deserializePluginManifest = Tracer.traceFunc( - "core: deserializePluginManifest", - (manifest: string, options?: DeserializeManifestOptions): PluginManifest => { - let anyPluginManifest: AnyPluginManifest | undefined; - try { - anyPluginManifest = JSON.parse(manifest) as AnyPluginManifest; - } catch (e) { - anyPluginManifest = YAML.safeLoad(manifest) as - | AnyPluginManifest - | undefined; - } - - if (!anyPluginManifest) { - throw Error(`Unable to parse PluginManifest: ${manifest}`); - } - - if (!options || !options.noValidate) { - validatePluginManifest(anyPluginManifest, options?.extSchema); - } - - anyPluginManifest.__type = "PluginManifest"; - - const versionCompare = compare( - anyPluginManifest.format, - latestPluginManifestFormat - ); - - if (versionCompare === -1) { - // Upgrade - return migratePluginManifest(anyPluginManifest, latestPluginManifestFormat); - } else if (versionCompare === 1) { - // Downgrade - throw Error( - `Cannot downgrade Polywrap version ${anyPluginManifest.format}, please upgrade your PolywrapClient package.` - ); - } else { - // Latest - return anyPluginManifest as PluginManifest; - } - } -); diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/validate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/validate.ts deleted file mode 100644 index 6eff52d0c3..0000000000 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/validate.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/validate-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. - */ -import { - AnyPluginManifest, - PluginManifestFormats -} from "."; -import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.plugin/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.plugin/0.0.1-prealpha.2.json"; -import schema_0_0_1_prealpha_3 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap.plugin/0.0.1-prealpha.3.json"; -import { Tracer } from "@polywrap/tracing-js" - -import { - Schema, - Validator, - ValidationError, - ValidatorResult -} from "jsonschema"; - -type PluginManifestSchemas = { - [key in PluginManifestFormats]: Schema | undefined -}; - -const schemas: PluginManifestSchemas = { - "0.0.1-prealpha.1": schema_0_0_1_prealpha_1, - "0.0.1-prealpha.2": schema_0_0_1_prealpha_2, - "0.0.1-prealpha.3": schema_0_0_1_prealpha_3, -}; - -const validator = new Validator(); - -Validator.prototype.customFormats.pluginLanguage = Validators.pluginLanguage; -Validator.prototype.customFormats.file = Validators.file; -Validator.prototype.customFormats.packageName = Validators.packageName; -Validator.prototype.customFormats.graphqlFile = Validators.graphqlFile; - -export const validatePluginManifest = Tracer.traceFunc( - "core: validatePluginManifest", - ( - manifest: AnyPluginManifest, - extSchema: Schema | undefined = undefined - ): void => { - const schema = schemas[manifest.format as PluginManifestFormats]; - - if (!schema) { - throw Error(`Unrecognized PluginManifest schema format "${manifest.format}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); - } - - const throwIfErrors = (result: ValidatorResult) => { - if (result.errors.length) { - throw new Error([ - `Validation errors encountered while sanitizing PluginManifest format ${manifest.format}`, - ...result.errors.map((error: ValidationError) => error.toString()) - ].join("\n")); - } - }; - - throwIfErrors(validator.validate(manifest, schema)); - - if (extSchema) { - throwIfErrors(validator.validate(manifest, extSchema)); - } - } -); diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/deserialize.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/deserialize.ts deleted file mode 100644 index def04e45c3..0000000000 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/deserialize.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. - */ - -import { - PolywrapManifest, - AnyPolywrapManifest, - migratePolywrapManifest, - validatePolywrapManifest, - latestPolywrapManifestFormat, -} from "."; -import { DeserializeManifestOptions } from "../../"; - -import { compare } from "semver"; -import YAML from "js-yaml"; -import { Tracer } from "@polywrap/tracing-js"; - -export const deserializePolywrapManifest = Tracer.traceFunc( - "core: deserializePolywrapManifest", - (manifest: string, options?: DeserializeManifestOptions): PolywrapManifest => { - let anyPolywrapManifest: AnyPolywrapManifest | undefined; - try { - anyPolywrapManifest = JSON.parse(manifest) as AnyPolywrapManifest; - } catch (e) { - anyPolywrapManifest = YAML.safeLoad(manifest) as - | AnyPolywrapManifest - | undefined; - } - - if (!anyPolywrapManifest) { - throw Error(`Unable to parse PolywrapManifest: ${manifest}`); - } - - if (!options || !options.noValidate) { - validatePolywrapManifest(anyPolywrapManifest, options?.extSchema); - } - - anyPolywrapManifest.__type = "PolywrapManifest"; - - const versionCompare = compare( - anyPolywrapManifest.format, - latestPolywrapManifestFormat - ); - - if (versionCompare === -1) { - // Upgrade - return migratePolywrapManifest(anyPolywrapManifest, latestPolywrapManifestFormat); - } else if (versionCompare === 1) { - // Downgrade - throw Error( - `Cannot downgrade Polywrap version ${anyPolywrapManifest.format}, please upgrade your PolywrapClient package.` - ); - } else { - // Latest - return anyPolywrapManifest as PolywrapManifest; - } - } -); diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/validate.ts b/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/validate.ts deleted file mode 100644 index b51300260b..0000000000 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/validate.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/validate-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. - */ -import { - AnyPolywrapManifest, - PolywrapManifestFormats -} from "."; -import * as Validators from "../../validators"; -import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap/0.0.1-prealpha.1.json"; -import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap/0.0.1-prealpha.2.json"; -import schema_0_0_1_prealpha_3 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap/0.0.1-prealpha.3.json"; -import schema_0_0_1_prealpha_4 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap/0.0.1-prealpha.4.json"; -import schema_0_0_1_prealpha_5 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap/0.0.1-prealpha.5.json"; -import schema_0_0_1_prealpha_6 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap/0.0.1-prealpha.6.json"; -import schema_0_0_1_prealpha_7 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap/0.0.1-prealpha.7.json"; -import schema_0_0_1_prealpha_8 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap/0.0.1-prealpha.8.json"; -import schema_0_0_1_prealpha_9 from "@polywrap/polywrap-manifest-schemas/formats/schemas/polywrap/0.0.1-prealpha.9.json"; -import { Tracer } from "@polywrap/tracing-js" - -import { - Schema, - Validator, - ValidationError, - ValidatorResult -} from "jsonschema"; - -type PolywrapManifestSchemas = { - [key in PolywrapManifestFormats]: Schema | undefined -}; - -const schemas: PolywrapManifestSchemas = { - "0.0.1-prealpha.1": schema_0_0_1_prealpha_1, - "0.0.1-prealpha.2": schema_0_0_1_prealpha_2, - "0.0.1-prealpha.3": schema_0_0_1_prealpha_3, - "0.0.1-prealpha.4": schema_0_0_1_prealpha_4, - "0.0.1-prealpha.5": schema_0_0_1_prealpha_5, - "0.0.1-prealpha.6": schema_0_0_1_prealpha_6, - "0.0.1-prealpha.7": schema_0_0_1_prealpha_7, - "0.0.1-prealpha.8": schema_0_0_1_prealpha_8, - "0.0.1-prealpha.9": schema_0_0_1_prealpha_9, -}; - -const validator = new Validator(); - -Validator.prototype.customFormats.file = Validators.file; -Validator.prototype.customFormats.wasmLanguage = Validators.wasmLanguage; -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", - ( - manifest: AnyPolywrapManifest, - extSchema: Schema | undefined = undefined - ): void => { - const schema = schemas[manifest.format as PolywrapManifestFormats]; - - if (!schema) { - throw Error(`Unrecognized PolywrapManifest schema format "${manifest.format}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); - } - - const throwIfErrors = (result: ValidatorResult) => { - if (result.errors.length) { - throw new Error([ - `Validation errors encountered while sanitizing PolywrapManifest format ${manifest.format}`, - ...result.errors.map((error: ValidationError) => error.toString()) - ].join("\n")); - } - }; - - throwIfErrors(validator.validate(manifest, schema)); - - if (extSchema) { - throwIfErrors(validator.validate(manifest, extSchema)); - } - } -); diff --git a/packages/manifest-schemas/polywrap/formats/validators.ts b/packages/manifest-schemas/polywrap/formats/validators.ts deleted file mode 100644 index f1d20d60e2..0000000000 --- a/packages/manifest-schemas/polywrap/formats/validators.ts +++ /dev/null @@ -1,146 +0,0 @@ -import { Uri } from "@polywrap/core-js"; - -export function file(path: unknown): boolean { - if (typeof path !== "string") { - return false; - } - - // eslint-disable-next-line no-useless-escape - const validPathMatch = path.match(/^((\.\/|..\/)[^\/ ]*)+\/?$/gm); - - let result = false; - if (validPathMatch && validPathMatch[0]) { - result = validPathMatch[0].length === path.length; - } - - return result; -} - -export function packageName(name: unknown): boolean { - return typeof name === "string"; -} - -export function packageTag(tag: unknown): boolean { - return typeof tag === "string"; -} - -export function dockerImageName(name: unknown): boolean { - return typeof name === "string"; -} - -export function dockerfileName(value: unknown): boolean { - return ( - typeof value === "string" && file(value) && value.indexOf("Dockerfile") > -1 - ); -} - -export function dockerImageId(value: unknown): boolean { - return typeof value === "string" && value.indexOf("sha256:") > -1; -} - -export function wasmLanguage(language: unknown): boolean { - return ( - typeof language === "string" && - (language === "interface" || language.indexOf("wasm/") > -1) - ); -} - -export function pluginLanguage(language: unknown): boolean { - return typeof language === "string" && language.indexOf("plugin/") > -1; -} - -export function appLanguage(language: unknown): boolean { - return typeof language === "string" && language.indexOf("app/") > -1; -} - -export function imageFile(filePath: unknown): boolean { - return ( - typeof filePath === "string" && - file(filePath) && - !!filePath.match(/(\.svg|\.png)$/)?.length - ); -} - -export function websiteUrl(url: unknown): boolean { - function validUrl(str: string) { - const pattern = new RegExp( - "^(https?:\\/\\/)?" + // protocol - "((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|" + // domain name - "((\\d{1,3}\\.){3}\\d{1,3}))" + // OR ip (v4) address - "(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*" + // port and path - "(\\?[;&a-z\\d%_.~+=-]*)?" + // query string - "(\\#[-a-z\\d_]*)?$", // fragment locator - "i" - ); - return !!pattern.test(str); - } - return typeof url === "string" && validUrl(url); -} - -export function graphqlFile(filePath: unknown): boolean { - return ( - typeof filePath === "string" && - file(filePath) && - !!filePath.match(/(\.graphql)$/)?.length - ); -} - -export function jsonFile(filePath: unknown): boolean { - return ( - typeof filePath === "string" && - file(filePath) && - !!filePath.match(/(\.json)$/)?.length - ); -} - -export function yamlFile(filePath: unknown): boolean { - return ( - typeof filePath === "string" && - file(filePath) && - !!filePath.match(/(\.yaml)$/)?.length - ); -} - -export function manifestFile(filePath: unknown): boolean { - return jsonFile(filePath) || yamlFile(filePath); -} - -export function regexString(regex: unknown): boolean { - if (typeof regex !== "string") { - return false; - } - - let isValid = true; - try { - new RegExp(regex); - } catch (e) { - isValid = false; - } - - return isValid; -} - -export function polywrapUri(uri: unknown): boolean { - return typeof uri === "string" && Uri.isValidUri(uri); -} - -export function schemaFile(filePath: unknown): boolean { - return typeof filePath === "string" && file(filePath); -} - -export function directory(path: unknown): boolean { - if (typeof path === "boolean") { - return true; - } - if (typeof path !== "string") { - return false; - } - - const validDirRegex = /^\/?[\w\-/]+$/; - - return !!validDirRegex.test(path); -} - -export function validType(type: unknown): boolean { - return typeof type === "string" && (type === "wasm" || type === "interface"); -} diff --git a/packages/manifest-schemas/polywrap/templates/deserialize-ts.mustache b/packages/manifest-schemas/polywrap/templates/deserialize-ts.mustache deleted file mode 100644 index 65a8e45188..0000000000 --- a/packages/manifest-schemas/polywrap/templates/deserialize-ts.mustache +++ /dev/null @@ -1,61 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. - */ - -import { - {{type}}, - Any{{type}}, - migrate{{type}}, - validate{{type}}, - latest{{type}}Format, -} from "."; -import { DeserializeManifestOptions } from "../../"; - -import { compare } from "semver"; -import YAML from "js-yaml"; -import { Tracer } from "@polywrap/tracing-js"; - -export const deserialize{{type}} = Tracer.traceFunc( - "core: deserialize{{type}}", - (manifest: string, options?: DeserializeManifestOptions): {{type}} => { - let any{{type}}: Any{{type}} | undefined; - try { - any{{type}} = JSON.parse(manifest) as Any{{type}}; - } catch (e) { - any{{type}} = YAML.safeLoad(manifest) as - | Any{{type}} - | undefined; - } - - if (!any{{type}}) { - throw Error(`Unable to parse {{type}}: ${manifest}`); - } - - if (!options || !options.noValidate) { - validate{{type}}(any{{type}}, options?.extSchema); - } - - any{{type}}.__type = "{{type}}"; - - const versionCompare = compare( - any{{type}}.format, - latest{{type}}Format - ); - - if (versionCompare === -1) { - // Upgrade - return migrate{{type}}(any{{type}}, latest{{type}}Format); - } else if (versionCompare === 1) { - // Downgrade - throw Error( - `Cannot downgrade Polywrap version ${any{{type}}.format}, please upgrade your PolywrapClient package.` - ); - } else { - // Latest - return any{{type}} as {{type}}; - } - } -); diff --git a/packages/manifest-schemas/polywrap/templates/validate-ts.mustache b/packages/manifest-schemas/polywrap/templates/validate-ts.mustache deleted file mode 100644 index 8947fdb999..0000000000 --- a/packages/manifest-schemas/polywrap/templates/validate-ts.mustache +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/validate-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. - */ -import { - Any{{#latest}}{{type}}{{/latest}}, - {{#latest}}{{type}}{{/latest}}Formats -} from "."; -{{#validators.length}}import * as Validators from "../../validators";{{/validators.length}} -{{#formats}} -import schema_{{tsVersion}} from "@polywrap/polywrap-manifest-schemas/formats/schemas/{{dir}}/{{version}}.json"; -{{/formats}} -import { Tracer } from "@polywrap/tracing-js" - -import { - Schema, - Validator, - ValidationError, - ValidatorResult -} from "jsonschema"; - -type {{#latest}}{{type}}{{/latest}}Schemas = { - [key in {{#latest}}{{type}}{{/latest}}Formats]: Schema | undefined -}; - -const schemas: {{#latest}}{{type}}{{/latest}}Schemas = { - {{#formats}} - "{{version}}": schema_{{tsVersion}}, - {{/formats}} -}; - -const validator = new Validator(); - -{{#validators}} -Validator.prototype.customFormats.{{.}} = Validators.{{.}}; -{{/validators}} - -export const validate{{#latest}}{{type}}{{/latest}} = Tracer.traceFunc( - "core: validate{{#latest}}{{type}}{{/latest}}", - ( - manifest: Any{{#latest}}{{type}}{{/latest}}, - extSchema: Schema | undefined = undefined - ): void => { - const schema = schemas[manifest.format as {{#latest}}{{type}}{{/latest}}Formats]; - - if (!schema) { - throw Error(`Unrecognized {{#latest}}{{type}}{{/latest}} schema format "${manifest.format}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); - } - - const throwIfErrors = (result: ValidatorResult) => { - if (result.errors.length) { - throw new Error([ - `Validation errors encountered while sanitizing {{#latest}}{{type}}{{/latest}} format ${manifest.format}`, - ...result.errors.map((error: ValidationError) => error.toString()) - ].join("\n")); - } - }; - - throwIfErrors(validator.validate(manifest, schema)); - - if (extSchema) { - throwIfErrors(validator.validate(manifest, extSchema)); - } - } -); diff --git a/packages/manifest-schemas/polywrap/tsconfig.json b/packages/manifest-schemas/polywrap/tsconfig.json deleted file mode 100644 index dbd71ca0b5..0000000000 --- a/packages/manifest-schemas/polywrap/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../../tsconfig.json", - "compilerOptions": { - "outDir": "build" - }, - "include": [ - "./formats/**/*.ts" - ], - "exclude": [ - "./formats/validators.ts", - "./formats/schemas" - ]} diff --git a/packages/manifest-schemas/wrap/formats/index.ts b/packages/manifest-schemas/wrap/formats/index.ts deleted file mode 100644 index c7460f35d2..0000000000 --- a/packages/manifest-schemas/wrap/formats/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./interfaces"; -export * from "./deserialize"; \ No newline at end of file diff --git a/packages/manifest-schemas/wrap/formats/interfaces/deserialize.ts b/packages/manifest-schemas/wrap/formats/interfaces/deserialize.ts deleted file mode 100644 index ddf543f03a..0000000000 --- a/packages/manifest-schemas/wrap/formats/interfaces/deserialize.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, - * and run ts-node ./scripts/generateWrapManifestTypes.ts to regenerate this file. - */ - -import { - WrapManifest, - AnyWrapManifest, - migrateWrapManifest, - validateWrapManifest, - latestWrapManifestVersion, -} from "."; -import { DeserializeManifestOptions } from "../"; - -import { compare } from "semver"; -import { Tracer } from "@polywrap/tracing-js"; - -export const deserializeWrapManifest = Tracer.traceFunc( - "core: deserializeWrapManifest", - (manifest: Uint8Array, decoder: (m: Uint8Array) => unknown, options?: DeserializeManifestOptions): WrapManifest => { - let anyWrapManifest: AnyWrapManifest | undefined; - try { - anyWrapManifest = decoder(manifest) as AnyWrapManifest; - } catch (e) { - throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); - } - - if (!options || !options.noValidate) { - validateWrapManifest(anyWrapManifest); - } - - const versionCompare = compare( - anyWrapManifest.version, - latestWrapManifestVersion - ); - - if (versionCompare === -1) { - // Upgrade - return migrateWrapManifest(anyWrapManifest, latestWrapManifestVersion); - } else if (versionCompare === 1) { - // Downgrade - throw Error( - `Cannot downgrade WrapManifest version ${anyWrapManifest.version}, please upgrade your WRAP package.` - ); - } else { - // Latest - return anyWrapManifest as WrapManifest; - } - } -); diff --git a/packages/manifest-schemas/wrap/formats/interfaces/migrate.ts b/packages/manifest-schemas/wrap/formats/interfaces/migrate.ts deleted file mode 100644 index 6225a65ac7..0000000000 --- a/packages/manifest-schemas/wrap/formats/interfaces/migrate.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/migrate-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/migrate-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. - */ -import { - AnyWrapManifest, - WrapManifest, - WrapManifestVersions, - latestWrapManifestVersion -} from "."; - - -import { Tracer } from "@polywrap/tracing-js"; - -type Migrator = { - [key in WrapManifestVersions]?: (m: AnyWrapManifest) => WrapManifest; -}; - -export const migrators: Migrator = { -}; - -export const migrateWrapManifest = Tracer.traceFunc( - "core: migrateWrapManifest", - (manifest: AnyWrapManifest, to: WrapManifestVersions): WrapManifest => { - const from = manifest.version as WrapManifestVersions; - - if (from === latestWrapManifestVersion) { - return manifest as WrapManifest; - } - - if (!(from in WrapManifestVersions)) { - throw new Error(`Unrecognized WrapManifestVersion "${manifest.version}"`); - } - - throw new Error(`This should never happen, WrapManifest migrators is empty. from: ${from}, to: ${to}`); - } -); diff --git a/packages/manifest-schemas/wrap/formats/interfaces/validate.ts b/packages/manifest-schemas/wrap/formats/interfaces/validate.ts deleted file mode 100644 index 81f70acd06..0000000000 --- a/packages/manifest-schemas/wrap/formats/interfaces/validate.ts +++ /dev/null @@ -1,60 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/validate-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. - */ -import { - AnyWrapManifest, - WrapManifestVersions -} from "."; - -import schema_0_0_1 from "@polywrap/wrap-manifest-schemas/formats/schemas/wrap.info/0.0.1.json"; -import { Tracer } from "@polywrap/tracing-js" - -import { - Schema, - Validator, - ValidationError, - ValidatorResult -} from "jsonschema"; - -type WrapManifestSchemas = { - [key in WrapManifestVersions]: Schema | undefined -}; - -const schemas: WrapManifestSchemas = { - "0.0.1": schema_0_0_1, -}; - -const validator = new Validator(); - - -export const validateWrapManifest = Tracer.traceFunc( - "core: validateWrapManifest", - ( - manifest: AnyWrapManifest, - extSchema: Schema | undefined = undefined - ): void => { - const schema = schemas[manifest.version as WrapManifestVersions]; - - if (!schema) { - throw Error(`Unrecognized WrapManifest schema version "${manifest.version}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); - } - - const throwIfErrors = (result: ValidatorResult) => { - if (result.errors.length) { - throw new Error([ - `Validation errors encountered while sanitizing WrapManifest version ${manifest.version}`, - ...result.errors.map((error: ValidationError) => error.toString()) - ].join("\n")); - } - }; - - throwIfErrors(validator.validate(manifest, schema)); - - if (extSchema) { - throwIfErrors(validator.validate(manifest, extSchema)); - } - } -); diff --git a/packages/manifest-schemas/wrap/templates/deserialize-ts.mustache b/packages/manifest-schemas/wrap/templates/deserialize-ts.mustache deleted file mode 100644 index ddf543f03a..0000000000 --- a/packages/manifest-schemas/wrap/templates/deserialize-ts.mustache +++ /dev/null @@ -1,52 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, - * and run ts-node ./scripts/generateWrapManifestTypes.ts to regenerate this file. - */ - -import { - WrapManifest, - AnyWrapManifest, - migrateWrapManifest, - validateWrapManifest, - latestWrapManifestVersion, -} from "."; -import { DeserializeManifestOptions } from "../"; - -import { compare } from "semver"; -import { Tracer } from "@polywrap/tracing-js"; - -export const deserializeWrapManifest = Tracer.traceFunc( - "core: deserializeWrapManifest", - (manifest: Uint8Array, decoder: (m: Uint8Array) => unknown, options?: DeserializeManifestOptions): WrapManifest => { - let anyWrapManifest: AnyWrapManifest | undefined; - try { - anyWrapManifest = decoder(manifest) as AnyWrapManifest; - } catch (e) { - throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); - } - - if (!options || !options.noValidate) { - validateWrapManifest(anyWrapManifest); - } - - const versionCompare = compare( - anyWrapManifest.version, - latestWrapManifestVersion - ); - - if (versionCompare === -1) { - // Upgrade - return migrateWrapManifest(anyWrapManifest, latestWrapManifestVersion); - } else if (versionCompare === 1) { - // Downgrade - throw Error( - `Cannot downgrade WrapManifest version ${anyWrapManifest.version}, please upgrade your WRAP package.` - ); - } else { - // Latest - return anyWrapManifest as WrapManifest; - } - } -); diff --git a/packages/manifest-schemas/wrap/templates/validate-ts.mustache b/packages/manifest-schemas/wrap/templates/validate-ts.mustache deleted file mode 100644 index 52233095c4..0000000000 --- a/packages/manifest-schemas/wrap/templates/validate-ts.mustache +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by scripts/manifest/validate-ts.mustache. - * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, - * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. - */ -import { - Any{{#latest}}WrapManifest{{/latest}}, - {{#latest}}WrapManifest{{/latest}}Versions -} from "."; -{{#validators.length}}import * as Validators from "../validators";{{/validators.length}} -{{#formats}} -import schema_{{tsVersion}} from "@polywrap/wrap-manifest-schemas/formats/schemas/wrap.info/{{version}}.json"; -{{/formats}} -import { Tracer } from "@polywrap/tracing-js" - -import { - Schema, - Validator, - ValidationError, - ValidatorResult -} from "jsonschema"; - -type {{#latest}}WrapManifest{{/latest}}Schemas = { - [key in {{#latest}}WrapManifest{{/latest}}Versions]: Schema | undefined -}; - -const schemas: {{#latest}}WrapManifest{{/latest}}Schemas = { - {{#formats}} - "{{version}}": schema_{{tsVersion}}, - {{/formats}} -}; - -const validator = new Validator(); - -{{#validators}} -Validator.prototype.{{.}} = Validators.{{.}}; -{{/validators}} - -export const validate{{#latest}}WrapManifest{{/latest}} = Tracer.traceFunc( - "core: validate{{#latest}}WrapManifest{{/latest}}", - ( - manifest: Any{{#latest}}WrapManifest{{/latest}}, - extSchema: Schema | undefined = undefined - ): void => { - const schema = schemas[manifest.version as {{#latest}}WrapManifest{{/latest}}Versions]; - - if (!schema) { - throw Error(`Unrecognized {{#latest}}WrapManifest{{/latest}} schema version "${manifest.version}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); - } - - const throwIfErrors = (result: ValidatorResult) => { - if (result.errors.length) { - throw new Error([ - `Validation errors encountered while sanitizing {{#latest}}WrapManifest{{/latest}} version ${manifest.version}`, - ...result.errors.map((error: ValidationError) => error.toString()) - ].join("\n")); - } - }; - - throwIfErrors(validator.validate(manifest, schema)); - - if (extSchema) { - throwIfErrors(validator.validate(manifest, extSchema)); - } - } -); diff --git a/packages/manifest-schemas/wrap/tsconfig.json b/packages/manifest-schemas/wrap/tsconfig.json deleted file mode 100644 index dbd71ca0b5..0000000000 --- a/packages/manifest-schemas/wrap/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../../tsconfig.json", - "compilerOptions": { - "outDir": "build" - }, - "include": [ - "./formats/**/*.ts" - ], - "exclude": [ - "./formats/validators.ts", - "./formats/schemas" - ]} diff --git a/packages/manifest/.gitignore b/packages/manifest/.gitignore new file mode 100644 index 0000000000..2b6d9bc65d --- /dev/null +++ b/packages/manifest/.gitignore @@ -0,0 +1 @@ +!wrap \ No newline at end of file diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.app/0.0.1-prealpha.1.json b/packages/manifest/polywrap/schema/formats/polywrap.app/0.0.1-prealpha.1.json similarity index 80% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap.app/0.0.1-prealpha.1.json rename to packages/manifest/polywrap/schema/formats/polywrap.app/0.0.1-prealpha.1.json index 7116d530f9..055a512d0f 100644 --- a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.app/0.0.1-prealpha.1.json +++ b/packages/manifest/polywrap/schema/formats/polywrap.app/0.0.1-prealpha.1.json @@ -16,12 +16,12 @@ "language": { "description": "Language in which the source code is written.", "type": "string", - "format": "appLanguage" + "pattern": "^app\\/[a-z0-9]+$" }, "schema": { "description": "Path to graphql schema.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" }, "import_redirects": { "description": "Redirects for the schema's imports.", @@ -33,12 +33,12 @@ "uri": { "description": "Import URI to be redirected.", "type": "string", - "format": "polywrapUri" + "pattern": "^[wrap://]*[a-z\\-\\_0-9]+\\/.+$" }, "schema": { "description": "Path to a graphql schema to be used for the import.", "type": "string", - "format": "schemaFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" } }, "required": [ diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.app/0.0.1-prealpha.2.json b/packages/manifest/polywrap/schema/formats/polywrap.app/0.0.1-prealpha.2.json similarity index 79% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap.app/0.0.1-prealpha.2.json rename to packages/manifest/polywrap/schema/formats/polywrap.app/0.0.1-prealpha.2.json index 78cad5deba..10b0e826d9 100644 --- a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.app/0.0.1-prealpha.2.json +++ b/packages/manifest/polywrap/schema/formats/polywrap.app/0.0.1-prealpha.2.json @@ -17,17 +17,17 @@ "name": { "description": "Name of this wrapper package.", "type": "string", - "format": "packageName" + "pattern": "^[a-zA-Z0-9\\-\\_]+$" }, "language": { "description": "Language in which the source code is written.", "type": "string", - "format": "appLanguage" + "pattern": "^app\\/[a-z0-9]+$" }, "schema": { "description": "Path to graphql schema.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" }, "import_redirects": { "description": "Redirects for the schema's imports.", @@ -39,12 +39,12 @@ "uri": { "description": "Import URI to be redirected.", "type": "string", - "format": "polywrapUri" + "pattern": "^[wrap://]*[a-z\\-\\_0-9]+\\/.+$" }, "schema": { "description": "Path to a graphql schema to be used for the import.", "type": "string", - "format": "schemaFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" } }, "required": [ diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.build/0.0.1-prealpha.1.json b/packages/manifest/polywrap/schema/formats/polywrap.build/0.0.1-prealpha.1.json similarity index 77% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap.build/0.0.1-prealpha.1.json rename to packages/manifest/polywrap/schema/formats/polywrap.build/0.0.1-prealpha.1.json index d80c21a79e..08cb8f19fd 100644 --- a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.build/0.0.1-prealpha.1.json +++ b/packages/manifest/polywrap/schema/formats/polywrap.build/0.0.1-prealpha.1.json @@ -19,17 +19,12 @@ "name": { "description": "Docker image name.", "type": "string", - "format": "dockerImageName" + "pattern": "^[a-zA-Z0-9\\-\\_]+$" }, "dockerfile": { "description": "Docker image file name.", "type": "string", - "format": "dockerfileName" - }, - "buildImageId": { - "description": "Id of the docker image.", - "type": "string", - "format": "dockerImageId" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/Dockerfile$" } } }, diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.build/0.0.1-prealpha.2.json b/packages/manifest/polywrap/schema/formats/polywrap.build/0.0.1-prealpha.2.json similarity index 77% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap.build/0.0.1-prealpha.2.json rename to packages/manifest/polywrap/schema/formats/polywrap.build/0.0.1-prealpha.2.json index 559e7e67a2..dc1b7b9f9c 100644 --- a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.build/0.0.1-prealpha.2.json +++ b/packages/manifest/polywrap/schema/formats/polywrap.build/0.0.1-prealpha.2.json @@ -16,17 +16,12 @@ "name": { "description": "Docker image name.", "type": "string", - "format": "dockerImageName" + "pattern": "^[a-zA-Z0-9\\-\\_]+$" }, "dockerfile": { "description": "Docker image file name.", "type": "string", - "format": "dockerfileName" - }, - "buildImageId": { - "description": "Id of the docker image.", - "type": "string", - "format": "dockerImageId" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/Dockerfile$" } } }, @@ -52,7 +47,7 @@ "filter": { "description": "Ignore files matching this regex in linked package directory.", "type": "string", - "format": "regexString" + "pattern": "^(?:(?:[^?+*{}()[\\]\\\\|]+|\\\\.|\\[(?:\\^?\\\\.|\\^[^\\\\]|[^\\\\^])(?:[^\\]\\\\]+|\\\\.)*\\]|\\((?:\\?[:=!]|\\?<[=!]|\\?>|\\?<[^\\W\\d]\\w*>|\\?'[^\\W\\d]\\w*')?(?)|\\)(?<-N>))(?:(?:[?+*]|\\{\\d+(?:,\\d*)?\\})[?+]?)?|\\|)*$(?(N)(?!))" } }, "required": ["name", "path"] diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.build/0.0.1-prealpha.3.json b/packages/manifest/polywrap/schema/formats/polywrap.build/0.0.1-prealpha.3.json similarity index 81% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap.build/0.0.1-prealpha.3.json rename to packages/manifest/polywrap/schema/formats/polywrap.build/0.0.1-prealpha.3.json index 081d963775..516555e5cc 100644 --- a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.build/0.0.1-prealpha.3.json +++ b/packages/manifest/polywrap/schema/formats/polywrap.build/0.0.1-prealpha.3.json @@ -16,17 +16,12 @@ "name": { "description": "Docker image name.", "type": "string", - "format": "dockerImageName" + "pattern": "^[a-zA-Z0-9\\-\\_]+$" }, "dockerfile": { "description": "Docker image file name.", "type": "string", - "format": "dockerfileName" - }, - "buildImageId": { - "description": "Id of the docker image.", - "type": "string", - "format": "dockerImageId" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/Dockerfile$" }, "buildx": { "description": "Configuration options for Docker Buildx, set to true for default value.", @@ -36,7 +31,7 @@ "cache": { "description": "Path to cache directory, set to true for default value, set to false to disable caching.", "type": ["string", "boolean"], - "format": "directory" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" }, "removeBuilder": { "description": "Remove the builder instance.", @@ -72,7 +67,7 @@ "filter": { "description": "Ignore files matching this regex in linked package directory.", "type": "string", - "format": "regexString" + "pattern": "^(?:(?:[^?+*{}()[\\]\\\\|]+|\\\\.|\\[(?:\\^?\\\\.|\\^[^\\\\]|[^\\\\^])(?:[^\\]\\\\]+|\\\\.)*\\]|\\((?:\\?[:=!]|\\?<[=!]|\\?>|\\?<[^\\W\\d]\\w*>|\\?'[^\\W\\d]\\w*')?(?)|\\)(?<-N>))(?:(?:[?+*]|\\{\\d+(?:,\\d*)?\\})[?+]?)?|\\|)*$(?(N)(?!))" } }, "required": ["name", "path"] diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.deploy/0.0.1-prealpha.1.json b/packages/manifest/polywrap/schema/formats/polywrap.deploy/0.0.1-prealpha.1.json similarity index 94% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap.deploy/0.0.1-prealpha.1.json rename to packages/manifest/polywrap/schema/formats/polywrap.deploy/0.0.1-prealpha.1.json index ebef33fc11..daadcc1ddc 100644 --- a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.deploy/0.0.1-prealpha.1.json +++ b/packages/manifest/polywrap/schema/formats/polywrap.deploy/0.0.1-prealpha.1.json @@ -35,7 +35,7 @@ "uri": { "description": "URI to pass into the deploy stage.", "type": "string", - "format": "polywrapUri" + "pattern": "^[wrap://]*[a-z\\-\\_0-9]+\\/.+$" } } } diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.infra/0.0.1-prealpha.1.json b/packages/manifest/polywrap/schema/formats/polywrap.infra/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap.infra/0.0.1-prealpha.1.json rename to packages/manifest/polywrap/schema/formats/polywrap.infra/0.0.1-prealpha.1.json diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.infra/0.0.1-prealpha.2.json b/packages/manifest/polywrap/schema/formats/polywrap.infra/0.0.1-prealpha.2.json similarity index 100% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap.infra/0.0.1-prealpha.2.json rename to packages/manifest/polywrap/schema/formats/polywrap.infra/0.0.1-prealpha.2.json diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.meta/0.0.1-prealpha.1.json b/packages/manifest/polywrap/schema/formats/polywrap.meta/0.0.1-prealpha.1.json similarity index 71% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap.meta/0.0.1-prealpha.1.json rename to packages/manifest/polywrap/schema/formats/polywrap.meta/0.0.1-prealpha.1.json index c13a8241fd..6eb1c3aa9e 100644 --- a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.meta/0.0.1-prealpha.1.json +++ b/packages/manifest/polywrap/schema/formats/polywrap.meta/0.0.1-prealpha.1.json @@ -27,12 +27,12 @@ "repository": { "description": "Reference to the repository holding source code.", "type": "string", - "format": "websiteUrl" + "pattern": "^((h|H)(t|T)(t|T)(p|P)(s|S)?:\\/\\/)?((([a-zA-Z\\d]([a-zA-Z\\d-]*[a-zA-Z\\d])*)\\.)+[a-zA-Z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-zA-Z\\d%_.~+]*)*(\\?[;&a-zA-Z\\d%_.~+=-]*)?(\\#[-a-zA-Z\\d_]*)?$" }, "icon": { "description": "Path to wrapper icon.", "type": "string", - "format": "imageFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(svg|png)$" }, "links": { "description": "Relevant web links.", @@ -48,12 +48,12 @@ "icon": { "description": "Web link icon.", "type": "string", - "format": "imageFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(svg|png)$" }, "url": { "description": "Url to the web link.", "type": "string", - "format": "websiteUrl" + "pattern": "^((h|H)(t|T)(t|T)(p|P)(s|S)?:\\/\\/)?((([a-zA-Z\\d]([a-zA-Z\\d-]*[a-zA-Z\\d])*)\\.)+[a-zA-Z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-zA-Z\\d%_.~+]*)*(\\?[;&a-zA-Z\\d%_.~+=-]*)?(\\#[-a-zA-Z\\d_]*)?$" } }, "required": [ @@ -80,12 +80,12 @@ "query": { "description": "Path to graph ql file.", "type": "string", - "format": "graphqlFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" }, "vars": { "description": "Query parameters.", "type": "string", - "format": "jsonFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.json$" } }, "required": [ diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.meta/0.0.1-prealpha.2.json b/packages/manifest/polywrap/schema/formats/polywrap.meta/0.0.1-prealpha.2.json similarity index 71% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap.meta/0.0.1-prealpha.2.json rename to packages/manifest/polywrap/schema/formats/polywrap.meta/0.0.1-prealpha.2.json index a0b24090d5..2f8bbb984e 100644 --- a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.meta/0.0.1-prealpha.2.json +++ b/packages/manifest/polywrap/schema/formats/polywrap.meta/0.0.1-prealpha.2.json @@ -26,12 +26,12 @@ "repository": { "description": "Reference to the repository holding source code.", "type": "string", - "format": "websiteUrl" + "pattern": "^((h|H)(t|T)(t|T)(p|P)(s|S)?:\\/\\/)?((([a-zA-Z\\d]([a-zA-Z\\d-]*[a-zA-Z\\d])*)\\.)+[a-zA-Z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-zA-Z\\d%_.~+]*)*(\\?[;&a-zA-Z\\d%_.~+=-]*)?(\\#[-a-zA-Z\\d_]*)?$" }, "icon": { "description": "Path to wrapper icon.", "type": "string", - "format": "imageFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(svg|png)$" }, "links": { "description": "Relevant web links.", @@ -47,12 +47,12 @@ "icon": { "description": "Web link icon.", "type": "string", - "format": "imageFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(svg|png)$" }, "url": { "description": "Url to the web link.", "type": "string", - "format": "websiteUrl" + "pattern": "^((h|H)(t|T)(t|T)(p|P)(s|S)?:\\/\\/)?((([a-zA-Z\\d]([a-zA-Z\\d-]*[a-zA-Z\\d])*)\\.)+[a-zA-Z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-zA-Z\\d%_.~+]*)*(\\?[;&a-zA-Z\\d%_.~+=-]*)?(\\#[-a-zA-Z\\d_]*)?$" } }, "required": [ @@ -79,12 +79,12 @@ "query": { "description": "Path to graph ql file.", "type": "string", - "format": "graphqlFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" }, "vars": { "description": "Query parameters.", "type": "string", - "format": "jsonFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.json$" } }, "required": [ diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.meta/0.0.1-prealpha.3.json b/packages/manifest/polywrap/schema/formats/polywrap.meta/0.0.1-prealpha.3.json similarity index 72% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap.meta/0.0.1-prealpha.3.json rename to packages/manifest/polywrap/schema/formats/polywrap.meta/0.0.1-prealpha.3.json index 33790085bb..c8eddeed1c 100644 --- a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.meta/0.0.1-prealpha.3.json +++ b/packages/manifest/polywrap/schema/formats/polywrap.meta/0.0.1-prealpha.3.json @@ -26,7 +26,7 @@ "repository": { "description": "Reference to the repository holding source code.", "type": "string", - "format": "websiteUrl" + "pattern": "^((h|H)(t|T)(t|T)(p|P)(s|S)?:\\/\\/)?((([a-zA-Z\\d]([a-zA-Z\\d-]*[a-zA-Z\\d])*)\\.)+[a-zA-Z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-zA-Z\\d%_.~+]*)*(\\?[;&a-zA-Z\\d%_.~+=-]*)?(\\#[-a-zA-Z\\d_]*)?$" }, "tags": { "description": "List of relevant tag keywords.", @@ -34,13 +34,13 @@ "items": { "description": "Tag keyword.", "type": "string", - "format": "packageTag" + "pattern": "^[a-zA-Z0-9\\-\\_]+$" } }, "icon": { "description": "Path to wrapper icon.", "type": "string", - "format": "imageFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(svg|png)$" }, "links": { "description": "Relevant web links.", @@ -56,12 +56,12 @@ "icon": { "description": "Web link icon.", "type": "string", - "format": "imageFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(svg|png)$" }, "url": { "description": "Url to the web link.", "type": "string", - "format": "websiteUrl" + "pattern": "^((h|H)(t|T)(t|T)(p|P)(s|S)?:\\/\\/)?((([a-zA-Z\\d]([a-zA-Z\\d-]*[a-zA-Z\\d])*)\\.)+[a-zA-Z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-zA-Z\\d%_.~+]*)*(\\?[;&a-zA-Z\\d%_.~+=-]*)?(\\#[-a-zA-Z\\d_]*)?$" } }, "required": [ @@ -88,12 +88,12 @@ "query": { "description": "Path to graph ql file.", "type": "string", - "format": "graphqlFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" }, "vars": { "description": "Query parameters.", "type": "string", - "format": "jsonFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.json$" } }, "required": [ diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.plugin/0.0.1-prealpha.1.json b/packages/manifest/polywrap/schema/formats/polywrap.plugin/0.0.1-prealpha.1.json similarity index 91% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap.plugin/0.0.1-prealpha.1.json rename to packages/manifest/polywrap/schema/formats/polywrap.plugin/0.0.1-prealpha.1.json index a6a0d093bc..a1cd251215 100644 --- a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.plugin/0.0.1-prealpha.1.json +++ b/packages/manifest/polywrap/schema/formats/polywrap.plugin/0.0.1-prealpha.1.json @@ -16,12 +16,12 @@ "language": { "description" : "Plugin language.", "type": "string", - "format": "pluginLanguage" + "pattern": "^plugin\\/[a-z0-9]+$" }, "schema": { "description": "Path to graphql schema.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" }, "import_redirects": { "description": "Redirects source URI to local wrapper or plugin.", diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.plugin/0.0.1-prealpha.2.json b/packages/manifest/polywrap/schema/formats/polywrap.plugin/0.0.1-prealpha.2.json similarity index 84% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap.plugin/0.0.1-prealpha.2.json rename to packages/manifest/polywrap/schema/formats/polywrap.plugin/0.0.1-prealpha.2.json index da9f710352..1aea19c073 100644 --- a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.plugin/0.0.1-prealpha.2.json +++ b/packages/manifest/polywrap/schema/formats/polywrap.plugin/0.0.1-prealpha.2.json @@ -17,12 +17,12 @@ "name": { "description": "Plugin name.", "type": "string", - "format": "packageName" + "pattern": "^[a-zA-Z0-9\\-\\_]+$" }, "language": { "description" : "Plugin language.", "type": "string", - "format": "pluginLanguage" + "pattern": "^plugin\\/[a-z0-9]+$" }, "modules": { "description": "Modules of Polywrap schema and implementation.", @@ -37,12 +37,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "format": "graphqlFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" } }, "required": [ @@ -57,12 +57,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "format": "graphqlFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" } }, "required": [ diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.plugin/0.0.1-prealpha.3.json b/packages/manifest/polywrap/schema/formats/polywrap.plugin/0.0.1-prealpha.3.json similarity index 84% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap.plugin/0.0.1-prealpha.3.json rename to packages/manifest/polywrap/schema/formats/polywrap.plugin/0.0.1-prealpha.3.json index bfedbe2f38..bfc91296e7 100644 --- a/packages/manifest-schemas/polywrap/formats/schemas/polywrap.plugin/0.0.1-prealpha.3.json +++ b/packages/manifest/polywrap/schema/formats/polywrap.plugin/0.0.1-prealpha.3.json @@ -17,22 +17,22 @@ "name": { "description": "Plugin name.", "type": "string", - "format": "packageName" + "pattern": "^[a-zA-Z0-9\\-\\_]+$" }, "language": { "description" : "Plugin language.", "type": "string", - "format": "pluginLanguage" + "pattern": "^plugin\\/[a-z0-9]+$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" }, "schema": { "description": "Path to graphql schema.", "type": "string", - "format": "graphqlFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" }, "import_redirects": { "description": "Redirects source URI to local wrapper or plugin.", diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.1.json b/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.1.json similarity index 91% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.1.json rename to packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.1.json index 7282beb4d6..fc8a715a18 100644 --- a/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.1.json +++ b/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.1.json @@ -32,7 +32,7 @@ "file": { "description": "Path to graphql schema file.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" } }, "required": [ @@ -51,7 +51,7 @@ "file": { "description": "Path to Polywrap module implementation file.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" } }, "required": [ @@ -78,7 +78,7 @@ "file": { "description": "Path to graphql schema file.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" } }, "required": [ @@ -97,7 +97,7 @@ "file": { "description": "Path to Polywrap module implementation file.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" } }, "required": [ diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.2.json b/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.2.json similarity index 85% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.2.json rename to packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.2.json index 6e696fd383..f6441d672a 100644 --- a/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.2.json +++ b/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.2.json @@ -20,12 +20,12 @@ "build": { "description": "Path to the customized build manifest file.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" }, "language": { "description": "Language in which the source code is written.", "type": "string", - "format": "wasmLanguage" + "pattern": "wasm\/" }, "modules": { "description": "Modules of Polywrap schema and implementation.", @@ -40,12 +40,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" } }, "required": [ @@ -61,12 +61,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" } }, "required": [ diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.3.json b/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.3.json similarity index 85% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.3.json rename to packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.3.json index 43675e821f..a840a0fe58 100644 --- a/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.3.json +++ b/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.3.json @@ -19,12 +19,12 @@ "build": { "description": "Path to the customized build manifest file.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" }, "language": { "description": "Language in which the source code is written.", "type": "string", - "format": "wasmLanguage" + "pattern": "^interface|wasm\\/[a-z0-9]+$" }, "interface": { "description": "Wrapper has no Wasm implementation, only the schema.", @@ -43,12 +43,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" } }, "required": [ @@ -63,12 +63,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" } }, "required": [ diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.4.json b/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.4.json similarity index 85% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.4.json rename to packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.4.json index 6e9e6e35c4..ef9681d30e 100644 --- a/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.4.json +++ b/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.4.json @@ -20,12 +20,12 @@ "build": { "description": "Path to the customized build manifest file.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" }, "language": { "description": "Language in which the source code is written.", "type": "string", - "format": "wasmLanguage" + "pattern": "^interface|wasm\\/[a-z0-9]+$" }, "modules": { "description": "Modules of Polywrap schema and implementation.", @@ -40,12 +40,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" } }, "required": [ @@ -60,12 +60,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" } }, "required": [ diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.5.json b/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.5.json similarity index 80% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.5.json rename to packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.5.json index 623bf43829..1e41c0b51a 100644 --- a/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.5.json +++ b/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.5.json @@ -16,17 +16,17 @@ "build": { "description": "Path to the customized build manifest file.", "type": "string", - "format": "yamlFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.yaml$" }, "meta": { "description": "Path to wrapper metadata manifest file.", "type": "string", - "format": "yamlFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.yaml$" }, "language": { "description": "Language in which the source code is written.", "type": "string", - "format": "wasmLanguage" + "pattern": "^interface|wasm\\/[a-z0-9]+$" }, "modules": { "description": "Modules of Polywrap schema and implementation.", @@ -41,12 +41,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "format": "graphqlFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" } }, "required": [ @@ -61,12 +61,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "format": "graphqlFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" } }, "required": [ diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.6.json b/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.6.json similarity index 80% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.6.json rename to packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.6.json index d15a84c8e4..af1465ad89 100644 --- a/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.6.json +++ b/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.6.json @@ -16,17 +16,17 @@ "build": { "description": "Path to the customized build manifest file.", "type": "string", - "format": "manifestFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(yaml|json)$" }, "meta": { "description": "Path to wrapper metadata manifest file.", "type": "string", - "format": "manifestFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(yaml|json)$" }, "language": { "description": "Language in which the source code is written.", "type": "string", - "format": "wasmLanguage" + "pattern": "^interface|wasm\\/[a-z0-9]+$" }, "modules": { "description": "Modules of Polywrap schema and implementation.", @@ -41,12 +41,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "format": "graphqlFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" } }, "required": [ @@ -61,12 +61,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "format": "graphqlFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" } }, "required": [ diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.7.json b/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.7.json similarity index 79% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.7.json rename to packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.7.json index f507bfc5c9..46792ad571 100644 --- a/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.7.json +++ b/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.7.json @@ -17,22 +17,22 @@ "name": { "description": "Name of this wrapper package.", "type": "string", - "format": "packageName" + "pattern": "^[a-zA-Z0-9\\-\\_]+$" }, "build": { "description": "Path to the customized build manifest file.", "type": "string", - "format": "manifestFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(yaml|json)$" }, "meta": { "description": "Path to wrapper metadata manifest file.", "type": "string", - "format": "manifestFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(yaml|json)$" }, "language": { "description": "Language in which the source code is written.", "type": "string", - "format": "wasmLanguage" + "pattern": "^interface|wasm\\/[a-z0-9]+$" }, "modules": { "description": "Modules of Polywrap schema and implementation.", @@ -47,12 +47,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "format": "graphqlFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" } }, "required": [ @@ -67,12 +67,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "format": "graphqlFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" } }, "required": [ diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.8.json b/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.8.json similarity index 78% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.8.json rename to packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.8.json index 1c0feaa85c..203fa4b4ad 100644 --- a/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.8.json +++ b/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.8.json @@ -17,27 +17,27 @@ "name": { "description": "Name of this wrapper package.", "type": "string", - "format": "packageName" + "pattern": "^[a-zA-Z0-9\\-\\_]+$" }, "build": { "description": "Path to the customized build manifest file.", "type": "string", - "format": "manifestFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(yaml|json)$" }, "meta": { "description": "Path to wrapper metadata manifest file.", "type": "string", - "format": "manifestFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(yaml|json)$" }, "deploy": { "description": "Path to wrapper deploy manifest file.", "type": "string", - "format": "manifestFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(yaml|json)$" }, "language": { "description": "Language in which the source code is written.", "type": "string", - "format": "wasmLanguage" + "pattern": "^interface|wasm\\/[a-z0-9]+$" }, "modules": { "description": "Modules of Polywrap schema and implementation.", @@ -52,12 +52,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "format": "graphqlFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" } }, "required": [ @@ -72,12 +72,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "format": "graphqlFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" } }, "required": [ diff --git a/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.9.json b/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.9.json similarity index 70% rename from packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.9.json rename to packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.9.json index 03f4e5a3ef..e4726ce156 100644 --- a/packages/manifest-schemas/polywrap/formats/schemas/polywrap/0.0.1-prealpha.9.json +++ b/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.9.json @@ -17,37 +17,37 @@ "name": { "description": "Name of this wrapper package.", "type": "string", - "format": "packageName" + "pattern": "^[a-zA-Z0-9\\-\\_]+$" }, "build": { "description": "Path to the wrapper build manifest file.", "type": "string", - "format": "manifestFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(yaml|json)$" }, "meta": { "description": "Path to wrapper metadata manifest file.", "type": "string", - "format": "manifestFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(yaml|json)$" }, "deploy": { "description": "Path to wrapper deploy manifest file.", "type": "string", - "format": "manifestFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(yaml|json)$" }, "language": { "description": "Language in which the source code is written.", "type": "string", - "format": "wasmLanguage" + "pattern": "^interface|wasm\\/[a-z0-9]+$" }, "module": { "description": "Path to the module's entry point.", "type": "string", - "format": "file" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" }, "schema": { "description": "Path to the module's graphql schema.", "type": "string", - "format": "graphqlFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" }, "import_redirects": { "description": "Redirects for the schema's imports.", @@ -59,12 +59,12 @@ "uri": { "description": "Import URI to be redirected.", "type": "string", - "format": "polywrapUri" + "pattern": "^[wrap://]*[a-z\\-\\_0-9]+\\/.+$" }, "schema": { "description": "Path to a graphql schema to be used for the import.", "type": "string", - "format": "schemaFile" + "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" } }, "required": [ diff --git a/packages/manifest-schemas/polywrap/package.json b/packages/manifest/polywrap/schema/package.json similarity index 67% rename from packages/manifest-schemas/polywrap/package.json rename to packages/manifest/polywrap/schema/package.json index 2609336220..d0a9e3cfd7 100644 --- a/packages/manifest-schemas/polywrap/package.json +++ b/packages/manifest/polywrap/schema/package.json @@ -7,13 +7,9 @@ "type": "git", "url": "https://github.com/polywrap/monorepo.git" }, - "main": "./build/index.js", + "main": "./package.json", "scripts": { - "lint": "eslint --color -c ../../.eslintrc.js .", - "build": "ts-node generator.ts && tsc" - }, - "devDependencies": { - "ts-node": "8.10.2" + "lint": "eslint --color -c ../../.eslintrc.js ." }, "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", "publishConfig": { diff --git a/packages/manifest/polywrap/types/typescript/package.json b/packages/manifest/polywrap/types/typescript/package.json new file mode 100644 index 0000000000..d9ae67dd94 --- /dev/null +++ b/packages/manifest/polywrap/types/typescript/package.json @@ -0,0 +1,33 @@ +{ + "name": "@polywrap/polywrap-manifest-typescript-types", + "description": "Polywrap Manifest TypeScript Typings", + "version": "0.0.1-prealpha.91", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/polywrap/monorepo.git" + }, + "main": "./build/index.js", + "scripts": { + "lint": "eslint --color -c ../../.eslintrc.js .", + "build": "ts-node ./scripts/generate.ts && tsc" + }, + "dependencies": { + "@polywrap/polywrap-manifest-schemas": "0.0.1-prealpha.91", + "jsonschema": "1.4.0", + "js-yaml": "3.14.0", + "semver": "7.3.5" + }, + "devDependencies": { + "@polywrap/os-js": "0.0.1-prealpha.91", + "@types/js-yaml": "3.11.1", + "typescript": "4.0.7", + "json-schema-to-typescript": "10.1.3", + "mustache": "4.0.1", + "ts-node": "8.10.2" + }, + "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", + "publishConfig": { + "access": "public" + } +} diff --git a/packages/manifest-schemas/polywrap/generator.ts b/packages/manifest/polywrap/types/typescript/scripts/generate.ts similarity index 96% rename from packages/manifest-schemas/polywrap/generator.ts rename to packages/manifest/polywrap/types/typescript/scripts/generate.ts index 3a5cc9f1dd..499279efae 100644 --- a/packages/manifest-schemas/polywrap/generator.ts +++ b/packages/manifest/polywrap/types/typescript/scripts/generate.ts @@ -6,7 +6,8 @@ import * as JsonSchema from "json-schema-to-typescript"; async function generateFormatTypes() { // Fetch all schemas within the @polywrap/polywrap-manifest-schemas/schemas/formats directory - const formatsDir = path.join(__dirname, "formats/schemas"); + const schemasPackageDir = path.dirname(require.resolve("@polywrap/polywrap-manifest-schemas")); + const formatsDir = path.join(schemasPackageDir, "formats"); // Get all format types (wasm, build, infra, app, plugin, etc) const formatTypes = fs @@ -19,7 +20,7 @@ async function generateFormatTypes() { const formatTypeDir = path.join(formatsDir, formatTypeName); const formatOutputDir = path.join( __dirname, - `./formats/interfaces/${formatTypeName}` + `../src/formats/${formatTypeName}` ); const formatModules = []; diff --git a/packages/manifest/polywrap/types/typescript/scripts/templates/deserialize-ts.mustache b/packages/manifest/polywrap/types/typescript/scripts/templates/deserialize-ts.mustache new file mode 100644 index 0000000000..f1b3119809 --- /dev/null +++ b/packages/manifest/polywrap/types/typescript/scripts/templates/deserialize-ts.mustache @@ -0,0 +1,60 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ + +import { + {{type}}, + Any{{type}}, + migrate{{type}}, + validate{{type}}, + latest{{type}}Format, +} from "."; +import { DeserializeManifestOptions } from "../../"; + +import { compare } from "semver"; +import YAML from "js-yaml"; + +export function deserialize{{type}}( + manifest: string, + options?: DeserializeManifestOptions +): {{type}} { + let any{{type}}: Any{{type}} | undefined; + try { + any{{type}} = JSON.parse(manifest) as Any{{type}}; + } catch (e) { + any{{type}} = YAML.safeLoad(manifest) as + | Any{{type}} + | undefined; + } + + if (!any{{type}}) { + throw Error(`Unable to parse {{type}}: ${manifest}`); + } + + if (!options || !options.noValidate) { + validate{{type}}(any{{type}}, options?.extSchema); + } + + any{{type}}.__type = "{{type}}"; + + const versionCompare = compare( + any{{type}}.format, + latest{{type}}Format + ); + + if (versionCompare === -1) { + // Upgrade + return migrate{{type}}(any{{type}}, latest{{type}}Format); + } else if (versionCompare === 1) { + // Downgrade + throw Error( + `Cannot downgrade Polywrap version ${any{{type}}.format}, please upgrade your PolywrapClient package.` + ); + } else { + // Latest + return any{{type}} as {{type}}; + } +} diff --git a/packages/manifest-schemas/polywrap/templates/index-ts.mustache b/packages/manifest/polywrap/types/typescript/scripts/templates/index-ts.mustache similarity index 100% rename from packages/manifest-schemas/polywrap/templates/index-ts.mustache rename to packages/manifest/polywrap/types/typescript/scripts/templates/index-ts.mustache diff --git a/packages/manifest-schemas/polywrap/templates/migrate-ts.mustache b/packages/manifest/polywrap/types/typescript/scripts/templates/migrate-ts.mustache similarity index 50% rename from packages/manifest-schemas/polywrap/templates/migrate-ts.mustache rename to packages/manifest/polywrap/types/typescript/scripts/templates/migrate-ts.mustache index acb1153c75..96b0749236 100644 --- a/packages/manifest-schemas/polywrap/templates/migrate-ts.mustache +++ b/packages/manifest/polywrap/types/typescript/scripts/templates/migrate-ts.mustache @@ -17,8 +17,6 @@ import { } from "./migrators/{{version}}_to_{{#latest}}{{version}}{{/latest}}"; {{/prevFormats}} -import { Tracer } from "@polywrap/tracing-js"; - type Migrator = { [key in {{#latest}}{{type}}{{/latest}}Formats]?: (m: Any{{#latest}}{{type}}{{/latest}}) => {{#latest}}{{type}}{{/latest}}; }; @@ -29,31 +27,31 @@ export const migrators: Migrator = { {{/prevFormats}} }; -export const migrate{{#latest}}{{type}}{{/latest}} = Tracer.traceFunc( - "core: migrate{{#latest}}{{type}}{{/latest}}", - (manifest: Any{{#latest}}{{type}}{{/latest}}, to: {{#latest}}{{type}}{{/latest}}Formats): {{#latest}}{{type}}{{/latest}} => { - const from = manifest.format as {{#latest}}{{type}}{{/latest}}Formats; +export function migrate{{#latest}}{{type}}{{/latest}}( + manifest: Any{{#latest}}{{type}}{{/latest}}, + to: {{#latest}}{{type}}{{/latest}}Formats +): {{#latest}}{{type}}{{/latest}} { + const from = manifest.format as {{#latest}}{{type}}{{/latest}}Formats; - if (from === latest{{#latest}}{{type}}{{/latest}}Format) { - return manifest as {{#latest}}{{type}}{{/latest}}; - } + if (from === latest{{#latest}}{{type}}{{/latest}}Format) { + return manifest as {{#latest}}{{type}}{{/latest}}; + } - if (!(from in {{#latest}}{{type}}{{/latest}}Formats)) { - throw new Error(`Unrecognized {{#latest}}{{type}}{{/latest}}Format "${manifest.format}"`); - } + if (!(from in {{#latest}}{{type}}{{/latest}}Formats)) { + throw new Error(`Unrecognized {{#latest}}{{type}}{{/latest}}Format "${manifest.format}"`); + } {{#prevFormats.length}} - const migrator = migrators[from]; - if (!migrator) { - throw new Error( - `Migrator from {{#latest}}{{type}}{{/latest}}Format "${from}" to "${to}" is not available` - ); - } - - return migrator(manifest); + const migrator = migrators[from]; + if (!migrator) { + throw new Error( + `Migrator from {{#latest}}{{type}}{{/latest}}Format "${from}" to "${to}" is not available` + ); + } + + return migrator(manifest); {{/prevFormats.length}} {{^prevFormats.length}} - throw new Error(`This should never happen, {{#latest}}{{type}}{{/latest}} migrators is empty. from: ${from}, to: ${to}`); + throw new Error(`This should never happen, {{#latest}}{{type}}{{/latest}} migrators is empty. from: ${from}, to: ${to}`); {{/prevFormats.length}} - } -); +} diff --git a/packages/manifest/polywrap/types/typescript/scripts/templates/validate-ts.mustache b/packages/manifest/polywrap/types/typescript/scripts/templates/validate-ts.mustache new file mode 100644 index 0000000000..962cf53643 --- /dev/null +++ b/packages/manifest/polywrap/types/typescript/scripts/templates/validate-ts.mustache @@ -0,0 +1,63 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/validate-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ +import { + Any{{#latest}}{{type}}{{/latest}}, + {{#latest}}{{type}}{{/latest}}Formats +} from "."; +{{#validators.length}}import * as Validators from "../../validators";{{/validators.length}} +{{#formats}} +import schema_{{tsVersion}} from "@polywrap/polywrap-manifest-schemas/formats/{{dir}}/{{version}}.json"; +{{/formats}} + +import { + Schema, + Validator, + ValidationError, + ValidatorResult +} from "jsonschema"; + +type {{#latest}}{{type}}{{/latest}}Schemas = { + [key in {{#latest}}{{type}}{{/latest}}Formats]: Schema | undefined +}; + +const schemas: {{#latest}}{{type}}{{/latest}}Schemas = { + {{#formats}} + "{{version}}": schema_{{tsVersion}}, + {{/formats}} +}; + +const validator = new Validator(); + +{{#validators}} +Validator.prototype.customFormats.{{.}} = Validators.{{.}}; +{{/validators}} + +export function validate{{#latest}}{{type}}{{/latest}}( + manifest: Any{{#latest}}{{type}}{{/latest}}, + extSchema: Schema | undefined = undefined +): void { + const schema = schemas[manifest.format as {{#latest}}{{type}}{{/latest}}Formats]; + + if (!schema) { + throw Error(`Unrecognized {{#latest}}{{type}}{{/latest}} schema format "${manifest.format}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); + } + + const throwIfErrors = (result: ValidatorResult) => { + if (result.errors.length) { + throw new Error([ + `Validation errors encountered while sanitizing {{#latest}}{{type}}{{/latest}} format ${manifest.format}`, + ...result.errors.map((error: ValidationError) => error.toString()) + ].join("\n")); + } + }; + + throwIfErrors(validator.validate(manifest, schema)); + + if (extSchema) { + throwIfErrors(validator.validate(manifest, extSchema)); + } +} diff --git a/packages/manifest-schemas/polywrap/formats/deserialize.ts b/packages/manifest/polywrap/types/typescript/src/deserialize.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/deserialize.ts rename to packages/manifest/polywrap/types/typescript/src/deserialize.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/index.ts b/packages/manifest/polywrap/types/typescript/src/formats/index.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/index.ts rename to packages/manifest/polywrap/types/typescript/src/formats/index.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/0.0.1-prealpha.1.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/0.0.1-prealpha.1.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/0.0.1-prealpha.1.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/0.0.1-prealpha.1.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/0.0.1-prealpha.2.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/0.0.1-prealpha.2.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/0.0.1-prealpha.2.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/0.0.1-prealpha.2.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/deserialize.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/deserialize.ts new file mode 100644 index 0000000000..11e71e41a6 --- /dev/null +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/deserialize.ts @@ -0,0 +1,60 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ + +import { + AppManifest, + AnyAppManifest, + migrateAppManifest, + validateAppManifest, + latestAppManifestFormat, +} from "."; +import { DeserializeManifestOptions } from "../../"; + +import { compare } from "semver"; +import YAML from "js-yaml"; + +export function deserializeAppManifest( + manifest: string, + options?: DeserializeManifestOptions +): AppManifest { + let anyAppManifest: AnyAppManifest | undefined; + try { + anyAppManifest = JSON.parse(manifest) as AnyAppManifest; + } catch (e) { + anyAppManifest = YAML.safeLoad(manifest) as + | AnyAppManifest + | undefined; + } + + if (!anyAppManifest) { + throw Error(`Unable to parse AppManifest: ${manifest}`); + } + + if (!options || !options.noValidate) { + validateAppManifest(anyAppManifest, options?.extSchema); + } + + anyAppManifest.__type = "AppManifest"; + + const versionCompare = compare( + anyAppManifest.format, + latestAppManifestFormat + ); + + if (versionCompare === -1) { + // Upgrade + return migrateAppManifest(anyAppManifest, latestAppManifestFormat); + } else if (versionCompare === 1) { + // Downgrade + throw Error( + `Cannot downgrade Polywrap version ${anyAppManifest.format}, please upgrade your PolywrapClient package.` + ); + } else { + // Latest + return anyAppManifest as AppManifest; + } +} diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/index.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/index.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/index.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/index.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/migrate.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/migrate.ts similarity index 51% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/migrate.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/migrate.ts index 357cb54d2e..a42cf0ac5e 100644 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/migrate.ts +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/migrate.ts @@ -15,8 +15,6 @@ import { migrate as migrate_0_0_1_prealpha_1_to_0_0_1_prealpha_2 } from "./migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2"; -import { Tracer } from "@polywrap/tracing-js"; - type Migrator = { [key in AppManifestFormats]?: (m: AnyAppManifest) => AppManifest; }; @@ -25,26 +23,26 @@ export const migrators: Migrator = { "0.0.1-prealpha.1": migrate_0_0_1_prealpha_1_to_0_0_1_prealpha_2, }; -export const migrateAppManifest = Tracer.traceFunc( - "core: migrateAppManifest", - (manifest: AnyAppManifest, to: AppManifestFormats): AppManifest => { - const from = manifest.format as AppManifestFormats; - - if (from === latestAppManifestFormat) { - return manifest as AppManifest; - } +export function migrateAppManifest( + manifest: AnyAppManifest, + to: AppManifestFormats +): AppManifest { + const from = manifest.format as AppManifestFormats; - if (!(from in AppManifestFormats)) { - throw new Error(`Unrecognized AppManifestFormat "${manifest.format}"`); - } + if (from === latestAppManifestFormat) { + return manifest as AppManifest; + } - const migrator = migrators[from]; - if (!migrator) { - throw new Error( - `Migrator from AppManifestFormat "${from}" to "${to}" is not available` - ); - } + if (!(from in AppManifestFormats)) { + throw new Error(`Unrecognized AppManifestFormat "${manifest.format}"`); + } - return migrator(manifest); + const migrator = migrators[from]; + if (!migrator) { + throw new Error( + `Migrator from AppManifestFormat "${from}" to "${to}" is not available` + ); } -); + + return migrator(manifest); +} diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/validate.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/validate.ts new file mode 100644 index 0000000000..01c1045708 --- /dev/null +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/validate.ts @@ -0,0 +1,58 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/validate-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ +import { + AnyAppManifest, + AppManifestFormats +} from "."; + +import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.app/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.app/0.0.1-prealpha.2.json"; + +import { + Schema, + Validator, + ValidationError, + ValidatorResult +} from "jsonschema"; + +type AppManifestSchemas = { + [key in AppManifestFormats]: Schema | undefined +}; + +const schemas: AppManifestSchemas = { + "0.0.1-prealpha.1": schema_0_0_1_prealpha_1, + "0.0.1-prealpha.2": schema_0_0_1_prealpha_2, +}; + +const validator = new Validator(); + + +export function validateAppManifest( + manifest: AnyAppManifest, + extSchema: Schema | undefined = undefined +): void { + const schema = schemas[manifest.format as AppManifestFormats]; + + if (!schema) { + throw Error(`Unrecognized AppManifest schema format "${manifest.format}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); + } + + const throwIfErrors = (result: ValidatorResult) => { + if (result.errors.length) { + throw new Error([ + `Validation errors encountered while sanitizing AppManifest format ${manifest.format}`, + ...result.errors.map((error: ValidationError) => error.toString()) + ].join("\n")); + } + }; + + throwIfErrors(validator.validate(manifest, schema)); + + if (extSchema) { + throwIfErrors(validator.validate(manifest, extSchema)); + } +} diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/0.0.1-prealpha.1.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/0.0.1-prealpha.1.ts similarity index 90% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/0.0.1-prealpha.1.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/0.0.1-prealpha.1.ts index 21ff37ce95..2c51e8d6db 100644 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/0.0.1-prealpha.1.ts +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/0.0.1-prealpha.1.ts @@ -23,10 +23,6 @@ export interface BuildManifest { * Docker image file name. */ dockerfile?: string; - /** - * Id of the docker image. - */ - buildImageId?: string; }; /** * Custom configuration. diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/0.0.1-prealpha.2.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/0.0.1-prealpha.2.ts similarity index 93% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/0.0.1-prealpha.2.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/0.0.1-prealpha.2.ts index 5f325662bb..56e1bd9d85 100644 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/0.0.1-prealpha.2.ts +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/0.0.1-prealpha.2.ts @@ -20,10 +20,6 @@ export interface BuildManifest { * Docker image file name. */ dockerfile?: string; - /** - * Id of the docker image. - */ - buildImageId?: string; }; /** * Custom configuration. diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/0.0.1-prealpha.3.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/0.0.1-prealpha.3.ts similarity index 95% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/0.0.1-prealpha.3.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/0.0.1-prealpha.3.ts index 640fa904bd..f1efb3b081 100644 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/0.0.1-prealpha.3.ts +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/0.0.1-prealpha.3.ts @@ -20,10 +20,6 @@ export interface BuildManifest { * Docker image file name. */ dockerfile?: string; - /** - * Id of the docker image. - */ - buildImageId?: string; /** * Configuration options for Docker Buildx, set to true for default value. */ diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/deserialize.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/deserialize.ts new file mode 100644 index 0000000000..534bc0f3b3 --- /dev/null +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/deserialize.ts @@ -0,0 +1,60 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ + +import { + BuildManifest, + AnyBuildManifest, + migrateBuildManifest, + validateBuildManifest, + latestBuildManifestFormat, +} from "."; +import { DeserializeManifestOptions } from "../../"; + +import { compare } from "semver"; +import YAML from "js-yaml"; + +export function deserializeBuildManifest( + manifest: string, + options?: DeserializeManifestOptions +): BuildManifest { + let anyBuildManifest: AnyBuildManifest | undefined; + try { + anyBuildManifest = JSON.parse(manifest) as AnyBuildManifest; + } catch (e) { + anyBuildManifest = YAML.safeLoad(manifest) as + | AnyBuildManifest + | undefined; + } + + if (!anyBuildManifest) { + throw Error(`Unable to parse BuildManifest: ${manifest}`); + } + + if (!options || !options.noValidate) { + validateBuildManifest(anyBuildManifest, options?.extSchema); + } + + anyBuildManifest.__type = "BuildManifest"; + + const versionCompare = compare( + anyBuildManifest.format, + latestBuildManifestFormat + ); + + if (versionCompare === -1) { + // Upgrade + return migrateBuildManifest(anyBuildManifest, latestBuildManifestFormat); + } else if (versionCompare === 1) { + // Downgrade + throw Error( + `Cannot downgrade Polywrap version ${anyBuildManifest.format}, please upgrade your PolywrapClient package.` + ); + } else { + // Latest + return anyBuildManifest as BuildManifest; + } +} diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/index.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/index.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/index.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/index.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/migrate.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/migrate.ts similarity index 56% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/migrate.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/migrate.ts index 4b6463aca7..44e1ef0c81 100644 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/migrate.ts +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/migrate.ts @@ -18,8 +18,6 @@ import { migrate as migrate_0_0_1_prealpha_2_to_0_0_1_prealpha_3 } from "./migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3"; -import { Tracer } from "@polywrap/tracing-js"; - type Migrator = { [key in BuildManifestFormats]?: (m: AnyBuildManifest) => BuildManifest; }; @@ -29,26 +27,26 @@ export const migrators: Migrator = { "0.0.1-prealpha.2": migrate_0_0_1_prealpha_2_to_0_0_1_prealpha_3, }; -export const migrateBuildManifest = Tracer.traceFunc( - "core: migrateBuildManifest", - (manifest: AnyBuildManifest, to: BuildManifestFormats): BuildManifest => { - const from = manifest.format as BuildManifestFormats; - - if (from === latestBuildManifestFormat) { - return manifest as BuildManifest; - } +export function migrateBuildManifest( + manifest: AnyBuildManifest, + to: BuildManifestFormats +): BuildManifest { + const from = manifest.format as BuildManifestFormats; - if (!(from in BuildManifestFormats)) { - throw new Error(`Unrecognized BuildManifestFormat "${manifest.format}"`); - } + if (from === latestBuildManifestFormat) { + return manifest as BuildManifest; + } - const migrator = migrators[from]; - if (!migrator) { - throw new Error( - `Migrator from BuildManifestFormat "${from}" to "${to}" is not available` - ); - } + if (!(from in BuildManifestFormats)) { + throw new Error(`Unrecognized BuildManifestFormat "${manifest.format}"`); + } - return migrator(manifest); + const migrator = migrators[from]; + if (!migrator) { + throw new Error( + `Migrator from BuildManifestFormat "${from}" to "${to}" is not available` + ); } -); + + return migrator(manifest); +} diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/validate.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/validate.ts new file mode 100644 index 0000000000..fd44e388e3 --- /dev/null +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/validate.ts @@ -0,0 +1,60 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/validate-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ +import { + AnyBuildManifest, + BuildManifestFormats +} from "."; + +import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.build/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.build/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_3 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.build/0.0.1-prealpha.3.json"; + +import { + Schema, + Validator, + ValidationError, + ValidatorResult +} from "jsonschema"; + +type BuildManifestSchemas = { + [key in BuildManifestFormats]: Schema | undefined +}; + +const schemas: BuildManifestSchemas = { + "0.0.1-prealpha.1": schema_0_0_1_prealpha_1, + "0.0.1-prealpha.2": schema_0_0_1_prealpha_2, + "0.0.1-prealpha.3": schema_0_0_1_prealpha_3, +}; + +const validator = new Validator(); + + +export function validateBuildManifest( + manifest: AnyBuildManifest, + extSchema: Schema | undefined = undefined +): void { + const schema = schemas[manifest.format as BuildManifestFormats]; + + if (!schema) { + throw Error(`Unrecognized BuildManifest schema format "${manifest.format}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); + } + + const throwIfErrors = (result: ValidatorResult) => { + if (result.errors.length) { + throw new Error([ + `Validation errors encountered while sanitizing BuildManifest format ${manifest.format}`, + ...result.errors.map((error: ValidationError) => error.toString()) + ].join("\n")); + } + }; + + throwIfErrors(validator.validate(manifest, schema)); + + if (extSchema) { + throwIfErrors(validator.validate(manifest, extSchema)); + } +} diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/0.0.1-prealpha.1.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/0.0.1-prealpha.1.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/0.0.1-prealpha.1.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/0.0.1-prealpha.1.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/deserialize.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/deserialize.ts new file mode 100644 index 0000000000..ce4a0767eb --- /dev/null +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/deserialize.ts @@ -0,0 +1,60 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ + +import { + DeployManifest, + AnyDeployManifest, + migrateDeployManifest, + validateDeployManifest, + latestDeployManifestFormat, +} from "."; +import { DeserializeManifestOptions } from "../../"; + +import { compare } from "semver"; +import YAML from "js-yaml"; + +export function deserializeDeployManifest( + manifest: string, + options?: DeserializeManifestOptions +): DeployManifest { + let anyDeployManifest: AnyDeployManifest | undefined; + try { + anyDeployManifest = JSON.parse(manifest) as AnyDeployManifest; + } catch (e) { + anyDeployManifest = YAML.safeLoad(manifest) as + | AnyDeployManifest + | undefined; + } + + if (!anyDeployManifest) { + throw Error(`Unable to parse DeployManifest: ${manifest}`); + } + + if (!options || !options.noValidate) { + validateDeployManifest(anyDeployManifest, options?.extSchema); + } + + anyDeployManifest.__type = "DeployManifest"; + + const versionCompare = compare( + anyDeployManifest.format, + latestDeployManifestFormat + ); + + if (versionCompare === -1) { + // Upgrade + return migrateDeployManifest(anyDeployManifest, latestDeployManifestFormat); + } else if (versionCompare === 1) { + // Downgrade + throw Error( + `Cannot downgrade Polywrap version ${anyDeployManifest.format}, please upgrade your PolywrapClient package.` + ); + } else { + // Latest + return anyDeployManifest as DeployManifest; + } +} diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/index.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/index.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.deploy/index.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/index.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/migrate.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/migrate.ts new file mode 100644 index 0000000000..e543a3441b --- /dev/null +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/migrate.ts @@ -0,0 +1,37 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/migrate-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/migrate-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ +import { + AnyDeployManifest, + DeployManifest, + DeployManifestFormats, + latestDeployManifestFormat +} from "."; + + +type Migrator = { + [key in DeployManifestFormats]?: (m: AnyDeployManifest) => DeployManifest; +}; + +export const migrators: Migrator = { +}; + +export function migrateDeployManifest( + manifest: AnyDeployManifest, + to: DeployManifestFormats +): DeployManifest { + const from = manifest.format as DeployManifestFormats; + + if (from === latestDeployManifestFormat) { + return manifest as DeployManifest; + } + + if (!(from in DeployManifestFormats)) { + throw new Error(`Unrecognized DeployManifestFormat "${manifest.format}"`); + } + + throw new Error(`This should never happen, DeployManifest migrators is empty. from: ${from}, to: ${to}`); +} diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/validate.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/validate.ts new file mode 100644 index 0000000000..325e1a3287 --- /dev/null +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/validate.ts @@ -0,0 +1,56 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/validate-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ +import { + AnyDeployManifest, + DeployManifestFormats +} from "."; + +import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.deploy/0.0.1-prealpha.1.json"; + +import { + Schema, + Validator, + ValidationError, + ValidatorResult +} from "jsonschema"; + +type DeployManifestSchemas = { + [key in DeployManifestFormats]: Schema | undefined +}; + +const schemas: DeployManifestSchemas = { + "0.0.1-prealpha.1": schema_0_0_1_prealpha_1, +}; + +const validator = new Validator(); + + +export function validateDeployManifest( + manifest: AnyDeployManifest, + extSchema: Schema | undefined = undefined +): void { + const schema = schemas[manifest.format as DeployManifestFormats]; + + if (!schema) { + throw Error(`Unrecognized DeployManifest schema format "${manifest.format}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); + } + + const throwIfErrors = (result: ValidatorResult) => { + if (result.errors.length) { + throw new Error([ + `Validation errors encountered while sanitizing DeployManifest format ${manifest.format}`, + ...result.errors.map((error: ValidationError) => error.toString()) + ].join("\n")); + } + }; + + throwIfErrors(validator.validate(manifest, schema)); + + if (extSchema) { + throwIfErrors(validator.validate(manifest, extSchema)); + } +} diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/0.0.1-prealpha.1.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/0.0.1-prealpha.1.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/0.0.1-prealpha.1.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/0.0.1-prealpha.1.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/0.0.1-prealpha.2.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/0.0.1-prealpha.2.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/0.0.1-prealpha.2.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/0.0.1-prealpha.2.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/deserialize.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/deserialize.ts new file mode 100644 index 0000000000..c2ba25da8d --- /dev/null +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/deserialize.ts @@ -0,0 +1,60 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ + +import { + InfraManifest, + AnyInfraManifest, + migrateInfraManifest, + validateInfraManifest, + latestInfraManifestFormat, +} from "."; +import { DeserializeManifestOptions } from "../../"; + +import { compare } from "semver"; +import YAML from "js-yaml"; + +export function deserializeInfraManifest( + manifest: string, + options?: DeserializeManifestOptions +): InfraManifest { + let anyInfraManifest: AnyInfraManifest | undefined; + try { + anyInfraManifest = JSON.parse(manifest) as AnyInfraManifest; + } catch (e) { + anyInfraManifest = YAML.safeLoad(manifest) as + | AnyInfraManifest + | undefined; + } + + if (!anyInfraManifest) { + throw Error(`Unable to parse InfraManifest: ${manifest}`); + } + + if (!options || !options.noValidate) { + validateInfraManifest(anyInfraManifest, options?.extSchema); + } + + anyInfraManifest.__type = "InfraManifest"; + + const versionCompare = compare( + anyInfraManifest.format, + latestInfraManifestFormat + ); + + if (versionCompare === -1) { + // Upgrade + return migrateInfraManifest(anyInfraManifest, latestInfraManifestFormat); + } else if (versionCompare === 1) { + // Downgrade + throw Error( + `Cannot downgrade Polywrap version ${anyInfraManifest.format}, please upgrade your PolywrapClient package.` + ); + } else { + // Latest + return anyInfraManifest as InfraManifest; + } +} diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/index.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/index.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/index.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/index.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/migrate.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/migrate.ts similarity index 50% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/migrate.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/migrate.ts index 0103c2ad8f..8033bc4fb2 100644 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/migrate.ts +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/migrate.ts @@ -15,8 +15,6 @@ import { migrate as migrate_0_0_1_prealpha_1_to_0_0_1_prealpha_2 } from "./migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2"; -import { Tracer } from "@polywrap/tracing-js"; - type Migrator = { [key in InfraManifestFormats]?: (m: AnyInfraManifest) => InfraManifest; }; @@ -25,26 +23,26 @@ export const migrators: Migrator = { "0.0.1-prealpha.1": migrate_0_0_1_prealpha_1_to_0_0_1_prealpha_2, }; -export const migrateInfraManifest = Tracer.traceFunc( - "core: migrateInfraManifest", - (manifest: AnyInfraManifest, to: InfraManifestFormats): InfraManifest => { - const from = manifest.format as InfraManifestFormats; - - if (from === latestInfraManifestFormat) { - return manifest as InfraManifest; - } +export function migrateInfraManifest( + manifest: AnyInfraManifest, + to: InfraManifestFormats +): InfraManifest { + const from = manifest.format as InfraManifestFormats; - if (!(from in InfraManifestFormats)) { - throw new Error(`Unrecognized InfraManifestFormat "${manifest.format}"`); - } + if (from === latestInfraManifestFormat) { + return manifest as InfraManifest; + } - const migrator = migrators[from]; - if (!migrator) { - throw new Error( - `Migrator from InfraManifestFormat "${from}" to "${to}" is not available` - ); - } + if (!(from in InfraManifestFormats)) { + throw new Error(`Unrecognized InfraManifestFormat "${manifest.format}"`); + } - return migrator(manifest); + const migrator = migrators[from]; + if (!migrator) { + throw new Error( + `Migrator from InfraManifestFormat "${from}" to "${to}" is not available` + ); } -); + + return migrator(manifest); +} diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/validate.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/validate.ts new file mode 100644 index 0000000000..4b52060707 --- /dev/null +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/validate.ts @@ -0,0 +1,58 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/validate-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ +import { + AnyInfraManifest, + InfraManifestFormats +} from "."; + +import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.infra/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.infra/0.0.1-prealpha.2.json"; + +import { + Schema, + Validator, + ValidationError, + ValidatorResult +} from "jsonschema"; + +type InfraManifestSchemas = { + [key in InfraManifestFormats]: Schema | undefined +}; + +const schemas: InfraManifestSchemas = { + "0.0.1-prealpha.1": schema_0_0_1_prealpha_1, + "0.0.1-prealpha.2": schema_0_0_1_prealpha_2, +}; + +const validator = new Validator(); + + +export function validateInfraManifest( + manifest: AnyInfraManifest, + extSchema: Schema | undefined = undefined +): void { + const schema = schemas[manifest.format as InfraManifestFormats]; + + if (!schema) { + throw Error(`Unrecognized InfraManifest schema format "${manifest.format}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); + } + + const throwIfErrors = (result: ValidatorResult) => { + if (result.errors.length) { + throw new Error([ + `Validation errors encountered while sanitizing InfraManifest format ${manifest.format}`, + ...result.errors.map((error: ValidationError) => error.toString()) + ].join("\n")); + } + }; + + throwIfErrors(validator.validate(manifest, schema)); + + if (extSchema) { + throwIfErrors(validator.validate(manifest, extSchema)); + } +} diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/0.0.1-prealpha.1.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/0.0.1-prealpha.1.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/0.0.1-prealpha.1.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/0.0.1-prealpha.1.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/0.0.1-prealpha.2.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/0.0.1-prealpha.2.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/0.0.1-prealpha.2.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/0.0.1-prealpha.2.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/0.0.1-prealpha.3.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/0.0.1-prealpha.3.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/0.0.1-prealpha.3.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/0.0.1-prealpha.3.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/deserialize.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/deserialize.ts new file mode 100644 index 0000000000..b23793de01 --- /dev/null +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/deserialize.ts @@ -0,0 +1,60 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ + +import { + MetaManifest, + AnyMetaManifest, + migrateMetaManifest, + validateMetaManifest, + latestMetaManifestFormat, +} from "."; +import { DeserializeManifestOptions } from "../../"; + +import { compare } from "semver"; +import YAML from "js-yaml"; + +export function deserializeMetaManifest( + manifest: string, + options?: DeserializeManifestOptions +): MetaManifest { + let anyMetaManifest: AnyMetaManifest | undefined; + try { + anyMetaManifest = JSON.parse(manifest) as AnyMetaManifest; + } catch (e) { + anyMetaManifest = YAML.safeLoad(manifest) as + | AnyMetaManifest + | undefined; + } + + if (!anyMetaManifest) { + throw Error(`Unable to parse MetaManifest: ${manifest}`); + } + + if (!options || !options.noValidate) { + validateMetaManifest(anyMetaManifest, options?.extSchema); + } + + anyMetaManifest.__type = "MetaManifest"; + + const versionCompare = compare( + anyMetaManifest.format, + latestMetaManifestFormat + ); + + if (versionCompare === -1) { + // Upgrade + return migrateMetaManifest(anyMetaManifest, latestMetaManifestFormat); + } else if (versionCompare === 1) { + // Downgrade + throw Error( + `Cannot downgrade Polywrap version ${anyMetaManifest.format}, please upgrade your PolywrapClient package.` + ); + } else { + // Latest + return anyMetaManifest as MetaManifest; + } +} diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/index.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/index.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/index.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/index.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/migrate.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/migrate.ts similarity index 56% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/migrate.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/migrate.ts index 8f5d4704a8..be9050a9db 100644 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/migrate.ts +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/migrate.ts @@ -18,8 +18,6 @@ import { migrate as migrate_0_0_1_prealpha_2_to_0_0_1_prealpha_3 } from "./migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3"; -import { Tracer } from "@polywrap/tracing-js"; - type Migrator = { [key in MetaManifestFormats]?: (m: AnyMetaManifest) => MetaManifest; }; @@ -29,26 +27,26 @@ export const migrators: Migrator = { "0.0.1-prealpha.2": migrate_0_0_1_prealpha_2_to_0_0_1_prealpha_3, }; -export const migrateMetaManifest = Tracer.traceFunc( - "core: migrateMetaManifest", - (manifest: AnyMetaManifest, to: MetaManifestFormats): MetaManifest => { - const from = manifest.format as MetaManifestFormats; - - if (from === latestMetaManifestFormat) { - return manifest as MetaManifest; - } +export function migrateMetaManifest( + manifest: AnyMetaManifest, + to: MetaManifestFormats +): MetaManifest { + const from = manifest.format as MetaManifestFormats; - if (!(from in MetaManifestFormats)) { - throw new Error(`Unrecognized MetaManifestFormat "${manifest.format}"`); - } + if (from === latestMetaManifestFormat) { + return manifest as MetaManifest; + } - const migrator = migrators[from]; - if (!migrator) { - throw new Error( - `Migrator from MetaManifestFormat "${from}" to "${to}" is not available` - ); - } + if (!(from in MetaManifestFormats)) { + throw new Error(`Unrecognized MetaManifestFormat "${manifest.format}"`); + } - return migrator(manifest); + const migrator = migrators[from]; + if (!migrator) { + throw new Error( + `Migrator from MetaManifestFormat "${from}" to "${to}" is not available` + ); } -); + + return migrator(manifest); +} diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/validate.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/validate.ts new file mode 100644 index 0000000000..fdb12f49cd --- /dev/null +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/validate.ts @@ -0,0 +1,60 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/validate-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ +import { + AnyMetaManifest, + MetaManifestFormats +} from "."; + +import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_3 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.meta/0.0.1-prealpha.3.json"; + +import { + Schema, + Validator, + ValidationError, + ValidatorResult +} from "jsonschema"; + +type MetaManifestSchemas = { + [key in MetaManifestFormats]: Schema | undefined +}; + +const schemas: MetaManifestSchemas = { + "0.0.1-prealpha.1": schema_0_0_1_prealpha_1, + "0.0.1-prealpha.2": schema_0_0_1_prealpha_2, + "0.0.1-prealpha.3": schema_0_0_1_prealpha_3, +}; + +const validator = new Validator(); + + +export function validateMetaManifest( + manifest: AnyMetaManifest, + extSchema: Schema | undefined = undefined +): void { + const schema = schemas[manifest.format as MetaManifestFormats]; + + if (!schema) { + throw Error(`Unrecognized MetaManifest schema format "${manifest.format}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); + } + + const throwIfErrors = (result: ValidatorResult) => { + if (result.errors.length) { + throw new Error([ + `Validation errors encountered while sanitizing MetaManifest format ${manifest.format}`, + ...result.errors.map((error: ValidationError) => error.toString()) + ].join("\n")); + } + }; + + throwIfErrors(validator.validate(manifest, schema)); + + if (extSchema) { + throwIfErrors(validator.validate(manifest, extSchema)); + } +} diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/0.0.1-prealpha.1.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/0.0.1-prealpha.1.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/0.0.1-prealpha.1.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/0.0.1-prealpha.1.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/0.0.1-prealpha.2.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/0.0.1-prealpha.2.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/0.0.1-prealpha.2.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/0.0.1-prealpha.2.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/0.0.1-prealpha.3.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/0.0.1-prealpha.3.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/0.0.1-prealpha.3.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/0.0.1-prealpha.3.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/deserialize.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/deserialize.ts new file mode 100644 index 0000000000..b79bead158 --- /dev/null +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/deserialize.ts @@ -0,0 +1,60 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ + +import { + PluginManifest, + AnyPluginManifest, + migratePluginManifest, + validatePluginManifest, + latestPluginManifestFormat, +} from "."; +import { DeserializeManifestOptions } from "../../"; + +import { compare } from "semver"; +import YAML from "js-yaml"; + +export function deserializePluginManifest( + manifest: string, + options?: DeserializeManifestOptions +): PluginManifest { + let anyPluginManifest: AnyPluginManifest | undefined; + try { + anyPluginManifest = JSON.parse(manifest) as AnyPluginManifest; + } catch (e) { + anyPluginManifest = YAML.safeLoad(manifest) as + | AnyPluginManifest + | undefined; + } + + if (!anyPluginManifest) { + throw Error(`Unable to parse PluginManifest: ${manifest}`); + } + + if (!options || !options.noValidate) { + validatePluginManifest(anyPluginManifest, options?.extSchema); + } + + anyPluginManifest.__type = "PluginManifest"; + + const versionCompare = compare( + anyPluginManifest.format, + latestPluginManifestFormat + ); + + if (versionCompare === -1) { + // Upgrade + return migratePluginManifest(anyPluginManifest, latestPluginManifestFormat); + } else if (versionCompare === 1) { + // Downgrade + throw Error( + `Cannot downgrade Polywrap version ${anyPluginManifest.format}, please upgrade your PolywrapClient package.` + ); + } else { + // Latest + return anyPluginManifest as PluginManifest; + } +} diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/index.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/index.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/index.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/index.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/migrate.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/migrate.ts similarity index 56% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/migrate.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/migrate.ts index 0993c1f1b2..8713652718 100644 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/migrate.ts +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/migrate.ts @@ -18,8 +18,6 @@ import { migrate as migrate_0_0_1_prealpha_2_to_0_0_1_prealpha_3 } from "./migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3"; -import { Tracer } from "@polywrap/tracing-js"; - type Migrator = { [key in PluginManifestFormats]?: (m: AnyPluginManifest) => PluginManifest; }; @@ -29,26 +27,26 @@ export const migrators: Migrator = { "0.0.1-prealpha.2": migrate_0_0_1_prealpha_2_to_0_0_1_prealpha_3, }; -export const migratePluginManifest = Tracer.traceFunc( - "core: migratePluginManifest", - (manifest: AnyPluginManifest, to: PluginManifestFormats): PluginManifest => { - const from = manifest.format as PluginManifestFormats; - - if (from === latestPluginManifestFormat) { - return manifest as PluginManifest; - } +export function migratePluginManifest( + manifest: AnyPluginManifest, + to: PluginManifestFormats +): PluginManifest { + const from = manifest.format as PluginManifestFormats; - if (!(from in PluginManifestFormats)) { - throw new Error(`Unrecognized PluginManifestFormat "${manifest.format}"`); - } + if (from === latestPluginManifestFormat) { + return manifest as PluginManifest; + } - const migrator = migrators[from]; - if (!migrator) { - throw new Error( - `Migrator from PluginManifestFormat "${from}" to "${to}" is not available` - ); - } + if (!(from in PluginManifestFormats)) { + throw new Error(`Unrecognized PluginManifestFormat "${manifest.format}"`); + } - return migrator(manifest); + const migrator = migrators[from]; + if (!migrator) { + throw new Error( + `Migrator from PluginManifestFormat "${from}" to "${to}" is not available` + ); } -); + + return migrator(manifest); +} diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/validate.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/validate.ts new file mode 100644 index 0000000000..300eb59375 --- /dev/null +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/validate.ts @@ -0,0 +1,60 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/validate-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ +import { + AnyPluginManifest, + PluginManifestFormats +} from "."; + +import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_3 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.plugin/0.0.1-prealpha.3.json"; + +import { + Schema, + Validator, + ValidationError, + ValidatorResult +} from "jsonschema"; + +type PluginManifestSchemas = { + [key in PluginManifestFormats]: Schema | undefined +}; + +const schemas: PluginManifestSchemas = { + "0.0.1-prealpha.1": schema_0_0_1_prealpha_1, + "0.0.1-prealpha.2": schema_0_0_1_prealpha_2, + "0.0.1-prealpha.3": schema_0_0_1_prealpha_3, +}; + +const validator = new Validator(); + + +export function validatePluginManifest( + manifest: AnyPluginManifest, + extSchema: Schema | undefined = undefined +): void { + const schema = schemas[manifest.format as PluginManifestFormats]; + + if (!schema) { + throw Error(`Unrecognized PluginManifest schema format "${manifest.format}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); + } + + const throwIfErrors = (result: ValidatorResult) => { + if (result.errors.length) { + throw new Error([ + `Validation errors encountered while sanitizing PluginManifest format ${manifest.format}`, + ...result.errors.map((error: ValidationError) => error.toString()) + ].join("\n")); + } + }; + + throwIfErrors(validator.validate(manifest, schema)); + + if (extSchema) { + throwIfErrors(validator.validate(manifest, extSchema)); + } +} diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.1.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.1.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.1.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.1.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.2.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.2.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.2.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.2.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.3.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.3.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.3.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.3.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.4.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.4.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.4.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.4.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.5.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.5.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.5.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.5.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.6.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.6.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.6.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.6.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.7.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.7.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.7.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.7.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.8.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.8.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.8.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.8.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.9.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.9.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap/0.0.1-prealpha.9.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.9.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/deserialize.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/deserialize.ts new file mode 100644 index 0000000000..925b15b3ac --- /dev/null +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/deserialize.ts @@ -0,0 +1,60 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ + +import { + PolywrapManifest, + AnyPolywrapManifest, + migratePolywrapManifest, + validatePolywrapManifest, + latestPolywrapManifestFormat, +} from "."; +import { DeserializeManifestOptions } from "../../"; + +import { compare } from "semver"; +import YAML from "js-yaml"; + +export function deserializePolywrapManifest( + manifest: string, + options?: DeserializeManifestOptions +): PolywrapManifest { + let anyPolywrapManifest: AnyPolywrapManifest | undefined; + try { + anyPolywrapManifest = JSON.parse(manifest) as AnyPolywrapManifest; + } catch (e) { + anyPolywrapManifest = YAML.safeLoad(manifest) as + | AnyPolywrapManifest + | undefined; + } + + if (!anyPolywrapManifest) { + throw Error(`Unable to parse PolywrapManifest: ${manifest}`); + } + + if (!options || !options.noValidate) { + validatePolywrapManifest(anyPolywrapManifest, options?.extSchema); + } + + anyPolywrapManifest.__type = "PolywrapManifest"; + + const versionCompare = compare( + anyPolywrapManifest.format, + latestPolywrapManifestFormat + ); + + if (versionCompare === -1) { + // Upgrade + return migratePolywrapManifest(anyPolywrapManifest, latestPolywrapManifestFormat); + } else if (versionCompare === 1) { + // Downgrade + throw Error( + `Cannot downgrade Polywrap version ${anyPolywrapManifest.format}, please upgrade your PolywrapClient package.` + ); + } else { + // Latest + return anyPolywrapManifest as PolywrapManifest; + } +} diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/index.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/index.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap/index.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap/index.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrate.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrate.ts similarity index 74% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrate.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrate.ts index 59a545e250..2d04aeb6a3 100644 --- a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrate.ts +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrate.ts @@ -36,8 +36,6 @@ import { migrate as migrate_0_0_1_prealpha_8_to_0_0_1_prealpha_9 } from "./migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9"; -import { Tracer } from "@polywrap/tracing-js"; - type Migrator = { [key in PolywrapManifestFormats]?: (m: AnyPolywrapManifest) => PolywrapManifest; }; @@ -53,26 +51,26 @@ export const migrators: Migrator = { "0.0.1-prealpha.8": migrate_0_0_1_prealpha_8_to_0_0_1_prealpha_9, }; -export const migratePolywrapManifest = Tracer.traceFunc( - "core: migratePolywrapManifest", - (manifest: AnyPolywrapManifest, to: PolywrapManifestFormats): PolywrapManifest => { - const from = manifest.format as PolywrapManifestFormats; - - if (from === latestPolywrapManifestFormat) { - return manifest as PolywrapManifest; - } +export function migratePolywrapManifest( + manifest: AnyPolywrapManifest, + to: PolywrapManifestFormats +): PolywrapManifest { + const from = manifest.format as PolywrapManifestFormats; - if (!(from in PolywrapManifestFormats)) { - throw new Error(`Unrecognized PolywrapManifestFormat "${manifest.format}"`); - } + if (from === latestPolywrapManifestFormat) { + return manifest as PolywrapManifest; + } - const migrator = migrators[from]; - if (!migrator) { - throw new Error( - `Migrator from PolywrapManifestFormat "${from}" to "${to}" is not available` - ); - } + if (!(from in PolywrapManifestFormats)) { + throw new Error(`Unrecognized PolywrapManifestFormat "${manifest.format}"`); + } - return migrator(manifest); + const migrator = migrators[from]; + if (!migrator) { + throw new Error( + `Migrator from PolywrapManifestFormat "${from}" to "${to}" is not available` + ); } -); + + return migrator(manifest); +} diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts diff --git a/packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/manifest-schemas/polywrap/formats/interfaces/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts rename to packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/validate.ts b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/validate.ts new file mode 100644 index 0000000000..13a275fe4f --- /dev/null +++ b/packages/manifest/polywrap/types/typescript/src/formats/polywrap/validate.ts @@ -0,0 +1,72 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/validate-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ +import { + AnyPolywrapManifest, + PolywrapManifestFormats +} from "."; + +import schema_0_0_1_prealpha_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.1.json"; +import schema_0_0_1_prealpha_2 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.2.json"; +import schema_0_0_1_prealpha_3 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.3.json"; +import schema_0_0_1_prealpha_4 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.4.json"; +import schema_0_0_1_prealpha_5 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.5.json"; +import schema_0_0_1_prealpha_6 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.6.json"; +import schema_0_0_1_prealpha_7 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.7.json"; +import schema_0_0_1_prealpha_8 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.8.json"; +import schema_0_0_1_prealpha_9 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.0.1-prealpha.9.json"; + +import { + Schema, + Validator, + ValidationError, + ValidatorResult +} from "jsonschema"; + +type PolywrapManifestSchemas = { + [key in PolywrapManifestFormats]: Schema | undefined +}; + +const schemas: PolywrapManifestSchemas = { + "0.0.1-prealpha.1": schema_0_0_1_prealpha_1, + "0.0.1-prealpha.2": schema_0_0_1_prealpha_2, + "0.0.1-prealpha.3": schema_0_0_1_prealpha_3, + "0.0.1-prealpha.4": schema_0_0_1_prealpha_4, + "0.0.1-prealpha.5": schema_0_0_1_prealpha_5, + "0.0.1-prealpha.6": schema_0_0_1_prealpha_6, + "0.0.1-prealpha.7": schema_0_0_1_prealpha_7, + "0.0.1-prealpha.8": schema_0_0_1_prealpha_8, + "0.0.1-prealpha.9": schema_0_0_1_prealpha_9, +}; + +const validator = new Validator(); + + +export function validatePolywrapManifest( + manifest: AnyPolywrapManifest, + extSchema: Schema | undefined = undefined +): void { + const schema = schemas[manifest.format as PolywrapManifestFormats]; + + if (!schema) { + throw Error(`Unrecognized PolywrapManifest schema format "${manifest.format}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); + } + + const throwIfErrors = (result: ValidatorResult) => { + if (result.errors.length) { + throw new Error([ + `Validation errors encountered while sanitizing PolywrapManifest format ${manifest.format}`, + ...result.errors.map((error: ValidationError) => error.toString()) + ].join("\n")); + } + }; + + throwIfErrors(validator.validate(manifest, schema)); + + if (extSchema) { + throwIfErrors(validator.validate(manifest, extSchema)); + } +} diff --git a/packages/manifest-schemas/polywrap/formats/index.ts b/packages/manifest/polywrap/types/typescript/src/index.ts similarity index 50% rename from packages/manifest-schemas/polywrap/formats/index.ts rename to packages/manifest/polywrap/types/typescript/src/index.ts index 7893a41703..041f37b508 100644 --- a/packages/manifest-schemas/polywrap/formats/index.ts +++ b/packages/manifest/polywrap/types/typescript/src/index.ts @@ -1,2 +1,2 @@ -export * from "./interfaces"; +export * from "./formats"; export * from "./deserialize"; diff --git a/packages/manifest/polywrap/types/typescript/tsconfig.json b/packages/manifest/polywrap/types/typescript/tsconfig.json new file mode 100644 index 0000000000..1b87939adb --- /dev/null +++ b/packages/manifest/polywrap/types/typescript/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../../../../tsconfig.json", + "compilerOptions": { + "outDir": "build" + }, + "include": [ + "./src/**/*.ts" + ] +} diff --git a/packages/manifest-schemas/wrap/formats/schemas/wrap.info/0.0.1.json b/packages/manifest/wrap/schema/formats/wrap.info/0.0.1.json similarity index 100% rename from packages/manifest-schemas/wrap/formats/schemas/wrap.info/0.0.1.json rename to packages/manifest/wrap/schema/formats/wrap.info/0.0.1.json diff --git a/packages/manifest-schemas/wrap/package.json b/packages/manifest/wrap/schema/package.json similarity index 59% rename from packages/manifest-schemas/wrap/package.json rename to packages/manifest/wrap/schema/package.json index 8e12e8608a..08166001d2 100644 --- a/packages/manifest-schemas/wrap/package.json +++ b/packages/manifest/wrap/schema/package.json @@ -1,19 +1,15 @@ { "name": "@polywrap/wrap-manifest-schemas", - "description": "Polywrap Manifest Schemas", + "description": "WRAP Manifest Schemas", "version": "0.0.1-prealpha.91", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/polywrap/monorepo.git" }, - "main": "./build/index.js", + "main": "./package.json", "scripts": { - "lint": "eslint --color -c ../../.eslintrc.js .", - "build": "ts-node generator.ts && tsc" - }, - "devDependencies": { - "ts-node": "8.10.2" + "lint": "eslint --color -c ../../.eslintrc.js ." }, "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", "publishConfig": { diff --git a/packages/manifest/wrap/types/typescript/package.json b/packages/manifest/wrap/types/typescript/package.json new file mode 100644 index 0000000000..f22269034b --- /dev/null +++ b/packages/manifest/wrap/types/typescript/package.json @@ -0,0 +1,31 @@ +{ + "name": "@polywrap/wrap-manifest-typescript-types", + "description": "WRAP Manifest TypeScript Typings", + "version": "0.0.1-prealpha.91", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/polywrap/monorepo.git" + }, + "main": "./build/index.js", + "scripts": { + "lint": "eslint --color -c ../../.eslintrc.js .", + "build": "ts-node ./scripts/generate.ts && tsc" + }, + "dependencies": { + "@polywrap/wrap-manifest-schemas": "0.0.1-prealpha.91", + "jsonschema": "1.4.0", + "semver": "7.3.5" + }, + "devDependencies": { + "@polywrap/os-js": "0.0.1-prealpha.91", + "json-schema-to-typescript": "10.1.3", + "typescript": "4.0.7", + "mustache": "4.0.1", + "ts-node": "8.10.2" + }, + "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", + "publishConfig": { + "access": "public" + } +} diff --git a/packages/manifest-schemas/wrap/generator.ts b/packages/manifest/wrap/types/typescript/scripts/generate.ts similarity index 94% rename from packages/manifest-schemas/wrap/generator.ts rename to packages/manifest/wrap/types/typescript/scripts/generate.ts index 88bce43c40..471d7003ae 100644 --- a/packages/manifest-schemas/wrap/generator.ts +++ b/packages/manifest/wrap/types/typescript/scripts/generate.ts @@ -6,8 +6,9 @@ import { compile } from "json-schema-to-typescript" async function generateFormatTypes() { // Fetch all schemas within the @polywrap/wrap-manifest-schemas/formats directory - const formatsDir = path.join(__dirname, "formats/schemas/wrap.info"); - const formatOutputDir = path.join(__dirname, `./formats/interfaces`); + const schemasPackageDir = path.dirname(require.resolve("@polywrap/wrap-manifest-schemas")); + const formatsDir = path.join(schemasPackageDir, "formats/wrap.info"); + const formatOutputDir = path.join(__dirname, `../src/formats/wrap.info`); // Get all JSON schemas for this format type (0.0.1, 0.0.2, etc) const formatSchemaFiles = fs.readdirSync(formatsDir); diff --git a/packages/manifest/wrap/types/typescript/scripts/templates/deserialize-ts.mustache b/packages/manifest/wrap/types/typescript/scripts/templates/deserialize-ts.mustache new file mode 100644 index 0000000000..49657ef975 --- /dev/null +++ b/packages/manifest/wrap/types/typescript/scripts/templates/deserialize-ts.mustache @@ -0,0 +1,52 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, + * and run ts-node ./scripts/generateWrapManifestTypes.ts to regenerate this file. + */ + +import { + WrapManifest, + AnyWrapManifest, + migrateWrapManifest, + validateWrapManifest, + latestWrapManifestVersion, +} from "."; +import { DeserializeManifestOptions } from "../../"; + +import { compare } from "semver"; + +export function deserializeWrapManifest( + manifest: Uint8Array, + decoder: (m: Uint8Array) => unknown, + options?: DeserializeManifestOptions +): WrapManifest { + let anyWrapManifest: AnyWrapManifest | undefined; + try { + anyWrapManifest = decoder(manifest) as AnyWrapManifest; + } catch (e) { + throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); + } + + if (!options || !options.noValidate) { + validateWrapManifest(anyWrapManifest); + } + + const versionCompare = compare( + anyWrapManifest.version, + latestWrapManifestVersion + ); + + if (versionCompare === -1) { + // Upgrade + return migrateWrapManifest(anyWrapManifest, latestWrapManifestVersion); + } else if (versionCompare === 1) { + // Downgrade + throw Error( + `Cannot downgrade WrapManifest version ${anyWrapManifest.version}, please upgrade your WRAP package.` + ); + } else { + // Latest + return anyWrapManifest as WrapManifest; + } +} diff --git a/packages/manifest-schemas/wrap/templates/index-ts.mustache b/packages/manifest/wrap/types/typescript/scripts/templates/index-ts.mustache similarity index 100% rename from packages/manifest-schemas/wrap/templates/index-ts.mustache rename to packages/manifest/wrap/types/typescript/scripts/templates/index-ts.mustache diff --git a/packages/manifest-schemas/wrap/templates/migrate-ts.mustache b/packages/manifest/wrap/types/typescript/scripts/templates/migrate-ts.mustache similarity index 50% rename from packages/manifest-schemas/wrap/templates/migrate-ts.mustache rename to packages/manifest/wrap/types/typescript/scripts/templates/migrate-ts.mustache index 2c3fd92936..23212e6a83 100644 --- a/packages/manifest-schemas/wrap/templates/migrate-ts.mustache +++ b/packages/manifest/wrap/types/typescript/scripts/templates/migrate-ts.mustache @@ -17,8 +17,6 @@ import { } from "./migrators/{{version}}_to_{{#latest}}{{version}}{{/latest}}"; {{/prevFormats}} -import { Tracer } from "@polywrap/tracing-js"; - type Migrator = { [key in {{#latest}}WrapManifest{{/latest}}Versions]?: (m: Any{{#latest}}WrapManifest{{/latest}}) => {{#latest}}WrapManifest{{/latest}}; }; @@ -29,31 +27,31 @@ export const migrators: Migrator = { {{/prevFormats}} }; -export const migrate{{#latest}}WrapManifest{{/latest}} = Tracer.traceFunc( - "core: migrate{{#latest}}WrapManifest{{/latest}}", - (manifest: Any{{#latest}}WrapManifest{{/latest}}, to: {{#latest}}WrapManifest{{/latest}}Versions): {{#latest}}WrapManifest{{/latest}} => { - const from = manifest.version as {{#latest}}WrapManifest{{/latest}}Versions; +export function migrate{{#latest}}WrapManifest{{/latest}}( + manifest: Any{{#latest}}WrapManifest{{/latest}}, + to: {{#latest}}WrapManifest{{/latest}}Versions +): {{#latest}}WrapManifest{{/latest}} { + const from = manifest.version as {{#latest}}WrapManifest{{/latest}}Versions; - if (from === latest{{#latest}}WrapManifest{{/latest}}Version) { - return manifest as {{#latest}}WrapManifest{{/latest}}; - } + if (from === latest{{#latest}}WrapManifest{{/latest}}Version) { + return manifest as {{#latest}}WrapManifest{{/latest}}; + } - if (!(from in {{#latest}}WrapManifest{{/latest}}Versions)) { - throw new Error(`Unrecognized {{#latest}}WrapManifest{{/latest}}Version "${manifest.version}"`); - } + if (!(from in {{#latest}}WrapManifest{{/latest}}Versions)) { + throw new Error(`Unrecognized {{#latest}}WrapManifest{{/latest}}Version "${manifest.version}"`); + } {{#prevFormats.length}} - const migrator = migrators[from]; - if (!migrator) { - throw new Error( - `Migrator from {{#latest}}WrapManifest{{/latest}}Version "${from}" to "${to}" is not available` - ); - } - - return migrator(manifest); + const migrator = migrators[from]; + if (!migrator) { + throw new Error( + `Migrator from {{#latest}}WrapManifest{{/latest}}Version "${from}" to "${to}" is not available` + ); + } + + return migrator(manifest); {{/prevFormats.length}} {{^prevFormats.length}} - throw new Error(`This should never happen, {{#latest}}WrapManifest{{/latest}} migrators is empty. from: ${from}, to: ${to}`); + throw new Error(`This should never happen, {{#latest}}WrapManifest{{/latest}} migrators is empty. from: ${from}, to: ${to}`); {{/prevFormats.length}} - } -); +} diff --git a/packages/manifest/wrap/types/typescript/scripts/templates/validate-ts.mustache b/packages/manifest/wrap/types/typescript/scripts/templates/validate-ts.mustache new file mode 100644 index 0000000000..360f71bb52 --- /dev/null +++ b/packages/manifest/wrap/types/typescript/scripts/templates/validate-ts.mustache @@ -0,0 +1,63 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/validate-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ +import { + Any{{#latest}}WrapManifest{{/latest}}, + {{#latest}}WrapManifest{{/latest}}Versions +} from "."; +{{#validators.length}}import * as Validators from "../validators";{{/validators.length}} +{{#formats}} +import schema_{{tsVersion}} from "@polywrap/wrap-manifest-schemas/formats/wrap.info/{{version}}.json"; +{{/formats}} + +import { + Schema, + Validator, + ValidationError, + ValidatorResult +} from "jsonschema"; + +type {{#latest}}WrapManifest{{/latest}}Schemas = { + [key in {{#latest}}WrapManifest{{/latest}}Versions]: Schema | undefined +}; + +const schemas: {{#latest}}WrapManifest{{/latest}}Schemas = { + {{#formats}} + "{{version}}": schema_{{tsVersion}}, + {{/formats}} +}; + +const validator = new Validator(); + +{{#validators}} +Validator.prototype.{{.}} = Validators.{{.}}; +{{/validators}} + +export function validate{{#latest}}WrapManifest{{/latest}}( + manifest: Any{{#latest}}WrapManifest{{/latest}}, + extSchema: Schema | undefined = undefined +): void { + const schema = schemas[manifest.version as {{#latest}}WrapManifest{{/latest}}Versions]; + + if (!schema) { + throw Error(`Unrecognized {{#latest}}WrapManifest{{/latest}} schema version "${manifest.version}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); + } + + const throwIfErrors = (result: ValidatorResult) => { + if (result.errors.length) { + throw new Error([ + `Validation errors encountered while sanitizing {{#latest}}WrapManifest{{/latest}} version ${manifest.version}`, + ...result.errors.map((error: ValidationError) => error.toString()) + ].join("\n")); + } + }; + + throwIfErrors(validator.validate(manifest, schema)); + + if (extSchema) { + throwIfErrors(validator.validate(manifest, extSchema)); + } +} diff --git a/packages/manifest-schemas/wrap/formats/deserialize.ts b/packages/manifest/wrap/types/typescript/src/deserialize.ts similarity index 100% rename from packages/manifest-schemas/wrap/formats/deserialize.ts rename to packages/manifest/wrap/types/typescript/src/deserialize.ts diff --git a/packages/manifest/wrap/types/typescript/src/formats/index.ts b/packages/manifest/wrap/types/typescript/src/formats/index.ts new file mode 100644 index 0000000000..2a999f615e --- /dev/null +++ b/packages/manifest/wrap/types/typescript/src/formats/index.ts @@ -0,0 +1 @@ +export * from "./wrap.info"; diff --git a/packages/manifest-schemas/wrap/formats/interfaces/0.0.1.ts b/packages/manifest/wrap/types/typescript/src/formats/wrap.info/0.0.1.ts similarity index 100% rename from packages/manifest-schemas/wrap/formats/interfaces/0.0.1.ts rename to packages/manifest/wrap/types/typescript/src/formats/wrap.info/0.0.1.ts diff --git a/packages/manifest/wrap/types/typescript/src/formats/wrap.info/deserialize.ts b/packages/manifest/wrap/types/typescript/src/formats/wrap.info/deserialize.ts new file mode 100644 index 0000000000..49657ef975 --- /dev/null +++ b/packages/manifest/wrap/types/typescript/src/formats/wrap.info/deserialize.ts @@ -0,0 +1,52 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/deserialize-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/deserialize-ts.mustache, + * and run ts-node ./scripts/generateWrapManifestTypes.ts to regenerate this file. + */ + +import { + WrapManifest, + AnyWrapManifest, + migrateWrapManifest, + validateWrapManifest, + latestWrapManifestVersion, +} from "."; +import { DeserializeManifestOptions } from "../../"; + +import { compare } from "semver"; + +export function deserializeWrapManifest( + manifest: Uint8Array, + decoder: (m: Uint8Array) => unknown, + options?: DeserializeManifestOptions +): WrapManifest { + let anyWrapManifest: AnyWrapManifest | undefined; + try { + anyWrapManifest = decoder(manifest) as AnyWrapManifest; + } catch (e) { + throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); + } + + if (!options || !options.noValidate) { + validateWrapManifest(anyWrapManifest); + } + + const versionCompare = compare( + anyWrapManifest.version, + latestWrapManifestVersion + ); + + if (versionCompare === -1) { + // Upgrade + return migrateWrapManifest(anyWrapManifest, latestWrapManifestVersion); + } else if (versionCompare === 1) { + // Downgrade + throw Error( + `Cannot downgrade WrapManifest version ${anyWrapManifest.version}, please upgrade your WRAP package.` + ); + } else { + // Latest + return anyWrapManifest as WrapManifest; + } +} diff --git a/packages/manifest-schemas/wrap/formats/interfaces/index.ts b/packages/manifest/wrap/types/typescript/src/formats/wrap.info/index.ts similarity index 100% rename from packages/manifest-schemas/wrap/formats/interfaces/index.ts rename to packages/manifest/wrap/types/typescript/src/formats/wrap.info/index.ts diff --git a/packages/manifest/wrap/types/typescript/src/formats/wrap.info/migrate.ts b/packages/manifest/wrap/types/typescript/src/formats/wrap.info/migrate.ts new file mode 100644 index 0000000000..9cdb713beb --- /dev/null +++ b/packages/manifest/wrap/types/typescript/src/formats/wrap.info/migrate.ts @@ -0,0 +1,37 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/migrate-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/migrate-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ +import { + AnyWrapManifest, + WrapManifest, + WrapManifestVersions, + latestWrapManifestVersion +} from "."; + + +type Migrator = { + [key in WrapManifestVersions]?: (m: AnyWrapManifest) => WrapManifest; +}; + +export const migrators: Migrator = { +}; + +export function migrateWrapManifest( + manifest: AnyWrapManifest, + to: WrapManifestVersions +): WrapManifest { + const from = manifest.version as WrapManifestVersions; + + if (from === latestWrapManifestVersion) { + return manifest as WrapManifest; + } + + if (!(from in WrapManifestVersions)) { + throw new Error(`Unrecognized WrapManifestVersion "${manifest.version}"`); + } + + throw new Error(`This should never happen, WrapManifest migrators is empty. from: ${from}, to: ${to}`); +} diff --git a/packages/manifest/wrap/types/typescript/src/formats/wrap.info/validate.ts b/packages/manifest/wrap/types/typescript/src/formats/wrap.info/validate.ts new file mode 100644 index 0000000000..48836c92db --- /dev/null +++ b/packages/manifest/wrap/types/typescript/src/formats/wrap.info/validate.ts @@ -0,0 +1,56 @@ +/* eslint-disable */ +/** + * This file was automatically generated by scripts/manifest/validate-ts.mustache. + * DO NOT MODIFY IT BY HAND. Instead, modify scripts/manifest/validate-ts.mustache, + * and run node ./scripts/manifest/generateFormatTypes.js to regenerate this file. + */ +import { + AnyWrapManifest, + WrapManifestVersions +} from "."; + +import schema_0_0_1 from "@polywrap/wrap-manifest-schemas/formats/wrap.info/0.0.1.json"; + +import { + Schema, + Validator, + ValidationError, + ValidatorResult +} from "jsonschema"; + +type WrapManifestSchemas = { + [key in WrapManifestVersions]: Schema | undefined +}; + +const schemas: WrapManifestSchemas = { + "0.0.1": schema_0_0_1, +}; + +const validator = new Validator(); + + +export function validateWrapManifest( + manifest: AnyWrapManifest, + extSchema: Schema | undefined = undefined +): void { + const schema = schemas[manifest.version as WrapManifestVersions]; + + if (!schema) { + throw Error(`Unrecognized WrapManifest schema version "${manifest.version}"\nmanifest: ${JSON.stringify(manifest, null, 2)}`); + } + + const throwIfErrors = (result: ValidatorResult) => { + if (result.errors.length) { + throw new Error([ + `Validation errors encountered while sanitizing WrapManifest version ${manifest.version}`, + ...result.errors.map((error: ValidationError) => error.toString()) + ].join("\n")); + } + }; + + throwIfErrors(validator.validate(manifest, schema)); + + if (extSchema) { + throwIfErrors(validator.validate(manifest, extSchema)); + } +} diff --git a/packages/manifest/wrap/types/typescript/src/index.ts b/packages/manifest/wrap/types/typescript/src/index.ts new file mode 100644 index 0000000000..041f37b508 --- /dev/null +++ b/packages/manifest/wrap/types/typescript/src/index.ts @@ -0,0 +1,2 @@ +export * from "./formats"; +export * from "./deserialize"; diff --git a/packages/manifest/wrap/types/typescript/tsconfig.json b/packages/manifest/wrap/types/typescript/tsconfig.json new file mode 100644 index 0000000000..1b87939adb --- /dev/null +++ b/packages/manifest/wrap/types/typescript/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../../../../tsconfig.json", + "compilerOptions": { + "outDir": "build" + }, + "include": [ + "./src/**/*.ts" + ] +} diff --git a/yarn.lock b/yarn.lock index 9a2c2026d5..5148737daa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7287,9 +7287,9 @@ electron-fetch@^1.7.2: encoding "^0.1.13" electron-to-chromium@^1.3.378, electron-to-chromium@^1.4.172: - version "1.4.176" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.176.tgz#61ab2a1de3b5072ee31881a937c08ac6780d1cfa" - integrity sha512-92JdgyRlcNDwuy75MjuFSb3clt6DGJ2IXSpg0MCjKd3JV9eSmuUAIyWiGAp/EtT0z2D4rqbYqThQLV90maH3Zw== + version "1.4.177" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.177.tgz#b6a4436eb788ca732556cd69f384b8a3c82118c5" + integrity sha512-FYPir3NSBEGexSZUEeht81oVhHfLFl6mhUKSkjHN/iB/TwEIt/WHQrqVGfTLN5gQxwJCQkIJBe05eOXjI7omgg== elliptic@6.5.4, elliptic@^6.5.3: version "6.5.4" @@ -12053,9 +12053,9 @@ loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0: js-tokens "^3.0.0 || ^4.0.0" lottie-web@^5.1.3: - version "5.9.5" - resolved "https://registry.yarnpkg.com/lottie-web/-/lottie-web-5.9.5.tgz#9c822064e641f3b2d01644636ed8bdbb876147d3" - integrity sha512-4GI1jC2+YV9DyTXEz4HnAuaoOMT6yBs9KxG50rsmM7eRjUhyBpbETSVuzHAkamfP+nyNuQ84jhQxDnfjBrJdQg== + version "5.9.6" + resolved "https://registry.yarnpkg.com/lottie-web/-/lottie-web-5.9.6.tgz#62ae68563355d3e04aa75d53dec3dd4bea0e57c9" + integrity sha512-JFs7KsHwflugH5qIXBpB4905yC1Sub2MZWtl/elvO/QC6qj1ApqbUZJyjzJseJUtVpgiDaXQLjBlIJGS7UUUXA== lower-case@^2.0.2: version "2.0.2" From 2513fb8a8b27a507191bf2741ad49ad272834cd8 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Fri, 1 Jul 2022 19:04:36 -0700 Subject: [PATCH 25/46] move types into JS folder --- package.json | 5 ++- packages/js/core/package.json | 3 +- .../js/core/src/__tests__/is-buffer.spec.ts | 15 ++++++++ .../file-string-malformed/polywrap.yaml | 5 --- packages/js/core/src/index.ts | 1 - packages/js/core/src/types/Client.ts | 2 +- packages/js/core/src/types/Wrapper.ts | 2 +- .../extendable/ExtendableUriResolver.ts | 3 +- .../extendable/UriResolverWrapper.ts | 4 +-- .../extendable/types/CreateWrapperFunc.ts | 4 ++- packages/js/core/src/utils/is-buffer.ts | 7 ++++ .../{manifest => js/manifests}/.gitignore | 0 packages/js/manifests/polywrap/jest.config.js | 12 +++++++ .../manifests/polywrap}/package.json | 17 ++++++--- .../manifests/polywrap}/scripts/generate.ts | 0 .../scripts/templates/deserialize-ts.mustache | 0 .../scripts/templates/index-ts.mustache | 0 .../scripts/templates/migrate-ts.mustache | 0 .../scripts/templates/validate-ts.mustache | 0 .../src/__tests__/PolywrapManifest.spec.ts | 35 +++++++++++++++++++ .../file-string-malformed/polywrap.yaml | 5 +++ .../incorrect-version-format/polywrap.yaml | 0 .../src/__tests__/manifest/polywrap/main.ts | 0 .../polywrap/not-accepted-field/polywrap.yaml | 0 .../required-field-missing/polywrap.yaml | 0 .../manifest/polywrap/schema.graphql | 0 .../polywrap/wrong-type/polywrap.yaml | 0 .../manifests/polywrap}/src/deserialize.ts | 0 .../manifests/polywrap}/src/formats/index.ts | 0 .../formats/polywrap.app/0.0.1-prealpha.1.ts | 0 .../formats/polywrap.app/0.0.1-prealpha.2.ts | 0 .../src/formats/polywrap.app/deserialize.ts | 0 .../src/formats/polywrap.app/index.ts | 0 .../src/formats/polywrap.app/migrate.ts | 0 .../0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts | 0 .../src/formats/polywrap.app/validate.ts | 0 .../polywrap.build/0.0.1-prealpha.1.ts | 0 .../polywrap.build/0.0.1-prealpha.2.ts | 0 .../polywrap.build/0.0.1-prealpha.3.ts | 0 .../src/formats/polywrap.build/deserialize.ts | 0 .../src/formats/polywrap.build/index.ts | 0 .../src/formats/polywrap.build/migrate.ts | 0 .../0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts | 0 .../0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts | 0 .../src/formats/polywrap.build/validate.ts | 0 .../polywrap.deploy/0.0.1-prealpha.1.ts | 0 .../formats/polywrap.deploy/deserialize.ts | 0 .../src/formats/polywrap.deploy/index.ts | 0 .../src/formats/polywrap.deploy/migrate.ts | 0 .../src/formats/polywrap.deploy/validate.ts | 0 .../polywrap.infra/0.0.1-prealpha.1.ts | 0 .../polywrap.infra/0.0.1-prealpha.2.ts | 0 .../src/formats/polywrap.infra/deserialize.ts | 0 .../src/formats/polywrap.infra/index.ts | 0 .../src/formats/polywrap.infra/migrate.ts | 0 .../0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts | 0 .../src/formats/polywrap.infra/validate.ts | 0 .../formats/polywrap.meta/0.0.1-prealpha.1.ts | 0 .../formats/polywrap.meta/0.0.1-prealpha.2.ts | 0 .../formats/polywrap.meta/0.0.1-prealpha.3.ts | 0 .../src/formats/polywrap.meta/deserialize.ts | 0 .../src/formats/polywrap.meta/index.ts | 0 .../src/formats/polywrap.meta/migrate.ts | 0 .../0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts | 0 .../0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts | 0 .../src/formats/polywrap.meta/validate.ts | 0 .../polywrap.plugin/0.0.1-prealpha.1.ts | 0 .../polywrap.plugin/0.0.1-prealpha.2.ts | 0 .../polywrap.plugin/0.0.1-prealpha.3.ts | 0 .../formats/polywrap.plugin/deserialize.ts | 0 .../src/formats/polywrap.plugin/index.ts | 0 .../src/formats/polywrap.plugin/migrate.ts | 0 .../0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts | 0 .../0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts | 0 .../src/formats/polywrap.plugin/validate.ts | 0 .../src/formats/polywrap/0.0.1-prealpha.1.ts | 0 .../src/formats/polywrap/0.0.1-prealpha.2.ts | 0 .../src/formats/polywrap/0.0.1-prealpha.3.ts | 0 .../src/formats/polywrap/0.0.1-prealpha.4.ts | 0 .../src/formats/polywrap/0.0.1-prealpha.5.ts | 0 .../src/formats/polywrap/0.0.1-prealpha.6.ts | 0 .../src/formats/polywrap/0.0.1-prealpha.7.ts | 0 .../src/formats/polywrap/0.0.1-prealpha.8.ts | 0 .../src/formats/polywrap/0.0.1-prealpha.9.ts | 0 .../src/formats/polywrap/deserialize.ts | 0 .../polywrap}/src/formats/polywrap/index.ts | 0 .../polywrap}/src/formats/polywrap/migrate.ts | 0 .../0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts | 0 .../0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts | 0 .../src/formats/polywrap/validate.ts | 0 .../manifests/polywrap}/src/index.ts | 0 .../js/manifests/polywrap/tsconfig.build.json | 9 +++++ .../manifests/polywrap}/tsconfig.json | 5 +-- packages/js/manifests/wrap/jest.config.js | 12 +++++++ .../manifests/wrap}/package.json | 18 +++++++--- .../manifests/wrap}/scripts/generate.ts | 0 .../scripts/templates/deserialize-ts.mustache | 4 +-- .../wrap}/scripts/templates/index-ts.mustache | 0 .../scripts/templates/migrate-ts.mustache | 0 .../scripts/templates/validate-ts.mustache | 0 .../wrap}/src/__tests__/WrapManifest.spec.ts | 6 ++-- .../manifests/wrap}/src/deserialize.ts | 0 .../manifests/wrap}/src/formats/index.ts | 0 .../wrap}/src/formats/wrap.info/0.0.1.ts | 0 .../src/formats/wrap.info/deserialize.ts | 4 +-- .../wrap}/src/formats/wrap.info/index.ts | 0 .../wrap}/src/formats/wrap.info/migrate.ts | 0 .../wrap}/src/formats/wrap.info/validate.ts | 0 .../manifests/wrap}/src/index.ts | 0 .../js/manifests/wrap/tsconfig.build.json | 9 +++++ .../manifests/wrap}/tsconfig.json | 5 +-- packages/js/msgpack/README.md | 0 packages/js/msgpack/jest.config.js | 11 ++++++ packages/js/msgpack/package.json | 35 +++++++++++++++++++ .../src/__tests__/msgpack.spec.ts | 9 +---- .../src/msgpack => msgpack/src}/index.ts | 8 ----- packages/js/msgpack/tsconfig.build.json | 9 +++++ packages/js/msgpack/tsconfig.json | 18 ++++++++++ packages/manifests/.gitignore | 1 + .../polywrap.app/0.0.1-prealpha.1.json | 4 +-- .../polywrap.app/0.0.1-prealpha.2.json | 4 +-- .../polywrap.build/0.0.1-prealpha.1.json | 0 .../polywrap.build/0.0.1-prealpha.2.json | 0 .../polywrap.build/0.0.1-prealpha.3.json | 2 +- .../polywrap.deploy/0.0.1-prealpha.1.json | 0 .../polywrap.infra/0.0.1-prealpha.1.json | 0 .../polywrap.infra/0.0.1-prealpha.2.json | 0 .../polywrap.meta/0.0.1-prealpha.1.json | 4 +-- .../polywrap.meta/0.0.1-prealpha.2.json | 4 +-- .../polywrap.meta/0.0.1-prealpha.3.json | 4 +-- .../polywrap.plugin/0.0.1-prealpha.1.json | 2 +- .../polywrap.plugin/0.0.1-prealpha.2.json | 8 ++--- .../polywrap.plugin/0.0.1-prealpha.3.json | 4 +-- .../formats/polywrap/0.0.1-prealpha.1.json | 8 ++--- .../formats/polywrap/0.0.1-prealpha.2.json | 10 +++--- .../formats/polywrap/0.0.1-prealpha.3.json | 10 +++--- .../formats/polywrap/0.0.1-prealpha.4.json | 10 +++--- .../formats/polywrap/0.0.1-prealpha.5.json | 12 +++---- .../formats/polywrap/0.0.1-prealpha.6.json | 8 ++--- .../formats/polywrap/0.0.1-prealpha.7.json | 8 ++--- .../formats/polywrap/0.0.1-prealpha.8.json | 8 ++--- .../formats/polywrap/0.0.1-prealpha.9.json | 6 ++-- .../polywrap}/package.json | 0 .../wrap}/formats/wrap.info/0.0.1.json | 0 .../schema => manifests/wrap}/package.json | 0 151 files changed, 289 insertions(+), 110 deletions(-) create mode 100644 packages/js/core/src/__tests__/is-buffer.spec.ts delete mode 100644 packages/js/core/src/__tests__/manifest/polywrap/file-string-malformed/polywrap.yaml create mode 100644 packages/js/core/src/utils/is-buffer.ts rename packages/{manifest => js/manifests}/.gitignore (100%) create mode 100644 packages/js/manifests/polywrap/jest.config.js rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/package.json (58%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/scripts/generate.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/scripts/templates/deserialize-ts.mustache (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/scripts/templates/index-ts.mustache (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/scripts/templates/migrate-ts.mustache (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/scripts/templates/validate-ts.mustache (100%) create mode 100644 packages/js/manifests/polywrap/src/__tests__/PolywrapManifest.spec.ts create mode 100644 packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/file-string-malformed/polywrap.yaml rename packages/js/{core => manifests/polywrap}/src/__tests__/manifest/polywrap/incorrect-version-format/polywrap.yaml (100%) rename packages/js/{core => manifests/polywrap}/src/__tests__/manifest/polywrap/main.ts (100%) rename packages/js/{core => manifests/polywrap}/src/__tests__/manifest/polywrap/not-accepted-field/polywrap.yaml (100%) rename packages/js/{core => manifests/polywrap}/src/__tests__/manifest/polywrap/required-field-missing/polywrap.yaml (100%) rename packages/js/{core => manifests/polywrap}/src/__tests__/manifest/polywrap/schema.graphql (100%) rename packages/js/{core => manifests/polywrap}/src/__tests__/manifest/polywrap/wrong-type/polywrap.yaml (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/deserialize.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/index.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.app/0.0.1-prealpha.1.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.app/0.0.1-prealpha.2.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.app/deserialize.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.app/index.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.app/migrate.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.app/validate.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.build/0.0.1-prealpha.1.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.build/0.0.1-prealpha.2.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.build/0.0.1-prealpha.3.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.build/deserialize.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.build/index.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.build/migrate.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.build/validate.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.deploy/0.0.1-prealpha.1.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.deploy/deserialize.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.deploy/index.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.deploy/migrate.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.deploy/validate.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.infra/0.0.1-prealpha.1.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.infra/0.0.1-prealpha.2.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.infra/deserialize.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.infra/index.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.infra/migrate.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.infra/validate.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.meta/0.0.1-prealpha.1.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.meta/0.0.1-prealpha.2.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.meta/0.0.1-prealpha.3.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.meta/deserialize.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.meta/index.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.meta/migrate.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.meta/validate.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.plugin/0.0.1-prealpha.1.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.plugin/0.0.1-prealpha.2.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.plugin/0.0.1-prealpha.3.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.plugin/deserialize.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.plugin/index.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.plugin/migrate.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap.plugin/validate.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap/0.0.1-prealpha.1.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap/0.0.1-prealpha.2.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap/0.0.1-prealpha.3.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap/0.0.1-prealpha.4.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap/0.0.1-prealpha.5.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap/0.0.1-prealpha.6.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap/0.0.1-prealpha.7.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap/0.0.1-prealpha.8.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap/0.0.1-prealpha.9.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap/deserialize.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap/index.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap/migrate.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/formats/polywrap/validate.ts (100%) rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/src/index.ts (100%) create mode 100644 packages/js/manifests/polywrap/tsconfig.build.json rename packages/{manifest/polywrap/types/typescript => js/manifests/polywrap}/tsconfig.json (60%) create mode 100644 packages/js/manifests/wrap/jest.config.js rename packages/{manifest/wrap/types/typescript => js/manifests/wrap}/package.json (54%) rename packages/{manifest/wrap/types/typescript => js/manifests/wrap}/scripts/generate.ts (100%) rename packages/{manifest/wrap/types/typescript => js/manifests/wrap}/scripts/templates/deserialize-ts.mustache (91%) rename packages/{manifest/wrap/types/typescript => js/manifests/wrap}/scripts/templates/index-ts.mustache (100%) rename packages/{manifest/wrap/types/typescript => js/manifests/wrap}/scripts/templates/migrate-ts.mustache (100%) rename packages/{manifest/wrap/types/typescript => js/manifests/wrap}/scripts/templates/validate-ts.mustache (100%) rename packages/js/{core => manifests/wrap}/src/__tests__/WrapManifest.spec.ts (96%) rename packages/{manifest/wrap/types/typescript => js/manifests/wrap}/src/deserialize.ts (100%) rename packages/{manifest/wrap/types/typescript => js/manifests/wrap}/src/formats/index.ts (100%) rename packages/{manifest/wrap/types/typescript => js/manifests/wrap}/src/formats/wrap.info/0.0.1.ts (100%) rename packages/{manifest/wrap/types/typescript => js/manifests/wrap}/src/formats/wrap.info/deserialize.ts (91%) rename packages/{manifest/wrap/types/typescript => js/manifests/wrap}/src/formats/wrap.info/index.ts (100%) rename packages/{manifest/wrap/types/typescript => js/manifests/wrap}/src/formats/wrap.info/migrate.ts (100%) rename packages/{manifest/wrap/types/typescript => js/manifests/wrap}/src/formats/wrap.info/validate.ts (100%) rename packages/{manifest/wrap/types/typescript => js/manifests/wrap}/src/index.ts (100%) create mode 100644 packages/js/manifests/wrap/tsconfig.build.json rename packages/{manifest/wrap/types/typescript => js/manifests/wrap}/tsconfig.json (60%) create mode 100644 packages/js/msgpack/README.md create mode 100644 packages/js/msgpack/jest.config.js create mode 100644 packages/js/msgpack/package.json rename packages/js/{core => msgpack}/src/__tests__/msgpack.spec.ts (79%) rename packages/js/{core/src/msgpack => msgpack/src}/index.ts (86%) create mode 100644 packages/js/msgpack/tsconfig.build.json create mode 100644 packages/js/msgpack/tsconfig.json create mode 100644 packages/manifests/.gitignore rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap.app/0.0.1-prealpha.1.json (85%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap.app/0.0.1-prealpha.2.json (86%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap.build/0.0.1-prealpha.1.json (100%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap.build/0.0.1-prealpha.2.json (100%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap.build/0.0.1-prealpha.3.json (95%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap.deploy/0.0.1-prealpha.1.json (100%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap.infra/0.0.1-prealpha.1.json (100%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap.infra/0.0.1-prealpha.2.json (100%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap.meta/0.0.1-prealpha.1.json (93%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap.meta/0.0.1-prealpha.2.json (93%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap.meta/0.0.1-prealpha.3.json (93%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap.plugin/0.0.1-prealpha.1.json (91%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap.plugin/0.0.1-prealpha.2.json (84%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap.plugin/0.0.1-prealpha.3.json (87%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap/0.0.1-prealpha.1.json (88%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap/0.0.1-prealpha.2.json (82%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap/0.0.1-prealpha.3.json (82%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap/0.0.1-prealpha.4.json (82%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap/0.0.1-prealpha.5.json (80%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap/0.0.1-prealpha.6.json (86%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap/0.0.1-prealpha.7.json (86%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap/0.0.1-prealpha.8.json (87%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/formats/polywrap/0.0.1-prealpha.9.json (87%) rename packages/{manifest/polywrap/schema => manifests/polywrap}/package.json (100%) rename packages/{manifest/wrap/schema => manifests/wrap}/formats/wrap.info/0.0.1.json (100%) rename packages/{manifest/wrap/schema => manifests/wrap}/package.json (100%) diff --git a/package.json b/package.json index 34b5a5c71c..95ba478cc6 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "./packages/cli", "./packages/core-interfaces/**", "./packages/js/**", - "./packages/manifest/**", + "./packages/manifests/**", "./packages/schema/**", "./packages/templates/**", "./packages/test-cases", @@ -29,14 +29,13 @@ "link:schema:compose": "cd packages/schema/compose && (yarn unlink || true) && yarn link && cd ../../../dependencies && yarn link @polywrap/schema-compose && cd ../", "link:schema:bind": "cd packages/schema/bind && (yarn unlink || true) && yarn link && cd ../../../dependencies && yarn link @polywrap/schema-bind && cd ../", "preinstall": "yarn dependencies:install", - "build": "yarn build:manifests && yarn build:core && yarn dependencies:link && yarn build:interfaces && yarn build:plugins && yarn build:client && yarn build:test-env && yarn build:cli", + "build": "yarn build:core && yarn dependencies:link && yarn build:interfaces && 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:interfaces": "lerna run build --scope @polywrap/*-interface --concurrency 1", "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:manifests": "lerna run build --scope @polywrap/tracing-js && cd packages/manifest-schemas/polywrap && yarn build && cd ../wrap && yarn build", "lint": "lerna run lint", "lint:fix": "lerna run lint -- --fix", "lint:ci": "yarn lint", diff --git a/packages/js/core/package.json b/packages/js/core/package.json index 8e5b7e4b69..3ab81dcd97 100644 --- a/packages/js/core/package.json +++ b/packages/js/core/package.json @@ -19,8 +19,8 @@ "test:watch": "jest --watch --passWithNoTests --verbose" }, "dependencies": { - "@msgpack/msgpack": "2.7.2", "@polywrap/tracing-js": "0.0.1-prealpha.91", + "@polywrap/wrap-manifest-types-js": "0.0.1-prealpha.91", "graphql": "15.5.0", "graphql-tag": "2.10.4", "js-yaml": "3.14.0", @@ -29,7 +29,6 @@ }, "devDependencies": { "@polywrap/os-js": "0.0.1-prealpha.91", - "@polywrap/wrap-manifest-schemas": "0.0.1-prealpha.91", "@types/jest": "26.0.8", "@types/prettier": "2.6.0", "@types/semver": "7.3.8", diff --git a/packages/js/core/src/__tests__/is-buffer.spec.ts b/packages/js/core/src/__tests__/is-buffer.spec.ts new file mode 100644 index 0000000000..57990ac379 --- /dev/null +++ b/packages/js/core/src/__tests__/is-buffer.spec.ts @@ -0,0 +1,15 @@ +import { isBuffer } from "../utils/is-buffer"; + +it("Should check if object is buffer", () => { + const array = [ + 130, 168, 102, 105, 114, 115, 116, 75, + 101, 121, 170, 102, 105, 114, 115, 116, + 86, 97, 108, 117, 101, 169, 115, 101, + 99, 111, 110, 100, 75, 101, 121, 171, + 115, 101, 99, 111, 110, 100, 86, 97, + 108, 117, 101 + ] + expect(isBuffer(array)).toBeFalsy(); + expect(isBuffer(Uint8Array.from(array))).toBeTruthy(); + expect(isBuffer(Uint8Array.from(array).buffer)).toBeTruthy(); +}); diff --git a/packages/js/core/src/__tests__/manifest/polywrap/file-string-malformed/polywrap.yaml b/packages/js/core/src/__tests__/manifest/polywrap/file-string-malformed/polywrap.yaml deleted file mode 100644 index b2b8a19967..0000000000 --- a/packages/js/core/src/__tests__/manifest/polywrap/file-string-malformed/polywrap.yaml +++ /dev/null @@ -1,5 +0,0 @@ -format: 0.0.1-prealpha.9 -name: "File string malformed" -language: wasm/assemblyscript -main: ../index.ts -schema: .9-../schema.graphql diff --git a/packages/js/core/src/index.ts b/packages/js/core/src/index.ts index 285e3af188..4a229d8fb8 100644 --- a/packages/js/core/src/index.ts +++ b/packages/js/core/src/index.ts @@ -1,7 +1,6 @@ export * from "./types"; export * from "./algorithms"; export * from "./interfaces"; -export * from "./msgpack"; export * from "./uri-resolution/core"; export * from "./uri-resolution/resolvers"; export * from "./workflow"; diff --git a/packages/js/core/src/types/Client.ts b/packages/js/core/src/types/Client.ts index d78b5631d1..c75b938467 100644 --- a/packages/js/core/src/types/Client.ts +++ b/packages/js/core/src/types/Client.ts @@ -12,7 +12,7 @@ import { import { UriResolver } from "../uri-resolution/core"; import { UriResolverHandler } from "./UriResolver"; -import { WrapManifest } from "@polywrap/wrap-manifest-schemas"; +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; export interface ClientConfig { redirects: UriRedirect[]; diff --git a/packages/js/core/src/types/Wrapper.ts b/packages/js/core/src/types/Wrapper.ts index b5d8b38bd1..f6aec82969 100644 --- a/packages/js/core/src/types/Wrapper.ts +++ b/packages/js/core/src/types/Wrapper.ts @@ -8,7 +8,7 @@ import { Invoker, InvocableResult, } from "."; -import { WrapManifest } from "@polywrap/polywrap-manifest-schemas"; +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; /** * The Wrapper definition, which can be used to spawn diff --git a/packages/js/core/src/uri-resolution/resolvers/extendable/ExtendableUriResolver.ts b/packages/js/core/src/uri-resolution/resolvers/extendable/ExtendableUriResolver.ts index 174177ee97..d5b6394d5e 100644 --- a/packages/js/core/src/uri-resolution/resolvers/extendable/ExtendableUriResolver.ts +++ b/packages/js/core/src/uri-resolution/resolvers/extendable/ExtendableUriResolver.ts @@ -4,7 +4,6 @@ import { WrapperCache, getImplementations, coreInterfaceUris, - DeserializeManifestOptions, } from "../../.."; import { CreateWrapperFunc } from "./types/CreateWrapperFunc"; import { UriResolutionResult } from "../../core/types/UriResolutionResult"; @@ -12,6 +11,8 @@ import { UriResolver, UriResolutionStack } from "../../core"; import { UriResolverWrapper } from "./UriResolverWrapper"; import { Queue } from "../../../utils/Queue"; +import { DeserializeManifestOptions } from "@polywrap/wrap-manifest-types-js"; + export type ExtendableUriResolverResult = UriResolutionResult & { implementationUri?: Uri; }; diff --git a/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts b/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts index 4eb79acc0d..d5e569bd42 100644 --- a/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts +++ b/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts @@ -11,9 +11,8 @@ import { getEnvFromUriOrResolutionStack } from "../getEnvFromUriOrResolutionStac import { DeserializeManifestOptions, deserializeWrapManifest, -} from "@polywrap/wrap-manifest-schemas"; +} from "@polywrap/wrap-manifest-types-js"; import { Tracer } from "@polywrap/tracing-js"; -import { msgpackDecode } from "../../../msgpack"; export class UriResolverWrapper implements UriResolver { constructor( @@ -53,7 +52,6 @@ export class UriResolverWrapper implements UriResolver { // meaning the URI resolver can also be used as an Wrapper resolver const manifest = deserializeWrapManifest( result.manifest, - msgpackDecode, this.deserializeOptions ); diff --git a/packages/js/core/src/uri-resolution/resolvers/extendable/types/CreateWrapperFunc.ts b/packages/js/core/src/uri-resolution/resolvers/extendable/types/CreateWrapperFunc.ts index 890a1d24b8..d46b3489ba 100644 --- a/packages/js/core/src/uri-resolution/resolvers/extendable/types/CreateWrapperFunc.ts +++ b/packages/js/core/src/uri-resolution/resolvers/extendable/types/CreateWrapperFunc.ts @@ -1,4 +1,6 @@ -import { Uri, Wrapper, WrapManifest, Env } from "../../../.."; +import { Uri, Wrapper, Env } from "../../../.."; + +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; export type CreateWrapperFunc = ( uri: Uri, diff --git a/packages/js/core/src/utils/is-buffer.ts b/packages/js/core/src/utils/is-buffer.ts new file mode 100644 index 0000000000..c2245a87ae --- /dev/null +++ b/packages/js/core/src/utils/is-buffer.ts @@ -0,0 +1,7 @@ +export function isBuffer(maybeBuf: unknown): maybeBuf is BufferSource { + if (maybeBuf instanceof ArrayBuffer || ArrayBuffer.isView(maybeBuf)) { + return true; + } else { + return false; + } +} diff --git a/packages/manifest/.gitignore b/packages/js/manifests/.gitignore similarity index 100% rename from packages/manifest/.gitignore rename to packages/js/manifests/.gitignore diff --git a/packages/js/manifests/polywrap/jest.config.js b/packages/js/manifests/polywrap/jest.config.js new file mode 100644 index 0000000000..6ac4f82580 --- /dev/null +++ b/packages/js/manifests/polywrap/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__/wrappers'], + globals: { + 'ts-jest': { + diagnostics: false + } + } +}; diff --git a/packages/manifest/polywrap/types/typescript/package.json b/packages/js/manifests/polywrap/package.json similarity index 58% rename from packages/manifest/polywrap/types/typescript/package.json rename to packages/js/manifests/polywrap/package.json index d9ae67dd94..990b3a93c5 100644 --- a/packages/manifest/polywrap/types/typescript/package.json +++ b/packages/js/manifests/polywrap/package.json @@ -1,5 +1,5 @@ { - "name": "@polywrap/polywrap-manifest-typescript-types", + "name": "@polywrap/polywrap-manifest-types-js", "description": "Polywrap Manifest TypeScript Typings", "version": "0.0.1-prealpha.91", "license": "MIT", @@ -9,8 +9,12 @@ }, "main": "./build/index.js", "scripts": { + "build": "rimraf ./build && tsc --project tsconfig.build.json", + "prebuild": "ts-node ./scripts/generate.ts", "lint": "eslint --color -c ../../.eslintrc.js .", - "build": "ts-node ./scripts/generate.ts && tsc" + "test": "jest --passWithNoTests --runInBand --verbose", + "test:ci": "jest --passWithNoTests --runInBand --verbose", + "test:watch": "jest --watch --passWithNoTests --verbose" }, "dependencies": { "@polywrap/polywrap-manifest-schemas": "0.0.1-prealpha.91", @@ -20,11 +24,16 @@ }, "devDependencies": { "@polywrap/os-js": "0.0.1-prealpha.91", + "@types/jest": "26.0.8", + "@types/prettier": "2.6.0", "@types/js-yaml": "3.11.1", - "typescript": "4.0.7", + "jest": "26.6.3", "json-schema-to-typescript": "10.1.3", "mustache": "4.0.1", - "ts-node": "8.10.2" + "rimraf": "3.0.2", + "ts-jest": "26.5.4", + "ts-node": "8.10.2", + "typescript": "4.0.7" }, "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", "publishConfig": { diff --git a/packages/manifest/polywrap/types/typescript/scripts/generate.ts b/packages/js/manifests/polywrap/scripts/generate.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/scripts/generate.ts rename to packages/js/manifests/polywrap/scripts/generate.ts diff --git a/packages/manifest/polywrap/types/typescript/scripts/templates/deserialize-ts.mustache b/packages/js/manifests/polywrap/scripts/templates/deserialize-ts.mustache similarity index 100% rename from packages/manifest/polywrap/types/typescript/scripts/templates/deserialize-ts.mustache rename to packages/js/manifests/polywrap/scripts/templates/deserialize-ts.mustache diff --git a/packages/manifest/polywrap/types/typescript/scripts/templates/index-ts.mustache b/packages/js/manifests/polywrap/scripts/templates/index-ts.mustache similarity index 100% rename from packages/manifest/polywrap/types/typescript/scripts/templates/index-ts.mustache rename to packages/js/manifests/polywrap/scripts/templates/index-ts.mustache diff --git a/packages/manifest/polywrap/types/typescript/scripts/templates/migrate-ts.mustache b/packages/js/manifests/polywrap/scripts/templates/migrate-ts.mustache similarity index 100% rename from packages/manifest/polywrap/types/typescript/scripts/templates/migrate-ts.mustache rename to packages/js/manifests/polywrap/scripts/templates/migrate-ts.mustache diff --git a/packages/manifest/polywrap/types/typescript/scripts/templates/validate-ts.mustache b/packages/js/manifests/polywrap/scripts/templates/validate-ts.mustache similarity index 100% rename from packages/manifest/polywrap/types/typescript/scripts/templates/validate-ts.mustache rename to packages/js/manifests/polywrap/scripts/templates/validate-ts.mustache diff --git a/packages/js/manifests/polywrap/src/__tests__/PolywrapManifest.spec.ts b/packages/js/manifests/polywrap/src/__tests__/PolywrapManifest.spec.ts new file mode 100644 index 0000000000..232a17d7f8 --- /dev/null +++ b/packages/js/manifests/polywrap/src/__tests__/PolywrapManifest.spec.ts @@ -0,0 +1,35 @@ +import { deserializePolywrapManifest } from "../"; + +import fs from "fs"; + +describe("Polywrap Manifest Validation", () => { + it("Should throw file string does not exist error", async () => { + const manifestPath = __dirname + "/manifest/polywrap/file-string-malformed/polywrap.yaml"; + const manifest = fs.readFileSync(manifestPath, "utf-8"); + + expect(() => deserializePolywrapManifest(manifest)).toThrowError(/instance.schema does not match pattern/); + }); + it("Should throw incorrect version format error", async () => { + const manifestPath = __dirname + "/manifest/polywrap/incorrect-version-format/polywrap.yaml"; + const manifest = fs.readFileSync(manifestPath, "utf-8"); + + expect(() => deserializePolywrapManifest(manifest)).toThrowError(/Unrecognized PolywrapManifest schema format/); + }); + it("Should throw not accepted field error", async () => { + const manifestPath = __dirname + "/manifest/polywrap/not-accepted-field/polywrap.yaml"; + const manifest = fs.readFileSync(manifestPath, "utf-8"); + + expect(() => deserializePolywrapManifest(manifest)).toThrowError(/not allowed to have the additional property "not_accepted_field"/); + }); + it("Should throw required field missing error", async () => { + const manifestPath = __dirname + "/manifest/polywrap/required-field-missing/polywrap.yaml"; + const manifest = fs.readFileSync(manifestPath, "utf-8"); + expect(() => deserializePolywrapManifest(manifest)).toThrowError(/instance requires property "schema"/); + }); + it("Should throw wrong type error", async () => { + const manifestPath = __dirname + "/manifest/polywrap/wrong-type/polywrap.yaml"; + const manifest = fs.readFileSync(manifestPath, "utf-8"); + + expect(() => deserializePolywrapManifest(manifest)).toThrowError(/instance.module is not of a type\(s\) string/); + }); +}); diff --git a/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/file-string-malformed/polywrap.yaml b/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/file-string-malformed/polywrap.yaml new file mode 100644 index 0000000000..2ddeee0152 --- /dev/null +++ b/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/file-string-malformed/polywrap.yaml @@ -0,0 +1,5 @@ +format: 0.0.1-prealpha.9 +name: package-name +language: wasm/assemblyscript +module: ../index.ts +schema: ..34234./schema.graphql diff --git a/packages/js/core/src/__tests__/manifest/polywrap/incorrect-version-format/polywrap.yaml b/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/incorrect-version-format/polywrap.yaml similarity index 100% rename from packages/js/core/src/__tests__/manifest/polywrap/incorrect-version-format/polywrap.yaml rename to packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/incorrect-version-format/polywrap.yaml diff --git a/packages/js/core/src/__tests__/manifest/polywrap/main.ts b/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/main.ts similarity index 100% rename from packages/js/core/src/__tests__/manifest/polywrap/main.ts rename to packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/main.ts diff --git a/packages/js/core/src/__tests__/manifest/polywrap/not-accepted-field/polywrap.yaml b/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/not-accepted-field/polywrap.yaml similarity index 100% rename from packages/js/core/src/__tests__/manifest/polywrap/not-accepted-field/polywrap.yaml rename to packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/not-accepted-field/polywrap.yaml diff --git a/packages/js/core/src/__tests__/manifest/polywrap/required-field-missing/polywrap.yaml b/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/required-field-missing/polywrap.yaml similarity index 100% rename from packages/js/core/src/__tests__/manifest/polywrap/required-field-missing/polywrap.yaml rename to packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/required-field-missing/polywrap.yaml diff --git a/packages/js/core/src/__tests__/manifest/polywrap/schema.graphql b/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/schema.graphql similarity index 100% rename from packages/js/core/src/__tests__/manifest/polywrap/schema.graphql rename to packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/schema.graphql diff --git a/packages/js/core/src/__tests__/manifest/polywrap/wrong-type/polywrap.yaml b/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/wrong-type/polywrap.yaml similarity index 100% rename from packages/js/core/src/__tests__/manifest/polywrap/wrong-type/polywrap.yaml rename to packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/wrong-type/polywrap.yaml diff --git a/packages/manifest/polywrap/types/typescript/src/deserialize.ts b/packages/js/manifests/polywrap/src/deserialize.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/deserialize.ts rename to packages/js/manifests/polywrap/src/deserialize.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/index.ts b/packages/js/manifests/polywrap/src/formats/index.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/index.ts rename to packages/js/manifests/polywrap/src/formats/index.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/0.0.1-prealpha.1.ts b/packages/js/manifests/polywrap/src/formats/polywrap.app/0.0.1-prealpha.1.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/0.0.1-prealpha.1.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.app/0.0.1-prealpha.1.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/0.0.1-prealpha.2.ts b/packages/js/manifests/polywrap/src/formats/polywrap.app/0.0.1-prealpha.2.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/0.0.1-prealpha.2.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.app/0.0.1-prealpha.2.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/deserialize.ts b/packages/js/manifests/polywrap/src/formats/polywrap.app/deserialize.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/deserialize.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.app/deserialize.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/index.ts b/packages/js/manifests/polywrap/src/formats/polywrap.app/index.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/index.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.app/index.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/migrate.ts b/packages/js/manifests/polywrap/src/formats/polywrap.app/migrate.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/migrate.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.app/migrate.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts b/packages/js/manifests/polywrap/src/formats/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.app/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/validate.ts b/packages/js/manifests/polywrap/src/formats/polywrap.app/validate.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.app/validate.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.app/validate.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/0.0.1-prealpha.1.ts b/packages/js/manifests/polywrap/src/formats/polywrap.build/0.0.1-prealpha.1.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/0.0.1-prealpha.1.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.build/0.0.1-prealpha.1.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/0.0.1-prealpha.2.ts b/packages/js/manifests/polywrap/src/formats/polywrap.build/0.0.1-prealpha.2.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/0.0.1-prealpha.2.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.build/0.0.1-prealpha.2.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/0.0.1-prealpha.3.ts b/packages/js/manifests/polywrap/src/formats/polywrap.build/0.0.1-prealpha.3.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/0.0.1-prealpha.3.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.build/0.0.1-prealpha.3.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/deserialize.ts b/packages/js/manifests/polywrap/src/formats/polywrap.build/deserialize.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/deserialize.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.build/deserialize.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/index.ts b/packages/js/manifests/polywrap/src/formats/polywrap.build/index.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/index.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.build/index.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/migrate.ts b/packages/js/manifests/polywrap/src/formats/polywrap.build/migrate.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/migrate.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.build/migrate.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts b/packages/js/manifests/polywrap/src/formats/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.build/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts b/packages/js/manifests/polywrap/src/formats/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.build/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/validate.ts b/packages/js/manifests/polywrap/src/formats/polywrap.build/validate.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.build/validate.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.build/validate.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/0.0.1-prealpha.1.ts b/packages/js/manifests/polywrap/src/formats/polywrap.deploy/0.0.1-prealpha.1.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/0.0.1-prealpha.1.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.deploy/0.0.1-prealpha.1.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/deserialize.ts b/packages/js/manifests/polywrap/src/formats/polywrap.deploy/deserialize.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/deserialize.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.deploy/deserialize.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/index.ts b/packages/js/manifests/polywrap/src/formats/polywrap.deploy/index.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/index.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.deploy/index.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/migrate.ts b/packages/js/manifests/polywrap/src/formats/polywrap.deploy/migrate.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/migrate.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.deploy/migrate.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/validate.ts b/packages/js/manifests/polywrap/src/formats/polywrap.deploy/validate.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.deploy/validate.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.deploy/validate.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/0.0.1-prealpha.1.ts b/packages/js/manifests/polywrap/src/formats/polywrap.infra/0.0.1-prealpha.1.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/0.0.1-prealpha.1.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.infra/0.0.1-prealpha.1.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/0.0.1-prealpha.2.ts b/packages/js/manifests/polywrap/src/formats/polywrap.infra/0.0.1-prealpha.2.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/0.0.1-prealpha.2.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.infra/0.0.1-prealpha.2.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/deserialize.ts b/packages/js/manifests/polywrap/src/formats/polywrap.infra/deserialize.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/deserialize.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.infra/deserialize.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/index.ts b/packages/js/manifests/polywrap/src/formats/polywrap.infra/index.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/index.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.infra/index.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/migrate.ts b/packages/js/manifests/polywrap/src/formats/polywrap.infra/migrate.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/migrate.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.infra/migrate.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts b/packages/js/manifests/polywrap/src/formats/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.infra/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.2.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/validate.ts b/packages/js/manifests/polywrap/src/formats/polywrap.infra/validate.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.infra/validate.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.infra/validate.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/0.0.1-prealpha.1.ts b/packages/js/manifests/polywrap/src/formats/polywrap.meta/0.0.1-prealpha.1.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/0.0.1-prealpha.1.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.meta/0.0.1-prealpha.1.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/0.0.1-prealpha.2.ts b/packages/js/manifests/polywrap/src/formats/polywrap.meta/0.0.1-prealpha.2.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/0.0.1-prealpha.2.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.meta/0.0.1-prealpha.2.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/0.0.1-prealpha.3.ts b/packages/js/manifests/polywrap/src/formats/polywrap.meta/0.0.1-prealpha.3.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/0.0.1-prealpha.3.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.meta/0.0.1-prealpha.3.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/deserialize.ts b/packages/js/manifests/polywrap/src/formats/polywrap.meta/deserialize.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/deserialize.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.meta/deserialize.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/index.ts b/packages/js/manifests/polywrap/src/formats/polywrap.meta/index.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/index.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.meta/index.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/migrate.ts b/packages/js/manifests/polywrap/src/formats/polywrap.meta/migrate.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/migrate.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.meta/migrate.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts b/packages/js/manifests/polywrap/src/formats/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.meta/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts b/packages/js/manifests/polywrap/src/formats/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.meta/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/validate.ts b/packages/js/manifests/polywrap/src/formats/polywrap.meta/validate.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.meta/validate.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.meta/validate.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/0.0.1-prealpha.1.ts b/packages/js/manifests/polywrap/src/formats/polywrap.plugin/0.0.1-prealpha.1.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/0.0.1-prealpha.1.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.plugin/0.0.1-prealpha.1.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/0.0.1-prealpha.2.ts b/packages/js/manifests/polywrap/src/formats/polywrap.plugin/0.0.1-prealpha.2.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/0.0.1-prealpha.2.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.plugin/0.0.1-prealpha.2.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/0.0.1-prealpha.3.ts b/packages/js/manifests/polywrap/src/formats/polywrap.plugin/0.0.1-prealpha.3.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/0.0.1-prealpha.3.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.plugin/0.0.1-prealpha.3.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/deserialize.ts b/packages/js/manifests/polywrap/src/formats/polywrap.plugin/deserialize.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/deserialize.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.plugin/deserialize.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/index.ts b/packages/js/manifests/polywrap/src/formats/polywrap.plugin/index.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/index.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.plugin/index.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/migrate.ts b/packages/js/manifests/polywrap/src/formats/polywrap.plugin/migrate.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/migrate.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.plugin/migrate.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts b/packages/js/manifests/polywrap/src/formats/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.plugin/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.3.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts b/packages/js/manifests/polywrap/src/formats/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.plugin/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.3.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/validate.ts b/packages/js/manifests/polywrap/src/formats/polywrap.plugin/validate.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap.plugin/validate.ts rename to packages/js/manifests/polywrap/src/formats/polywrap.plugin/validate.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.1.ts b/packages/js/manifests/polywrap/src/formats/polywrap/0.0.1-prealpha.1.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.1.ts rename to packages/js/manifests/polywrap/src/formats/polywrap/0.0.1-prealpha.1.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.2.ts b/packages/js/manifests/polywrap/src/formats/polywrap/0.0.1-prealpha.2.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.2.ts rename to packages/js/manifests/polywrap/src/formats/polywrap/0.0.1-prealpha.2.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.3.ts b/packages/js/manifests/polywrap/src/formats/polywrap/0.0.1-prealpha.3.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.3.ts rename to packages/js/manifests/polywrap/src/formats/polywrap/0.0.1-prealpha.3.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.4.ts b/packages/js/manifests/polywrap/src/formats/polywrap/0.0.1-prealpha.4.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.4.ts rename to packages/js/manifests/polywrap/src/formats/polywrap/0.0.1-prealpha.4.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.5.ts b/packages/js/manifests/polywrap/src/formats/polywrap/0.0.1-prealpha.5.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.5.ts rename to packages/js/manifests/polywrap/src/formats/polywrap/0.0.1-prealpha.5.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.6.ts b/packages/js/manifests/polywrap/src/formats/polywrap/0.0.1-prealpha.6.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.6.ts rename to packages/js/manifests/polywrap/src/formats/polywrap/0.0.1-prealpha.6.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.7.ts b/packages/js/manifests/polywrap/src/formats/polywrap/0.0.1-prealpha.7.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.7.ts rename to packages/js/manifests/polywrap/src/formats/polywrap/0.0.1-prealpha.7.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.8.ts b/packages/js/manifests/polywrap/src/formats/polywrap/0.0.1-prealpha.8.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.8.ts rename to packages/js/manifests/polywrap/src/formats/polywrap/0.0.1-prealpha.8.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.9.ts b/packages/js/manifests/polywrap/src/formats/polywrap/0.0.1-prealpha.9.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap/0.0.1-prealpha.9.ts rename to packages/js/manifests/polywrap/src/formats/polywrap/0.0.1-prealpha.9.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/deserialize.ts b/packages/js/manifests/polywrap/src/formats/polywrap/deserialize.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap/deserialize.ts rename to packages/js/manifests/polywrap/src/formats/polywrap/deserialize.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/index.ts b/packages/js/manifests/polywrap/src/formats/polywrap/index.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap/index.ts rename to packages/js/manifests/polywrap/src/formats/polywrap/index.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrate.ts b/packages/js/manifests/polywrap/src/formats/polywrap/migrate.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrate.ts rename to packages/js/manifests/polywrap/src/formats/polywrap/migrate.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts b/packages/js/manifests/polywrap/src/formats/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts rename to packages/js/manifests/polywrap/src/formats/polywrap/migrators/0.0.1-prealpha.1_to_0.0.1-prealpha.9.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts b/packages/js/manifests/polywrap/src/formats/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts rename to packages/js/manifests/polywrap/src/formats/polywrap/migrators/0.0.1-prealpha.2_to_0.0.1-prealpha.9.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts b/packages/js/manifests/polywrap/src/formats/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts rename to packages/js/manifests/polywrap/src/formats/polywrap/migrators/0.0.1-prealpha.3_to_0.0.1-prealpha.9.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts b/packages/js/manifests/polywrap/src/formats/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts rename to packages/js/manifests/polywrap/src/formats/polywrap/migrators/0.0.1-prealpha.4_to_0.0.1-prealpha.9.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts b/packages/js/manifests/polywrap/src/formats/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts rename to packages/js/manifests/polywrap/src/formats/polywrap/migrators/0.0.1-prealpha.5_to_0.0.1-prealpha.9.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts b/packages/js/manifests/polywrap/src/formats/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts rename to packages/js/manifests/polywrap/src/formats/polywrap/migrators/0.0.1-prealpha.6_to_0.0.1-prealpha.9.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts b/packages/js/manifests/polywrap/src/formats/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts rename to packages/js/manifests/polywrap/src/formats/polywrap/migrators/0.0.1-prealpha.7_to_0.0.1-prealpha.9.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts b/packages/js/manifests/polywrap/src/formats/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts rename to packages/js/manifests/polywrap/src/formats/polywrap/migrators/0.0.1-prealpha.8_to_0.0.1-prealpha.9.ts diff --git a/packages/manifest/polywrap/types/typescript/src/formats/polywrap/validate.ts b/packages/js/manifests/polywrap/src/formats/polywrap/validate.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/formats/polywrap/validate.ts rename to packages/js/manifests/polywrap/src/formats/polywrap/validate.ts diff --git a/packages/manifest/polywrap/types/typescript/src/index.ts b/packages/js/manifests/polywrap/src/index.ts similarity index 100% rename from packages/manifest/polywrap/types/typescript/src/index.ts rename to packages/js/manifests/polywrap/src/index.ts diff --git a/packages/js/manifests/polywrap/tsconfig.build.json b/packages/js/manifests/polywrap/tsconfig.build.json new file mode 100644 index 0000000000..9708b5768a --- /dev/null +++ b/packages/js/manifests/polywrap/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "include": [ + "./src/**/*.ts" + ], + "exclude": [ + "./src/**/__tests__" + ] +} \ No newline at end of file diff --git a/packages/manifest/polywrap/types/typescript/tsconfig.json b/packages/js/manifests/polywrap/tsconfig.json similarity index 60% rename from packages/manifest/polywrap/types/typescript/tsconfig.json rename to packages/js/manifests/polywrap/tsconfig.json index 1b87939adb..85d516ce30 100644 --- a/packages/manifest/polywrap/types/typescript/tsconfig.json +++ b/packages/js/manifests/polywrap/tsconfig.json @@ -1,9 +1,10 @@ { - "extends": "../../../../../tsconfig.json", + "extends": "../../../../tsconfig", "compilerOptions": { "outDir": "build" }, "include": [ "./src/**/*.ts" - ] + ], + "exclude": [] } diff --git a/packages/js/manifests/wrap/jest.config.js b/packages/js/manifests/wrap/jest.config.js new file mode 100644 index 0000000000..6ac4f82580 --- /dev/null +++ b/packages/js/manifests/wrap/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__/wrappers'], + globals: { + 'ts-jest': { + diagnostics: false + } + } +}; diff --git a/packages/manifest/wrap/types/typescript/package.json b/packages/js/manifests/wrap/package.json similarity index 54% rename from packages/manifest/wrap/types/typescript/package.json rename to packages/js/manifests/wrap/package.json index f22269034b..e4755612df 100644 --- a/packages/manifest/wrap/types/typescript/package.json +++ b/packages/js/manifests/wrap/package.json @@ -1,5 +1,5 @@ { - "name": "@polywrap/wrap-manifest-typescript-types", + "name": "@polywrap/wrap-manifest-types-js", "description": "WRAP Manifest TypeScript Typings", "version": "0.0.1-prealpha.91", "license": "MIT", @@ -9,20 +9,30 @@ }, "main": "./build/index.js", "scripts": { + "build": "rimraf ./build && tsc --project tsconfig.build.json", + "prebuild": "ts-node ./scripts/generate.ts", "lint": "eslint --color -c ../../.eslintrc.js .", - "build": "ts-node ./scripts/generate.ts && tsc" + "test": "jest --passWithNoTests --runInBand --verbose", + "test:ci": "jest --passWithNoTests --runInBand --verbose", + "test:watch": "jest --watch --passWithNoTests --verbose" }, "dependencies": { + "@polywrap/msgpack-js": "0.0.1-prealpha.91", "@polywrap/wrap-manifest-schemas": "0.0.1-prealpha.91", "jsonschema": "1.4.0", "semver": "7.3.5" }, "devDependencies": { "@polywrap/os-js": "0.0.1-prealpha.91", + "@types/jest": "26.0.8", + "@types/prettier": "2.6.0", + "jest": "26.6.3", "json-schema-to-typescript": "10.1.3", - "typescript": "4.0.7", "mustache": "4.0.1", - "ts-node": "8.10.2" + "rimraf": "3.0.2", + "ts-jest": "26.5.4", + "ts-node": "8.10.2", + "typescript": "4.0.7" }, "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", "publishConfig": { diff --git a/packages/manifest/wrap/types/typescript/scripts/generate.ts b/packages/js/manifests/wrap/scripts/generate.ts similarity index 100% rename from packages/manifest/wrap/types/typescript/scripts/generate.ts rename to packages/js/manifests/wrap/scripts/generate.ts diff --git a/packages/manifest/wrap/types/typescript/scripts/templates/deserialize-ts.mustache b/packages/js/manifests/wrap/scripts/templates/deserialize-ts.mustache similarity index 91% rename from packages/manifest/wrap/types/typescript/scripts/templates/deserialize-ts.mustache rename to packages/js/manifests/wrap/scripts/templates/deserialize-ts.mustache index 49657ef975..d57b0405b5 100644 --- a/packages/manifest/wrap/types/typescript/scripts/templates/deserialize-ts.mustache +++ b/packages/js/manifests/wrap/scripts/templates/deserialize-ts.mustache @@ -14,16 +14,16 @@ import { } from "."; import { DeserializeManifestOptions } from "../../"; +import { msgpackDecode } from "@polywrap/msgpack-js"; import { compare } from "semver"; export function deserializeWrapManifest( manifest: Uint8Array, - decoder: (m: Uint8Array) => unknown, options?: DeserializeManifestOptions ): WrapManifest { let anyWrapManifest: AnyWrapManifest | undefined; try { - anyWrapManifest = decoder(manifest) as AnyWrapManifest; + anyWrapManifest = msgpackDecode(manifest) as AnyWrapManifest; } catch (e) { throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); } diff --git a/packages/manifest/wrap/types/typescript/scripts/templates/index-ts.mustache b/packages/js/manifests/wrap/scripts/templates/index-ts.mustache similarity index 100% rename from packages/manifest/wrap/types/typescript/scripts/templates/index-ts.mustache rename to packages/js/manifests/wrap/scripts/templates/index-ts.mustache diff --git a/packages/manifest/wrap/types/typescript/scripts/templates/migrate-ts.mustache b/packages/js/manifests/wrap/scripts/templates/migrate-ts.mustache similarity index 100% rename from packages/manifest/wrap/types/typescript/scripts/templates/migrate-ts.mustache rename to packages/js/manifests/wrap/scripts/templates/migrate-ts.mustache diff --git a/packages/manifest/wrap/types/typescript/scripts/templates/validate-ts.mustache b/packages/js/manifests/wrap/scripts/templates/validate-ts.mustache similarity index 100% rename from packages/manifest/wrap/types/typescript/scripts/templates/validate-ts.mustache rename to packages/js/manifests/wrap/scripts/templates/validate-ts.mustache diff --git a/packages/js/core/src/__tests__/WrapManifest.spec.ts b/packages/js/manifests/wrap/src/__tests__/WrapManifest.spec.ts similarity index 96% rename from packages/js/core/src/__tests__/WrapManifest.spec.ts rename to packages/js/manifests/wrap/src/__tests__/WrapManifest.spec.ts index 1b1bd312d3..31ba1e8d33 100644 --- a/packages/js/core/src/__tests__/WrapManifest.spec.ts +++ b/packages/js/manifests/wrap/src/__tests__/WrapManifest.spec.ts @@ -1,8 +1,10 @@ import { WrapManifest, - deserializeWrapManifest, - msgpackEncode + deserializeWrapManifest } from ".."; +import { + msgpackEncode +} from "@polywrap/msgpack-js"; const testManifest: WrapManifest = { version: "0.0.1", diff --git a/packages/manifest/wrap/types/typescript/src/deserialize.ts b/packages/js/manifests/wrap/src/deserialize.ts similarity index 100% rename from packages/manifest/wrap/types/typescript/src/deserialize.ts rename to packages/js/manifests/wrap/src/deserialize.ts diff --git a/packages/manifest/wrap/types/typescript/src/formats/index.ts b/packages/js/manifests/wrap/src/formats/index.ts similarity index 100% rename from packages/manifest/wrap/types/typescript/src/formats/index.ts rename to packages/js/manifests/wrap/src/formats/index.ts diff --git a/packages/manifest/wrap/types/typescript/src/formats/wrap.info/0.0.1.ts b/packages/js/manifests/wrap/src/formats/wrap.info/0.0.1.ts similarity index 100% rename from packages/manifest/wrap/types/typescript/src/formats/wrap.info/0.0.1.ts rename to packages/js/manifests/wrap/src/formats/wrap.info/0.0.1.ts diff --git a/packages/manifest/wrap/types/typescript/src/formats/wrap.info/deserialize.ts b/packages/js/manifests/wrap/src/formats/wrap.info/deserialize.ts similarity index 91% rename from packages/manifest/wrap/types/typescript/src/formats/wrap.info/deserialize.ts rename to packages/js/manifests/wrap/src/formats/wrap.info/deserialize.ts index 49657ef975..d57b0405b5 100644 --- a/packages/manifest/wrap/types/typescript/src/formats/wrap.info/deserialize.ts +++ b/packages/js/manifests/wrap/src/formats/wrap.info/deserialize.ts @@ -14,16 +14,16 @@ import { } from "."; import { DeserializeManifestOptions } from "../../"; +import { msgpackDecode } from "@polywrap/msgpack-js"; import { compare } from "semver"; export function deserializeWrapManifest( manifest: Uint8Array, - decoder: (m: Uint8Array) => unknown, options?: DeserializeManifestOptions ): WrapManifest { let anyWrapManifest: AnyWrapManifest | undefined; try { - anyWrapManifest = decoder(manifest) as AnyWrapManifest; + anyWrapManifest = msgpackDecode(manifest) as AnyWrapManifest; } catch (e) { throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); } diff --git a/packages/manifest/wrap/types/typescript/src/formats/wrap.info/index.ts b/packages/js/manifests/wrap/src/formats/wrap.info/index.ts similarity index 100% rename from packages/manifest/wrap/types/typescript/src/formats/wrap.info/index.ts rename to packages/js/manifests/wrap/src/formats/wrap.info/index.ts diff --git a/packages/manifest/wrap/types/typescript/src/formats/wrap.info/migrate.ts b/packages/js/manifests/wrap/src/formats/wrap.info/migrate.ts similarity index 100% rename from packages/manifest/wrap/types/typescript/src/formats/wrap.info/migrate.ts rename to packages/js/manifests/wrap/src/formats/wrap.info/migrate.ts diff --git a/packages/manifest/wrap/types/typescript/src/formats/wrap.info/validate.ts b/packages/js/manifests/wrap/src/formats/wrap.info/validate.ts similarity index 100% rename from packages/manifest/wrap/types/typescript/src/formats/wrap.info/validate.ts rename to packages/js/manifests/wrap/src/formats/wrap.info/validate.ts diff --git a/packages/manifest/wrap/types/typescript/src/index.ts b/packages/js/manifests/wrap/src/index.ts similarity index 100% rename from packages/manifest/wrap/types/typescript/src/index.ts rename to packages/js/manifests/wrap/src/index.ts diff --git a/packages/js/manifests/wrap/tsconfig.build.json b/packages/js/manifests/wrap/tsconfig.build.json new file mode 100644 index 0000000000..9708b5768a --- /dev/null +++ b/packages/js/manifests/wrap/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "include": [ + "./src/**/*.ts" + ], + "exclude": [ + "./src/**/__tests__" + ] +} \ No newline at end of file diff --git a/packages/manifest/wrap/types/typescript/tsconfig.json b/packages/js/manifests/wrap/tsconfig.json similarity index 60% rename from packages/manifest/wrap/types/typescript/tsconfig.json rename to packages/js/manifests/wrap/tsconfig.json index 1b87939adb..85d516ce30 100644 --- a/packages/manifest/wrap/types/typescript/tsconfig.json +++ b/packages/js/manifests/wrap/tsconfig.json @@ -1,9 +1,10 @@ { - "extends": "../../../../../tsconfig.json", + "extends": "../../../../tsconfig", "compilerOptions": { "outDir": "build" }, "include": [ "./src/**/*.ts" - ] + ], + "exclude": [] } diff --git a/packages/js/msgpack/README.md b/packages/js/msgpack/README.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/js/msgpack/jest.config.js b/packages/js/msgpack/jest.config.js new file mode 100644 index 0000000000..a5ca876a5a --- /dev/null +++ b/packages/js/msgpack/jest.config.js @@ -0,0 +1,11 @@ +module.exports = { + collectCoverage: true, + preset: 'ts-jest', + testEnvironment: 'node', + testMatch: ["**/?(*.)+(spec|test).[jt]s?(x)"], + globals: { + 'ts-jest': { + diagnostics: false + } + } +}; diff --git a/packages/js/msgpack/package.json b/packages/js/msgpack/package.json new file mode 100644 index 0000000000..569bdd3421 --- /dev/null +++ b/packages/js/msgpack/package.json @@ -0,0 +1,35 @@ +{ + "name": "@polywrap/msgpack-js", + "description": "WRAP MsgPack Encoding", + "version": "0.0.1-prealpha.91", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/polywrap/monorepo.git" + }, + "main": "build/index.js", + "files": [ + "build" + ], + "scripts": { + "build": "rimraf ./build && tsc --project tsconfig.build.json", + "lint": "eslint --color -c ../../../.eslintrc.js --ignore-pattern src/__tests__/cases/* src/", + "test": "jest --passWithNoTests --runInBand --verbose", + "test:ci": "jest --passWithNoTests --runInBand --verbose", + "test:watch": "jest --watch --passWithNoTests --verbose" + }, + "dependencies": { + "@msgpack/msgpack": "2.7.2" + }, + "devDependencies": { + "@types/jest": "26.0.8", + "@types/prettier": "2.6.0", + "jest": "26.6.3", + "rimraf": "3.0.2", + "typescript": "4.0.7" + }, + "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", + "publishConfig": { + "access": "public" + } +} diff --git a/packages/js/core/src/__tests__/msgpack.spec.ts b/packages/js/msgpack/src/__tests__/msgpack.spec.ts similarity index 79% rename from packages/js/core/src/__tests__/msgpack.spec.ts rename to packages/js/msgpack/src/__tests__/msgpack.spec.ts index f5e97e0c3a..f828117f99 100644 --- a/packages/js/core/src/__tests__/msgpack.spec.ts +++ b/packages/js/msgpack/src/__tests__/msgpack.spec.ts @@ -1,4 +1,4 @@ -import {msgpackEncode, msgpackDecode, isBuffer} from "../msgpack"; +import { msgpackEncode, msgpackDecode } from "../"; describe("msgpack", () => { const expectedArrayLike = [ @@ -32,11 +32,4 @@ describe("msgpack", () => { expect(decoded).toEqual(customMap); }); - it("Should check if object is buffer", () => { - const notBuf = isBuffer(expectedArrayLike); - expect(notBuf).toBeFalsy() - const buf = isBuffer(Uint8Array.from(expectedArrayLike)); - expect(buf).toBeTruthy() - }) - }); diff --git a/packages/js/core/src/msgpack/index.ts b/packages/js/msgpack/src/index.ts similarity index 86% rename from packages/js/core/src/msgpack/index.ts rename to packages/js/msgpack/src/index.ts index e5e28ee00d..b571ef277e 100644 --- a/packages/js/core/src/msgpack/index.ts +++ b/packages/js/msgpack/src/index.ts @@ -54,11 +54,3 @@ export function msgpackDecode( const decoder = new Decoder(extensionCodec); return decoder.decode(buffer); } - -export function isBuffer(maybeBuf: unknown): maybeBuf is BufferSource { - if (maybeBuf instanceof ArrayBuffer || ArrayBuffer.isView(maybeBuf)) { - return true; - } else { - return false; - } -} diff --git a/packages/js/msgpack/tsconfig.build.json b/packages/js/msgpack/tsconfig.build.json new file mode 100644 index 0000000000..77aadfdd2f --- /dev/null +++ b/packages/js/msgpack/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "include": [ + "./src/**/*.ts" + ], + "exclude": [ + "./src/**/__tests__" + ] +} diff --git a/packages/js/msgpack/tsconfig.json b/packages/js/msgpack/tsconfig.json new file mode 100644 index 0000000000..920efc3c9d --- /dev/null +++ b/packages/js/msgpack/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../../../tsconfig", + "compilerOptions": { + "lib": [ + "es2020", + "es2015", + "es5", + "dom" + ], + "outDir": "build" + }, + "include": [ + "./src/**/*.ts" + ], + "exclude": [ + "./src/__tests__/cases/*.ts" + ] +} diff --git a/packages/manifests/.gitignore b/packages/manifests/.gitignore new file mode 100644 index 0000000000..2b6d9bc65d --- /dev/null +++ b/packages/manifests/.gitignore @@ -0,0 +1 @@ +!wrap \ No newline at end of file diff --git a/packages/manifest/polywrap/schema/formats/polywrap.app/0.0.1-prealpha.1.json b/packages/manifests/polywrap/formats/polywrap.app/0.0.1-prealpha.1.json similarity index 85% rename from packages/manifest/polywrap/schema/formats/polywrap.app/0.0.1-prealpha.1.json rename to packages/manifests/polywrap/formats/polywrap.app/0.0.1-prealpha.1.json index 055a512d0f..abbb381671 100644 --- a/packages/manifest/polywrap/schema/formats/polywrap.app/0.0.1-prealpha.1.json +++ b/packages/manifests/polywrap/formats/polywrap.app/0.0.1-prealpha.1.json @@ -21,7 +21,7 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" }, "import_redirects": { "description": "Redirects for the schema's imports.", @@ -38,7 +38,7 @@ "schema": { "description": "Path to a graphql schema to be used for the import.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" } }, "required": [ diff --git a/packages/manifest/polywrap/schema/formats/polywrap.app/0.0.1-prealpha.2.json b/packages/manifests/polywrap/formats/polywrap.app/0.0.1-prealpha.2.json similarity index 86% rename from packages/manifest/polywrap/schema/formats/polywrap.app/0.0.1-prealpha.2.json rename to packages/manifests/polywrap/formats/polywrap.app/0.0.1-prealpha.2.json index 10b0e826d9..98581def27 100644 --- a/packages/manifest/polywrap/schema/formats/polywrap.app/0.0.1-prealpha.2.json +++ b/packages/manifests/polywrap/formats/polywrap.app/0.0.1-prealpha.2.json @@ -27,7 +27,7 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" }, "import_redirects": { "description": "Redirects for the schema's imports.", @@ -44,7 +44,7 @@ "schema": { "description": "Path to a graphql schema to be used for the import.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" } }, "required": [ diff --git a/packages/manifest/polywrap/schema/formats/polywrap.build/0.0.1-prealpha.1.json b/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest/polywrap/schema/formats/polywrap.build/0.0.1-prealpha.1.json rename to packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.1.json diff --git a/packages/manifest/polywrap/schema/formats/polywrap.build/0.0.1-prealpha.2.json b/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.2.json similarity index 100% rename from packages/manifest/polywrap/schema/formats/polywrap.build/0.0.1-prealpha.2.json rename to packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.2.json diff --git a/packages/manifest/polywrap/schema/formats/polywrap.build/0.0.1-prealpha.3.json b/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.3.json similarity index 95% rename from packages/manifest/polywrap/schema/formats/polywrap.build/0.0.1-prealpha.3.json rename to packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.3.json index 516555e5cc..d72b2b085e 100644 --- a/packages/manifest/polywrap/schema/formats/polywrap.build/0.0.1-prealpha.3.json +++ b/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.3.json @@ -31,7 +31,7 @@ "cache": { "description": "Path to cache directory, set to true for default value, set to false to disable caching.", "type": ["string", "boolean"], - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" }, "removeBuilder": { "description": "Remove the builder instance.", diff --git a/packages/manifest/polywrap/schema/formats/polywrap.deploy/0.0.1-prealpha.1.json b/packages/manifests/polywrap/formats/polywrap.deploy/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest/polywrap/schema/formats/polywrap.deploy/0.0.1-prealpha.1.json rename to packages/manifests/polywrap/formats/polywrap.deploy/0.0.1-prealpha.1.json diff --git a/packages/manifest/polywrap/schema/formats/polywrap.infra/0.0.1-prealpha.1.json b/packages/manifests/polywrap/formats/polywrap.infra/0.0.1-prealpha.1.json similarity index 100% rename from packages/manifest/polywrap/schema/formats/polywrap.infra/0.0.1-prealpha.1.json rename to packages/manifests/polywrap/formats/polywrap.infra/0.0.1-prealpha.1.json diff --git a/packages/manifest/polywrap/schema/formats/polywrap.infra/0.0.1-prealpha.2.json b/packages/manifests/polywrap/formats/polywrap.infra/0.0.1-prealpha.2.json similarity index 100% rename from packages/manifest/polywrap/schema/formats/polywrap.infra/0.0.1-prealpha.2.json rename to packages/manifests/polywrap/formats/polywrap.infra/0.0.1-prealpha.2.json diff --git a/packages/manifest/polywrap/schema/formats/polywrap.meta/0.0.1-prealpha.1.json b/packages/manifests/polywrap/formats/polywrap.meta/0.0.1-prealpha.1.json similarity index 93% rename from packages/manifest/polywrap/schema/formats/polywrap.meta/0.0.1-prealpha.1.json rename to packages/manifests/polywrap/formats/polywrap.meta/0.0.1-prealpha.1.json index 6eb1c3aa9e..a9331a8af4 100644 --- a/packages/manifest/polywrap/schema/formats/polywrap.meta/0.0.1-prealpha.1.json +++ b/packages/manifests/polywrap/formats/polywrap.meta/0.0.1-prealpha.1.json @@ -80,12 +80,12 @@ "query": { "description": "Path to graph ql file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" }, "vars": { "description": "Query parameters.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.json$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.json$" } }, "required": [ diff --git a/packages/manifest/polywrap/schema/formats/polywrap.meta/0.0.1-prealpha.2.json b/packages/manifests/polywrap/formats/polywrap.meta/0.0.1-prealpha.2.json similarity index 93% rename from packages/manifest/polywrap/schema/formats/polywrap.meta/0.0.1-prealpha.2.json rename to packages/manifests/polywrap/formats/polywrap.meta/0.0.1-prealpha.2.json index 2f8bbb984e..64007d2795 100644 --- a/packages/manifest/polywrap/schema/formats/polywrap.meta/0.0.1-prealpha.2.json +++ b/packages/manifests/polywrap/formats/polywrap.meta/0.0.1-prealpha.2.json @@ -79,12 +79,12 @@ "query": { "description": "Path to graph ql file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" }, "vars": { "description": "Query parameters.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.json$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.json$" } }, "required": [ diff --git a/packages/manifest/polywrap/schema/formats/polywrap.meta/0.0.1-prealpha.3.json b/packages/manifests/polywrap/formats/polywrap.meta/0.0.1-prealpha.3.json similarity index 93% rename from packages/manifest/polywrap/schema/formats/polywrap.meta/0.0.1-prealpha.3.json rename to packages/manifests/polywrap/formats/polywrap.meta/0.0.1-prealpha.3.json index c8eddeed1c..418039c5b6 100644 --- a/packages/manifest/polywrap/schema/formats/polywrap.meta/0.0.1-prealpha.3.json +++ b/packages/manifests/polywrap/formats/polywrap.meta/0.0.1-prealpha.3.json @@ -88,12 +88,12 @@ "query": { "description": "Path to graph ql file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" }, "vars": { "description": "Query parameters.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.json$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.json$" } }, "required": [ diff --git a/packages/manifest/polywrap/schema/formats/polywrap.plugin/0.0.1-prealpha.1.json b/packages/manifests/polywrap/formats/polywrap.plugin/0.0.1-prealpha.1.json similarity index 91% rename from packages/manifest/polywrap/schema/formats/polywrap.plugin/0.0.1-prealpha.1.json rename to packages/manifests/polywrap/formats/polywrap.plugin/0.0.1-prealpha.1.json index a1cd251215..57fae4a448 100644 --- a/packages/manifest/polywrap/schema/formats/polywrap.plugin/0.0.1-prealpha.1.json +++ b/packages/manifests/polywrap/formats/polywrap.plugin/0.0.1-prealpha.1.json @@ -21,7 +21,7 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" }, "import_redirects": { "description": "Redirects source URI to local wrapper or plugin.", diff --git a/packages/manifest/polywrap/schema/formats/polywrap.plugin/0.0.1-prealpha.2.json b/packages/manifests/polywrap/formats/polywrap.plugin/0.0.1-prealpha.2.json similarity index 84% rename from packages/manifest/polywrap/schema/formats/polywrap.plugin/0.0.1-prealpha.2.json rename to packages/manifests/polywrap/formats/polywrap.plugin/0.0.1-prealpha.2.json index 1aea19c073..a354dac384 100644 --- a/packages/manifest/polywrap/schema/formats/polywrap.plugin/0.0.1-prealpha.2.json +++ b/packages/manifests/polywrap/formats/polywrap.plugin/0.0.1-prealpha.2.json @@ -37,12 +37,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" } }, "required": [ @@ -57,12 +57,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" } }, "required": [ diff --git a/packages/manifest/polywrap/schema/formats/polywrap.plugin/0.0.1-prealpha.3.json b/packages/manifests/polywrap/formats/polywrap.plugin/0.0.1-prealpha.3.json similarity index 87% rename from packages/manifest/polywrap/schema/formats/polywrap.plugin/0.0.1-prealpha.3.json rename to packages/manifests/polywrap/formats/polywrap.plugin/0.0.1-prealpha.3.json index bfc91296e7..6fb059e521 100644 --- a/packages/manifest/polywrap/schema/formats/polywrap.plugin/0.0.1-prealpha.3.json +++ b/packages/manifests/polywrap/formats/polywrap.plugin/0.0.1-prealpha.3.json @@ -27,12 +27,12 @@ "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" }, "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" }, "import_redirects": { "description": "Redirects source URI to local wrapper or plugin.", diff --git a/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.1.json b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.1.json similarity index 88% rename from packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.1.json rename to packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.1.json index fc8a715a18..a71246ade4 100644 --- a/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.1.json +++ b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.1.json @@ -32,7 +32,7 @@ "file": { "description": "Path to graphql schema file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" } }, "required": [ @@ -51,7 +51,7 @@ "file": { "description": "Path to Polywrap module implementation file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" } }, "required": [ @@ -78,7 +78,7 @@ "file": { "description": "Path to graphql schema file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" } }, "required": [ @@ -97,7 +97,7 @@ "file": { "description": "Path to Polywrap module implementation file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" } }, "required": [ diff --git a/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.2.json b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.2.json similarity index 82% rename from packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.2.json rename to packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.2.json index f6441d672a..7b1728ace4 100644 --- a/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.2.json +++ b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.2.json @@ -20,7 +20,7 @@ "build": { "description": "Path to the customized build manifest file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" }, "language": { "description": "Language in which the source code is written.", @@ -40,12 +40,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" } }, "required": [ @@ -61,12 +61,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" } }, "required": [ diff --git a/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.3.json b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.3.json similarity index 82% rename from packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.3.json rename to packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.3.json index a840a0fe58..d67cfb8b8d 100644 --- a/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.3.json +++ b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.3.json @@ -19,7 +19,7 @@ "build": { "description": "Path to the customized build manifest file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" }, "language": { "description": "Language in which the source code is written.", @@ -43,12 +43,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" } }, "required": [ @@ -63,12 +63,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" } }, "required": [ diff --git a/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.4.json b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.4.json similarity index 82% rename from packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.4.json rename to packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.4.json index ef9681d30e..32d2d3cbb1 100644 --- a/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.4.json +++ b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.4.json @@ -20,7 +20,7 @@ "build": { "description": "Path to the customized build manifest file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" }, "language": { "description": "Language in which the source code is written.", @@ -40,12 +40,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" } }, "required": [ @@ -60,12 +60,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" } }, "required": [ diff --git a/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.5.json b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.5.json similarity index 80% rename from packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.5.json rename to packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.5.json index 1e41c0b51a..1f54259264 100644 --- a/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.5.json +++ b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.5.json @@ -16,12 +16,12 @@ "build": { "description": "Path to the customized build manifest file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.yaml$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.yaml$" }, "meta": { "description": "Path to wrapper metadata manifest file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.yaml$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.yaml$" }, "language": { "description": "Language in which the source code is written.", @@ -41,12 +41,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" } }, "required": [ @@ -61,12 +61,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" } }, "required": [ diff --git a/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.6.json b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.6.json similarity index 86% rename from packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.6.json rename to packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.6.json index af1465ad89..b04c8c1374 100644 --- a/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.6.json +++ b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.6.json @@ -41,12 +41,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" } }, "required": [ @@ -61,12 +61,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" } }, "required": [ diff --git a/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.7.json b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.7.json similarity index 86% rename from packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.7.json rename to packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.7.json index 46792ad571..8c0901da69 100644 --- a/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.7.json +++ b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.7.json @@ -47,12 +47,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" } }, "required": [ @@ -67,12 +67,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" } }, "required": [ diff --git a/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.8.json b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.8.json similarity index 87% rename from packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.8.json rename to packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.8.json index 203fa4b4ad..3dea1df52c 100644 --- a/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.8.json +++ b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.8.json @@ -52,12 +52,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" } }, "required": [ @@ -72,12 +72,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" } }, "required": [ diff --git a/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.9.json b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.9.json similarity index 87% rename from packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.9.json rename to packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.9.json index e4726ce156..1c7b0e9f12 100644 --- a/packages/manifest/polywrap/schema/formats/polywrap/0.0.1-prealpha.9.json +++ b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.9.json @@ -42,12 +42,12 @@ "module": { "description": "Path to the module's entry point.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/?$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" }, "schema": { "description": "Path to the module's graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" }, "import_redirects": { "description": "Redirects for the schema's imports.", @@ -64,7 +64,7 @@ "schema": { "description": "Path to a graphql schema to be used for the import.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" } }, "required": [ diff --git a/packages/manifest/polywrap/schema/package.json b/packages/manifests/polywrap/package.json similarity index 100% rename from packages/manifest/polywrap/schema/package.json rename to packages/manifests/polywrap/package.json diff --git a/packages/manifest/wrap/schema/formats/wrap.info/0.0.1.json b/packages/manifests/wrap/formats/wrap.info/0.0.1.json similarity index 100% rename from packages/manifest/wrap/schema/formats/wrap.info/0.0.1.json rename to packages/manifests/wrap/formats/wrap.info/0.0.1.json diff --git a/packages/manifest/wrap/schema/package.json b/packages/manifests/wrap/package.json similarity index 100% rename from packages/manifest/wrap/schema/package.json rename to packages/manifests/wrap/package.json From 451d30c527c76f4e5f001894cc3efea9f42421b4 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Fri, 1 Jul 2022 19:10:13 -0700 Subject: [PATCH 26/46] core + validation build & pass tests --- packages/js/core/src/__tests__/resolveUri.spec.ts | 6 +++--- packages/js/validation/package.json | 2 +- packages/js/validation/src/types/WasmPackageValidator.ts | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/js/core/src/__tests__/resolveUri.spec.ts b/packages/js/core/src/__tests__/resolveUri.spec.ts index 00e8679c8c..c190b4dbd4 100644 --- a/packages/js/core/src/__tests__/resolveUri.spec.ts +++ b/packages/js/core/src/__tests__/resolveUri.spec.ts @@ -4,9 +4,7 @@ import { Client, InvokeOptions, InvokeResult, - WrapManifest, PluginModule, - PluginFactory, QueryOptions, QueryResult, Uri, @@ -24,11 +22,13 @@ import { PluginRegistration, SubscribeOptions, Subscription, - msgpackEncode, PluginPackage, GetManifestOptions, } from ".."; +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; +import { msgpackEncode } from "@polywrap/msgpack-js"; + describe("resolveUri", () => { const client = ( wrappers: Record>, diff --git a/packages/js/validation/package.json b/packages/js/validation/package.json index d81b667127..cbe3f9c23c 100644 --- a/packages/js/validation/package.json +++ b/packages/js/validation/package.json @@ -19,7 +19,7 @@ "test:watch": "jest --watch --passWithNoTests --verbose" }, "dependencies": { - "@polywrap/core-js": "0.0.1-prealpha.91", + "@polywrap/wrap-manifest-types-js": "0.0.1-prealpha.91", "@polywrap/schema-parse": "0.0.1-prealpha.91" }, "devDependencies": { diff --git a/packages/js/validation/src/types/WasmPackageValidator.ts b/packages/js/validation/src/types/WasmPackageValidator.ts index b42e8b845f..62b5d6f7f9 100644 --- a/packages/js/validation/src/types/WasmPackageValidator.ts +++ b/packages/js/validation/src/types/WasmPackageValidator.ts @@ -7,11 +7,10 @@ import { WRAP_WASM, } from ".."; -import { msgpackDecode } from "@polywrap/core-js"; import { WrapManifest, deserializeWrapManifest, -} from "@polywrap/wrap-manifest-schemas"; +} from "@polywrap/wrap-manifest-types-js"; import { renderSchema } from "@polywrap/schema-compose"; import * as path from "path"; @@ -138,7 +137,7 @@ export class WasmPackageValidator { const info = await reader.readFile(name); return { valid: true, - manifest: deserializeWrapManifest(info, msgpackDecode), + manifest: deserializeWrapManifest(info), }; } catch (e) { if (e.message.includes('instance requires property "abi"')) { From 1351b95102ca2a3fa19b75074374addaf996b49d Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Fri, 1 Jul 2022 19:41:04 -0700 Subject: [PATCH 27/46] everything building --- packages/cli/package.json | 3 +++ packages/cli/src/commands/deploy.ts | 8 ++++---- packages/cli/src/commands/infra.ts | 2 +- packages/cli/src/lib/Compiler.ts | 5 +++-- .../cli/src/lib/defaults/build-images/wasm/rust/index.ts | 2 +- packages/cli/src/lib/helpers/metadata.ts | 2 +- packages/cli/src/lib/infra/Infra.ts | 2 +- packages/cli/src/lib/project/AppProject.ts | 2 +- packages/cli/src/lib/project/PluginProject.ts | 2 +- packages/cli/src/lib/project/PolywrapProject.ts | 2 +- packages/cli/src/lib/project/manifests/app/load.ts | 2 +- packages/cli/src/lib/project/manifests/index.ts | 6 +++++- packages/cli/src/lib/project/manifests/output.ts | 6 ++++-- packages/cli/src/lib/project/manifests/plugin/load.ts | 2 +- packages/cli/src/lib/project/manifests/polywrap/load.ts | 2 +- packages/cli/src/lib/system/DockerCompose.ts | 2 +- packages/js/client/src/PolywrapClient.ts | 6 +++++- packages/js/client/src/default-client-config.ts | 2 +- packages/js/client/src/plugin/PluginWrapper.ts | 4 ++-- packages/js/client/src/wasm/WasmWrapper.ts | 4 ++-- packages/js/client/src/wasm/imports.ts | 2 +- packages/js/core/src/index.ts | 1 + packages/js/core/src/utils/index.ts | 2 ++ packages/js/test-env/package.json | 2 +- packages/js/test-env/src/index.ts | 6 ++---- 25 files changed, 47 insertions(+), 32 deletions(-) create mode 100644 packages/js/core/src/utils/index.ts diff --git a/packages/cli/package.json b/packages/cli/package.json index 9747e7f5f4..d1440f0bc7 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -40,11 +40,14 @@ "@polywrap/ens-resolver-plugin-js": "0.0.1-prealpha.91", "@polywrap/ethereum-plugin-js": "0.0.1-prealpha.91", "@polywrap/ipfs-plugin-js": "0.0.1-prealpha.91", + "@polywrap/msgpack-js": "0.0.1-prealpha.91", "@polywrap/os-js": "0.0.1-prealpha.91", + "@polywrap/polywrap-manifest-types-js": "0.0.1-prealpha.91", "@polywrap/schema-bind": "0.0.1-prealpha.91", "@polywrap/schema-compose": "0.0.1-prealpha.91", "@polywrap/schema-parse": "0.0.1-prealpha.91", "@polywrap/test-env-js": "0.0.1-prealpha.91", + "@polywrap/wrap-manifest-types-js": "0.0.1-prealpha.91", "assemblyscript": "0.19.1", "axios": "0.21.2", "chalk": "4.1.0", diff --git a/packages/cli/src/commands/deploy.ts b/packages/cli/src/commands/deploy.ts index 0acb4714b1..644a5da8d7 100644 --- a/packages/cli/src/commands/deploy.ts +++ b/packages/cli/src/commands/deploy.ts @@ -1,15 +1,15 @@ /* eslint-disable prefer-const */ -import { DeployerHandler } from "../lib/deploy/deployer"; import { Command, Program } from "./types"; - import { intlMsg, PolywrapProject, defaultPolywrapManifest, DeployPackage, - DeployManifest, + DeployerHandler, parseWasmManifestFileOption, -} from "@polywrap/polywrap-manifest-schemas"; +} from "../lib"; + +import { DeployManifest } from "@polywrap/polywrap-manifest-types-js"; import fs from "fs"; import nodePath from "path"; import { print } from "gluegun"; diff --git a/packages/cli/src/commands/infra.ts b/packages/cli/src/commands/infra.ts index e815387841..d5b68dc089 100644 --- a/packages/cli/src/commands/infra.ts +++ b/packages/cli/src/commands/infra.ts @@ -1,7 +1,7 @@ import { intlMsg, Infra, loadInfraManifest } from "../lib"; import { Command, Program } from "./types"; -import { InfraManifest } from "@polywrap/polywrap-manifest-schemas" +import { InfraManifest } from "@polywrap/polywrap-manifest-types-js"; import { print } from "gluegun"; import path from "path"; import { Argument } from "commander"; diff --git a/packages/cli/src/lib/Compiler.ts b/packages/cli/src/lib/Compiler.ts index fd52c91f96..5da5060e20 100644 --- a/packages/cli/src/lib/Compiler.ts +++ b/packages/cli/src/lib/Compiler.ts @@ -2,7 +2,6 @@ /* eslint-disable @typescript-eslint/no-empty-function */ import { - PolywrapManifest, PolywrapProject, SchemaComposer, withSpinner, @@ -16,7 +15,9 @@ import { outputManifest, } from "./"; -import { msgpackEncode, WrapManifest } from "@polywrap/core-js"; +import { PolywrapManifest } from "@polywrap/polywrap-manifest-types-js"; +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; +import { msgpackEncode } from "@polywrap/msgpack-js"; import { WasmWrapper } from "@polywrap/client-js"; import { WrapImports } from "@polywrap/client-js/build/wasm/types"; import { AsyncWasmInstance } from "@polywrap/asyncify-js"; diff --git a/packages/cli/src/lib/defaults/build-images/wasm/rust/index.ts b/packages/cli/src/lib/defaults/build-images/wasm/rust/index.ts index b3f3749af4..b7ff2c4195 100644 --- a/packages/cli/src/lib/defaults/build-images/wasm/rust/index.ts +++ b/packages/cli/src/lib/defaults/build-images/wasm/rust/index.ts @@ -1,7 +1,7 @@ import { CompilerOverrides } from "../../../../Compiler"; import { intlMsg } from "../../../../intl"; -import { PolywrapManifest } from "@polywrap/polywrap-manifest-schemas"; +import { PolywrapManifest } from "@polywrap/polywrap-manifest-types-js"; export function getCompilerOverrides(): CompilerOverrides { return { diff --git a/packages/cli/src/lib/helpers/metadata.ts b/packages/cli/src/lib/helpers/metadata.ts index b9b0727139..b25ca72bf8 100644 --- a/packages/cli/src/lib/helpers/metadata.ts +++ b/packages/cli/src/lib/helpers/metadata.ts @@ -2,7 +2,7 @@ import { withSpinner } from "./"; import { displayPath, intlMsg } from "../"; import { normalizePath } from "@polywrap/os-js"; -import { MetaManifest } from "@polywrap/polywrap-manifest-schemas"; +import { MetaManifest } from "@polywrap/polywrap-manifest-types-js"; import { Ora } from "ora"; import fs from "fs"; import path from "path"; diff --git a/packages/cli/src/lib/infra/Infra.ts b/packages/cli/src/lib/infra/Infra.ts index 7f99902761..1bb7a78a30 100644 --- a/packages/cli/src/lib/infra/Infra.ts +++ b/packages/cli/src/lib/infra/Infra.ts @@ -6,7 +6,7 @@ import { CacheDirectory, } from "../"; -import { InfraManifest } from "@polywrap/polywrap-manifest-schemas"; +import { InfraManifest } from "@polywrap/polywrap-manifest-types-js"; import path from "path"; import fs, { lstatSync, readdirSync } from "fs"; import YAML from "js-yaml"; diff --git a/packages/cli/src/lib/project/AppProject.ts b/packages/cli/src/lib/project/AppProject.ts index f5508399bb..dcda2ea43a 100644 --- a/packages/cli/src/lib/project/AppProject.ts +++ b/packages/cli/src/lib/project/AppProject.ts @@ -7,7 +7,7 @@ import { appManifestLanguageToBindLanguage, } from "./manifests"; -import { AppManifest } from "@polywrap/polywrap-manifest-schemas"; +import { AppManifest } from "@polywrap/polywrap-manifest-types-js"; import { Client } from "@polywrap/core-js"; import { ComposerOutput } from "@polywrap/schema-compose"; import { bindSchema, BindOutput } from "@polywrap/schema-bind"; diff --git a/packages/cli/src/lib/project/PluginProject.ts b/packages/cli/src/lib/project/PluginProject.ts index 2c681e2b11..87669b0ddd 100644 --- a/packages/cli/src/lib/project/PluginProject.ts +++ b/packages/cli/src/lib/project/PluginProject.ts @@ -8,7 +8,7 @@ import { } from "./manifests"; import { resetDir } from "../system"; -import { PluginManifest } from "@polywrap/polywrap-manifest-schemas"; +import { PluginManifest } from "@polywrap/polywrap-manifest-types-js"; import { bindSchema, BindOutput, BindOptions } from "@polywrap/schema-bind"; import { ComposerOutput } from "@polywrap/schema-compose"; import { Abi } from "@polywrap/schema-parse"; diff --git a/packages/cli/src/lib/project/PolywrapProject.ts b/packages/cli/src/lib/project/PolywrapProject.ts index 612a3a30a5..d13d10a255 100644 --- a/packages/cli/src/lib/project/PolywrapProject.ts +++ b/packages/cli/src/lib/project/PolywrapProject.ts @@ -24,7 +24,7 @@ import { PolywrapManifest, MetaManifest, DeployManifest, -} from "@polywrap/polywrap-manifest-schemas"; +} from "@polywrap/polywrap-manifest-types-js"; import { normalizePath } from "@polywrap/os-js"; import { bindSchema, BindOutput, BindOptions } from "@polywrap/schema-bind"; import { ComposerOutput } from "@polywrap/schema-compose"; diff --git a/packages/cli/src/lib/project/manifests/app/load.ts b/packages/cli/src/lib/project/manifests/app/load.ts index f9a15cbdd5..c62836c858 100644 --- a/packages/cli/src/lib/project/manifests/app/load.ts +++ b/packages/cli/src/lib/project/manifests/app/load.ts @@ -3,7 +3,7 @@ import { displayPath, withSpinner, intlMsg } from "../../../"; import { AppManifest, deserializeAppManifest, -} from "@polywrap/polywrap-manifest-schemas"; +} from "@polywrap/polywrap-manifest-types-js"; import fs from "fs"; export const defaultAppManifest = ["polywrap.app.yaml", "polywrap.app.yml"]; diff --git a/packages/cli/src/lib/project/manifests/index.ts b/packages/cli/src/lib/project/manifests/index.ts index d61c015990..58431659d1 100644 --- a/packages/cli/src/lib/project/manifests/index.ts +++ b/packages/cli/src/lib/project/manifests/index.ts @@ -4,7 +4,11 @@ export * from "./polywrap"; export * from "./language"; export * from "./output"; -import { PolywrapManifest, PluginManifest, AppManifest } from "../../"; +import { + PolywrapManifest, + PluginManifest, + AppManifest +} from "@polywrap/polywrap-manifest-types-js"; export type AnyProjectManifest = | PolywrapManifest diff --git a/packages/cli/src/lib/project/manifests/output.ts b/packages/cli/src/lib/project/manifests/output.ts index 832bf31ca4..ff475f3e04 100644 --- a/packages/cli/src/lib/project/manifests/output.ts +++ b/packages/cli/src/lib/project/manifests/output.ts @@ -2,12 +2,14 @@ import { displayPath, withSpinner, intlMsg, +} from "../../"; + +import { BuildManifest, PolywrapManifest, MetaManifest, PluginManifest, -} from "../../"; - +} from "@polywrap/polywrap-manifest-types-js"; import { writeFileSync, normalizePath } from "@polywrap/os-js"; import YAML from "js-yaml"; import path from "path"; diff --git a/packages/cli/src/lib/project/manifests/plugin/load.ts b/packages/cli/src/lib/project/manifests/plugin/load.ts index 0dd496de68..ba8d8c042b 100644 --- a/packages/cli/src/lib/project/manifests/plugin/load.ts +++ b/packages/cli/src/lib/project/manifests/plugin/load.ts @@ -3,7 +3,7 @@ import { displayPath, withSpinner, intlMsg } from "../../../"; import { PluginManifest, deserializePluginManifest, -} from "@polywrap/polywrap-manifest-schemas"; +} from "@polywrap/polywrap-manifest-types-js"; import fs from "fs"; export const defaultPluginManifest = [ diff --git a/packages/cli/src/lib/project/manifests/polywrap/load.ts b/packages/cli/src/lib/project/manifests/polywrap/load.ts index 64b472419f..a23a0f7169 100644 --- a/packages/cli/src/lib/project/manifests/polywrap/load.ts +++ b/packages/cli/src/lib/project/manifests/polywrap/load.ts @@ -16,7 +16,7 @@ import { deserializeDeployManifest, InfraManifest, deserializeInfraManifest, -} from "@polywrap/polywrap-manifest-schemas"; +} from "@polywrap/polywrap-manifest-types-js"; import { Schema as JsonSchema } from "jsonschema"; import path from "path"; diff --git a/packages/cli/src/lib/system/DockerCompose.ts b/packages/cli/src/lib/system/DockerCompose.ts index 7d7b0d87d3..031bf7e684 100644 --- a/packages/cli/src/lib/system/DockerCompose.ts +++ b/packages/cli/src/lib/system/DockerCompose.ts @@ -1,9 +1,9 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { InfraManifest } from "../" import { getDockerFileLock } from "./docker"; import path from "path"; import Commands, { IDockerComposeOptions } from "docker-compose"; +import { InfraManifest } from "@polywrap/polywrap-manifest-types-js"; export class DockerCompose { private _dockerLock = getDockerFileLock(); diff --git a/packages/js/client/src/PolywrapClient.ts b/packages/js/client/src/PolywrapClient.ts index 174b957a80..02deee84bc 100644 --- a/packages/js/client/src/PolywrapClient.ts +++ b/packages/js/client/src/PolywrapClient.ts @@ -46,10 +46,14 @@ import { JobRunner, PluginPackage, RunOptions, +} from "@polywrap/core-js"; +import { msgpackEncode, msgpackDecode, +} from "@polywrap/msgpack-js"; +import { WrapManifest, -} from "@polywrap/core-js"; +} from "@polywrap/wrap-manifest-types-js"; import { Tracer } from "@polywrap/tracing-js"; export interface PolywrapClientConfig diff --git a/packages/js/client/src/default-client-config.ts b/packages/js/client/src/default-client-config.ts index 87d63c42cc..609425b677 100644 --- a/packages/js/client/src/default-client-config.ts +++ b/packages/js/client/src/default-client-config.ts @@ -10,8 +10,8 @@ import { CacheResolver, PluginResolver, RedirectsResolver, - WrapManifest, } from "@polywrap/core-js"; +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; import { ipfsPlugin } from "@polywrap/ipfs-plugin-js"; import { ipfsResolverPlugin } from "@polywrap/ipfs-resolver-plugin-js"; import { ethereumPlugin } from "@polywrap/ethereum-plugin-js"; diff --git a/packages/js/client/src/plugin/PluginWrapper.ts b/packages/js/client/src/plugin/PluginWrapper.ts index 33b5e0a23d..a814bc0c58 100644 --- a/packages/js/client/src/plugin/PluginWrapper.ts +++ b/packages/js/client/src/plugin/PluginWrapper.ts @@ -8,11 +8,11 @@ import { Uri, GetFileOptions, Env, - msgpackDecode, GetManifestOptions, isBuffer, - WrapManifest, } from "@polywrap/core-js"; +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; +import { msgpackDecode } from "@polywrap/msgpack-js"; import { Tracer } from "@polywrap/tracing-js"; export class PluginWrapper extends Wrapper { diff --git a/packages/js/client/src/wasm/WasmWrapper.ts b/packages/js/client/src/wasm/WasmWrapper.ts index e032f8d79d..d2fede228a 100644 --- a/packages/js/client/src/wasm/WasmWrapper.ts +++ b/packages/js/client/src/wasm/WasmWrapper.ts @@ -7,17 +7,17 @@ import { InvokeResult, InvocableResult, Wrapper, - WrapManifest, Uri, Client, combinePaths, Env, UriResolverInterface, GetFileOptions, - msgpackEncode, GetManifestOptions, isBuffer, } from "@polywrap/core-js"; +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; +import { msgpackEncode } from "@polywrap/msgpack-js"; import { Tracer } from "@polywrap/tracing-js"; import { AsyncWasmInstance } from "@polywrap/asyncify-js"; diff --git a/packages/js/client/src/wasm/imports.ts b/packages/js/client/src/wasm/imports.ts index 08e9ef65ef..1974d64dc4 100644 --- a/packages/js/client/src/wasm/imports.ts +++ b/packages/js/client/src/wasm/imports.ts @@ -5,7 +5,7 @@ import { readBytes, readString, writeBytes, writeString } from "./buffer"; import { Client } from ".."; import { State } from "./WasmWrapper"; -import { msgpackEncode } from "@polywrap/core-js"; +import { msgpackEncode } from "@polywrap/msgpack-js"; export const createImports = (config: { client: Client; diff --git a/packages/js/core/src/index.ts b/packages/js/core/src/index.ts index 4a229d8fb8..774ca2e6fe 100644 --- a/packages/js/core/src/index.ts +++ b/packages/js/core/src/index.ts @@ -3,4 +3,5 @@ export * from "./algorithms"; export * from "./interfaces"; export * from "./uri-resolution/core"; export * from "./uri-resolution/resolvers"; +export * from "./utils"; export * from "./workflow"; diff --git a/packages/js/core/src/utils/index.ts b/packages/js/core/src/utils/index.ts new file mode 100644 index 0000000000..5a12a7dacb --- /dev/null +++ b/packages/js/core/src/utils/index.ts @@ -0,0 +1,2 @@ +export * from "./is-buffer"; +export * from "./Queue"; diff --git a/packages/js/test-env/package.json b/packages/js/test-env/package.json index 28451c7446..0dc1a7698f 100644 --- a/packages/js/test-env/package.json +++ b/packages/js/test-env/package.json @@ -20,7 +20,7 @@ "@polywrap/client-js": "0.0.1-prealpha.91", "@polywrap/core-js": "0.0.1-prealpha.91", "@polywrap/ethereum-plugin-js": "0.0.1-prealpha.91", - "@polywrap/polywrap-manifest-schemas": "0.0.1-prealpha.91", + "@polywrap/polywrap-manifest-types-js": "0.0.1-prealpha.91", "axios": "0.21.2", "js-yaml": "4.1.0", "spawn-command": "0.0.2-1" diff --git a/packages/js/test-env/src/index.ts b/packages/js/test-env/src/index.ts index fc45dcb8d5..b87e084dcb 100644 --- a/packages/js/test-env/src/index.ts +++ b/packages/js/test-env/src/index.ts @@ -1,8 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ import { generateName } from "./generate-name"; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore -import * as polywrapManifests from "../../../cli/build/lib/polywrap-manifests"; import path from "path"; import spawn from "spawn-command"; @@ -12,6 +9,7 @@ import yaml from "js-yaml"; import { Uri } from "@polywrap/core-js"; import { PolywrapClient } from "@polywrap/client-js"; import { ethereumPlugin } from "@polywrap/ethereum-plugin-js"; +import { deserializePolywrapManifest } from "@polywrap/polywrap-manifest-types-js"; export const ensAddresses = { ensAddress: "0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab", @@ -323,7 +321,7 @@ export async function buildAndDeployWrapper({ const { __type, ...polywrapManifest - } = polywrapManifests.deserializePolywrapManifest( + } = deserializePolywrapManifest( fs.readFileSync(manifestPath, "utf-8") ); From 475d2496a31dd8306c8d9fdf458aed32f2354a99 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Fri, 1 Jul 2022 20:28:48 -0700 Subject: [PATCH 28/46] regex fixes --- .../wasm/assemblyscript/Dockerfile.mustache | 2 +- .../build-images/wasm/rust/Dockerfile.mustache | 2 +- .../test-env/src/wrappers/ens/polywrap.build.json | 6 ------ .../js/test-env/src/wrappers/ens/polywrap.json | 8 -------- .../formats/polywrap.app/0.0.1-prealpha.1.json | 4 ++-- .../formats/polywrap.app/0.0.1-prealpha.2.json | 4 ++-- .../formats/polywrap.build/0.0.1-prealpha.1.json | 2 +- .../formats/polywrap.build/0.0.1-prealpha.2.json | 2 +- .../formats/polywrap.build/0.0.1-prealpha.3.json | 4 ++-- .../formats/polywrap.meta/0.0.1-prealpha.1.json | 8 ++++---- .../formats/polywrap.meta/0.0.1-prealpha.2.json | 8 ++++---- .../formats/polywrap.meta/0.0.1-prealpha.3.json | 8 ++++---- .../formats/polywrap.plugin/0.0.1-prealpha.1.json | 2 +- .../formats/polywrap.plugin/0.0.1-prealpha.2.json | 8 ++++---- .../formats/polywrap.plugin/0.0.1-prealpha.3.json | 4 ++-- .../formats/polywrap/0.0.1-prealpha.1.json | 8 ++++---- .../formats/polywrap/0.0.1-prealpha.2.json | 10 +++++----- .../formats/polywrap/0.0.1-prealpha.3.json | 10 +++++----- .../formats/polywrap/0.0.1-prealpha.4.json | 10 +++++----- .../formats/polywrap/0.0.1-prealpha.5.json | 12 ++++++------ .../formats/polywrap/0.0.1-prealpha.6.json | 12 ++++++------ .../formats/polywrap/0.0.1-prealpha.7.json | 12 ++++++------ .../formats/polywrap/0.0.1-prealpha.8.json | 14 +++++++------- .../formats/polywrap/0.0.1-prealpha.9.json | 12 ++++++------ .../wasm/build-cmd/001-sanity/expected/output.json | 6 ++---- .../004-default-build/expected/output.json | 6 ++---- .../005-default-dockerfile/expected/output.json | 6 ++---- .../006-custom-dockerfile/expected/output.json | 6 ++---- .../007-linked-packages/expected/output.json | 6 ++---- .../build-cmd/008-metadata/expected/output.json | 6 ++---- .../009-docker-buildx/expected/output.json | 6 ++---- .../010-custom-config/expected/output.json | 6 ++---- .../011-custom-config/expected/output.json | 6 ++---- 33 files changed, 97 insertions(+), 129 deletions(-) delete mode 100644 packages/js/test-env/src/wrappers/ens/polywrap.build.json delete mode 100644 packages/js/test-env/src/wrappers/ens/polywrap.json diff --git a/packages/cli/src/lib/defaults/build-images/wasm/assemblyscript/Dockerfile.mustache b/packages/cli/src/lib/defaults/build-images/wasm/assemblyscript/Dockerfile.mustache index e233c527ec..aebcda9fd6 100644 --- a/packages/cli/src/lib/defaults/build-images/wasm/assemblyscript/Dockerfile.mustache +++ b/packages/cli/src/lib/defaults/build-images/wasm/assemblyscript/Dockerfile.mustache @@ -35,7 +35,7 @@ COPY {{dir}} {{dir}} # Build the module at {{dir}} RUN ./node_modules/.bin/asc {{dir}}/wrap/entry.ts \ --path ./node_modules \ - --outFile ./build/{{name}}.wasm \ + --outFile ./build/wrap.wasm \ --use abort={{dir}}/wrap/entry/wrapAbort \ --optimize --importMemory \ --runtime stub \ diff --git a/packages/cli/src/lib/defaults/build-images/wasm/rust/Dockerfile.mustache b/packages/cli/src/lib/defaults/build-images/wasm/rust/Dockerfile.mustache index 5efaee0309..f1d6c9c99f 100644 --- a/packages/cli/src/lib/defaults/build-images/wasm/rust/Dockerfile.mustache +++ b/packages/cli/src/lib/defaults/build-images/wasm/rust/Dockerfile.mustache @@ -102,6 +102,6 @@ RUN wasm-snip ./build/bg_module.wasm -o ./build/snipped_module.wasm && \ rm -rf ./build/bg_module.wasm # Use wasm-opt to perform the "asyncify" post-processing step over all modules -RUN wasm-opt --asyncify -Os ./build/snipped_module.wasm -o ./build/module.wasm && \ +RUN wasm-opt --asyncify -Os ./build/snipped_module.wasm -o ./build/wrap.wasm && \ rm -rf ./build/snipped_module.wasm {{/polywrap_module}} diff --git a/packages/js/test-env/src/wrappers/ens/polywrap.build.json b/packages/js/test-env/src/wrappers/ens/polywrap.build.json deleted file mode 100644 index b7e543137a..0000000000 --- a/packages/js/test-env/src/wrappers/ens/polywrap.build.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "format": "0.0.1-prealpha.3", - "docker": { - "buildImageId": "sha256:54772a455aa905c66af9f2c1f97e0a339883c6d20400a12858fa970cdd055afa\n" - } -} \ No newline at end of file diff --git a/packages/js/test-env/src/wrappers/ens/polywrap.json b/packages/js/test-env/src/wrappers/ens/polywrap.json deleted file mode 100644 index 6ce33dfa08..0000000000 --- a/packages/js/test-env/src/wrappers/ens/polywrap.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "format": "0.0.1-prealpha.9", - "name": "ENS", - "language": "wasm/assemblyscript", - "build": "./polywrap.build.json", - "schema": "./schema.graphql", - "module": "./module.wasm" -} \ No newline at end of file diff --git a/packages/manifests/polywrap/formats/polywrap.app/0.0.1-prealpha.1.json b/packages/manifests/polywrap/formats/polywrap.app/0.0.1-prealpha.1.json index abbb381671..7f5ebfe81c 100644 --- a/packages/manifests/polywrap/formats/polywrap.app/0.0.1-prealpha.1.json +++ b/packages/manifests/polywrap/formats/polywrap.app/0.0.1-prealpha.1.json @@ -21,7 +21,7 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" }, "import_redirects": { "description": "Redirects for the schema's imports.", @@ -38,7 +38,7 @@ "schema": { "description": "Path to a graphql schema to be used for the import.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.graphql$" } }, "required": [ diff --git a/packages/manifests/polywrap/formats/polywrap.app/0.0.1-prealpha.2.json b/packages/manifests/polywrap/formats/polywrap.app/0.0.1-prealpha.2.json index 98581def27..c0d4368c9a 100644 --- a/packages/manifests/polywrap/formats/polywrap.app/0.0.1-prealpha.2.json +++ b/packages/manifests/polywrap/formats/polywrap.app/0.0.1-prealpha.2.json @@ -27,7 +27,7 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" }, "import_redirects": { "description": "Redirects for the schema's imports.", @@ -44,7 +44,7 @@ "schema": { "description": "Path to a graphql schema to be used for the import.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.graphql$" } }, "required": [ diff --git a/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.1.json b/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.1.json index 08cb8f19fd..e4fb722c2e 100644 --- a/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.1.json +++ b/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.1.json @@ -24,7 +24,7 @@ "dockerfile": { "description": "Docker image file name.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/Dockerfile$" + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/Dockerfile(.mustache)?$" } } }, diff --git a/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.2.json b/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.2.json index dc1b7b9f9c..d1a56179bb 100644 --- a/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.2.json +++ b/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.2.json @@ -21,7 +21,7 @@ "dockerfile": { "description": "Docker image file name.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/Dockerfile$" + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/Dockerfile(.mustache)?$" } } }, diff --git a/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.3.json b/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.3.json index d72b2b085e..0a58e989a7 100644 --- a/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.3.json +++ b/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.3.json @@ -21,7 +21,7 @@ "dockerfile": { "description": "Docker image file name.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/Dockerfile$" + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/Dockerfile(.mustache)?$" }, "buildx": { "description": "Configuration options for Docker Buildx, set to true for default value.", @@ -31,7 +31,7 @@ "cache": { "description": "Path to cache directory, set to true for default value, set to false to disable caching.", "type": ["string", "boolean"], - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" }, "removeBuilder": { "description": "Remove the builder instance.", diff --git a/packages/manifests/polywrap/formats/polywrap.meta/0.0.1-prealpha.1.json b/packages/manifests/polywrap/formats/polywrap.meta/0.0.1-prealpha.1.json index a9331a8af4..c719b2a2d4 100644 --- a/packages/manifests/polywrap/formats/polywrap.meta/0.0.1-prealpha.1.json +++ b/packages/manifests/polywrap/formats/polywrap.meta/0.0.1-prealpha.1.json @@ -32,7 +32,7 @@ "icon": { "description": "Path to wrapper icon.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(svg|png)$" + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/[\\w\\-\\.]+\\.(svg|png)$" }, "links": { "description": "Relevant web links.", @@ -48,7 +48,7 @@ "icon": { "description": "Web link icon.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(svg|png)$" + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/[\\w\\-\\.]+\\.(svg|png)$" }, "url": { "description": "Url to the web link.", @@ -80,12 +80,12 @@ "query": { "description": "Path to graph ql file.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.graphql$" }, "vars": { "description": "Query parameters.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.json$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.json$" } }, "required": [ diff --git a/packages/manifests/polywrap/formats/polywrap.meta/0.0.1-prealpha.2.json b/packages/manifests/polywrap/formats/polywrap.meta/0.0.1-prealpha.2.json index 64007d2795..7bbac1e90c 100644 --- a/packages/manifests/polywrap/formats/polywrap.meta/0.0.1-prealpha.2.json +++ b/packages/manifests/polywrap/formats/polywrap.meta/0.0.1-prealpha.2.json @@ -31,7 +31,7 @@ "icon": { "description": "Path to wrapper icon.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(svg|png)$" + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/[\\w\\-\\.]+\\.(svg|png)$" }, "links": { "description": "Relevant web links.", @@ -47,7 +47,7 @@ "icon": { "description": "Web link icon.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(svg|png)$" + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/[\\w\\-\\.]+\\.(svg|png)$" }, "url": { "description": "Url to the web link.", @@ -79,12 +79,12 @@ "query": { "description": "Path to graph ql file.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.graphql$" }, "vars": { "description": "Query parameters.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.json$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.json$" } }, "required": [ diff --git a/packages/manifests/polywrap/formats/polywrap.meta/0.0.1-prealpha.3.json b/packages/manifests/polywrap/formats/polywrap.meta/0.0.1-prealpha.3.json index 418039c5b6..80f7b5c2d0 100644 --- a/packages/manifests/polywrap/formats/polywrap.meta/0.0.1-prealpha.3.json +++ b/packages/manifests/polywrap/formats/polywrap.meta/0.0.1-prealpha.3.json @@ -40,7 +40,7 @@ "icon": { "description": "Path to wrapper icon.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(svg|png)$" + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/[\\w\\-\\.]+\\.(svg|png)$" }, "links": { "description": "Relevant web links.", @@ -56,7 +56,7 @@ "icon": { "description": "Web link icon.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(svg|png)$" + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/[\\w\\-\\.]+\\.(svg|png)$" }, "url": { "description": "Url to the web link.", @@ -88,12 +88,12 @@ "query": { "description": "Path to graph ql file.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.graphql$" }, "vars": { "description": "Query parameters.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.json$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.json$" } }, "required": [ diff --git a/packages/manifests/polywrap/formats/polywrap.plugin/0.0.1-prealpha.1.json b/packages/manifests/polywrap/formats/polywrap.plugin/0.0.1-prealpha.1.json index 57fae4a448..f95e357e4b 100644 --- a/packages/manifests/polywrap/formats/polywrap.plugin/0.0.1-prealpha.1.json +++ b/packages/manifests/polywrap/formats/polywrap.plugin/0.0.1-prealpha.1.json @@ -21,7 +21,7 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" }, "import_redirects": { "description": "Redirects source URI to local wrapper or plugin.", diff --git a/packages/manifests/polywrap/formats/polywrap.plugin/0.0.1-prealpha.2.json b/packages/manifests/polywrap/formats/polywrap.plugin/0.0.1-prealpha.2.json index a354dac384..aa837e366c 100644 --- a/packages/manifests/polywrap/formats/polywrap.plugin/0.0.1-prealpha.2.json +++ b/packages/manifests/polywrap/formats/polywrap.plugin/0.0.1-prealpha.2.json @@ -37,12 +37,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" } }, "required": [ @@ -57,12 +57,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" } }, "required": [ diff --git a/packages/manifests/polywrap/formats/polywrap.plugin/0.0.1-prealpha.3.json b/packages/manifests/polywrap/formats/polywrap.plugin/0.0.1-prealpha.3.json index 6fb059e521..3ee1cdf834 100644 --- a/packages/manifests/polywrap/formats/polywrap.plugin/0.0.1-prealpha.3.json +++ b/packages/manifests/polywrap/formats/polywrap.plugin/0.0.1-prealpha.3.json @@ -27,12 +27,12 @@ "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" }, "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.graphql$" }, "import_redirects": { "description": "Redirects source URI to local wrapper or plugin.", diff --git a/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.1.json b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.1.json index a71246ade4..65bcacad41 100644 --- a/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.1.json +++ b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.1.json @@ -32,7 +32,7 @@ "file": { "description": "Path to graphql schema file.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" } }, "required": [ @@ -51,7 +51,7 @@ "file": { "description": "Path to Polywrap module implementation file.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" } }, "required": [ @@ -78,7 +78,7 @@ "file": { "description": "Path to graphql schema file.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" } }, "required": [ @@ -97,7 +97,7 @@ "file": { "description": "Path to Polywrap module implementation file.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" } }, "required": [ diff --git a/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.2.json b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.2.json index 7b1728ace4..cd5661e414 100644 --- a/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.2.json +++ b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.2.json @@ -20,7 +20,7 @@ "build": { "description": "Path to the customized build manifest file.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" }, "language": { "description": "Language in which the source code is written.", @@ -40,12 +40,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" } }, "required": [ @@ -61,12 +61,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" } }, "required": [ diff --git a/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.3.json b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.3.json index d67cfb8b8d..f7cf9d042c 100644 --- a/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.3.json +++ b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.3.json @@ -19,7 +19,7 @@ "build": { "description": "Path to the customized build manifest file.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" }, "language": { "description": "Language in which the source code is written.", @@ -43,12 +43,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" } }, "required": [ @@ -63,12 +63,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" } }, "required": [ diff --git a/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.4.json b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.4.json index 32d2d3cbb1..09acb29ebc 100644 --- a/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.4.json +++ b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.4.json @@ -20,7 +20,7 @@ "build": { "description": "Path to the customized build manifest file.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" }, "language": { "description": "Language in which the source code is written.", @@ -40,12 +40,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" } }, "required": [ @@ -60,12 +60,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" } }, "required": [ diff --git a/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.5.json b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.5.json index 1f54259264..d89bb7df8c 100644 --- a/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.5.json +++ b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.5.json @@ -16,12 +16,12 @@ "build": { "description": "Path to the customized build manifest file.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.yaml$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.yaml$" }, "meta": { "description": "Path to wrapper metadata manifest file.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.yaml$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.yaml$" }, "language": { "description": "Language in which the source code is written.", @@ -41,12 +41,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" } }, "required": [ @@ -61,12 +61,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" } }, "required": [ diff --git a/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.6.json b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.6.json index b04c8c1374..c53165e3a2 100644 --- a/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.6.json +++ b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.6.json @@ -16,12 +16,12 @@ "build": { "description": "Path to the customized build manifest file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(yaml|json)$" + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/[\\w\\-\\.]+\\.(yaml|json)$" }, "meta": { "description": "Path to wrapper metadata manifest file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(yaml|json)$" + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/[\\w\\-\\.]+\\.(yaml|json)$" }, "language": { "description": "Language in which the source code is written.", @@ -41,12 +41,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" } }, "required": [ @@ -61,12 +61,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" } }, "required": [ diff --git a/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.7.json b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.7.json index 8c0901da69..76bea49ac9 100644 --- a/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.7.json +++ b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.7.json @@ -22,12 +22,12 @@ "build": { "description": "Path to the customized build manifest file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(yaml|json)$" + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/[\\w\\-\\.]+\\.(yaml|json)$" }, "meta": { "description": "Path to wrapper metadata manifest file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(yaml|json)$" + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/[\\w\\-\\.]+\\.(yaml|json)$" }, "language": { "description": "Language in which the source code is written.", @@ -47,12 +47,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" } }, "required": [ @@ -67,12 +67,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" } }, "required": [ diff --git a/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.8.json b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.8.json index 3dea1df52c..a092da08fb 100644 --- a/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.8.json +++ b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.8.json @@ -22,17 +22,17 @@ "build": { "description": "Path to the customized build manifest file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(yaml|json)$" + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/[\\w\\-\\.]+\\.(yaml|json)$" }, "meta": { "description": "Path to wrapper metadata manifest file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(yaml|json)$" + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/[\\w\\-\\.]+\\.(yaml|json)$" }, "deploy": { "description": "Path to wrapper deploy manifest file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(yaml|json)$" + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/[\\w\\-\\.]+\\.(yaml|json)$" }, "language": { "description": "Language in which the source code is written.", @@ -52,12 +52,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" } }, "required": [ @@ -72,12 +72,12 @@ "schema": { "description": "Path to graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.graphql$" }, "module": { "description": "Path to Polywrap implementation.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" } }, "required": [ diff --git a/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.9.json b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.9.json index 1c7b0e9f12..7b23980017 100644 --- a/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.9.json +++ b/packages/manifests/polywrap/formats/polywrap/0.0.1-prealpha.9.json @@ -22,17 +22,17 @@ "build": { "description": "Path to the wrapper build manifest file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(yaml|json)$" + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/[\\w\\-\\.]+\\.(yaml|json)$" }, "meta": { "description": "Path to wrapper metadata manifest file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(yaml|json)$" + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/[\\w\\-\\.]+\\.(yaml|json)$" }, "deploy": { "description": "Path to wrapper deploy manifest file.", "type": "string", - "pattern": "^\\.?\\.?\\/?(\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/[a-zA-Z0-9\\-_]+\\.(yaml|json)$" + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/[\\w\\-\\.]+\\.(yaml|json)$" }, "language": { "description": "Language in which the source code is written.", @@ -42,12 +42,12 @@ "module": { "description": "Path to the module's entry point.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.?[\\w\\-]*$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" }, "schema": { "description": "Path to the module's graphql schema.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.graphql$" }, "import_redirects": { "description": "Redirects for the schema's imports.", @@ -64,7 +64,7 @@ "schema": { "description": "Path to a graphql schema to be used for the import.", "type": "string", - "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-]+|\\/\\.\\.|\\/\\.)+\\/)?[a-zA-Z0-9\\-_]+\\.graphql$" + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.graphql$" } }, "required": [ diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/001-sanity/expected/output.json b/packages/test-cases/cases/cli/wasm/build-cmd/001-sanity/expected/output.json index 97ca582cee..d91a8e5545 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/001-sanity/expected/output.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/001-sanity/expected/output.json @@ -1,6 +1,4 @@ [ - "module.wasm", - "polywrap.json", - "polywrap.build.json", - "schema.graphql" + "wrap.wasm", + "wrap.info" ] \ No newline at end of file diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/004-default-build/expected/output.json b/packages/test-cases/cases/cli/wasm/build-cmd/004-default-build/expected/output.json index 97ca582cee..d91a8e5545 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/004-default-build/expected/output.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/004-default-build/expected/output.json @@ -1,6 +1,4 @@ [ - "module.wasm", - "polywrap.json", - "polywrap.build.json", - "schema.graphql" + "wrap.wasm", + "wrap.info" ] \ No newline at end of file diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/005-default-dockerfile/expected/output.json b/packages/test-cases/cases/cli/wasm/build-cmd/005-default-dockerfile/expected/output.json index 97ca582cee..d91a8e5545 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/005-default-dockerfile/expected/output.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/005-default-dockerfile/expected/output.json @@ -1,6 +1,4 @@ [ - "module.wasm", - "polywrap.json", - "polywrap.build.json", - "schema.graphql" + "wrap.wasm", + "wrap.info" ] \ No newline at end of file diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/006-custom-dockerfile/expected/output.json b/packages/test-cases/cases/cli/wasm/build-cmd/006-custom-dockerfile/expected/output.json index 97ca582cee..d91a8e5545 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/006-custom-dockerfile/expected/output.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/006-custom-dockerfile/expected/output.json @@ -1,6 +1,4 @@ [ - "module.wasm", - "polywrap.json", - "polywrap.build.json", - "schema.graphql" + "wrap.wasm", + "wrap.info" ] \ No newline at end of file diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/007-linked-packages/expected/output.json b/packages/test-cases/cases/cli/wasm/build-cmd/007-linked-packages/expected/output.json index 97ca582cee..d91a8e5545 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/007-linked-packages/expected/output.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/007-linked-packages/expected/output.json @@ -1,6 +1,4 @@ [ - "module.wasm", - "polywrap.json", - "polywrap.build.json", - "schema.graphql" + "wrap.wasm", + "wrap.info" ] \ No newline at end of file diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/008-metadata/expected/output.json b/packages/test-cases/cases/cli/wasm/build-cmd/008-metadata/expected/output.json index 97ca582cee..d91a8e5545 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/008-metadata/expected/output.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/008-metadata/expected/output.json @@ -1,6 +1,4 @@ [ - "module.wasm", - "polywrap.json", - "polywrap.build.json", - "schema.graphql" + "wrap.wasm", + "wrap.info" ] \ No newline at end of file diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/009-docker-buildx/expected/output.json b/packages/test-cases/cases/cli/wasm/build-cmd/009-docker-buildx/expected/output.json index 97ca582cee..d91a8e5545 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/009-docker-buildx/expected/output.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/009-docker-buildx/expected/output.json @@ -1,6 +1,4 @@ [ - "module.wasm", - "polywrap.json", - "polywrap.build.json", - "schema.graphql" + "wrap.wasm", + "wrap.info" ] \ No newline at end of file diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/expected/output.json b/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/expected/output.json index 97ca582cee..d91a8e5545 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/expected/output.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/expected/output.json @@ -1,6 +1,4 @@ [ - "module.wasm", - "polywrap.json", - "polywrap.build.json", - "schema.graphql" + "wrap.wasm", + "wrap.info" ] \ No newline at end of file diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/011-custom-config/expected/output.json b/packages/test-cases/cases/cli/wasm/build-cmd/011-custom-config/expected/output.json index 97ca582cee..d91a8e5545 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/011-custom-config/expected/output.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/011-custom-config/expected/output.json @@ -1,6 +1,4 @@ [ - "module.wasm", - "polywrap.json", - "polywrap.build.json", - "schema.graphql" + "wrap.wasm", + "wrap.info" ] \ No newline at end of file From 7874f4b90b14620a3f7538e396135fd5af04c42f Mon Sep 17 00:00:00 2001 From: cbrzn Date: Mon, 4 Jul 2022 17:36:15 +0200 Subject: [PATCH 29/46] chore(cli): green light on built tests (removed filter regexp for now) --- packages/cli/lang/en.json | 6 +- packages/cli/lang/es.json | 6 +- packages/cli/src/lib/Compiler.ts | 67 ++++++++++++++----- .../polywrap.build/0.0.1-prealpha.2.json | 3 +- .../polywrap.build/0.0.1-prealpha.3.json | 3 +- .../build-cmd/001-sanity/expected/stdout.json | 3 +- .../004-default-build/expected/stdout.json | 3 +- .../expected/stdout.json | 4 +- .../expected/stdout.json | 3 +- .../007-linked-packages/expected/stdout.json | 3 +- .../008-metadata/expected/stdout.json | 5 +- .../009-docker-buildx/expected/stdout.json | 5 +- .../010-custom-config/expected/stdout.json | 3 +- .../011-custom-config/expected/stdout.json | 3 +- 14 files changed, 73 insertions(+), 44 deletions(-) diff --git a/packages/cli/lang/en.json b/packages/cli/lang/en.json index 97bf197ff6..ed5e6d05d0 100644 --- a/packages/cli/lang/en.json +++ b/packages/cli/lang/en.json @@ -270,5 +270,9 @@ "lib_wasm_rust_invalidModule": "Module paths must point to Cargo.toml files. Found: {path}", "lib_docker_invalidImageId": "Invalid docker image ID returned: {imageId}", "lib_docker_noInstall": "Docker executable not found in PATH", - "lib_infra_unrecognizedModule": "Unrecognized modules: {modules}. Default modules: {defaultModules}" + "lib_infra_unrecognizedModule": "Unrecognized modules: {modules}. Default modules: {defaultModules}", + "lib_wrap_abi_not_found": "No WRAP ABI found", + "lib_helpers_wrap_manifest_outputText": "WRAP manifest written in {path}", + "lib_helpers_wrap_manifest_outputError": "Error writing WRAP manifest in {path}", + "lib_helpers_wrap_manifest_outputWarning": "Warning writing WRAP manifest in {path}" } \ No newline at end of file diff --git a/packages/cli/lang/es.json b/packages/cli/lang/es.json index 2cb3ac43f0..d1a9b2bf91 100644 --- a/packages/cli/lang/es.json +++ b/packages/cli/lang/es.json @@ -270,5 +270,9 @@ "lib_wasm_rust_invalidModule": "Module paths must point to Cargo.toml files. Found: {path}", "lib_docker_invalidImageId": "Invalid docker image ID returned: {imageId}", "lib_docker_noInstall": "Docker executable not found in PATH", - "lib_infra_unrecognizedModule": "Unrecognized modules: {modules}. Default modules: {defaultModules}" + "lib_infra_unrecognizedModule": "Unrecognized modules: {modules}. Default modules: {defaultModules}", + "lib_wrap_abi_not_found": "No WRAP ABI found", + "lib_helpers_wrap_manifest_outputText": "WRAP manifest written in {path}", + "lib_helpers_wrap_manifest_outputError": "Error writing WRAP manifest in {path}", + "lib_helpers_wrap_manifest_outputWarning": "Warning writing WRAP manifest in {path}" } \ No newline at end of file diff --git a/packages/cli/src/lib/Compiler.ts b/packages/cli/src/lib/Compiler.ts index a794d93197..f427d0b00b 100644 --- a/packages/cli/src/lib/Compiler.ts +++ b/packages/cli/src/lib/Compiler.ts @@ -13,6 +13,7 @@ import { intlMsg, resetDir, outputManifest, + displayPath, } from "./"; import { PolywrapManifest } from "@polywrap/polywrap-manifest-types-js"; @@ -23,7 +24,11 @@ import { WrapImports } from "@polywrap/client-js/build/wasm/types"; import { AsyncWasmInstance } from "@polywrap/asyncify-js"; import { Abi } from "@polywrap/schema-parse"; import { ComposerOutput } from "@polywrap/schema-compose"; -import { writeFileSync, writeDirectorySync } from "@polywrap/os-js"; +import { + writeFileSync, + writeDirectorySync, + normalizePath, +} from "@polywrap/os-js"; import * as gluegun from "gluegun"; import fs from "fs"; import path from "path"; @@ -325,9 +330,10 @@ export class Compiler { const { outputDir } = this._config; if (!state.composerOutput.schema) { + // This is not being shown with intlMsg because this will be removed throw Error("Compiler.outputComposedSchema: no schema found"); } - + writeFileSync( `${outputDir}/schema.graphql`, state.composerOutput.schema, @@ -335,29 +341,54 @@ export class Compiler { ); } - private async _outputWrapManifest(state: CompilerState): Promise { + private async _outputWrapManifest( + state: CompilerState, + quiet = false + ): Promise { const { outputDir, project } = this._config; + let manifestPath = `${outputDir}/wrap.info`; + const run = async () => { + if (!state.composerOutput.abi) { + throw Error(intlMsg.lib_wrap_abi_not_found()); + } - if (!state.composerOutput.abi) { - throw Error("Compiler.outputWrapManifest: no WRAP ABI found"); - } + const manifest = await project.getManifest(); - const manifest = await project.getManifest(); + const abi: Abi = { + ...state.composerOutput.abi, + }; - const abi: Abi = { - ...state.composerOutput.abi, - }; + const info: WrapManifest = { + abi: { ...abi }, + name: manifest.name, + type: (await this._isInterface()) ? "interface" : "wasm", + version: "0.0.1", + }; - const info: WrapManifest = { - abi: { ...abi }, - name: manifest.name, - type: (await this._isInterface()) ? "interface" : "wasm", - version: "0.0.1", + writeFileSync(manifestPath, msgpackEncode(info), { + encoding: "binary", + }); }; - writeFileSync(`${outputDir}/wrap.info`, msgpackEncode(info), { - encoding: "binary", - }); + if (quiet) { + return await run(); + } else { + manifestPath = displayPath(manifestPath); + return await withSpinner( + intlMsg.lib_helpers_wrap_manifest_outputText({ + path: normalizePath(manifestPath), + }), + intlMsg.lib_helpers_wrap_manifest_outputError({ + path: normalizePath(manifestPath), + }), + intlMsg.lib_helpers_wrap_manifest_outputWarning({ + path: normalizePath(manifestPath), + }), + (_spinner): Promise => { + return Promise.resolve(run()); + } + ); + } } private async _outputPolywrapMetadata(): Promise { diff --git a/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.2.json b/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.2.json index d1a56179bb..d388a9109f 100644 --- a/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.2.json +++ b/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.2.json @@ -46,8 +46,7 @@ }, "filter": { "description": "Ignore files matching this regex in linked package directory.", - "type": "string", - "pattern": "^(?:(?:[^?+*{}()[\\]\\\\|]+|\\\\.|\\[(?:\\^?\\\\.|\\^[^\\\\]|[^\\\\^])(?:[^\\]\\\\]+|\\\\.)*\\]|\\((?:\\?[:=!]|\\?<[=!]|\\?>|\\?<[^\\W\\d]\\w*>|\\?'[^\\W\\d]\\w*')?(?)|\\)(?<-N>))(?:(?:[?+*]|\\{\\d+(?:,\\d*)?\\})[?+]?)?|\\|)*$(?(N)(?!))" + "type": "string" } }, "required": ["name", "path"] diff --git a/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.3.json b/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.3.json index 0a58e989a7..a480d5a1e7 100644 --- a/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.3.json +++ b/packages/manifests/polywrap/formats/polywrap.build/0.0.1-prealpha.3.json @@ -66,8 +66,7 @@ }, "filter": { "description": "Ignore files matching this regex in linked package directory.", - "type": "string", - "pattern": "^(?:(?:[^?+*{}()[\\]\\\\|]+|\\\\.|\\[(?:\\^?\\\\.|\\^[^\\\\]|[^\\\\^])(?:[^\\]\\\\]+|\\\\.)*\\]|\\((?:\\?[:=!]|\\?<[=!]|\\?>|\\?<[^\\W\\d]\\w*>|\\?'[^\\W\\d]\\w*')?(?)|\\)(?<-N>))(?:(?:[?+*]|\\{\\d+(?:,\\d*)?\\})[?+]?)?|\\|)*$(?(N)(?!))" + "type": "string" } }, "required": ["name", "path"] diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/001-sanity/expected/stdout.json b/packages/test-cases/cases/cli/wasm/build-cmd/001-sanity/expected/stdout.json index 2f5da39ad0..f010d65eea 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/001-sanity/expected/stdout.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/001-sanity/expected/stdout.json @@ -1,8 +1,7 @@ { "stdout": [ "Artifacts written to ./build from the image `polywrap-build-env-", - "Manifest written to ./build/polywrap.json", - "build/polywrap.json" + "WRAP manifest written in ./build" ], "exitCode": 0 } diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/004-default-build/expected/stdout.json b/packages/test-cases/cases/cli/wasm/build-cmd/004-default-build/expected/stdout.json index 2f5da39ad0..f010d65eea 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/004-default-build/expected/stdout.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/004-default-build/expected/stdout.json @@ -1,8 +1,7 @@ { "stdout": [ "Artifacts written to ./build from the image `polywrap-build-env-", - "Manifest written to ./build/polywrap.json", - "build/polywrap.json" + "WRAP manifest written in ./build" ], "exitCode": 0 } diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/005-default-dockerfile/expected/stdout.json b/packages/test-cases/cases/cli/wasm/build-cmd/005-default-dockerfile/expected/stdout.json index 2f5da39ad0..a1d6426d25 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/005-default-dockerfile/expected/stdout.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/005-default-dockerfile/expected/stdout.json @@ -1,8 +1,8 @@ { "stdout": [ "Artifacts written to ./build from the image `polywrap-build-env-", - "Manifest written to ./build/polywrap.json", - "build/polywrap.json" + "WRAP manifest written in ./build" + ], "exitCode": 0 } diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/006-custom-dockerfile/expected/stdout.json b/packages/test-cases/cases/cli/wasm/build-cmd/006-custom-dockerfile/expected/stdout.json index 2f5da39ad0..f010d65eea 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/006-custom-dockerfile/expected/stdout.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/006-custom-dockerfile/expected/stdout.json @@ -1,8 +1,7 @@ { "stdout": [ "Artifacts written to ./build from the image `polywrap-build-env-", - "Manifest written to ./build/polywrap.json", - "build/polywrap.json" + "WRAP manifest written in ./build" ], "exitCode": 0 } diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/007-linked-packages/expected/stdout.json b/packages/test-cases/cases/cli/wasm/build-cmd/007-linked-packages/expected/stdout.json index 2f5da39ad0..f010d65eea 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/007-linked-packages/expected/stdout.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/007-linked-packages/expected/stdout.json @@ -1,8 +1,7 @@ { "stdout": [ "Artifacts written to ./build from the image `polywrap-build-env-", - "Manifest written to ./build/polywrap.json", - "build/polywrap.json" + "WRAP manifest written in ./build" ], "exitCode": 0 } diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/008-metadata/expected/stdout.json b/packages/test-cases/cases/cli/wasm/build-cmd/008-metadata/expected/stdout.json index 31c089053b..2ce6796271 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/008-metadata/expected/stdout.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/008-metadata/expected/stdout.json @@ -1,13 +1,12 @@ { "stdout": [ "Artifacts written to ./build from the image `polywrap-build-env-", - "Manifest written to ./build/polywrap.json", - "build/polywrap.json", "build/polywrap.meta.json", "build/meta/queries/test.graphql", "build/meta/queries/test.json", "build/meta/links/link.svg", - "build/meta/icon/icon.png" + "build/meta/icon/icon.png", + "WRAP manifest written in ./build" ], "exitCode": 0 } diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/009-docker-buildx/expected/stdout.json b/packages/test-cases/cases/cli/wasm/build-cmd/009-docker-buildx/expected/stdout.json index 9d8067dee4..e4beb54a58 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/009-docker-buildx/expected/stdout.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/009-docker-buildx/expected/stdout.json @@ -1,8 +1,7 @@ { "stdout": [ "Artifacts written to ./build from the image `polywrap-build-env-", - "Manifest written to ./build/polywrap.json", - "build/polywrap.json", + "WRAP manifest written in ./build", "docker rmi polywrap-build-env-", "docker buildx rm polywrap-build-env-" ], @@ -11,4 +10,4 @@ ".polywrap/wasm/build/image/cache/index.json", ".polywrap/wasm/build/image/cache/blobs/sha256/" ] -} +} \ No newline at end of file diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/expected/stdout.json b/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/expected/stdout.json index 2f5da39ad0..f010d65eea 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/expected/stdout.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/expected/stdout.json @@ -1,8 +1,7 @@ { "stdout": [ "Artifacts written to ./build from the image `polywrap-build-env-", - "Manifest written to ./build/polywrap.json", - "build/polywrap.json" + "WRAP manifest written in ./build" ], "exitCode": 0 } diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/011-custom-config/expected/stdout.json b/packages/test-cases/cases/cli/wasm/build-cmd/011-custom-config/expected/stdout.json index 2f5da39ad0..f010d65eea 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/011-custom-config/expected/stdout.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/011-custom-config/expected/stdout.json @@ -1,8 +1,7 @@ { "stdout": [ "Artifacts written to ./build from the image `polywrap-build-env-", - "Manifest written to ./build/polywrap.json", - "build/polywrap.json" + "WRAP manifest written in ./build" ], "exitCode": 0 } From 6be2519852957245f1ebf62ea956a3edc68a8a0c Mon Sep 17 00:00:00 2001 From: cbrzn Date: Mon, 4 Jul 2022 21:31:18 +0200 Subject: [PATCH 30/46] chore: update validation with new abi interface --- .../src/wrappers/ens/{module.wasm => wrap.wasm} | Bin .../js/validation/src/__tests__/sizes.spec.ts | 2 +- .../wrappers/file-size-over-100-kb/wrap.info | Bin 165 -> 169 bytes .../wrappers/module-size-over-100-kb/wrap.info | Bin 165 -> 169 bytes .../wrappers/more-than-6-files/wrap.info | Bin 165 -> 169 bytes .../wrappers/package-size-over-100-kb/wrap.info | Bin 165 -> 169 bytes .../wrappers/valid-interface/wrap.info | Bin 175 -> 174 bytes .../src/__tests__/wrappers/valid/wrap.info | Bin 165 -> 169 bytes .../src/types/WasmPackageValidator.ts | 2 +- 9 files changed, 2 insertions(+), 2 deletions(-) rename packages/js/test-env/src/wrappers/ens/{module.wasm => wrap.wasm} (100%) diff --git a/packages/js/test-env/src/wrappers/ens/module.wasm b/packages/js/test-env/src/wrappers/ens/wrap.wasm similarity index 100% rename from packages/js/test-env/src/wrappers/ens/module.wasm rename to packages/js/test-env/src/wrappers/ens/wrap.wasm diff --git a/packages/js/validation/src/__tests__/sizes.spec.ts b/packages/js/validation/src/__tests__/sizes.spec.ts index 0f1d3c08d6..8f60a47763 100644 --- a/packages/js/validation/src/__tests__/sizes.spec.ts +++ b/packages/js/validation/src/__tests__/sizes.spec.ts @@ -18,8 +18,8 @@ const assertValidWrapper = async (wrapperPath: string) => { maxModuleSize: 1_000_000, maxNumberOfFiles: 1000, }); - const result = await validator.validate(reader); + console.log({ result }) expect(result.valid).toBeTruthy(); expect(result.failReason).toEqual(undefined); }; diff --git a/packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/wrap.info b/packages/js/validation/src/__tests__/wrappers/file-size-over-100-kb/wrap.info index 544f2491b2f1ed36fbbcd1e83d1c7f70fd4b7b4a..5e3ea0ac0394320ea74f41a790d56f619fd79ef7 100644 GIT binary patch delta 72 zcmZ3=xROz~Wl3IQZtA+^{QR8w%)FA+qO`>1)FmaA1*uEQ6N__~m!%dJXXfWEHPAEA bGn}ZACA1+kw;;c$BsIk~uPg+ptat(dNGKi3 delta 68 zcmZ3FXbEqBLf2f$g&$5 diff --git a/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/wrap.info b/packages/js/validation/src/__tests__/wrappers/module-size-over-100-kb/wrap.info index 544f2491b2f1ed36fbbcd1e83d1c7f70fd4b7b4a..5e3ea0ac0394320ea74f41a790d56f619fd79ef7 100644 GIT binary patch delta 72 zcmZ3=xROz~Wl3IQZtA+^{QR8w%)FA+qO`>1)FmaA1*uEQ6N__~m!%dJXXfWEHPAEA bGn}ZACA1+kw;;c$BsIk~uPg+ptat(dNGKi3 delta 68 zcmZ3FXbEqBLf2f$g&$5 diff --git a/packages/js/validation/src/__tests__/wrappers/more-than-6-files/wrap.info b/packages/js/validation/src/__tests__/wrappers/more-than-6-files/wrap.info index 544f2491b2f1ed36fbbcd1e83d1c7f70fd4b7b4a..5e3ea0ac0394320ea74f41a790d56f619fd79ef7 100644 GIT binary patch delta 72 zcmZ3=xROz~Wl3IQZtA+^{QR8w%)FA+qO`>1)FmaA1*uEQ6N__~m!%dJXXfWEHPAEA bGn}ZACA1+kw;;c$BsIk~uPg+ptat(dNGKi3 delta 68 zcmZ3FXbEqBLf2f$g&$5 diff --git a/packages/js/validation/src/__tests__/wrappers/package-size-over-100-kb/wrap.info b/packages/js/validation/src/__tests__/wrappers/package-size-over-100-kb/wrap.info index 544f2491b2f1ed36fbbcd1e83d1c7f70fd4b7b4a..5e3ea0ac0394320ea74f41a790d56f619fd79ef7 100644 GIT binary patch delta 72 zcmZ3=xROz~Wl3IQZtA+^{QR8w%)FA+qO`>1)FmaA1*uEQ6N__~m!%dJXXfWEHPAEA bGn}ZACA1+kw;;c$BsIk~uPg+ptat(dNGKi3 delta 68 zcmZ3FXbEqBLf2f$g&$5 diff --git a/packages/js/validation/src/__tests__/wrappers/valid-interface/wrap.info b/packages/js/validation/src/__tests__/wrappers/valid-interface/wrap.info index 818432785b3e18c6ed84d22bcb74e509d26b1cb8..465fb073ed6f1af5775b5d960233e84b50a5757e 100644 GIT binary patch delta 58 zcmZ3_xQ=mxsO*xG%7WCDnRz9tMQMr2smse!i;6Sz^OhRu8R!{KG|Cd%keOSMUsRHs N;+j_$0#sW(0RXD&7eW94 delta 59 zcmZ3-xSnx>sO<8x)S}|d{JfB_^j%G|CcQo|;z{0u*gr OlAW2Ca*lzKfdK%r{T7V? diff --git a/packages/js/validation/src/__tests__/wrappers/valid/wrap.info b/packages/js/validation/src/__tests__/wrappers/valid/wrap.info index 544f2491b2f1ed36fbbcd1e83d1c7f70fd4b7b4a..5e3ea0ac0394320ea74f41a790d56f619fd79ef7 100644 GIT binary patch delta 72 zcmZ3=xROz~Wl3IQZtA+^{QR8w%)FA+qO`>1)FmaA1*uEQ6N__~m!%dJXXfWEHPAEA bGn}ZACA1+kw;;c$BsIk~uPg+ptat(dNGKi3 delta 68 zcmZ3FXbEqBLf2f$g&$5 diff --git a/packages/js/validation/src/types/WasmPackageValidator.ts b/packages/js/validation/src/types/WasmPackageValidator.ts index 62b5d6f7f9..15c9725a78 100644 --- a/packages/js/validation/src/types/WasmPackageValidator.ts +++ b/packages/js/validation/src/types/WasmPackageValidator.ts @@ -149,7 +149,7 @@ export class WasmPackageValidator { private async validateAbi(manifest: WrapManifest): Promise { try { - // TODO(cbrzn): Just validate the structure of Abi with the JSON Schema and remove never + // TODO(cbrzn): Just validate the structure of Abi with the JSON Schema and remove renderSchema(manifest.abi as never, false); } catch (err) { return this.fail(ValidationFailReason.InvalidAbi, err); From c5e858a97b47a15f0ff86f038aa60850758b8ad1 Mon Sep 17 00:00:00 2001 From: cbrzn Date: Tue, 5 Jul 2022 00:08:58 +0200 Subject: [PATCH 31/46] feat(fs-uri-resolver): looks for wrap.info and returns it as expected --- packages/cli/src/commands/deploy.ts | 22 ++++----- packages/cli/src/lib/Compiler.ts | 3 +- packages/js/client/src/PolywrapClient.ts | 11 +---- .../src/__tests__/core/wasm-wrapper.spec.ts | 14 ++---- packages/js/client/src/wasm/WasmWrapper.ts | 38 +++++++-------- packages/js/core/src/types/Client.ts | 6 +-- .../extendable/ExtendableUriResolver.ts | 1 - .../wrap/src/formats/wrap.info/deserialize.ts | 1 - .../src/__tests__/e2e.spec.ts | 14 +++--- .../file-system-resolver/src/index.ts | 36 +++++++------- .../test-env/src/wrappers/ens/schema.graphql | 44 ++++++++++-------- .../js/test-env/src/wrappers/ens/wrap.info | Bin 0 -> 74067 bytes .../js/test-env/src/wrappers/ens/wrap.wasm | Bin 265431 -> 265420 bytes .../deploy/002-no-ext/polywrap.build.yaml | 2 +- 14 files changed, 87 insertions(+), 105 deletions(-) create mode 100644 packages/js/test-env/src/wrappers/ens/wrap.info diff --git a/packages/cli/src/commands/deploy.ts b/packages/cli/src/commands/deploy.ts index 644a5da8d7..477de0bab6 100644 --- a/packages/cli/src/commands/deploy.ts +++ b/packages/cli/src/commands/deploy.ts @@ -1,20 +1,20 @@ /* eslint-disable prefer-const */ -import { Command, Program } from "./types"; +import {Command, Program} from "./types"; import { - intlMsg, - PolywrapProject, defaultPolywrapManifest, - DeployPackage, DeployerHandler, + DeployPackage, + intlMsg, parseWasmManifestFileOption, + PolywrapProject, } from "../lib"; -import { DeployManifest } from "@polywrap/polywrap-manifest-types-js"; +import {DeployManifest} from "@polywrap/polywrap-manifest-types-js"; import fs from "fs"; import nodePath from "path"; -import { print } from "gluegun"; -import { Uri } from "@polywrap/core-js"; -import { validate } from "jsonschema"; +import {print} from "gluegun"; +import {Uri} from "@polywrap/core-js"; +import {validate} from "jsonschema"; const defaultManifestStr = defaultPolywrapManifest.join(" | "); const pathStr = intlMsg.commands_deploy_options_o_path(); @@ -55,7 +55,7 @@ async function run(options: DeployCommandOptions): Promise { const project = new PolywrapProject({ rootDir: nodePath.dirname(manifestFile), polywrapManifestPath: manifestFile, - quiet: verbose ? false : true, + quiet: !verbose, }); await project.validate(); @@ -92,14 +92,12 @@ async function run(options: DeployCommandOptions): Promise { // Create all handlers Object.entries(deployManifest.stages).forEach(([stageName, stageValue]) => { const publisher = stageToPackageMap[stageName].deployer; - const handler = new DeployerHandler( + handlers[stageName] = new DeployerHandler( stageName, publisher, stageValue.config, print ); - - handlers[stageName] = handler; }); // Establish dependency chains diff --git a/packages/cli/src/lib/Compiler.ts b/packages/cli/src/lib/Compiler.ts index f427d0b00b..a1d995b68d 100644 --- a/packages/cli/src/lib/Compiler.ts +++ b/packages/cli/src/lib/Compiler.ts @@ -365,7 +365,8 @@ export class Compiler { version: "0.0.1", }; - writeFileSync(manifestPath, msgpackEncode(info), { + const encodedInfo = msgpackEncode(info); + writeFileSync(manifestPath, encodedInfo, { encoding: "binary", }); }; diff --git a/packages/js/client/src/PolywrapClient.ts b/packages/js/client/src/PolywrapClient.ts index 8845abb90c..0ca72f7a5c 100644 --- a/packages/js/client/src/PolywrapClient.ts +++ b/packages/js/client/src/PolywrapClient.ts @@ -47,13 +47,8 @@ import { PluginPackage, RunOptions, } from "@polywrap/core-js"; -import { - msgpackEncode, - msgpackDecode, -} from "@polywrap/msgpack-js"; -import { - WrapManifest, -} from "@polywrap/wrap-manifest-types-js"; +import { msgpackEncode, msgpackDecode } from "@polywrap/msgpack-js"; +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; import { Tracer } from "@polywrap/tracing-js"; export interface PolywrapClientConfig @@ -329,7 +324,6 @@ export class PolywrapClient implements Client { }; const wrapper = await this._loadWrapper(typedOptions.uri, { contextId }); - const invocableResult = await wrapper.invoke( typedOptions, contextualizeClient(this, contextId) @@ -496,7 +490,6 @@ export class PolywrapClient implements Client { if (!cacheRead) { uriResolvers = uriResolvers.filter((x) => x.name !== CacheResolver.name); } - const { wrapper, uri: resolvedUri, uriHistory, error } = await resolveUri( this._toUri(uri), uriResolvers, diff --git a/packages/js/client/src/__tests__/core/wasm-wrapper.spec.ts b/packages/js/client/src/__tests__/core/wasm-wrapper.spec.ts index 08c205f56c..8753e8795f 100644 --- a/packages/js/client/src/__tests__/core/wasm-wrapper.spec.ts +++ b/packages/js/client/src/__tests__/core/wasm-wrapper.spec.ts @@ -5,13 +5,13 @@ import { stopTestEnvironment, providers } from "@polywrap/test-env-js"; +import { msgpackDecode } from "@polywrap/msgpack-js" import { Uri, createPolywrapClient, PolywrapClientConfig, PluginModule, - Subscription, - msgpackDecode + Subscription } from "../.."; import { GetPathToTestWrappers } from "@polywrap/test-cases"; @@ -233,20 +233,14 @@ describe("wasm-wrapper", () => { path: "./schema.graphql", encoding: "utf8", })) as string; - expect(fileStr).toContain(`getData( - address: String! - connection: Ethereum_Connection - ): Int!`); + expect(fileStr).toContain(`type Module @imports`); const fileBuffer: Uint8Array = (await client.getFile(wrapperUri, { path: "./schema.graphql", })) as Uint8Array; const decoder = new TextDecoder("utf8"); const text = decoder.decode(fileBuffer); - expect(text).toContain(`getData( - address: String! - connection: Ethereum_Connection - ): Int!`); + expect(text).toContain(`type Module @imports`); await expect(() => client.getFile(new Uri("wrap://ens/ipfs.polywrap.eth"), { diff --git a/packages/js/client/src/wasm/WasmWrapper.ts b/packages/js/client/src/wasm/WasmWrapper.ts index 085cce85fa..3804c0ca8e 100644 --- a/packages/js/client/src/wasm/WasmWrapper.ts +++ b/packages/js/client/src/wasm/WasmWrapper.ts @@ -16,7 +16,10 @@ import { GetManifestOptions, isBuffer, } from "@polywrap/core-js"; -import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; +import { + deserializeWrapManifest, + WrapManifest, +} from "@polywrap/wrap-manifest-types-js"; import { msgpackEncode } from "@polywrap/msgpack-js"; import { Tracer } from "@polywrap/tracing-js"; import { AsyncWasmInstance } from "@polywrap/asyncify-js"; @@ -49,7 +52,7 @@ export interface State { export class WasmWrapper extends Wrapper { public static requiredExports: readonly string[] = ["_wrap_invoke"]; - + private _info: WrapManifest | undefined = undefined; private _schema?: string; private _wasm: Uint8Array | undefined = undefined; @@ -123,32 +126,25 @@ export class WasmWrapper extends Wrapper { return this._info; } - this._schema = await this.getFile({ - path: "schema.graphql", encoding: 'utf-8' - }, client) as string + this._schema = (await this.getFile( + { + path: "schema.graphql", + encoding: "utf-8", + }, + client + )) as string; const moduleManifest = "wrap.info"; - if (!moduleManifest) { - throw Error(`Package manifest does not contain information`); - } - const data = (await this.getFile( - { path: moduleManifest, encoding: "utf-8" }, + { path: moduleManifest }, client - )) as string; + )) as Uint8Array; - if (options.abi) { - try { - return JSON.parse(data) as WrapManifest - // const { abi } = JSON.parse(data); - // return JSON.stringify(abi); - } catch (e) { - console.log("Package information is not well formatted"); - } + if (!data) { + throw Error(`Package manifest does not contain information`); } - - return JSON.parse(data) as WrapManifest + return deserializeWrapManifest(data); } @Tracer.traceMethod("WasmWrapper: invoke") diff --git a/packages/js/core/src/types/Client.ts b/packages/js/core/src/types/Client.ts index c75b938467..84bb7c12df 100644 --- a/packages/js/core/src/types/Client.ts +++ b/packages/js/core/src/types/Client.ts @@ -38,13 +38,11 @@ export type GetUriResolversOptions = Contextualized; export type GetSchemaOptions = Contextualized; -export type GetManifestOptions = { - abi?: boolean; -} & Contextualized; +export type GetManifestOptions = Contextualized; export interface GetFileOptions extends Contextualized { path: string; - encoding?: "utf-8" | string; + encoding?: "utf-8" | "msgpack" | string; } export interface GetImplementationsOptions extends Contextualized { diff --git a/packages/js/core/src/uri-resolution/resolvers/extendable/ExtendableUriResolver.ts b/packages/js/core/src/uri-resolution/resolvers/extendable/ExtendableUriResolver.ts index d5b6394d5e..f6f07408be 100644 --- a/packages/js/core/src/uri-resolution/resolvers/extendable/ExtendableUriResolver.ts +++ b/packages/js/core/src/uri-resolution/resolvers/extendable/ExtendableUriResolver.ts @@ -69,7 +69,6 @@ export class ExtendableUriResolver implements UriResolver { ); for (const resolver of resolvers) { - console.log({ resolvers }) const result = await resolver.resolveUri( uri, client, diff --git a/packages/js/manifests/wrap/src/formats/wrap.info/deserialize.ts b/packages/js/manifests/wrap/src/formats/wrap.info/deserialize.ts index d57b0405b5..aff11e75d0 100644 --- a/packages/js/manifests/wrap/src/formats/wrap.info/deserialize.ts +++ b/packages/js/manifests/wrap/src/formats/wrap.info/deserialize.ts @@ -27,7 +27,6 @@ export function deserializeWrapManifest( } catch (e) { throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); } - if (!options || !options.noValidate) { validateWrapManifest(anyWrapManifest); } diff --git a/packages/js/plugins/uri-resolvers/file-system-resolver/src/__tests__/e2e.spec.ts b/packages/js/plugins/uri-resolvers/file-system-resolver/src/__tests__/e2e.spec.ts index dc589a8e02..07b617de33 100644 --- a/packages/js/plugins/uri-resolvers/file-system-resolver/src/__tests__/e2e.spec.ts +++ b/packages/js/plugins/uri-resolvers/file-system-resolver/src/__tests__/e2e.spec.ts @@ -101,21 +101,21 @@ describe("Filesystem plugin", () => { expect(schema).toBe(expectedSchema); // get the manifest - const manifest = await client.getManifest(fsUri, { type: "polywrap" }); + const manifest = await client.getManifest(fsUri, {}); expect(manifest).toBeTruthy(); - expect(manifest.language).toBe("wasm/assemblyscript"); + expect(manifest.version).toBe("0.0.1"); // get a file const file = await client.getFile(fsUri, { - path: "polywrap.json", - encoding: "utf-8", + path: "wrap.info", }); + const expectedFile = await fs.promises.readFile( - `${fsPath}/polywrap.json`, - "utf-8" + `${fsPath}/wrap.info` ); - expect(file).toBe(expectedFile); + const expectedInfo = Uint8Array.from(expectedFile) + expect(file).toStrictEqual(expectedInfo); }); }); diff --git a/packages/js/plugins/uri-resolvers/file-system-resolver/src/index.ts b/packages/js/plugins/uri-resolvers/file-system-resolver/src/index.ts index 6e424fd23a..6596b6b0ff 100644 --- a/packages/js/plugins/uri-resolvers/file-system-resolver/src/index.ts +++ b/packages/js/plugins/uri-resolvers/file-system-resolver/src/index.ts @@ -24,30 +24,28 @@ export class FileSystemResolverPlugin extends Module { return null; } - const manifestSearchPatterns = ["polywrap.json"]; + const manifestSearchPattern = "wrap.info"; let manifest: Bytes | undefined; - for (const manifestSearchPattern of manifestSearchPatterns) { - const manifestPath = path.resolve(args.path, manifestSearchPattern); - const manifestExistsResult = await FileSystem_Module.exists( - { path: manifestPath }, - _client - ); + const manifestPath = path.resolve(args.path, manifestSearchPattern); + const manifestExistsResult = await FileSystem_Module.exists( + { path: manifestPath }, + _client + ); - if (manifestExistsResult.data) { - try { - const manifestResult = await FileSystem_Module.readFile( - { path: manifestPath, encoding: FileSystem_EncodingEnum.BINARY }, - _client - ); - if (manifestResult.error) { - console.warn(manifestResult.error); - } - manifest = manifestResult.data; - } catch (e) { - // TODO: logging + if (manifestExistsResult.data) { + try { + const manifestResult = await FileSystem_Module.readFile( + { path: manifestPath, encoding: FileSystem_EncodingEnum.BINARY }, + _client + ); + if (manifestResult.error) { + console.warn(manifestResult.error); } + manifest = manifestResult.data; + } catch (e) { + // TODO: logging } } diff --git a/packages/js/test-env/src/wrappers/ens/schema.graphql b/packages/js/test-env/src/wrappers/ens/schema.graphql index 6e2a3ca7bb..b7cae7ce0a 100644 --- a/packages/js/test-env/src/wrappers/ens/schema.graphql +++ b/packages/js/test-env/src/wrappers/ens/schema.graphql @@ -33,6 +33,8 @@ directive @enabled_interface on OBJECT directive @annotate(type: String!) on FIELD +directive @env(required: Boolean!) on FIELD_DEFINITION + ### Polywrap Header END ### type Module @imports( @@ -306,6 +308,11 @@ type Module @imports( ): CreateSubdomainInOpenDomainAndSetContentHashResponse } +type TxOverrides { + gasPrice: BigInt + gasLimit: BigInt +} + type ConfigureOpenDomainResponse { fifsRegistrarAddress: String! registerOpenDomainTxReceipt: Ethereum_TxResponse! @@ -329,15 +336,10 @@ type RegistrationResult { tx: Ethereum_TxResponse } -type TxOverrides { - gasPrice: BigInt - gasLimit: BigInt -} - ### Imported Modules START ### type Ethereum_Module @imported( - uri: "ens/ethereum.polywrap.eth", + uri: "wrap://ens/ethereum.polywrap.eth", namespace: "Ethereum", nativeType: "Module" ) { @@ -495,7 +497,7 @@ type Ethereum_Module @imported( } type UTS46_Module @imported( - uri: "ens/uts46.polywrap.eth", + uri: "wrap://ens/uts46.polywrap.eth", namespace: "UTS46", nativeType: "Module" ) { @@ -513,7 +515,7 @@ type UTS46_Module @imported( } type SHA3_Module @imported( - uri: "ens/sha3.polywrap.eth", + uri: "wrap://ens/sha3.polywrap.eth", namespace: "SHA3", nativeType: "Module" ) { @@ -573,7 +575,7 @@ type SHA3_Module @imported( ### Imported Objects START ### type Ethereum_Connection @imported( - uri: "ens/ethereum.polywrap.eth", + uri: "wrap://ens/ethereum.polywrap.eth", namespace: "Ethereum", nativeType: "Connection" ) { @@ -582,7 +584,7 @@ type Ethereum_Connection @imported( } type Ethereum_TxOverrides @imported( - uri: "ens/ethereum.polywrap.eth", + uri: "wrap://ens/ethereum.polywrap.eth", namespace: "Ethereum", nativeType: "TxOverrides" ) { @@ -592,7 +594,7 @@ type Ethereum_TxOverrides @imported( } type Ethereum_StaticTxResult @imported( - uri: "ens/ethereum.polywrap.eth", + uri: "wrap://ens/ethereum.polywrap.eth", namespace: "Ethereum", nativeType: "StaticTxResult" ) { @@ -601,7 +603,7 @@ type Ethereum_StaticTxResult @imported( } type Ethereum_TxRequest @imported( - uri: "ens/ethereum.polywrap.eth", + uri: "wrap://ens/ethereum.polywrap.eth", namespace: "Ethereum", nativeType: "TxRequest" ) { @@ -617,7 +619,7 @@ type Ethereum_TxRequest @imported( } type Ethereum_TxReceipt @imported( - uri: "ens/ethereum.polywrap.eth", + uri: "wrap://ens/ethereum.polywrap.eth", namespace: "Ethereum", nativeType: "TxReceipt" ) { @@ -641,7 +643,7 @@ type Ethereum_TxReceipt @imported( } type Ethereum_Log @imported( - uri: "ens/ethereum.polywrap.eth", + uri: "wrap://ens/ethereum.polywrap.eth", namespace: "Ethereum", nativeType: "Log" ) { @@ -657,7 +659,7 @@ type Ethereum_Log @imported( } type Ethereum_EventNotification @imported( - uri: "ens/ethereum.polywrap.eth", + uri: "wrap://ens/ethereum.polywrap.eth", namespace: "Ethereum", nativeType: "EventNotification" ) { @@ -667,7 +669,7 @@ type Ethereum_EventNotification @imported( } type Ethereum_Network @imported( - uri: "ens/ethereum.polywrap.eth", + uri: "wrap://ens/ethereum.polywrap.eth", namespace: "Ethereum", nativeType: "Network" ) { @@ -677,7 +679,7 @@ type Ethereum_Network @imported( } type Ethereum_TxResponse @imported( - uri: "ens/ethereum.polywrap.eth", + uri: "wrap://ens/ethereum.polywrap.eth", namespace: "Ethereum", nativeType: "TxResponse" ) { @@ -703,7 +705,7 @@ type Ethereum_TxResponse @imported( } type Ethereum_Access @imported( - uri: "ens/ethereum.polywrap.eth", + uri: "wrap://ens/ethereum.polywrap.eth", namespace: "Ethereum", nativeType: "Access" ) { @@ -712,7 +714,7 @@ type Ethereum_Access @imported( } type UTS46_ConvertResult @imported( - uri: "ens/uts46.polywrap.eth", + uri: "wrap://ens/uts46.polywrap.eth", namespace: "UTS46", nativeType: "ConvertResult" ) { @@ -721,3 +723,7 @@ type UTS46_ConvertResult @imported( } ### Imported Objects END ### + +### Imported Envs START ### + +### Imported Envs END ### diff --git a/packages/js/test-env/src/wrappers/ens/wrap.info b/packages/js/test-env/src/wrappers/ens/wrap.info new file mode 100644 index 0000000000000000000000000000000000000000..966e6b144b648d4a2401e1914ece2e619f584baa GIT binary patch literal 74067 zcmeHQOOG7Kk){A0_PXn%FTxt$lOb6oB^W-Lq{tOvX-41-R|ml$YPxe~%F|uds;Zuc zPc~re^TJ)Nch}g30c+kf)bKT?Y{>=&-s|cI5YUg=tjg}H%*x1&$m|}ndQ>NZJsr`J z5np^68I_s!%k5w({Kw;X>8GrdEp821`m4X+$@ss=i<|T7EJ?yHOLwB6&(01K_VF-G zSodsaEsVOa91W6qz>+Lv>A(GRA+vWqT)7=(#n%s3g7kwV?68{HU+)G<5^SAq_k+RN zUfKzILGnwo^s9Tq(z6{F4f|)$hEc-OxVO%_^Ti0}lbiYHusQFA{V?-32a+b5a}-7y zOO}HUOYaNset9E~mcx}{!sZ7odMEA&VRVP3gE&eV>g`WP!&}IbFj^_Te!3hkr+3&& zm}W_kTdyAXO5Wh?cds$MsApb^(g@Y$++O9jYvAh zXHQag8nJ96PS)o58eu-UvC1pi+uagA<{;^4rf4FXDG|l}?O_r=e{CZP20wh`4Hl(u zuu(z!`XKIY<)6RKKRL|TIO%}b=m+D1^(YFmaGmARJF0>u!gxCV60d6Q>m)Ufad7F0%+MOLUX~kTMJG^0qrtLb5&JZY%V@cRm;Rm3rzy-PB+K`KePan-a!Icoi%Ca2Bv5lG;@$>5lrWTcE=yK)F$+=RWZcO|WzG0ryz-NR!gg}6 z!Iu3?!R1t;zp^y3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bGcopd{iVvb?J6?6KDv6w?G37xhZbMCuC zj_yIdHsA;s@sfw+s-)9yS*`LRdue*p`L)3Iiib6Hu;NivTZ0pC*`8$dY&DBM298Isqc@lZx)r%!#_%NM#hEOmWzLq zyy6Mnc-c?#sQ0A&l0mc!R=lZeuy|uONDfz2s zs%XR>baLj8IF97)!2&>kK79{Rtggbbib}u&9?YMwkg-?lv9Hj$y|NmQ$fry1SDodX3YmFTzfy&h4iOcRqFA zD@}*5t2uhxL~uwxjmp*n!o0J7NUB6u(7}3-=?uVhx?{ zcAv$I*3x5c_iA4GHcj!kLFaGF9YTDo#|PPMa13Q#!=EPvbQ(0?YSv;@x??81`TJWwrcL z39D~{yE)-Pc^KE!m+rg-)?ZmTRTe_;1QPs9RD8g-K{PoL5Q|~Gl|UvZN+2K7yhKzf W`G^y{O{67BmVFf%_YJP|T>l3sK(Yk@ diff --git a/packages/test-cases/cases/cli/wasm/deploy/002-no-ext/polywrap.build.yaml b/packages/test-cases/cases/cli/wasm/deploy/002-no-ext/polywrap.build.yaml index e897cd3cdc..9f8b2d1fc6 100644 --- a/packages/test-cases/cases/cli/wasm/deploy/002-no-ext/polywrap.build.yaml +++ b/packages/test-cases/cases/cli/wasm/deploy/002-no-ext/polywrap.build.yaml @@ -3,4 +3,4 @@ config: node_version: "14.16.0" linked_packages: - name: "@polywrap/wasm-as" - path: ../../../../../wasm/as + path: ../../../../../../wasm/as From 2283ae2978c2712dea265bdba0e37790360fc817 Mon Sep 17 00:00:00 2001 From: cbrzn Date: Tue, 5 Jul 2022 02:07:25 +0200 Subject: [PATCH 32/46] feat(ipfs-uri-resolve): fetch wrap.info & resolve uri tests are green --- packages/cli/src/lib/Compiler.ts | 23 ++++---- .../wasm/assemblyscript/polywrap.build.yaml | 2 +- .../cli/src/lib/project/PolywrapProject.ts | 31 ++++++----- .../src/__tests__/core/resolveUri.spec.ts | 1 - .../wrap/src/formats/wrap.info/deserialize.ts | 1 + .../ipfs-resolver/src/__tests__/e2e.spec.ts | 24 ++++----- .../uri-resolvers/ipfs-resolver/src/index.ts | 50 +++++++++--------- packages/js/test-env/src/generate-name.ts | 11 ++-- packages/js/test-env/src/index.ts | 2 +- .../js/test-env/src/wrappers/ens/wrap.info | Bin 74067 -> 74067 bytes 10 files changed, 73 insertions(+), 72 deletions(-) diff --git a/packages/cli/src/lib/Compiler.ts b/packages/cli/src/lib/Compiler.ts index a1d995b68d..3605ffa02d 100644 --- a/packages/cli/src/lib/Compiler.ts +++ b/packages/cli/src/lib/Compiler.ts @@ -2,18 +2,18 @@ /* eslint-disable @typescript-eslint/no-empty-function */ import { - PolywrapProject, - SchemaComposer, - withSpinner, - outputMetadata, + copyArtifactsFromBuildImage, + createBuildImage, + displayPath, generateDockerfile, generateDockerImageName, - createBuildImage, - copyArtifactsFromBuildImage, intlMsg, - resetDir, outputManifest, - displayPath, + outputMetadata, + PolywrapProject, + resetDir, + SchemaComposer, + withSpinner, } from "./"; import { PolywrapManifest } from "@polywrap/polywrap-manifest-types-js"; @@ -25,9 +25,9 @@ import { AsyncWasmInstance } from "@polywrap/asyncify-js"; import { Abi } from "@polywrap/schema-parse"; import { ComposerOutput } from "@polywrap/schema-compose"; import { - writeFileSync, - writeDirectorySync, normalizePath, + writeDirectorySync, + writeFileSync, } from "@polywrap/os-js"; import * as gluegun from "gluegun"; import fs from "fs"; @@ -365,7 +365,8 @@ export class Compiler { version: "0.0.1", }; - const encodedInfo = msgpackEncode(info); + const s = JSON.stringify(info); + const encodedInfo = msgpackEncode(JSON.parse(s)); writeFileSync(manifestPath, encodedInfo, { encoding: "binary", }); diff --git a/packages/cli/src/lib/defaults/build-images/wasm/assemblyscript/polywrap.build.yaml b/packages/cli/src/lib/defaults/build-images/wasm/assemblyscript/polywrap.build.yaml index f5c56ef46e..b0db2977f4 100644 --- a/packages/cli/src/lib/defaults/build-images/wasm/assemblyscript/polywrap.build.yaml +++ b/packages/cli/src/lib/defaults/build-images/wasm/assemblyscript/polywrap.build.yaml @@ -2,6 +2,6 @@ format: 0.0.1-prealpha.1 docker: dockerfile: ./Dockerfile.mustache config: - node_version: "14.16.0" + node_version: "16.13.0" include: - ./package.json diff --git a/packages/cli/src/lib/project/PolywrapProject.ts b/packages/cli/src/lib/project/PolywrapProject.ts index d13d10a255..6e20fd239c 100644 --- a/packages/cli/src/lib/project/PolywrapProject.ts +++ b/packages/cli/src/lib/project/PolywrapProject.ts @@ -1,17 +1,17 @@ /* eslint-disable @typescript-eslint/no-var-requires */ /* eslint-disable @typescript-eslint/naming-convention */ -import { ProjectConfig, Project } from "."; +import { Project, ProjectConfig } from "."; import { - loadPolywrapManifest, + isPolywrapManifestLanguage, loadBuildManifest, + loadDeployManifest, + loadDeployManifestExt, loadMetaManifest, + loadPolywrapManifest, + outputManifest, PolywrapManifestLanguage, polywrapManifestLanguages, - isPolywrapManifestLanguage, - outputManifest, - loadDeployManifest, - loadDeployManifestExt, polywrapManifestLanguageToBindLanguage, } from "./manifests"; import { Deployer } from "../deploy"; @@ -21,12 +21,12 @@ import { intlMsg } from "../intl"; import { BuildManifest, - PolywrapManifest, - MetaManifest, DeployManifest, + MetaManifest, + PolywrapManifest, } from "@polywrap/polywrap-manifest-types-js"; import { normalizePath } from "@polywrap/os-js"; -import { bindSchema, BindOutput, BindOptions } from "@polywrap/schema-bind"; +import { BindOptions, BindOutput, bindSchema } from "@polywrap/schema-bind"; import { ComposerOutput } from "@polywrap/schema-compose"; import { Abi } from "@polywrap/schema-parse"; import regexParser from "regex-parser"; @@ -43,13 +43,6 @@ export interface PolywrapProjectConfig extends ProjectConfig { } export class PolywrapProject extends Project { - private _polywrapManifest: PolywrapManifest | undefined; - private _buildManifest: BuildManifest | undefined; - private _deployManifest: DeployManifest | undefined; - private _metaManifest: MetaManifest | undefined; - private _defaultBuildImageCached = false; - private _defaultDeployModulesCached = false; - public static cacheLayout = { root: "wasm/", buildDir: "build/", @@ -60,6 +53,12 @@ export class PolywrapProject extends Project { deployDir: "deploy/", deployModulesDir: "deploy/modules/", }; + private _polywrapManifest: PolywrapManifest | undefined; + private _buildManifest: BuildManifest | undefined; + private _deployManifest: DeployManifest | undefined; + private _metaManifest: MetaManifest | undefined; + private _defaultBuildImageCached = false; + private _defaultDeployModulesCached = false; constructor(protected _config: PolywrapProjectConfig) { super(_config, { diff --git a/packages/js/client/src/__tests__/core/resolveUri.spec.ts b/packages/js/client/src/__tests__/core/resolveUri.spec.ts index e4635a2587..006325602d 100644 --- a/packages/js/client/src/__tests__/core/resolveUri.spec.ts +++ b/packages/js/client/src/__tests__/core/resolveUri.spec.ts @@ -257,7 +257,6 @@ describe("resolveUri", () => { const ipfsUri = new Uri(`ipfs/${deployResult.ipfsCid}`); const result = await client.resolveUri(ensUri); - expect(result.wrapper).toBeTruthy(); expect(result.uri).toEqual(ipfsUri); expect(result.error).toBeFalsy(); diff --git a/packages/js/manifests/wrap/src/formats/wrap.info/deserialize.ts b/packages/js/manifests/wrap/src/formats/wrap.info/deserialize.ts index aff11e75d0..d57b0405b5 100644 --- a/packages/js/manifests/wrap/src/formats/wrap.info/deserialize.ts +++ b/packages/js/manifests/wrap/src/formats/wrap.info/deserialize.ts @@ -27,6 +27,7 @@ export function deserializeWrapManifest( } catch (e) { throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); } + if (!options || !options.noValidate) { validateWrapManifest(anyWrapManifest); } diff --git a/packages/js/plugins/uri-resolvers/ipfs-resolver/src/__tests__/e2e.spec.ts b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/__tests__/e2e.spec.ts index 3b11236ee6..78e2e55e78 100644 --- a/packages/js/plugins/uri-resolvers/ipfs-resolver/src/__tests__/e2e.spec.ts +++ b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/__tests__/e2e.spec.ts @@ -1,11 +1,6 @@ import { PolywrapClient } from "@polywrap/client-js"; import { GetPathToTestWrappers } from "@polywrap/test-cases"; -import { - initTestEnvironment, - providers, - stopTestEnvironment, - buildAndDeployWrapper, -} from "@polywrap/test-env-js"; +import { buildAndDeployWrapper, initTestEnvironment, providers, stopTestEnvironment } from "@polywrap/test-env-js"; import { ipfsResolverPlugin } from ".."; import { ipfsPlugin } from "@polywrap/ipfs-plugin-js"; @@ -29,7 +24,7 @@ describe("IPFS Plugin", () => { wrapperAbsPath: `${GetPathToTestWrappers()}/wasm-as/simple-storage`, ipfsProvider: providers.ipfs, ethereumProvider: providers.ethereum, - ensName: "simple-storage.eth", + ensName: "simple.storage.eth" }); wrapperIpfsCid = ipfsCid; @@ -39,16 +34,16 @@ describe("IPFS Plugin", () => { { uri: "wrap://ens/ipfs.polywrap.eth", plugin: ipfsPlugin({ - provider: providers.ipfs, - }), + provider: providers.ipfs + }) }, { uri: "wrap://ens/ipfs-uri-resolver.polywrap.eth", plugin: ipfsResolverPlugin({ - provider: providers.ipfs, - }), - }, - ], + provider: providers.ipfs + }) + } + ] }); }); @@ -70,5 +65,8 @@ describe("IPFS Plugin", () => { const schema = await resolution.wrapper?.getSchema(client); expect(schema).toEqual(expectedSchema); + + const info = await resolution.wrapper?.getManifest({}, client); + expect(info?.name).toBe("SimpleStorage"); }); }); diff --git a/packages/js/plugins/uri-resolvers/ipfs-resolver/src/index.ts b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/index.ts index a63a9f57d2..b793d55e58 100644 --- a/packages/js/plugins/uri-resolvers/ipfs-resolver/src/index.ts +++ b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/index.ts @@ -1,12 +1,12 @@ import { - Module, - Args_tryResolveUri, Args_getFile, + Args_tryResolveUri, Bytes, - UriResolver_MaybeUriOrManifest, - manifest, - Ipfs_Module, Client, + Ipfs_Module, + manifest, + Module, + UriResolver_MaybeUriOrManifest, } from "./wrap"; import { PluginFactory } from "@polywrap/core-js"; @@ -34,31 +34,29 @@ export class IpfsResolverPlugin extends Module { return { manifest: null, uri: null }; } - const manifestSearchPatterns = ["polywrap.json"]; + const manifestSearchPattern = "wrap.info"; - let manifest: Buffer | undefined; + let manifest: Bytes | undefined; - for (const manifestSearchPattern of manifestSearchPatterns) { - try { - const manifestResult = await Ipfs_Module.cat( - { - cid: `${args.path}/${manifestSearchPattern}`, - options: { - timeout: 5000, - }, + try { + const manifestResult = await Ipfs_Module.cat( + { + cid: `${args.path}/${manifestSearchPattern}`, + options: { + timeout: 5000, }, - _client - ); - - if (manifestResult.data) { - manifest = Buffer.from(manifestResult.data); - } else { - throw new Error(); - } - } catch (e) { - // TODO: logging - // https://github.com/web3-api/monorepo/issues/33 + }, + _client + ); + + if (manifestResult.data) { + manifest = Buffer.from(manifestResult.data); + } else { + throw new Error(); } + } catch (e) { + // TODO: logging + // https://github.com/web3-api/monorepo/issues/33 } return { uri: null, manifest: manifest ?? null }; diff --git a/packages/js/test-env/src/generate-name.ts b/packages/js/test-env/src/generate-name.ts index 91d7c012cb..c79f49ff07 100644 --- a/packages/js/test-env/src/generate-name.ts +++ b/packages/js/test-env/src/generate-name.ts @@ -2,7 +2,7 @@ const getRandomInt = (min: number, max: number) => { return Math.floor(Math.random() * (max - min)) + min; }; -export const generateName = (): string => { +export const generateName = (subdomain: boolean = false): string => { const name1 = [ "abandoned", "able", @@ -1351,7 +1351,7 @@ export const generateName = (): string => { "zealous", "zesty", "zigzag", - "rocky", + "rocky" ]; const name2 = [ @@ -2855,11 +2855,16 @@ export const generateName = (): string => { "yesterday", "Thomas", "Tom", - "Lieuwe", + "Lieuwe" ]; const name = `${name1[getRandomInt(0, name1.length + 1)]}-${ name2[getRandomInt(0, name2.length + 1)] }`; + + if (subdomain) { + return name1[getRandomInt(0, 10)] + "." + name2[getRandomInt(10, 20)]; + } + return name; }; diff --git a/packages/js/test-env/src/index.ts b/packages/js/test-env/src/index.ts index b87e084dcb..13ec730758 100644 --- a/packages/js/test-env/src/index.ts +++ b/packages/js/test-env/src/index.ts @@ -241,7 +241,7 @@ export async function buildAndDeployWrapper({ ); // create a new ENS domain - const wrapperEns = ensName ?? `${generateName()}.eth`; + const wrapperEns = ensName ?? `${generateName(true)}.eth`; await buildWrapper(wrapperAbsPath); diff --git a/packages/js/test-env/src/wrappers/ens/wrap.info b/packages/js/test-env/src/wrappers/ens/wrap.info index 966e6b144b648d4a2401e1914ece2e619f584baa..4f2aa7e5bb3618052beedbda7ba56e2bf5cd7cd5 100644 GIT binary patch delta 44 zcmcb7h~@GjmWC~i#)=BMY0I1Ir A3jhEB delta 44 zcmcb7h~@GjmWC~i#)=B@Y0Iv@c AJpcdz From 2f17f327c1d96a14e20947e728d946f0b81328ab Mon Sep 17 00:00:00 2001 From: cbrzn Date: Tue, 5 Jul 2022 02:52:26 +0200 Subject: [PATCH 33/46] chore: lint is green + fixes in plugin tests --- packages/cli/src/commands/deploy.ts | 10 +++--- packages/cli/src/lib/Compiler.ts | 2 +- packages/cli/src/lib/project/AppProject.ts | 1 - .../cli/src/lib/project/manifests/index.ts | 2 +- .../cli/src/lib/project/manifests/output.ts | 6 +--- packages/js/client/package.json | 2 ++ .../src/algorithms/find-plugin-package.ts | 2 +- packages/js/manifests/polywrap/package.json | 1 - packages/js/manifests/wrap/package.json | 1 - .../js/manifests/wrap/scripts/generate.ts | 2 +- .../ens-resolver/src/__tests__/e2e.spec.ts | 34 +++++++++--------- .../ipfs-resolver/src/__tests__/e2e.spec.ts | 2 +- packages/js/test-env/src/generate-name.ts | 14 +++----- packages/js/test-env/src/index.ts | 7 ++-- .../js/test-env/src/wrappers/ens/wrap.wasm | Bin 265420 -> 266116 bytes packages/js/validation/package.json | 2 +- packages/manifests/polywrap/package.json | 3 -- packages/manifests/wrap/package.json | 3 -- 18 files changed, 37 insertions(+), 57 deletions(-) diff --git a/packages/cli/src/commands/deploy.ts b/packages/cli/src/commands/deploy.ts index 477de0bab6..0c43a49f79 100644 --- a/packages/cli/src/commands/deploy.ts +++ b/packages/cli/src/commands/deploy.ts @@ -1,5 +1,5 @@ /* eslint-disable prefer-const */ -import {Command, Program} from "./types"; +import { Command, Program } from "./types"; import { defaultPolywrapManifest, DeployerHandler, @@ -9,12 +9,12 @@ import { PolywrapProject, } from "../lib"; -import {DeployManifest} from "@polywrap/polywrap-manifest-types-js"; +import { DeployManifest } from "@polywrap/polywrap-manifest-types-js"; import fs from "fs"; import nodePath from "path"; -import {print} from "gluegun"; -import {Uri} from "@polywrap/core-js"; -import {validate} from "jsonschema"; +import { print } from "gluegun"; +import { Uri } from "@polywrap/core-js"; +import { validate } from "jsonschema"; const defaultManifestStr = defaultPolywrapManifest.join(" | "); const pathStr = intlMsg.commands_deploy_options_o_path(); diff --git a/packages/cli/src/lib/Compiler.ts b/packages/cli/src/lib/Compiler.ts index 3605ffa02d..2a5a6c9601 100644 --- a/packages/cli/src/lib/Compiler.ts +++ b/packages/cli/src/lib/Compiler.ts @@ -190,7 +190,7 @@ export class Compiler { compilerOverrides, }; - this._validateState(state); + await this._validateState(state); this._state = state; return this._state; diff --git a/packages/cli/src/lib/project/AppProject.ts b/packages/cli/src/lib/project/AppProject.ts index ba0389ccab..dcda2ea43a 100644 --- a/packages/cli/src/lib/project/AppProject.ts +++ b/packages/cli/src/lib/project/AppProject.ts @@ -7,7 +7,6 @@ import { appManifestLanguageToBindLanguage, } from "./manifests"; - import { AppManifest } from "@polywrap/polywrap-manifest-types-js"; import { Client } from "@polywrap/core-js"; import { ComposerOutput } from "@polywrap/schema-compose"; diff --git a/packages/cli/src/lib/project/manifests/index.ts b/packages/cli/src/lib/project/manifests/index.ts index 58431659d1..ed7f7251dd 100644 --- a/packages/cli/src/lib/project/manifests/index.ts +++ b/packages/cli/src/lib/project/manifests/index.ts @@ -7,7 +7,7 @@ export * from "./output"; import { PolywrapManifest, PluginManifest, - AppManifest + AppManifest, } from "@polywrap/polywrap-manifest-types-js"; export type AnyProjectManifest = diff --git a/packages/cli/src/lib/project/manifests/output.ts b/packages/cli/src/lib/project/manifests/output.ts index ff475f3e04..38cf7594fb 100644 --- a/packages/cli/src/lib/project/manifests/output.ts +++ b/packages/cli/src/lib/project/manifests/output.ts @@ -1,8 +1,4 @@ -import { - displayPath, - withSpinner, - intlMsg, -} from "../../"; +import { displayPath, withSpinner, intlMsg } from "../../"; import { BuildManifest, diff --git a/packages/js/client/package.json b/packages/js/client/package.json index 87ca8cad7e..2fbde0fe23 100644 --- a/packages/js/client/package.json +++ b/packages/js/client/package.json @@ -36,6 +36,8 @@ "@polywrap/sha3-plugin-js": "0.0.1-prealpha.91", "@polywrap/tracing-js": "0.0.1-prealpha.91", "@polywrap/uts46-plugin-js": "0.0.1-prealpha.91", + "@polywrap/msgpack-js": "0.0.1-prealpha.91", + "@polywrap/wrap-manifest-types-js": "0.0.1-prealpha.91", "graphql": "15.5.0", "js-yaml": "3.14.0", "uuid": "8.3.2" diff --git a/packages/js/core/src/algorithms/find-plugin-package.ts b/packages/js/core/src/algorithms/find-plugin-package.ts index d35c7bd723..162398325d 100644 --- a/packages/js/core/src/algorithms/find-plugin-package.ts +++ b/packages/js/core/src/algorithms/find-plugin-package.ts @@ -12,4 +12,4 @@ export const findPluginPackage = Tracer.traceFunc( return pluginRedirect?.plugin as PluginPackage | undefined; } -); \ No newline at end of file +); diff --git a/packages/js/manifests/polywrap/package.json b/packages/js/manifests/polywrap/package.json index 990b3a93c5..540d1befc7 100644 --- a/packages/js/manifests/polywrap/package.json +++ b/packages/js/manifests/polywrap/package.json @@ -11,7 +11,6 @@ "scripts": { "build": "rimraf ./build && tsc --project tsconfig.build.json", "prebuild": "ts-node ./scripts/generate.ts", - "lint": "eslint --color -c ../../.eslintrc.js .", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", "test:watch": "jest --watch --passWithNoTests --verbose" diff --git a/packages/js/manifests/wrap/package.json b/packages/js/manifests/wrap/package.json index e4755612df..0c540f1f48 100644 --- a/packages/js/manifests/wrap/package.json +++ b/packages/js/manifests/wrap/package.json @@ -11,7 +11,6 @@ "scripts": { "build": "rimraf ./build && tsc --project tsconfig.build.json", "prebuild": "ts-node ./scripts/generate.ts", - "lint": "eslint --color -c ../../.eslintrc.js .", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", "test:watch": "jest --watch --passWithNoTests --verbose" diff --git a/packages/js/manifests/wrap/scripts/generate.ts b/packages/js/manifests/wrap/scripts/generate.ts index 471d7003ae..55f0ebf057 100644 --- a/packages/js/manifests/wrap/scripts/generate.ts +++ b/packages/js/manifests/wrap/scripts/generate.ts @@ -145,7 +145,7 @@ async function generateFormatTypes() { }; generateFormatTypes() - .then(text => { + .then(() => { process.exit(); }) .catch(err => { diff --git a/packages/js/plugins/uri-resolvers/ens-resolver/src/__tests__/e2e.spec.ts b/packages/js/plugins/uri-resolvers/ens-resolver/src/__tests__/e2e.spec.ts index de2ff407ae..910ed05684 100644 --- a/packages/js/plugins/uri-resolvers/ens-resolver/src/__tests__/e2e.spec.ts +++ b/packages/js/plugins/uri-resolvers/ens-resolver/src/__tests__/e2e.spec.ts @@ -1,11 +1,11 @@ -import { PolywrapClient, defaultIpfsProviders } from "@polywrap/client-js"; +import { defaultIpfsProviders, PolywrapClient } from "@polywrap/client-js"; import { GetPathToTestWrappers } from "@polywrap/test-cases"; import { + buildAndDeployWrapper, + ensAddresses, initTestEnvironment, providers, - ensAddresses, - stopTestEnvironment, - buildAndDeployWrapper, + stopTestEnvironment } from "@polywrap/test-env-js"; import { ensResolverPlugin } from ".."; @@ -30,7 +30,7 @@ describe("ENS Resolver Plugin", () => { wrapperAbsPath: wrapperAbsPath, ipfsProvider: providers.ipfs, ethereumProvider: providers.ethereum, - ensName: "simple-storage.eth", + ensName: "cool.wrapper.eth" }); wrapperEnsDomain = ensDomain; @@ -41,29 +41,29 @@ describe("ENS Resolver Plugin", () => { uri: "wrap://ens/ipfs.polywrap.eth", plugin: ipfsPlugin({ provider: providers.ipfs, - fallbackProviders: defaultIpfsProviders, - }), + fallbackProviders: defaultIpfsProviders + }) }, { uri: "wrap://ens/ethereum.polywrap.eth", plugin: ethereumPlugin({ networks: { testnet: { - provider: providers.ethereum, - }, + provider: providers.ethereum + } }, - defaultNetwork: "testnet", - }), + defaultNetwork: "testnet" + }) }, { uri: "wrap://ens/ens-resolver.polywrap.eth", plugin: ensResolverPlugin({ addresses: { - testnet: ensAddresses.ensAddress, - }, - }), - }, - ], + testnet: ensAddresses.ensAddress + } + }) + } + ] }); }); @@ -88,7 +88,7 @@ describe("ENS Resolver Plugin", () => { expect(schema).toEqual(expectedSchema); const manifest = await resolution.wrapper?.getManifest( - { type: "polywrap" }, + {}, client ); diff --git a/packages/js/plugins/uri-resolvers/ipfs-resolver/src/__tests__/e2e.spec.ts b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/__tests__/e2e.spec.ts index 78e2e55e78..2aec48904c 100644 --- a/packages/js/plugins/uri-resolvers/ipfs-resolver/src/__tests__/e2e.spec.ts +++ b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/__tests__/e2e.spec.ts @@ -24,7 +24,7 @@ describe("IPFS Plugin", () => { wrapperAbsPath: `${GetPathToTestWrappers()}/wasm-as/simple-storage`, ipfsProvider: providers.ipfs, ethereumProvider: providers.ethereum, - ensName: "simple.storage.eth" + ensName: "simple-storage.eth" }); wrapperIpfsCid = ipfsCid; diff --git a/packages/js/test-env/src/generate-name.ts b/packages/js/test-env/src/generate-name.ts index c79f49ff07..5b07b40237 100644 --- a/packages/js/test-env/src/generate-name.ts +++ b/packages/js/test-env/src/generate-name.ts @@ -2,7 +2,7 @@ const getRandomInt = (min: number, max: number) => { return Math.floor(Math.random() * (max - min)) + min; }; -export const generateName = (subdomain: boolean = false): string => { +export const generateName = (): string => { const name1 = [ "abandoned", "able", @@ -1351,7 +1351,7 @@ export const generateName = (subdomain: boolean = false): string => { "zealous", "zesty", "zigzag", - "rocky" + "rocky", ]; const name2 = [ @@ -2855,16 +2855,10 @@ export const generateName = (subdomain: boolean = false): string => { "yesterday", "Thomas", "Tom", - "Lieuwe" + "Lieuwe", ]; - const name = `${name1[getRandomInt(0, name1.length + 1)]}-${ + return `${name1[getRandomInt(0, name1.length + 1)]}-${ name2[getRandomInt(0, name2.length + 1)] }`; - - if (subdomain) { - return name1[getRandomInt(0, 10)] + "." + name2[getRandomInt(10, 20)]; - } - - return name; }; diff --git a/packages/js/test-env/src/index.ts b/packages/js/test-env/src/index.ts index 13ec730758..562d0fd699 100644 --- a/packages/js/test-env/src/index.ts +++ b/packages/js/test-env/src/index.ts @@ -241,7 +241,7 @@ export async function buildAndDeployWrapper({ ); // create a new ENS domain - const wrapperEns = ensName ?? `${generateName(true)}.eth`; + const wrapperEns = ensName ?? `${generateName()}.eth`; await buildWrapper(wrapperAbsPath); @@ -318,10 +318,7 @@ export async function buildAndDeployWrapper({ // manually configure manifests - const { - __type, - ...polywrapManifest - } = deserializePolywrapManifest( + const { __type, ...polywrapManifest } = deserializePolywrapManifest( fs.readFileSync(manifestPath, "utf-8") ); diff --git a/packages/js/test-env/src/wrappers/ens/wrap.wasm b/packages/js/test-env/src/wrappers/ens/wrap.wasm index 48ae319aef95c448093fc9cf3a6f27fd77e175b1..cd55e60e45dd68f6c26896253b54a6f398bf0148 100644 GIT binary patch delta 5500 zcmZu!3wRXO72bQ!>~4|`WFe6}f!RO;zKCdvg(A&Z6M-U%hyq$GqS%540=}?H(xOz$ zRu&UDf&mj=;gR41$^hL$P(YCd5=E$(Pq$xuAVvsPAnF1=ckb@8pv(7h=id9D=YP(b zNpO+-`Pbe4XA!oqpFIoBStur64Zb60Yd?{gB_B=<6(@$nIi&t`A(Os+Rk$iA|0$W8 zZh?trS(TWeL8V5e#~{<>yS}+ZATy zz@Aj9zDo3=qPs+Ax^FE1_kbyKXiXQ$qsBR+6Fpo2SzQucy|7p-(rtag<^h+EH6R~L@HkZj;kc?Z4FfRgDhhRX*-^ulbd$bGv<81hP#bb>5hc(jO0O)5>xg+kC+ zuYpkk-C@|=c`Srfwm_toYdS-0x&_aW@B|6hVsOoU2ZOaZ3m1K{T(QTXQO$M*M(K`C zYI8&(M$YV*4(Squa1|sP zbok(t*W!DRxx(@K&HsX zU8g7MTq(;Il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S8e5FNnk<7|KczV@u%lWH_y@3|6-A_5#Gds;B$x7 zy>OF_32X@84{2aex-I5O`LdS#efoP$p-m?+7Uj@JdiRz(yB>P@HeY?4!=(3F|3Dhr z3}ktqF*@Gi(wtkg{+-_1?CV|3QcJT{Xggg`V{b}m;LbKwGzpjswyj#>;laAMl>e=9 zEyV{S<}v~ezl%DsZHqMSE>Eyc(VV_u~t7vx*yFf^3_WMN$Y;Vz1j|y#W z#0MborP{0{dZ7`Yg329a7Tmd-MxIUE&Tz2UBK3j5PS&^tLX{eqNl5YB%Pb-N0|Hel zZaNhTX)*+Mg==YB!ebd$o~M&~Mu)B1t!XI-iM4ns9;Ii%T}=~E8i1kdh)G_Qiomu< zV|iVY;=#Q~J(osBlJq<{_tJkPX`ArTHAzaLT{>wEHhdj9J1bf$Lg#*<$#!mlMbENB z`)Ryh`WoCd8e*P-5q&l4y!L>G8ro%$tmHOGCUDoPK@Sn2zZ;}XN{o@x!RBi=V>;Rn zMxNW+7^x2iIJ)P>)cZRBVF(%`%QQGvibrQ1&>0tNnHno)g0GJ3v0StBkcN6ER+qJeT6;C_Go!;w7G|6Kdj1{{#K-ZZ-e_ diff --git a/packages/js/validation/package.json b/packages/js/validation/package.json index cbe3f9c23c..bf56b5df2d 100644 --- a/packages/js/validation/package.json +++ b/packages/js/validation/package.json @@ -20,7 +20,7 @@ }, "dependencies": { "@polywrap/wrap-manifest-types-js": "0.0.1-prealpha.91", - "@polywrap/schema-parse": "0.0.1-prealpha.91" + "@polywrap/schema-compose": "0.0.1-prealpha.91" }, "devDependencies": { "@types/jest": "26.0.8", diff --git a/packages/manifests/polywrap/package.json b/packages/manifests/polywrap/package.json index d0a9e3cfd7..900823c289 100644 --- a/packages/manifests/polywrap/package.json +++ b/packages/manifests/polywrap/package.json @@ -8,9 +8,6 @@ "url": "https://github.com/polywrap/monorepo.git" }, "main": "./package.json", - "scripts": { - "lint": "eslint --color -c ../../.eslintrc.js ." - }, "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", "publishConfig": { "access": "public" diff --git a/packages/manifests/wrap/package.json b/packages/manifests/wrap/package.json index 08166001d2..09db8bf598 100644 --- a/packages/manifests/wrap/package.json +++ b/packages/manifests/wrap/package.json @@ -8,9 +8,6 @@ "url": "https://github.com/polywrap/monorepo.git" }, "main": "./package.json", - "scripts": { - "lint": "eslint --color -c ../../.eslintrc.js ." - }, "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", "publishConfig": { "access": "public" From c56c538be52e045d38381668abcdfaad1763f55c Mon Sep 17 00:00:00 2001 From: cbrzn Date: Tue, 5 Jul 2022 03:01:26 +0200 Subject: [PATCH 34/46] chore: delete notes file & fix ipfs uri resolver test --- notes | 38 ------------------- packages/cli/src/commands/run.ts | 2 +- .../ipfs-resolver/src/__tests__/e2e.spec.ts | 2 +- 3 files changed, 2 insertions(+), 40 deletions(-) delete mode 100644 notes diff --git a/notes b/notes deleted file mode 100644 index 8fcabee8f5..0000000000 --- a/notes +++ /dev/null @@ -1,38 +0,0 @@ -manifest - polywrap/ - schema/ - package.json - formats/ - polywrap.app/ - 0.0.1.json - polywrap.wasm/ - 0.0.1.json - polywrap.plugin/ - 0.0.1.json - binding/ - typescript/ - package.json - scripts/ - templates/ - deserialize-ts.mustache - generate.ts - src/ - index.ts - deserialize.ts - wrap/ - schema/ - package.json - formats/ - 0.0.1.json - binding/ - typescript/ - package.json - scripts/ - templates/ - deserialize-ts.mustache - generate.ts - src/ - index.ts - deserialize.ts - python/ - rust/ diff --git a/packages/cli/src/commands/run.ts b/packages/cli/src/commands/run.ts index 08e5fc31ec..b67fc91647 100644 --- a/packages/cli/src/commands/run.ts +++ b/packages/cli/src/commands/run.ts @@ -115,7 +115,7 @@ const _run = async (workflowPath: string, options: WorkflowCommandOptions) => { if (outputFile) { const outputFileExt = path.extname(outputFile).substring(1); - if (!outputFileExt) throw new Error("Require output file extention"); + if (!outputFileExt) throw new Error("Require output file extension"); switch (outputFileExt) { case "yaml": case "yml": diff --git a/packages/js/plugins/uri-resolvers/ipfs-resolver/src/__tests__/e2e.spec.ts b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/__tests__/e2e.spec.ts index 2aec48904c..1addb8a935 100644 --- a/packages/js/plugins/uri-resolvers/ipfs-resolver/src/__tests__/e2e.spec.ts +++ b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/__tests__/e2e.spec.ts @@ -24,7 +24,7 @@ describe("IPFS Plugin", () => { wrapperAbsPath: `${GetPathToTestWrappers()}/wasm-as/simple-storage`, ipfsProvider: providers.ipfs, ethereumProvider: providers.ethereum, - ensName: "simple-storage.eth" + ensName: "cool.wrapper.eth" }); wrapperIpfsCid = ipfsCid; From 8a28e51b92984c530cfce4d7e99a65a1cc861eb3 Mon Sep 17 00:00:00 2001 From: cbrzn Date: Tue, 5 Jul 2022 11:23:56 +0200 Subject: [PATCH 35/46] chore: update ens wrapper in test env js --- .../js/test-env/src/wrappers/ens/wrap.wasm | Bin 266116 -> 266270 bytes .../simple-storage/polywrap.deploy-temp.yaml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/js/test-env/src/wrappers/ens/wrap.wasm b/packages/js/test-env/src/wrappers/ens/wrap.wasm index cd55e60e45dd68f6c26896253b54a6f398bf0148..7371c165407e7b58cd1c7a4d6c2d197200b61c91 100644 GIT binary patch delta 1621 zcmZ8hO>7%Q6yA9=PEyvfC-yq=U&F5L#CD5n*G=4VfsCL=%B4}oAqf(2K|%ozlpk?G zF``tJsH#>Ncomh}Mu^g$sD#u73DF+f10o1f_0Ut5W7P!2u|lZf&8}x_>dWrF_r34? z=Dp|n6 z;tk(K8{*+xwhc0TD{5Uw>)MZWI1#zz&vJRv))rEzT9BPjg)~f$7<4=x z(LkRj{W!#lAf%+a@+!-nusS6`=o@`8nX1P93 zF!HRy5d|lbOH5@A#;mkrD;|%7O^xBo(&C)YLASr~sAeEDD^$)fg#*YL7Ne9md94(f z&Ets~sE-L%Fsa~gRlu7w;AVs>ns8K6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3gDq%Fk|^fGr=qMw_nwuAF>i^f$2Cp#MR zBGb{Zu4Fvka!i4KjHSvu31i!Y?)=AkD7)N>jE9sy_GBN*@*UtCHQ9oZ(i&QC@y#=I zwS~%lX}wsl-@sn}I}yyr>(LA@aV4VZHNj<7s5XaZ^3qnLxPku2Ayqmzhk8@mT7>A+ zE?(JAJ!sGLtpgVI|V$sPMLU>yz>8X9VwfgT~3mNeP-RSU#&V3*|C!SAJ=B#*@9{E=6_Voe0GK8Co{yYKl$ByF4 zAnq!k-zrtCCW*hd#sAA&dmmrt#8>pw20~r`jSsOrA~t=FZ04}llj>jk5vRsQ=N)?+ KzP&AP)cyr7IvczI diff --git a/packages/test-cases/cases/wrappers/wasm-as/simple-storage/polywrap.deploy-temp.yaml b/packages/test-cases/cases/wrappers/wasm-as/simple-storage/polywrap.deploy-temp.yaml index 36cfbd69d4..541b321ea8 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/simple-storage/polywrap.deploy-temp.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/simple-storage/polywrap.deploy-temp.yaml @@ -10,6 +10,6 @@ stages: package: ens depends_on: ipfsDeploy config: - domainName: good-natured-reveal.eth + domainName: simple-storage.eth provider: http://localhost:8545 ensRegistryAddress: '0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab' From cc4a3afff2131c07c46659b38f5a2baf11df730b Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Tue, 5 Jul 2022 13:18:02 +0200 Subject: [PATCH 36/46] change polywrap to wrap, using schema file as test validation, checking type in manifest --- packages/cli/src/__tests__/e2e/build.spec.ts | 2 +- .../src/__tests__/core/wasm-wrapper.spec.ts | 24 ++++++++++++------- .../src/__tests__/e2e.spec.ts | 11 ++++----- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/packages/cli/src/__tests__/e2e/build.spec.ts b/packages/cli/src/__tests__/e2e/build.spec.ts index 6a651ee2ff..83f985463d 100644 --- a/packages/cli/src/__tests__/e2e/build.spec.ts +++ b/packages/cli/src/__tests__/e2e/build.spec.ts @@ -180,7 +180,7 @@ describe("e2e tests for build command", () => { expect(error).toBe(""); expect(code).toEqual(0); expect(output).toContain(`Artifacts written to ${buildDir}`); - expect(output).toContain(`Manifest written to ${buildDir}/polywrap.json`); + expect(output).toContain(`Manifest written to ${buildDir}/wrap.info`); testBuildOutput(testCaseDir, outputDir); }); diff --git a/packages/js/client/src/__tests__/core/wasm-wrapper.spec.ts b/packages/js/client/src/__tests__/core/wasm-wrapper.spec.ts index 8753e8795f..25e4c57c00 100644 --- a/packages/js/client/src/__tests__/core/wasm-wrapper.spec.ts +++ b/packages/js/client/src/__tests__/core/wasm-wrapper.spec.ts @@ -14,6 +14,7 @@ import { Subscription } from "../.."; import { GetPathToTestWrappers } from "@polywrap/test-cases"; +import fs from "fs"; jest.setTimeout(200000); @@ -22,8 +23,8 @@ describe("wasm-wrapper", () => { let ethProvider: string; let ensAddress: string; - const wrapperPath = `${GetPathToTestWrappers()}/wasm-as/simple-storage` - const wrapperUri = `fs/${wrapperPath}/build` + const wrapperPath = `${GetPathToTestWrappers()}/wasm-as/simple-storage`; + const wrapperUri = `fs/${wrapperPath}/build`; beforeAll(async () => { await initTestEnvironment(); @@ -229,18 +230,25 @@ describe("wasm-wrapper", () => { test("getFile -- simple-storage polywrap", async () => { const client = await getClient(); + const expectedSchema = await fs.promises.readFile( + `${wrapperPath}/build/schema.graphql`, + "utf8" + ); + const fileStr: string = (await client.getFile(wrapperUri, { path: "./schema.graphql", encoding: "utf8", })) as string; - expect(fileStr).toContain(`type Module @imports`); + + expect(fileStr).toEqual(expectedSchema); const fileBuffer: Uint8Array = (await client.getFile(wrapperUri, { path: "./schema.graphql", })) as Uint8Array; const decoder = new TextDecoder("utf8"); const text = decoder.decode(fileBuffer); - expect(text).toContain(`type Module @imports`); + + expect(text).toEqual(expectedSchema); await expect(() => client.getFile(new Uri("wrap://ens/ipfs.polywrap.eth"), { @@ -306,8 +314,8 @@ describe("wasm-wrapper", () => { args: { address: address, connection: { - networkNameOrChainId: "testnet" - } + networkNameOrChainId: "testnet", + }, }, frequency: { ms: 4500 }, }); @@ -384,8 +392,8 @@ describe("wasm-wrapper", () => { args: { address: address, connection: { - networkNameOrChainId: "testnet" - } + networkNameOrChainId: "testnet", + }, }, frequency: { ms: 4500 }, }); diff --git a/packages/js/plugins/uri-resolvers/file-system-resolver/src/__tests__/e2e.spec.ts b/packages/js/plugins/uri-resolvers/file-system-resolver/src/__tests__/e2e.spec.ts index 07b617de33..540591662f 100644 --- a/packages/js/plugins/uri-resolvers/file-system-resolver/src/__tests__/e2e.spec.ts +++ b/packages/js/plugins/uri-resolvers/file-system-resolver/src/__tests__/e2e.spec.ts @@ -82,8 +82,8 @@ describe("Filesystem plugin", () => { method: "deployContract", args: { connection: { - networkNameOrChainId: "testnet" - } + networkNameOrChainId: "testnet", + }, }, }); @@ -105,17 +105,16 @@ describe("Filesystem plugin", () => { expect(manifest).toBeTruthy(); expect(manifest.version).toBe("0.0.1"); + expect(manifest.type).toEqual("wasm"); // get a file const file = await client.getFile(fsUri, { path: "wrap.info", }); - const expectedFile = await fs.promises.readFile( - `${fsPath}/wrap.info` - ); + const expectedFile = await fs.promises.readFile(`${fsPath}/wrap.info`); - const expectedInfo = Uint8Array.from(expectedFile) + const expectedInfo = Uint8Array.from(expectedFile); expect(file).toStrictEqual(expectedInfo); }); }); From 472628283d3d204f85a237a8cc1579ef13a332df Mon Sep 17 00:00:00 2001 From: cbrzn Date: Tue, 5 Jul 2022 13:53:44 +0200 Subject: [PATCH 37/46] chore: update ens wrapper --- .../js/test-env/src/wrappers/ens/wrap.wasm | Bin 266270 -> 265729 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/packages/js/test-env/src/wrappers/ens/wrap.wasm b/packages/js/test-env/src/wrappers/ens/wrap.wasm index 7371c165407e7b58cd1c7a4d6c2d197200b61c91..4d5cda05db1d386b0bc046163ac1c68c2bc8b443 100644 GIT binary patch delta 4193 zcm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)@Ca`IrSvLXQJPSvless-pbI@cwot73l%3XBS)TZNmLWIo&_u)*` z-s^&WX4y=fzLZ)rwOnd_1vULn+hevzZF6k@X{+Nqm2SK0XLK*4g%>ez@C_{18S@1H z&#^sXn`iqCKYwj|mVVKTd5+)ktIcSl>~FCOIs+8yMK{g*7B>h#UHKNvp=pJZ-Fg}~ zKxaL5fR^tXmTJrBtEc8nEsyfMumqb{0`(upK@>ZHRn&S0%QQC7K+RoD7G6cwJvfCb zzLU(W$+*JSrtHRI@_mQ@22G?SkG+X^S*o-?O|wJO%S!BDf2=zJ>g#*yHERjIjlqDFPySO@+!N>aU%`J=}$jjGS$aPT+K>`Pcc z3(n#KXjrR4^jsBUcrD$WuI1D1=Ws0e*D0F7Ih=?7^+3%*p00xPxCk49@l}Xd(A21W zyE`U*YqSbNbup~uS*C zn^dZ01JKg%aVT_eqHW(}8T$DP#(v~e_xCc2%?juJ8{*HwZ z*&@Zil9FrFxJD8F3R#g1ImCI6HR4EXi`MsI4s^bu(lY$2wDi3}3r}+FFI>QBqLcn| z0XIWmlZC4Ob0QR*2`M$(^$^Q@Tpzc4(!d*}LaRz_=5Bv}4`)?KM>>qF*^zBrO z)7HXN0hC`AK*KIol+}G$iJiNEsvDTRx*yBHh*0$v9`48<6=UZWoCZyA%Rb1XP(SB? z!aung`cft9Sb~voY93wv_-p9gt3q7b&ms2hO>)#gg~w|NqRTd|PFrfF4n zF3CPcwJM-3!p_$CWQ`Eo0}yFbEbD|;!<}t!^k0^Is4ed z_35nhhjeW)?dLb}A6ACC(%De>uyRY!&}zWnuDG7b(B^@^gQlM1QZ;obcsXB8ptD2O z>)$iAX(CLaOsz_E%ZHnOkoygvDsa%Lxv0je4TMOli+_fq0Q_7 From f0b5bca0065dbaf0b7f4ec5559091de6b524be4d Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Tue, 5 Jul 2022 14:02:17 +0200 Subject: [PATCH 38/46] using local plugin package to test schema --- .../src/__tests__/core/plugin-wrapper.spec.ts | 107 ++++-------------- 1 file changed, 22 insertions(+), 85 deletions(-) diff --git a/packages/js/client/src/__tests__/core/plugin-wrapper.spec.ts b/packages/js/client/src/__tests__/core/plugin-wrapper.spec.ts index b87ef610a5..77fbfe6997 100644 --- a/packages/js/client/src/__tests__/core/plugin-wrapper.spec.ts +++ b/packages/js/client/src/__tests__/core/plugin-wrapper.spec.ts @@ -85,92 +85,29 @@ describe("plugin-wrapper", () => { }); test("getSchema -- plugin schema", async () => { - const client = await getClient(); - const schema: string = await client.getSchema( - "wrap://ens/js-logger.polywrap.eth" - ); + const testPluginUri = "ens/test-plugin.eth"; + const pluginSchema = "type Module { someMethod(arg: String): String }"; - expect(schema).toStrictEqual( - `### 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 ### -` - ); + const pluginPackage = { + factory: () => ({} as PluginModule<{}>), + manifest: { + schema: pluginSchema, + implements: [], + }, + }; + + const client = new PolywrapClient({ + plugins: [ + { + uri: testPluginUri, + plugin: pluginPackage, + }, + ], + }); + + const schema: string = await client.getSchema(testPluginUri); + + expect(schema).toStrictEqual(pluginSchema); }); it("plugin map types", async () => { From 9cd3d7136b36e7e76c016c9115719959062cd38c Mon Sep 17 00:00:00 2001 From: cbrzn Date: Tue, 5 Jul 2022 14:09:24 +0200 Subject: [PATCH 39/46] chore: uses same ens of integrations repository --- .../test-env/src/wrappers/ens/schema.graphql | 10 +++++----- .../js/test-env/src/wrappers/ens/wrap.info | Bin 74067 -> 74059 bytes 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/js/test-env/src/wrappers/ens/schema.graphql b/packages/js/test-env/src/wrappers/ens/schema.graphql index b7cae7ce0a..1b939e94f5 100644 --- a/packages/js/test-env/src/wrappers/ens/schema.graphql +++ b/packages/js/test-env/src/wrappers/ens/schema.graphql @@ -308,11 +308,6 @@ type Module @imports( ): CreateSubdomainInOpenDomainAndSetContentHashResponse } -type TxOverrides { - gasPrice: BigInt - gasLimit: BigInt -} - type ConfigureOpenDomainResponse { fifsRegistrarAddress: String! registerOpenDomainTxReceipt: Ethereum_TxResponse! @@ -336,6 +331,11 @@ type RegistrationResult { tx: Ethereum_TxResponse } +type TxOverrides { + gasPrice: BigInt + gasLimit: BigInt +} + ### Imported Modules START ### type Ethereum_Module @imported( diff --git a/packages/js/test-env/src/wrappers/ens/wrap.info b/packages/js/test-env/src/wrappers/ens/wrap.info index 4f2aa7e5bb3618052beedbda7ba56e2bf5cd7cd5..d71d19b91b2408f4c003f465281acee9995d8440 100644 GIT binary patch delta 61 zcmV-D0K)&%!UW601dtiCcLBr+0fv)-$QH3GM*)L73%5H90rV9dqh)S$q;z?3Wu$ju Tb8V+~WpZ;ei+!_I! zlW;-`livXlvmODz2!lHdw>t{~^c5tlWo~mVcXDBHaAk6&ba`-Pq<3L+ZKrl+a&u{K KZly3TFfK6-`6oL7 From 12836835b82431d246a2bc287199e8fb6bcf232c Mon Sep 17 00:00:00 2001 From: cbrzn Date: Tue, 5 Jul 2022 14:15:19 +0200 Subject: [PATCH 40/46] chore: removing unsued file --- .../cases/cli/wasm/run/workflows/output.json | 14 -------------- .../wasm-as/simple-storage/polywrap-temp.yaml | 8 -------- .../simple-storage/polywrap.deploy-temp.yaml | 15 --------------- 3 files changed, 37 deletions(-) delete mode 100644 packages/test-cases/cases/cli/wasm/run/workflows/output.json delete mode 100644 packages/test-cases/cases/wrappers/wasm-as/simple-storage/polywrap-temp.yaml delete mode 100644 packages/test-cases/cases/wrappers/wasm-as/simple-storage/polywrap.deploy-temp.yaml diff --git a/packages/test-cases/cases/cli/wasm/run/workflows/output.json b/packages/test-cases/cases/cli/wasm/run/workflows/output.json deleted file mode 100644 index 513054b1da..0000000000 --- a/packages/test-cases/cases/cli/wasm/run/workflows/output.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "id": "cases.0", - "error": {} - }, - { - "id": "cases.case1.0", - "error": {} - }, - { - "id": "cases.case1.1", - "error": {} - } -] \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/simple-storage/polywrap-temp.yaml b/packages/test-cases/cases/wrappers/wasm-as/simple-storage/polywrap-temp.yaml deleted file mode 100644 index 41f4623e9f..0000000000 --- a/packages/test-cases/cases/wrappers/wasm-as/simple-storage/polywrap-temp.yaml +++ /dev/null @@ -1,8 +0,0 @@ -format: 0.0.1-prealpha.9 -name: SimpleStorage -language: wasm/assemblyscript -build: ./polywrap.build.yaml -meta: ./polywrap.meta.yaml -schema: ./schema.graphql -module: ./src/index.ts -deploy: ./polywrap.deploy-temp.yaml diff --git a/packages/test-cases/cases/wrappers/wasm-as/simple-storage/polywrap.deploy-temp.yaml b/packages/test-cases/cases/wrappers/wasm-as/simple-storage/polywrap.deploy-temp.yaml deleted file mode 100644 index 541b321ea8..0000000000 --- a/packages/test-cases/cases/wrappers/wasm-as/simple-storage/polywrap.deploy-temp.yaml +++ /dev/null @@ -1,15 +0,0 @@ -format: 0.0.1-prealpha.1 -stages: - ipfsDeploy: - package: ipfs - uri: >- - fs//home/cesar/dev/polywrap/monorepo/packages/test-cases/cases/wrappers/wasm-as/simple-storage/build - config: - gatewayUri: http://localhost:5001 - ensPublish: - package: ens - depends_on: ipfsDeploy - config: - domainName: simple-storage.eth - provider: http://localhost:8545 - ensRegistryAddress: '0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab' From 5ec7867959706720fe5c637ecbf6d35974e228d2 Mon Sep 17 00:00:00 2001 From: cbrzn Date: Tue, 5 Jul 2022 14:34:30 +0200 Subject: [PATCH 41/46] chore(cli): tests should be green --- packages/cli/src/__tests__/e2e/build.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/__tests__/e2e/build.spec.ts b/packages/cli/src/__tests__/e2e/build.spec.ts index 83f985463d..33df90e861 100644 --- a/packages/cli/src/__tests__/e2e/build.spec.ts +++ b/packages/cli/src/__tests__/e2e/build.spec.ts @@ -180,7 +180,7 @@ describe("e2e tests for build command", () => { expect(error).toBe(""); expect(code).toEqual(0); expect(output).toContain(`Artifacts written to ${buildDir}`); - expect(output).toContain(`Manifest written to ${buildDir}/wrap.info`); + expect(output).toContain(`WRAP manifest written in ${buildDir}/wrap.info`); testBuildOutput(testCaseDir, outputDir); }); From 0c109d67b197ed18889e3ea649577a738fe16202 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Tue, 5 Jul 2022 15:48:48 -0700 Subject: [PATCH 42/46] core-interfaces -> interfaces + make public --- .github/CODEOWNERS | 2 +- package.json | 2 +- packages/{core-interfaces => interfaces}/README.md | 0 .../{core-interfaces => interfaces}/file-system/README.md | 0 .../{core-interfaces => interfaces}/file-system/package.json | 1 - .../file-system/polywrap.deploy.yaml | 0 .../{core-interfaces => interfaces}/file-system/polywrap.yaml | 0 .../file-system/src/schema.graphql | 0 packages/{core-interfaces => interfaces}/ipfs/README.md | 0 packages/{core-interfaces => interfaces}/ipfs/package.json | 2 +- .../{core-interfaces => interfaces}/ipfs/polywrap.deploy.yaml | 0 packages/{core-interfaces => interfaces}/ipfs/polywrap.yaml | 0 .../{core-interfaces => interfaces}/ipfs/src/schema.graphql | 0 packages/{core-interfaces => interfaces}/logger/README.md | 0 packages/{core-interfaces => interfaces}/logger/package.json | 1 - .../logger/polywrap.deploy.yaml | 0 packages/{core-interfaces => interfaces}/logger/polywrap.yaml | 0 .../{core-interfaces => interfaces}/logger/src/schema.graphql | 0 .../{core-interfaces => interfaces}/uri-resolver/README.md | 0 .../{core-interfaces => interfaces}/uri-resolver/package.json | 1 - .../uri-resolver/polywrap.deploy.yaml | 0 .../uri-resolver/polywrap.yaml | 0 .../uri-resolver/src/schema.graphql | 0 packages/js/plugins/file-system/polywrap.plugin.yaml | 2 +- packages/js/plugins/ipfs/polywrap.plugin.yaml | 2 +- packages/js/plugins/logger/polywrap.plugin.yaml | 2 +- .../plugins/uri-resolvers/ens-resolver/polywrap.plugin.yaml | 2 +- .../uri-resolvers/file-system-resolver/polywrap.plugin.yaml | 4 ++-- .../plugins/uri-resolvers/ipfs-resolver/polywrap.plugin.yaml | 4 ++-- 29 files changed, 11 insertions(+), 14 deletions(-) rename packages/{core-interfaces => interfaces}/README.md (100%) rename packages/{core-interfaces => interfaces}/file-system/README.md (100%) rename packages/{core-interfaces => interfaces}/file-system/package.json (96%) rename packages/{core-interfaces => interfaces}/file-system/polywrap.deploy.yaml (100%) rename packages/{core-interfaces => interfaces}/file-system/polywrap.yaml (100%) rename packages/{core-interfaces => interfaces}/file-system/src/schema.graphql (100%) rename packages/{core-interfaces => interfaces}/ipfs/README.md (100%) rename packages/{core-interfaces => interfaces}/ipfs/package.json (96%) rename packages/{core-interfaces => interfaces}/ipfs/polywrap.deploy.yaml (100%) rename packages/{core-interfaces => interfaces}/ipfs/polywrap.yaml (100%) rename packages/{core-interfaces => interfaces}/ipfs/src/schema.graphql (100%) rename packages/{core-interfaces => interfaces}/logger/README.md (100%) rename packages/{core-interfaces => interfaces}/logger/package.json (96%) rename packages/{core-interfaces => interfaces}/logger/polywrap.deploy.yaml (100%) rename packages/{core-interfaces => interfaces}/logger/polywrap.yaml (100%) rename packages/{core-interfaces => interfaces}/logger/src/schema.graphql (100%) rename packages/{core-interfaces => interfaces}/uri-resolver/README.md (100%) rename packages/{core-interfaces => interfaces}/uri-resolver/package.json (96%) rename packages/{core-interfaces => interfaces}/uri-resolver/polywrap.deploy.yaml (100%) rename packages/{core-interfaces => interfaces}/uri-resolver/polywrap.yaml (100%) rename packages/{core-interfaces => interfaces}/uri-resolver/src/schema.graphql (100%) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index eef213ac42..6a958e7c3d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -16,7 +16,7 @@ packages/manifest-schemas/ @dOrgJelli packages/js/cli @dOrgJelli @krisbitney @namesty @nerfZael @Niraj-Kamdar # Client Interfaces -packages/core-interfaces @dOrgJelli +packages/interfaces @dOrgJelli # JS Client packages/js/client @dOrgJelli @krisbitney @namesty @nerfZael diff --git a/package.json b/package.json index 232ff5856c..b443736662 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "workspaces": { "packages": [ "./packages/cli", - "./packages/core-interfaces/**", + "./packages/interfaces/**", "./packages/js/**", "./packages/manifests/**", "./packages/schema/**", diff --git a/packages/core-interfaces/README.md b/packages/interfaces/README.md similarity index 100% rename from packages/core-interfaces/README.md rename to packages/interfaces/README.md diff --git a/packages/core-interfaces/file-system/README.md b/packages/interfaces/file-system/README.md similarity index 100% rename from packages/core-interfaces/file-system/README.md rename to packages/interfaces/file-system/README.md diff --git a/packages/core-interfaces/file-system/package.json b/packages/interfaces/file-system/package.json similarity index 96% rename from packages/core-interfaces/file-system/package.json rename to packages/interfaces/file-system/package.json index cdddfea195..eb2918e591 100644 --- a/packages/core-interfaces/file-system/package.json +++ b/packages/interfaces/file-system/package.json @@ -1,7 +1,6 @@ { "name": "@polywrap/file-system-interface", "description": "Polywrap Filesystem Interface", - "private": true, "version": "0.0.1-prealpha.92", "scripts": { "build": "node ../../../dependencies/node_modules/polywrap/bin/polywrap build", diff --git a/packages/core-interfaces/file-system/polywrap.deploy.yaml b/packages/interfaces/file-system/polywrap.deploy.yaml similarity index 100% rename from packages/core-interfaces/file-system/polywrap.deploy.yaml rename to packages/interfaces/file-system/polywrap.deploy.yaml diff --git a/packages/core-interfaces/file-system/polywrap.yaml b/packages/interfaces/file-system/polywrap.yaml similarity index 100% rename from packages/core-interfaces/file-system/polywrap.yaml rename to packages/interfaces/file-system/polywrap.yaml diff --git a/packages/core-interfaces/file-system/src/schema.graphql b/packages/interfaces/file-system/src/schema.graphql similarity index 100% rename from packages/core-interfaces/file-system/src/schema.graphql rename to packages/interfaces/file-system/src/schema.graphql diff --git a/packages/core-interfaces/ipfs/README.md b/packages/interfaces/ipfs/README.md similarity index 100% rename from packages/core-interfaces/ipfs/README.md rename to packages/interfaces/ipfs/README.md diff --git a/packages/core-interfaces/ipfs/package.json b/packages/interfaces/ipfs/package.json similarity index 96% rename from packages/core-interfaces/ipfs/package.json rename to packages/interfaces/ipfs/package.json index 7b02e5beb4..08d8bbbe67 100644 --- a/packages/core-interfaces/ipfs/package.json +++ b/packages/interfaces/ipfs/package.json @@ -1,7 +1,6 @@ { "name": "@polywrap/ipfs-interface", "description": "Polywrap Ipfs Interface", - "private": true, "version": "0.0.1-prealpha.92", "scripts": { "build": "node ../../../dependencies/node_modules/polywrap/bin/polywrap build", @@ -14,5 +13,6 @@ "polywrap": "0.0.1-prealpha.92" }, "publishConfig": { + "access": "public" } } diff --git a/packages/core-interfaces/ipfs/polywrap.deploy.yaml b/packages/interfaces/ipfs/polywrap.deploy.yaml similarity index 100% rename from packages/core-interfaces/ipfs/polywrap.deploy.yaml rename to packages/interfaces/ipfs/polywrap.deploy.yaml diff --git a/packages/core-interfaces/ipfs/polywrap.yaml b/packages/interfaces/ipfs/polywrap.yaml similarity index 100% rename from packages/core-interfaces/ipfs/polywrap.yaml rename to packages/interfaces/ipfs/polywrap.yaml diff --git a/packages/core-interfaces/ipfs/src/schema.graphql b/packages/interfaces/ipfs/src/schema.graphql similarity index 100% rename from packages/core-interfaces/ipfs/src/schema.graphql rename to packages/interfaces/ipfs/src/schema.graphql diff --git a/packages/core-interfaces/logger/README.md b/packages/interfaces/logger/README.md similarity index 100% rename from packages/core-interfaces/logger/README.md rename to packages/interfaces/logger/README.md diff --git a/packages/core-interfaces/logger/package.json b/packages/interfaces/logger/package.json similarity index 96% rename from packages/core-interfaces/logger/package.json rename to packages/interfaces/logger/package.json index c6ea9d35e2..f62de0d28f 100644 --- a/packages/core-interfaces/logger/package.json +++ b/packages/interfaces/logger/package.json @@ -1,7 +1,6 @@ { "name": "@polywrap/logger-interface", "description": "Polywrap Logger Interface", - "private": true, "version": "0.0.1-prealpha.92", "scripts": { "build": "node ../../../dependencies/node_modules/polywrap/bin/polywrap build", diff --git a/packages/core-interfaces/logger/polywrap.deploy.yaml b/packages/interfaces/logger/polywrap.deploy.yaml similarity index 100% rename from packages/core-interfaces/logger/polywrap.deploy.yaml rename to packages/interfaces/logger/polywrap.deploy.yaml diff --git a/packages/core-interfaces/logger/polywrap.yaml b/packages/interfaces/logger/polywrap.yaml similarity index 100% rename from packages/core-interfaces/logger/polywrap.yaml rename to packages/interfaces/logger/polywrap.yaml diff --git a/packages/core-interfaces/logger/src/schema.graphql b/packages/interfaces/logger/src/schema.graphql similarity index 100% rename from packages/core-interfaces/logger/src/schema.graphql rename to packages/interfaces/logger/src/schema.graphql diff --git a/packages/core-interfaces/uri-resolver/README.md b/packages/interfaces/uri-resolver/README.md similarity index 100% rename from packages/core-interfaces/uri-resolver/README.md rename to packages/interfaces/uri-resolver/README.md diff --git a/packages/core-interfaces/uri-resolver/package.json b/packages/interfaces/uri-resolver/package.json similarity index 96% rename from packages/core-interfaces/uri-resolver/package.json rename to packages/interfaces/uri-resolver/package.json index 904f014d87..f9c0a1f1a5 100644 --- a/packages/core-interfaces/uri-resolver/package.json +++ b/packages/interfaces/uri-resolver/package.json @@ -1,7 +1,6 @@ { "name": "@polywrap/uri-resolver-interface", "description": "URI Resolver Interface", - "private": true, "version": "0.0.1-prealpha.92", "scripts": { "build": "node ../../../dependencies/node_modules/polywrap/bin/polywrap build", diff --git a/packages/core-interfaces/uri-resolver/polywrap.deploy.yaml b/packages/interfaces/uri-resolver/polywrap.deploy.yaml similarity index 100% rename from packages/core-interfaces/uri-resolver/polywrap.deploy.yaml rename to packages/interfaces/uri-resolver/polywrap.deploy.yaml diff --git a/packages/core-interfaces/uri-resolver/polywrap.yaml b/packages/interfaces/uri-resolver/polywrap.yaml similarity index 100% rename from packages/core-interfaces/uri-resolver/polywrap.yaml rename to packages/interfaces/uri-resolver/polywrap.yaml diff --git a/packages/core-interfaces/uri-resolver/src/schema.graphql b/packages/interfaces/uri-resolver/src/schema.graphql similarity index 100% rename from packages/core-interfaces/uri-resolver/src/schema.graphql rename to packages/interfaces/uri-resolver/src/schema.graphql diff --git a/packages/js/plugins/file-system/polywrap.plugin.yaml b/packages/js/plugins/file-system/polywrap.plugin.yaml index e05b410494..70e2c7f427 100644 --- a/packages/js/plugins/file-system/polywrap.plugin.yaml +++ b/packages/js/plugins/file-system/polywrap.plugin.yaml @@ -5,4 +5,4 @@ module: ./src/index.ts schema: ./src/schema.graphql import_redirects: - uri: "ens/fs.polywrap.eth" - schema: ../../../core-interfaces/file-system/build/schema.graphql + schema: ../../../interfaces/file-system/build/schema.graphql diff --git a/packages/js/plugins/ipfs/polywrap.plugin.yaml b/packages/js/plugins/ipfs/polywrap.plugin.yaml index beafbe18d8..30f0a88a13 100644 --- a/packages/js/plugins/ipfs/polywrap.plugin.yaml +++ b/packages/js/plugins/ipfs/polywrap.plugin.yaml @@ -5,4 +5,4 @@ module: ./src/index.ts schema: ./src/schema.graphql import_redirects: - uri: "ens/ipfs.polywrap.eth" - schema: ../../../core-interfaces/ipfs/build/schema.graphql + schema: ../../../interfaces/ipfs/build/schema.graphql diff --git a/packages/js/plugins/logger/polywrap.plugin.yaml b/packages/js/plugins/logger/polywrap.plugin.yaml index 2cfbab9bcb..32e1cdbd60 100644 --- a/packages/js/plugins/logger/polywrap.plugin.yaml +++ b/packages/js/plugins/logger/polywrap.plugin.yaml @@ -5,4 +5,4 @@ module: ./src/index.ts schema: ./src/schema.graphql import_redirects: - uri: "ens/logger.core.polywrap.eth" - schema: ../../../core-interfaces/logger/src/schema.graphql + schema: ../../../interfaces/logger/src/schema.graphql diff --git a/packages/js/plugins/uri-resolvers/ens-resolver/polywrap.plugin.yaml b/packages/js/plugins/uri-resolvers/ens-resolver/polywrap.plugin.yaml index 88a8f79e8b..c61222e15c 100644 --- a/packages/js/plugins/uri-resolvers/ens-resolver/polywrap.plugin.yaml +++ b/packages/js/plugins/uri-resolvers/ens-resolver/polywrap.plugin.yaml @@ -5,4 +5,4 @@ module: ./src/index.ts schema: ./src/schema.graphql import_redirects: - uri: "ens/uri-resolver.core.polywrap.eth" - schema: ../../../../core-interfaces/uri-resolver/src/schema.graphql + schema: ../../../../interfaces/uri-resolver/src/schema.graphql diff --git a/packages/js/plugins/uri-resolvers/file-system-resolver/polywrap.plugin.yaml b/packages/js/plugins/uri-resolvers/file-system-resolver/polywrap.plugin.yaml index 0682de64f4..b605c8e676 100644 --- a/packages/js/plugins/uri-resolvers/file-system-resolver/polywrap.plugin.yaml +++ b/packages/js/plugins/uri-resolvers/file-system-resolver/polywrap.plugin.yaml @@ -5,6 +5,6 @@ module: ./src/index.ts schema: ./src/schema.graphql import_redirects: - uri: "ens/uri-resolver.core.polywrap.eth" - schema: ../../../../core-interfaces/uri-resolver/src/schema.graphql + schema: ../../../../interfaces/uri-resolver/src/schema.graphql - uri: "ens/fs.polywrap.eth" - schema: ../../../../core-interfaces/file-system/build/schema.graphql \ No newline at end of file + schema: ../../../../interfaces/file-system/build/schema.graphql \ No newline at end of file diff --git a/packages/js/plugins/uri-resolvers/ipfs-resolver/polywrap.plugin.yaml b/packages/js/plugins/uri-resolvers/ipfs-resolver/polywrap.plugin.yaml index fbf84d2214..a724d4e642 100644 --- a/packages/js/plugins/uri-resolvers/ipfs-resolver/polywrap.plugin.yaml +++ b/packages/js/plugins/uri-resolvers/ipfs-resolver/polywrap.plugin.yaml @@ -5,6 +5,6 @@ module: ./src/index.ts schema: ./src/schema.graphql import_redirects: - uri: "ens/uri-resolver.core.polywrap.eth" - schema: ../../../../core-interfaces/uri-resolver/src/schema.graphql + schema: ../../../../interfaces/uri-resolver/src/schema.graphql - uri: "ens/ipfs.polywrap.eth" - schema: ../../../../core-interfaces/ipfs/build/schema.graphql + schema: ../../../../interfaces/ipfs/build/schema.graphql From 025cec31d1fc64ac97b565640b9f946870da49b8 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Tue, 5 Jul 2022 15:57:31 -0700 Subject: [PATCH 43/46] fix UriResolverInterface module export --- packages/js/client/src/wasm/WasmWrapper.ts | 2 +- packages/js/core/src/__tests__/resolveUri.spec.ts | 6 +++--- packages/js/core/src/interfaces/uri-resolver.ts | 3 +-- .../resolvers/extendable/UriResolverWrapper.ts | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/js/client/src/wasm/WasmWrapper.ts b/packages/js/client/src/wasm/WasmWrapper.ts index 3804c0ca8e..4f421c4d9f 100644 --- a/packages/js/client/src/wasm/WasmWrapper.ts +++ b/packages/js/client/src/wasm/WasmWrapper.ts @@ -81,7 +81,7 @@ export class WasmWrapper extends Wrapper { client: Client ): Promise { const { path, encoding } = options; - const { data, error } = await UriResolverInterface.Method.getFile( + const { data, error } = await UriResolverInterface.module.getFile( { invoke: ( options: InvokeOptions diff --git a/packages/js/core/src/__tests__/resolveUri.spec.ts b/packages/js/core/src/__tests__/resolveUri.spec.ts index c190b4dbd4..207c9a5b2c 100644 --- a/packages/js/core/src/__tests__/resolveUri.spec.ts +++ b/packages/js/core/src/__tests__/resolveUri.spec.ts @@ -232,11 +232,11 @@ describe("resolveUri", () => { const wrapper = new Uri("wrap://ens/ens"); const file = new Uri("wrap/some-file"); const path = "wrap/some-path"; - const query = UriResolverInterface.Method; + const module = UriResolverInterface.module; const uri = new Uri("wrap/some-uri"); - expect(query.tryResolveUri(client(wrappers), wrapper, uri)).toBeDefined(); - expect(query.getFile(client(wrappers), file, path)).toBeDefined(); + expect(module.tryResolveUri(client(wrappers), wrapper, uri)).toBeDefined(); + expect(module.getFile(client(wrappers), file, path)).toBeDefined(); }); it("works in the typical case", async () => { diff --git a/packages/js/core/src/interfaces/uri-resolver.ts b/packages/js/core/src/interfaces/uri-resolver.ts index 3f6649106e..182e27efcc 100644 --- a/packages/js/core/src/interfaces/uri-resolver.ts +++ b/packages/js/core/src/interfaces/uri-resolver.ts @@ -8,8 +8,7 @@ export interface MaybeUriOrManifest { manifest?: Uint8Array; } -// eslint-disable-next-line @typescript-eslint/naming-convention -export const Method = { +export const module = { tryResolveUri: Tracer.traceFunc( "core: uri-resolver: tryResolveUri", async ( diff --git a/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts b/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts index d5e569bd42..3eaa7e98ba 100644 --- a/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts +++ b/packages/js/core/src/uri-resolution/resolvers/extendable/UriResolverWrapper.ts @@ -84,7 +84,7 @@ const tryResolveUriWithImplementation = async ( implementationUri: Uri, invoker: Invoker ): Promise => { - const { data } = await UriResolverInterface.Method.tryResolveUri( + const { data } = await UriResolverInterface.module.tryResolveUri( invoker, implementationUri, uri From 9b5a85fadac41c358928c36bc6dc71939d8122fd Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Tue, 5 Jul 2022 16:25:37 -0700 Subject: [PATCH 44/46] remove msgpack as encoding option for getFile --- packages/js/core/src/types/Client.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/js/core/src/types/Client.ts b/packages/js/core/src/types/Client.ts index 84bb7c12df..bd9a7cfa86 100644 --- a/packages/js/core/src/types/Client.ts +++ b/packages/js/core/src/types/Client.ts @@ -42,7 +42,7 @@ export type GetManifestOptions = Contextualized; export interface GetFileOptions extends Contextualized { path: string; - encoding?: "utf-8" | "msgpack" | string; + encoding?: "utf-8" | string; } export interface GetImplementationsOptions extends Contextualized { From 969f1d67b4e4b8499645a3cfaa56d4175b02581e Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Tue, 5 Jul 2022 17:12:57 -0700 Subject: [PATCH 45/46] remove null fields from output abi --- packages/cli/src/lib/Compiler.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/lib/Compiler.ts b/packages/cli/src/lib/Compiler.ts index 2a5a6c9601..9ce101baca 100644 --- a/packages/cli/src/lib/Compiler.ts +++ b/packages/cli/src/lib/Compiler.ts @@ -358,8 +358,18 @@ export class Compiler { ...state.composerOutput.abi, }; + const filteredAbi: Record = { ...abi }; + + Object.keys(filteredAbi).forEach((key) => { + const value = filteredAbi[key]; + + if (value === null || value === undefined) { + delete filteredAbi[key]; + } + }); + const info: WrapManifest = { - abi: { ...abi }, + abi: filteredAbi, name: manifest.name, type: (await this._isInterface()) ? "interface" : "wasm", version: "0.0.1", From 7fd5b2faad2cb664044edde133d8e068d685d97a Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Tue, 5 Jul 2022 17:18:33 -0700 Subject: [PATCH 46/46] remove null fields from wrap.info --- .../js/test-env/src/wrappers/ens/wrap.info | Bin 74059 -> 49992 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/packages/js/test-env/src/wrappers/ens/wrap.info b/packages/js/test-env/src/wrappers/ens/wrap.info index d71d19b91b2408f4c003f465281acee9995d8440..eba53a10cd4e0552485c36f960933778b210275b 100644 GIT binary patch literal 49992 zcmeHQOK%*<5tacSa*cD$#juf_0zV|#Fmj3{OEF z&f_RsaS|gz0Gs6UB~dTNvaRHjT%#W#z&|E6-P60>(^cI)x*Gj ze{QFp#BG*jAxm%nj`MV9vLuWe>rv2R`}5&^dYv`GG)sc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