diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index fccc65cf71..33b3a71cdc 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -55,7 +55,6 @@ packages/js/plugins/ethereum @dOrgJelli @krisbitney @namesty packages/js/plugins/file-system @krisbitney @dOrgJelli @Niraj-Kamdar @cbrzn packages/js/plugins/http @dOrgJelli @ramilexe @cbrzn @namesty @krisbitney packages/js/plugins/ipfs @dOrgJelli @krisbitney @nerfZael -packages/js/plugins/logger @dOrgJelli @cbrzn @nerfZael packages/js/plugins/ws @dOrgJelli @nerfZael @fetsorn packages/js/plugins/uri-resolvers/ens-resolver @nerfZael @pileks @krisbitney @cbrzn @dOrgJelli packages/js/plugins/uri-resolvers/file-system-resolver @pileks @dOrgJelli @nerfZael @cbrzn @krisbitney diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a75eef07a..4559675cb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Polywrap Origin (0.10.0-pre.5) ## Features -* [PR-1430](https://github.com/polywrap/toolchain/pull/1430) `polywrap` CLI: Polywrap `wasm/` & `interface/` projects can now include a `resources:` directory, specified in the `polywrap.yaml` manifest. This resources directory will be copied into the `build/` folder upon runnin `polywrap build`. For example: +* [PR-1436](https://github.com/polywrap/toolchain/pull/1436) `@polywrap/client-config-builder-js`: + * The default client config now uses the `wrap://ens/wrappers.polywrap.eth:logger@1.0.0` interface, and adds the `@polywrap/logger-plugin-js` package @ `wrap://plugin/logger` as an implementation. +* [PR-1430](https://github.com/polywrap/toolchain/pull/1430) `polywrap` CLI: + * Polywrap `wasm/` & `interface/` projects can now include a `resources:` directory, specified in the `polywrap.yaml` manifest. This resources directory will be copied into the `build/` folder upon runnin `polywrap build`. For example: ```yaml format: 0.3.0 project: @@ -10,13 +13,16 @@ ... resources: ./resources ``` -* [PR-1430](https://github.com/polywrap/toolchain/pull/1430) `@polywrap/polywrap-manifest-types-js`, `@polywrap/polywrap-manifest-schemas`: Added version `0.3.0` of the `PolywrapManifest`, which includes the new `resources: string` field, containing a directory path. -* [PR-1411](https://github.com/polywrap/toolchain/pull/1411) `@polywrap/client-config-builder-js`: The `ens-text-record-resolver` wrapper @ [`wrap://ipfs/QmfRCVA1MSAjUbrXXjya4xA9QHkbWeiKRsT7Um1cvrR7FY`](https://wrappers.io/v/ipfs/QmfRCVA1MSAjUbrXXjya4xA9QHkbWeiKRsT7Um1cvrR7FY) has been added to the default client config bundle. This resolver enables ENS, text-record based, WRAP URI resolution. The text-record's key must be prepended with the `wrap/...` identifier. For example, the URI `wrap://ens/domain.eth:foo` maps to `domain.eth`'s `wrap/foo` text record. The `wrap/foo` text-record's value must contain another valid WRAP URI. For examples, see [dev.polywrap.eth](https://app.ens.domains/name/dev.polywrap.eth/details). +* [PR-1430](https://github.com/polywrap/toolchain/pull/1430) `@polywrap/polywrap-manifest-types-js`, `@polywrap/polywrap-manifest-schemas`: + * Added version `0.3.0` of the `PolywrapManifest`, which includes the new `resources: string` field, containing a directory path. +* [PR-1411](https://github.com/polywrap/toolchain/pull/1411) `@polywrap/client-config-builder-js`: + * The `ens-text-record-resolver` wrapper @ [`wrap://ipfs/QmfRCVA1MSAjUbrXXjya4xA9QHkbWeiKRsT7Um1cvrR7FY`](https://wrappers.io/v/ipfs/QmfRCVA1MSAjUbrXXjya4xA9QHkbWeiKRsT7Um1cvrR7FY) has been added to the default client config bundle. This resolver enables ENS, text-record based, WRAP URI resolution. The text-record's key must be prepended with the `wrap/...` identifier. For example, the URI `wrap://ens/domain.eth:foo` maps to `domain.eth`'s `wrap/foo` text record. The `wrap/foo` text-record's value must contain another valid WRAP URI. For examples, see [dev.polywrap.eth](https://app.ens.domains/name/dev.polywrap.eth/details). * [PR-1369](https://github.com/polywrap/toolchain/pull/1369) `@polywrap/core-js`: * `GetImplementationsOptions` now accepts an optional resolution context, to be used to handle infinite recursion when a resolver uses `getImplementations` * `GetImplementationsOptions` now accepts an optional `applyResolution`. This can be used to apply URI resolution to interfaces. -* [PR-1236](https://github.com/polywrap/toolchain/pull/1236) `@polywrap/client-js`: Polywrap Client now re-exports the config builder and uri-resolvers (in addition to core) packages. This is done to improve dev exp and remove the need for users to import those package themselves. - * For users who do not need those packages and are using noDefaults there will be a separate PR that refactor core client functionality into a core-client package that does not depend on the config builder and uri-resolvers packages, but has no defaults. +* [PR-1236](https://github.com/polywrap/toolchain/pull/1236) `@polywrap/client-js`: + * Polywrap Client now re-exports the config builder and uri-resolvers (in addition to core) packages. This is done to improve dev exp and remove the need for users to import those package themselves. + * For users who do not need those packages and are using noDefaults there will be a separate PR that refactor core client functionality into a core-client package that does not depend on the config builder and uri-resolvers packages, but has no defaults. * [PR-1236](https://github.com/polywrap/toolchain/pull/1236) `@polywrap/client-config-builder-js`: * Added `addRedirects`, `addWrappers`, `addPackages` methods to the `ClientConfigBuilder`, so users can add many items at once. * Added `buildDefault` to the `ClientConfigBuilder` which builds a `ClientConfig` using default resolvers. @@ -24,11 +30,16 @@ * New package for plugins. * Can create plugin packages with `PluginPackage.from`. * Accepts `manifest` and a `PluginModule`, or an inline `PluginModule`. -* [PR-1236](https://github.com/polywrap/toolchain/pull/1236) `@polywrap/uri-resolvers-js`: Added `StaticResolver` and `StaticResolver.from` to optimize building resolvers with `IUriRedirect`, `IUriWrapper` and `IUriPackage`. -* [PR-1236] `@polywrap/schema-bind`: In `plugin-ts` bindings, the `PluginModule` type is now imported fron `@polywrap/plugin-js` instead of `@polywrap/core-js`. -* [PR-1349](https://github.com/polywrap/toolchain/pull/1349) `polywrap` CLI: A `-l, --log-file [path]` option has been added to all commands. Its purpose is to configure a `Log file to save console output to`, useful in situations when the console log overflows. +* [PR-1236](https://github.com/polywrap/toolchain/pull/1236) `@polywrap/uri-resolvers-js`: + * Added `StaticResolver` and `StaticResolver.from` to optimize building resolvers with `IUriRedirect`, `IUriWrapper` and `IUriPackage`. +* [PR-1236] `@polywrap/schema-bind`: + * In `plugin-ts` bindings, the `PluginModule` type is now imported fron `@polywrap/plugin-js` instead of `@polywrap/core-js`. +* [PR-1349](https://github.com/polywrap/toolchain/pull/1349) `polywrap` CLI: + * A `-l, --log-file [path]` option has been added to all commands. Its purpose is to configure a `Log file to save console output to`, useful in situations when the console log overflows. ## Breaking Changes +* [PR-1436](https://github.com/polywrap/toolchain/pull/1436) `@polywrap/client-config-builder-js`: + * Default client config no longer uses the `wrap://ens/logger.core.polywrap.eth` interface URI, or `wrap://ens/js-logger.polywrap.eth` plugin URI. * [PR-1369](https://github.com/polywrap/toolchain/pull/1369) `@polywrap/client-config-builder-js`: * Calling `buildCoreConfig` no longer returns a `CoreClientConfig` with redirects since redirects are no longer a part of `CoreClientConfig`. * [PR-1369](https://github.com/polywrap/toolchain/pull/1369) `@polywrap/uri-resolvers-js`: @@ -42,10 +53,12 @@ * `applyRedirects` helper function has been replaced with `applyResolution`. * [PR-1369](https://github.com/polywrap/toolchain/pull/1369) `@polywrap/client-js`: * `PolywrapClient` config when using `noDefaults: true` no longer accepts `redirects` (Since redirects have been removed from `CoreClientConfig`). -* [PR-1367](https://github.com/polywrap/toolchain/pull/1367) `polywrap` CLI: The JS/TS module passed into the `--client-config` option has a new entrypoint signature. - * Instead of `getCustomConfig`, users should export the following `configure(builder: IClientConfigBuilder): IClientConfigBuilder`. - * `IClientConfigBuilder` can be imported from the `@polywrap/client-config-builder-js` package. -* [PR-1367](https://github.com/polywrap/toolchain/pull/1367) `@polywrap/client-config-builder-js`: Renamed `removeUriRedirect(...)` to `removeRedirect(...)`. +* [PR-1367](https://github.com/polywrap/toolchain/pull/1367) `polywrap` CLI: + * The JS/TS module passed into the `--client-config` option has a new entrypoint signature. + * Instead of `getCustomConfig`, users should export the following `configure(builder: IClientConfigBuilder): IClientConfigBuilder`. + * `IClientConfigBuilder` can be imported from the `@polywrap/client-config-builder-js` package. +* [PR-1367](https://github.com/polywrap/toolchain/pull/1367) `@polywrap/client-config-builder-js`: + * Renamed `removeUriRedirect(...)` to `removeRedirect(...)`. * [PR-1236](https://github.com/polywrap/toolchain/pull/1236) `@polywrap/client-js`: * The Polywrap Client with `noDefaults: false` no longer accepts a `plugins` field, but it accepts `wrappers` and `packages`. * `resolver` field has been replaced with `resolvers`, since with default client the resolver used is the `RecursiveResolver` with the `PackageToWrapperCacheResolver`. @@ -68,19 +81,30 @@ * Replaced helper func `buildUriResolver` with `UriResolver.from` * Constructors of built-in resolvers like `RecursiveResolver` and `PackageToWrapperCacheResolver` now accept a concrete `IUriResolver` while their static `from` methods accept a `UriResolverLike` * Remove `PluginsResolver` and `PluginResolver`, users can now use `WrapperResolver` or `PackageResolver` -* [PR-1348](https://github.com/polywrap/toolchain/pull/1348) `polywrap` CLI: Rename the `run` command to `test`, which uses the `test` project extension, as defined in the `polywrap.test.yaml` manifest file. -* [PR-1379](https://github.com/polywrap/toolchain/pull/1379) `@polywrap/logging-js`: Moved the logging interface from the CLI's lib into its own package. -* [PR-1379](https://github.com/polywrap/toolchain/pull/1379) `@polywrap/polywrap-manifest-types-js`: Added an optional logger parameter to the deserialization function of all manifest types. -* [PR-1373](https://github.com/polywrap/toolchain/pull/1373) `@polywrap/ethereum-plugin-js`: Added a `signMessageBytes` method. - -## Bugs -* [PR-1396](https://github.com/polywrap/toolchain/pull/1396) `polywrap` CLI: The rust build images have been updated to properly remove the needless inclusion of the `wasm-interface-types` custom section, as a result of running wasm-bindgen. More information can be found [here](https://github.com/polywrap/toolchain/issues/1420). -* [PR-1336](https://github.com/polywrap/toolchain/pull/1336) `polywrap` CLI: Updated the CLI's README. -* [PR-1379](https://github.com/polywrap/toolchain/pull/1379) `polywrap` CLI: Automatically upgrading manifests now emits a warning, suggesting users to upgrade their manifest. -* [PR-1382](https://github.com/polywrap/toolchain/pull/1382) `polywrap` CLI: Invoke `asc` using `npx` to help with program resolution. -* [PR-1383](https://github.com/polywrap/toolchain/pull/1383) `@polywrap/templates`: Add the `https://ipfs.wrappers.io` gateway to the interface template's `polywrap.deploy.yaml` manifest. -* [PR-1375](https://github.com/polywrap/toolchain/pull/1375) `@polywrap/ethereum-plugin-js`: Update README to latest code. -* [PR-1368](https://github.com/polywrap/toolchain/pull/1368) `polywrap` CLI: Update error messaging for the `--client-config` option. +* [PR-1348](https://github.com/polywrap/toolchain/pull/1348) `polywrap` CLI: + * Rename the `run` command to `test`, which uses the `test` project extension, as defined in the `polywrap.test.yaml` manifest file. +* [PR-1379](https://github.com/polywrap/toolchain/pull/1379) `@polywrap/logging-js`: + * Moved the logging interface from the CLI's lib into its own package. +* [PR-1379](https://github.com/polywrap/toolchain/pull/1379) `@polywrap/polywrap-manifest-types-js`: + * Added an optional logger parameter to the deserialization function of all manifest types. +* [PR-1373](https://github.com/polywrap/toolchain/pull/1373) `@polywrap/ethereum-plugin-js`: + * Added a `signMessageBytes` method. + +## Bugs +* [PR-1396](https://github.com/polywrap/toolchain/pull/1396) `polywrap` CLI: + * The rust build images have been updated to properly remove the needless inclusion of the `wasm-interface-types` custom section, as a result of running wasm-bindgen. More information can be found [here](https://github.com/polywrap/toolchain/issues/1420). +* [PR-1336](https://github.com/polywrap/toolchain/pull/1336) `polywrap` CLI: + * Updated the CLI's README. +* [PR-1379](https://github.com/polywrap/toolchain/pull/1379) `polywrap` CLI: + * Automatically upgrading manifests now emits a warning, suggesting users to upgrade their manifest. +* [PR-1382](https://github.com/polywrap/toolchain/pull/1382) `polywrap` CLI: + * Invoke `asc` using `npx` to help with program resolution. +* [PR-1383](https://github.com/polywrap/toolchain/pull/1383) `@polywrap/templates`: + * Add the `https://ipfs.wrappers.io` gateway to the interface template's `polywrap.deploy.yaml` manifest. +* [PR-1375](https://github.com/polywrap/toolchain/pull/1375) `@polywrap/ethereum-plugin-js`: + * Update README to latest code. +* [PR-1368](https://github.com/polywrap/toolchain/pull/1368) `polywrap` CLI: + * Update error messaging for the `--client-config` option. # Polywrap Origin (0.9.3) ## Bugs diff --git a/packages/interfaces/logger/README.md b/packages/interfaces/logger/README.md deleted file mode 100644 index c8bf48f956..0000000000 --- a/packages/interfaces/logger/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# @polywrap/logger-interface - -Interface for logger wrappers. diff --git a/packages/interfaces/logger/deployment.json b/packages/interfaces/logger/deployment.json deleted file mode 100644 index 3b1d5e7eb0..0000000000 --- a/packages/interfaces/logger/deployment.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - { - "name": "ipfs_deploy", - "steps": [ - { - "name": "ipfs_deploy", - "id": "ipfs_deploy.ipfs_deploy", - "input": "wrap://fs/./build", - "result": "wrap://ipfs/QmWtN2YQBpY1o1x7B6opHRYwSgdpphR36RUm19PibF4Ecs" - } - ] - } -] \ No newline at end of file diff --git a/packages/interfaces/logger/package.json b/packages/interfaces/logger/package.json deleted file mode 100644 index b30ca0c343..0000000000 --- a/packages/interfaces/logger/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "@polywrap/logger-interface", - "description": "Polywrap Logger Interface", - "version": "0.10.0-pre.5", - "scripts": { - "build": "node ../../../dependencies/node_modules/polywrap/bin/polywrap build", - "build:patch": "node ../../cli/bin/polywrap build", - "lint": "eslint --color -c ../../../.eslintrc.js .", - "test:env:up": "npx polywrap infra up --modules=eth-ens-ipfs", - "test:env:down": "npx polywrap infra down --modules=eth-ens-ipfs", - "deploy": "npx polywrap deploy" - }, - "devDependencies": { - "polywrap": "0.10.0-pre.5" - }, - "publishConfig": { - "access": "public" - } -} diff --git a/packages/interfaces/logger/polywrap.deploy.yaml b/packages/interfaces/logger/polywrap.deploy.yaml deleted file mode 100644 index e36638b454..0000000000 --- a/packages/interfaces/logger/polywrap.deploy.yaml +++ /dev/null @@ -1,9 +0,0 @@ -format: 0.2.0 -jobs: - ipfs_deploy: - steps: - - name: ipfs_deploy - package: ipfs - uri: fs/./build - config: - gatewayUri: https://ipfs.wrappers.io diff --git a/packages/interfaces/logger/polywrap.yaml b/packages/interfaces/logger/polywrap.yaml deleted file mode 100644 index 9c44799b66..0000000000 --- a/packages/interfaces/logger/polywrap.yaml +++ /dev/null @@ -1,8 +0,0 @@ -format: 0.2.0 -project: - name: logger-interface - type: interface -source: - schema: ./src/schema.graphql -extensions: - deploy: ./polywrap.deploy.yaml diff --git a/packages/interfaces/logger/src/schema.graphql b/packages/interfaces/logger/src/schema.graphql deleted file mode 100644 index f4dc96620f..0000000000 --- a/packages/interfaces/logger/src/schema.graphql +++ /dev/null @@ -1,13 +0,0 @@ -enum LogLevel { - DEBUG - INFO - WARN - ERROR -} - -type Module { - log( - level: LogLevel! - message: String! - ): Boolean! -} diff --git a/packages/js/client-config-builder/package.json b/packages/js/client-config-builder/package.json index 3b05c0e50a..9a2abdd313 100644 --- a/packages/js/client-config-builder/package.json +++ b/packages/js/client-config-builder/package.json @@ -28,7 +28,7 @@ "@polywrap/http-resolver-plugin-js": "0.10.0-pre.5", "@polywrap/ipfs-plugin-js": "0.10.0-pre.5", "@polywrap/ipfs-resolver-plugin-js": "0.10.0-pre.5", - "@polywrap/logger-plugin-js": "0.10.0-pre.5", + "@polywrap/logger-plugin-js": "0.10.0", "@polywrap/uri-resolver-extensions-js": "0.10.0-pre.5", "@polywrap/uri-resolvers-js": "0.10.0-pre.5" }, diff --git a/packages/js/client-config-builder/src/bundles/getDefaultConfig.ts b/packages/js/client-config-builder/src/bundles/getDefaultConfig.ts index c7cbc2ae90..5900fbfdac 100644 --- a/packages/js/client-config-builder/src/bundles/getDefaultConfig.ts +++ b/packages/js/client-config-builder/src/bundles/getDefaultConfig.ts @@ -45,6 +45,10 @@ export const getDefaultConfig = (): ClientConfig => { from: new Uri("wrap://ens/graph-node.polywrap.eth"), to: new Uri(defaultWrappers.graphNode), }, + { + from: new Uri("wrap://ens/wrappers.polywrap.eth:logger@1.0.0"), + to: new Uri("wrap://plugin/logger"), + }, ], interfaces: [ { @@ -59,8 +63,8 @@ export const getDefaultConfig = (): ClientConfig => { ], }, { - interface: new Uri("wrap://ens/logger.core.polywrap.eth"), - implementations: [new Uri("wrap://ens/js-logger.polywrap.eth")], + interface: new Uri("wrap://ens/wrappers.polywrap.eth:logger@1.0.0"), + implementations: [new Uri("wrap://plugin/logger")], }, ], packages: getDefaultPlugins(), @@ -118,7 +122,7 @@ export const getDefaultPlugins = (): IUriPackage[] => { package: httpResolverPlugin({}), }, { - uri: new Uri("wrap://ens/js-logger.polywrap.eth"), + uri: new Uri("wrap://plugin/logger"), package: loggerPlugin({}), }, { diff --git a/packages/js/client/package.json b/packages/js/client/package.json index 0f35c4c0e6..48e3d0664b 100644 --- a/packages/js/client/package.json +++ b/packages/js/client/package.json @@ -38,7 +38,6 @@ "@polywrap/http-resolver-plugin-js": "0.10.0-pre.5", "@polywrap/ipfs-plugin-js": "0.10.0-pre.5", "@polywrap/ipfs-resolver-plugin-js": "0.10.0-pre.5", - "@polywrap/logger-plugin-js": "0.10.0-pre.5", "@polywrap/plugin-js": "0.10.0-pre.5", "@polywrap/test-cases": "0.10.0-pre.5", "@polywrap/test-env-js": "0.10.0-pre.5", diff --git a/packages/js/client/src/__tests__/core/sanity.spec.ts b/packages/js/client/src/__tests__/core/sanity.spec.ts index 4220f7973b..51f59e7179 100644 --- a/packages/js/client/src/__tests__/core/sanity.spec.ts +++ b/packages/js/client/src/__tests__/core/sanity.spec.ts @@ -21,8 +21,8 @@ describe("sanity", () => { ], }, { - interface: coreInterfaceUris.logger, - implementations: [new Uri("wrap://ens/js-logger.polywrap.eth")], + interface: new Uri("wrap://ens/wrappers.polywrap.eth:logger@1.0.0"), + implementations: [new Uri("wrap://plugin/logger")], }, ]); }); diff --git a/packages/js/core/src/interfaces/core-interface-uris.ts b/packages/js/core/src/interfaces/core-interface-uris.ts index 317ea5f684..5dde9bf85f 100644 --- a/packages/js/core/src/interfaces/core-interface-uris.ts +++ b/packages/js/core/src/interfaces/core-interface-uris.ts @@ -2,5 +2,4 @@ import { Uri } from "../"; export const coreInterfaceUris = { uriResolver: new Uri("wrap://ens/uri-resolver.core.polywrap.eth"), - logger: new Uri("wrap://ens/logger.core.polywrap.eth"), }; diff --git a/packages/js/plugins/logger/README.md b/packages/js/plugins/logger/README.md deleted file mode 100644 index ab9564a204..0000000000 --- a/packages/js/plugins/logger/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# @polywrap/logger-plugin-js - -Console Logger plugin implements the `wrap://ens/logger.core.polywrap.eth` core Polywrap interface. By default it logs all events using the Javascript `console` module. Different logging mechanisms can be set using the `LoggerConfig`. - -## Log levels - -- DEBUG -- INFO -- WARN -- ERROR - -## Example - -```ts -import { loggerPlugin, LogLevel } from "@polywrap/logger-plugin-js"; - -const client = new PolywrapClient({ - plugins: [{ - from: "wrap://ens/js-logger.polywrap.eth", - to: loggerPlugin() - }], - interfaces: [{ - interface: "wrap://ens/logger.core.polywrap.eth", - implementations: ["wrap://ens/js-logger.polywrap.eth"], - }] -}); - -// For custom logging logic, initialize the logger like so: -// loggerPlugin((level: LogLevel, message: string) => { ... }) - -const response = await client.query<{ log: boolean }>({ - uri: "wrap://ens/js-logger.polywrap.eth", - query: ` - query { - log( - level: ${LogLevel.INFO} - message: "Informational message" - ) - } - ` -}); -``` diff --git a/packages/js/plugins/logger/jest.config.js b/packages/js/plugins/logger/jest.config.js deleted file mode 100644 index 38888109ca..0000000000 --- a/packages/js/plugins/logger/jest.config.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = { - "roots": [ - "/src" - ], - "testMatch": [ - "**/__tests__/**/*.+(ts|tsx|js)", - "**/?(*.)+(spec|test).+(ts|tsx|js)" - ], - "transform": { - "^.+\\.(ts|tsx)$": "ts-jest" - }, - testEnvironment: 'node' -} diff --git a/packages/js/plugins/logger/package.json b/packages/js/plugins/logger/package.json deleted file mode 100644 index 1177279720..0000000000 --- a/packages/js/plugins/logger/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "@polywrap/logger-plugin-js", - "description": "Polywrap Javascript Logger Plugin", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/polywrap/monorepo.git" - }, - "files": [ - "build" - ], - "version": "0.10.0-pre.5", - "main": "build/index.js", - "scripts": { - "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", - "codegen": "node ../../../../dependencies/node_modules/polywrap/bin/polywrap codegen", - "lint": "eslint --color -c ../../../../.eslintrc.js src/", - "test": "jest --passWithNoTests --runInBand --verbose", - "test:ci": "jest --passWithNoTests --runInBand --verbose", - "test:watch": "jest --watch --passWithNoTests --verbose" - }, - "dependencies": { - "@polywrap/core-js": "0.10.0-pre.5", - "@polywrap/plugin-js": "0.10.0-pre.5" - }, - "devDependencies": { - "@polywrap/client-js": "0.10.0-pre.5", - "@polywrap/uri-resolvers-js": "0.10.0-pre.5", - "@types/jest": "26.0.8", - "@types/prettier": "2.6.0", - "jest": "26.6.3", - "rimraf": "3.0.2", - "ts-jest": "26.5.4", - "ts-node": "8.10.2", - "typescript": "4.1.6" - }, - "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", - "publishConfig": { - "access": "public" - } -} diff --git a/packages/js/plugins/logger/polywrap.plugin.yaml b/packages/js/plugins/logger/polywrap.plugin.yaml deleted file mode 100644 index ca4d9f398f..0000000000 --- a/packages/js/plugins/logger/polywrap.plugin.yaml +++ /dev/null @@ -1,10 +0,0 @@ -format: 0.2.0 -project: - name: Logger - type: plugin/typescript -source: - module: ./src/index.ts - schema: ./src/schema.graphql - import_abis: - - uri: "ens/logger.core.polywrap.eth" - abi: ../../../interfaces/logger/build/wrap.info diff --git a/packages/js/plugins/logger/src/__tests__/e2e/e2e.spec.ts b/packages/js/plugins/logger/src/__tests__/e2e/e2e.spec.ts deleted file mode 100644 index 84cf008d5c..0000000000 --- a/packages/js/plugins/logger/src/__tests__/e2e/e2e.spec.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { PolywrapClient } from "@polywrap/client-js"; -import { UriResolver } from "@polywrap/uri-resolvers-js"; -import { loggerPlugin } from "../.."; - -describe("log method", () => { - it("logs to console appropriate level", async () => { - const polywrapClient = new PolywrapClient( - { - resolver: UriResolver.from([ - { - uri: "wrap://ens/js-logger.polywrap.eth", - package: loggerPlugin({}), - }, - ]), - }, - { noDefaults: true } - ); - - const response = await polywrapClient.invoke({ - uri: "wrap://ens/js-logger.polywrap.eth", - method: "log", - args: { - level: "DEBUG", - message: "Test message", - }, - }); - - if (!response.ok) fail(response.error); - expect(response.value).toBeDefined(); - expect(response.value).toBe(true); - }); -}); diff --git a/packages/js/plugins/logger/src/index.ts b/packages/js/plugins/logger/src/index.ts deleted file mode 100644 index 1787c47153..0000000000 --- a/packages/js/plugins/logger/src/index.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { - Module, - Args_log, - Logger_LogLevel, - Logger_LogLevelEnum, - manifest, -} from "./wrap"; - -import { PluginFactory, PluginPackage } from "@polywrap/plugin-js"; - -export type LogFunc = (level: Logger_LogLevel, message: string) => boolean; - -export interface LoggerPluginConfig { - logFunc?: LogFunc; -} - -export class LoggerPlugin extends Module { - public log(args: Args_log): boolean { - if (this.config.logFunc) { - return this.config.logFunc(args.level, args.message); - } - - switch (args.level) { - case "DEBUG": - case Logger_LogLevelEnum.DEBUG: - console.debug(args.message); - break; - case "WARN": - case Logger_LogLevelEnum.WARN: - console.warn(args.message); - break; - case "ERROR": - case Logger_LogLevelEnum.ERROR: - console.error(args.message); - break; - case "INFO": - case Logger_LogLevelEnum.INFO: - console.log(args.message); - break; - default: - console.log(args.message); - } - - return true; - } -} - -export const loggerPlugin: PluginFactory = ( - config: LoggerPluginConfig -) => new PluginPackage(new LoggerPlugin(config), manifest); -export const plugin = loggerPlugin; diff --git a/packages/js/plugins/logger/src/schema.graphql b/packages/js/plugins/logger/src/schema.graphql deleted file mode 100644 index 06b2ec2b40..0000000000 --- a/packages/js/plugins/logger/src/schema.graphql +++ /dev/null @@ -1,3 +0,0 @@ -#import { Module } into Logger from "ens/logger.core.polywrap.eth" - -type Module implements Logger_Module { } diff --git a/packages/js/plugins/logger/tsconfig.build.json b/packages/js/plugins/logger/tsconfig.build.json deleted file mode 100644 index 77aadfdd2f..0000000000 --- a/packages/js/plugins/logger/tsconfig.build.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": [ - "./src/**/*.ts" - ], - "exclude": [ - "./src/**/__tests__" - ] -} diff --git a/packages/js/plugins/logger/tsconfig.json b/packages/js/plugins/logger/tsconfig.json deleted file mode 100644 index 85d516ce30..0000000000 --- a/packages/js/plugins/logger/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "../../../../tsconfig", - "compilerOptions": { - "outDir": "build" - }, - "include": [ - "./src/**/*.ts" - ], - "exclude": [] -} diff --git a/packages/test-cases/cases/cli/app/codegen/003-multi-import/polywrap.app.yaml b/packages/test-cases/cases/cli/app/codegen/003-multi-import/polywrap.app.yaml index ca2cac002a..cfd2202c04 100644 --- a/packages/test-cases/cases/cli/app/codegen/003-multi-import/polywrap.app.yaml +++ b/packages/test-cases/cases/cli/app/codegen/003-multi-import/polywrap.app.yaml @@ -7,5 +7,3 @@ source: import_abis: - uri: "wrap://ens/ethereum.polywrap.eth" abi: "./../../../../../../js/plugins/ethereum/build/wrap.info" - - uri: "wrap://ipfs/QmVGwj3FtvhiErJ1wWbmRuHpvEQ3t1BPNESvEiMJM57p2y" - abi: "./../../../../../../js/plugins/logger/build/wrap.info" diff --git a/packages/test-cases/cases/cli/app/codegen/003-multi-import/schema.graphql b/packages/test-cases/cases/cli/app/codegen/003-multi-import/schema.graphql index 7ede02a271..404013b886 100644 --- a/packages/test-cases/cases/cli/app/codegen/003-multi-import/schema.graphql +++ b/packages/test-cases/cases/cli/app/codegen/003-multi-import/schema.graphql @@ -1,2 +1,2 @@ #import * into Ethereum from "wrap://ens/ethereum.polywrap.eth" -#import * into Console from "wrap://ipfs/QmVGwj3FtvhiErJ1wWbmRuHpvEQ3t1BPNESvEiMJM57p2y" +#import * into Logger from "wrap://ens/wrappers.polywrap.eth:logger@1.0.0" diff --git a/packages/test-cases/cases/cli/docgen/004-app/expected/docs/Console_enums.md b/packages/test-cases/cases/cli/docgen/004-app/expected/docs/Console_enums.md deleted file mode 100644 index 06bc25b43a..0000000000 --- a/packages/test-cases/cases/cli/docgen/004-app/expected/docs/Console_enums.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -id: Console_enums -title: Console Enum Types -sidebar_position: 3 ---- - - -### Console_Logger_LogLevel - -```graphql -enum Console_Logger_LogLevel { - DEBUG - INFO - WARN - ERROR -} -``` - diff --git a/packages/test-cases/cases/cli/docgen/004-app/expected/docs/Logger_enums.md b/packages/test-cases/cases/cli/docgen/004-app/expected/docs/Logger_enums.md new file mode 100644 index 0000000000..c4cac40698 --- /dev/null +++ b/packages/test-cases/cases/cli/docgen/004-app/expected/docs/Logger_enums.md @@ -0,0 +1,18 @@ +--- +id: Logger_enums +title: Logger Enum Types +sidebar_position: 3 +--- + + +### Logger_Logger_LogLevel + +```graphql +enum Logger_Logger_LogLevel { + DEBUG + INFO + WARN + ERROR +} +``` + diff --git a/packages/test-cases/cases/cli/docgen/004-app/expected/docs/Console_module.md b/packages/test-cases/cases/cli/docgen/004-app/expected/docs/Logger_module.md similarity index 54% rename from packages/test-cases/cases/cli/docgen/004-app/expected/docs/Console_module.md rename to packages/test-cases/cases/cli/docgen/004-app/expected/docs/Logger_module.md index 3be64276af..c483edc248 100644 --- a/packages/test-cases/cases/cli/docgen/004-app/expected/docs/Console_module.md +++ b/packages/test-cases/cases/cli/docgen/004-app/expected/docs/Logger_module.md @@ -1,6 +1,6 @@ --- -id: Console_module -title: Console Module +id: Logger_module +title: Logger Module sidebar_position: 1 --- @@ -8,7 +8,7 @@ sidebar_position: 1 ```graphql log( - level: Console_Logger_LogLevel! + level: Logger_Logger_LogLevel! message: String! ): Boolean! ``` diff --git a/packages/test-cases/cases/cli/docgen/004-app/polywrap.app.yaml b/packages/test-cases/cases/cli/docgen/004-app/polywrap.app.yaml index b218bc9b78..75de97f0cf 100644 --- a/packages/test-cases/cases/cli/docgen/004-app/polywrap.app.yaml +++ b/packages/test-cases/cases/cli/docgen/004-app/polywrap.app.yaml @@ -7,5 +7,3 @@ source: import_abis: - uri: "wrap://ens/ethereum.polywrap.eth" abi: "./../../../../../js/plugins/ethereum/build/wrap.info" - - uri: "wrap://ipfs/QmVGwj3FtvhiErJ1wWbmRuHpvEQ3t1BPNESvEiMJM57p2y" - abi: "./../../../../../js/plugins/logger/build/wrap.info" diff --git a/packages/test-cases/cases/cli/docgen/004-app/schema.graphql b/packages/test-cases/cases/cli/docgen/004-app/schema.graphql index 7ede02a271..404013b886 100644 --- a/packages/test-cases/cases/cli/docgen/004-app/schema.graphql +++ b/packages/test-cases/cases/cli/docgen/004-app/schema.graphql @@ -1,2 +1,2 @@ #import * into Ethereum from "wrap://ens/ethereum.polywrap.eth" -#import * into Console from "wrap://ipfs/QmVGwj3FtvhiErJ1wWbmRuHpvEQ3t1BPNESvEiMJM57p2y" +#import * into Logger from "wrap://ens/wrappers.polywrap.eth:logger@1.0.0" diff --git a/yarn.lock b/yarn.lock index 5dd9b586d4..b6a8c4682d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3299,6 +3299,14 @@ pull-stream-to-async-iterator "^1.0.2" querystring "^0.2.0" +"@polywrap/logger-plugin-js@0.10.0": + version "0.10.0" + resolved "https://registry.yarnpkg.com/@polywrap/logger-plugin-js/-/logger-plugin-js-0.10.0.tgz#9fc10532e86642d7e8eb3fc7a34494cb077610bd" + integrity sha512-Pb+VcXhSGq2ks2bcPPARSLYksRzcadnBsCzf+tv5B3fisZjD+dEEdI8Apj7ol+186njhNVKzoeR5UYdtINUE0g== + dependencies: + "@polywrap/core-js" "0.10.0-pre.5" + "@polywrap/plugin-js" "0.10.0-pre.5" + "@polywrap/wrap-manifest-schemas@0.9.3": version "0.9.3" resolved "https://registry.yarnpkg.com/@polywrap/wrap-manifest-schemas/-/wrap-manifest-schemas-0.9.3.tgz#cdf950bb8951fba72afd8300aaf9a0a8159d7c37"