diff --git a/packages/js/client-config-builder/.gitignore b/packages/js/client-config-builder/.gitignore new file mode 100644 index 0000000000..dbb01bb64d --- /dev/null +++ b/packages/js/client-config-builder/.gitignore @@ -0,0 +1,3 @@ +/examples/**/*.d.ts +/examples/**/*.js +/examples/**/*.js.map diff --git a/packages/js/client-config-builder/README.md b/packages/js/client-config-builder/README.md index 50d55ab4ee..0daa99d9fa 100644 --- a/packages/js/client-config-builder/README.md +++ b/packages/js/client-config-builder/README.md @@ -1,56 +1,670 @@ # PolywrapClient Config Builder -A DSL for building the PolywrapClient config object. +A utility class for building the PolywrapClient config. Supports building configs using method chaining or imperatively. +## Quickstart + +### Initialize + +Initialize a ClientConfigBuilder using the [constructor](#constructor) + +```typescript + // start with a blank slate (typical usage) + const builder = new ClientConfigBuilder(); + + // instantiate a builder with a custom cache and/or resolver + const _builder = new ClientConfigBuilder( + new WrapperCache(), + RecursiveResolver.from([]) + ); +``` + +### Configure + +Add client configuration with [add](#add), or flexibly mix and match builder [configuration methods](#addwrapper) to add and remove configuration items. + +```typescript + // add multiple items to the configuration using the catch-all `add` method + builder.add({ + envs: [], + interfaces: [], + redirects: [], + wrappers: [], + packages: [], + resolvers: [], + }); + + // add or remove items by chaining method calls + builder + .addPackage({ + uri: "wrap://plugin/package", + package: httpPlugin({}), + }) + .removePackage("wrap://plugin/package") + .addPackages([ + { + uri: "wrap://plugin/http", + package: httpPlugin({}), + }, + { + uri: "wrap://plugin/filesystem", + package: fileSystemPlugin({}), + }, + ]); +``` + +You can add the entire [default client configuration bundle](#bundle--defaultconfig) at once with [addDefaults](#adddefaults) + +```typescript + builder.addDefaults(); +``` + +### Build + +Finally, build a ClientConfig or CoreClientConfig to pass to the PolywrapClient constructor. + +```typescript + // accepted by the PolywrapClient + const clientConfig = builder.build(); + + // accepted by either the PolywrapClient or the PolywrapCoreClient + const coreClientConfig = builder.buildCoreConfig(); +``` + +### Example + +A complete example using all or most of the available methods. + ```typescript= -import { ClientConfigBuilder } from "@polywrap/client-config-builder-js"; -import { PolywrapClient } from "@polywrap/client-js"; + // init + const builder = new ClientConfigBuilder(); -const config = new ClientConfigBuilder() - .add({ - envs: [/*...*/], - interfaces: [/*...*/], - redirects: [/*...*/], - wrappers: [/*...*/], - packages: [/*...*/], - resolvers: [/*...*/], - }) - .add({/*...*/}) - .build(); + // add the default bundle first to override its entries later + builder.addDefaults(); -// ... + // add many config items at once + builder.add({ + envs: [], + interfaces: [], + redirects: [], + wrappers: [], + packages: [], + resolvers: [], + }); -const builder = new ClientConfigBuilder(); + // add and remove wrappers + builder + .addWrapper({ + uri: "wrap://ens/wrapper.eth", + wrapper: await WasmWrapper.from( + new Uint8Array([1, 2, 3]), + new Uint8Array([1, 2, 3]) + ), + }) + .removeWrapper("wrap://ens/wrapper.eth") + .addWrappers([ + { + uri: "wrap://ens/wrapper.eth", + wrapper: await WasmWrapper.from( + new Uint8Array([1, 2, 3]), + new Uint8Array([1, 2, 3]) + ), + }, + ]); -builder.addDefaults(); + // add and remove wrap packages + builder + .addPackage({ + uri: "wrap://plugin/package", + package: httpPlugin({}), + }) + .removePackage("wrap://plugin/package") + .addPackages([ + { + uri: "wrap://plugin/package", + package: httpPlugin({}), + }, + ]); -builder.add({ - packages: [/*...*/] -}); + // add and remove Envs + builder + .addEnv("wrap://ens/wrapper.eth", { key: "value" }) + .removeEnv("wrap://ens/wrapper.eth") + .addEnvs([ + { + uri: "wrap://ens/wrapper.eth", + env: { key: "value" }, + }, + ]); -builder.add({ - envs: [/*...*/] -}); + // override existing Env, or add new Env if one is not registered at URI + builder.setEnv("wrap://ens/wrapper.eth", { key: "value" }); -const config = builder.build(); + // add or remove registration for an implementation of an interface + builder + .addInterfaceImplementation( + "wrap://ens/interface.eth", + "wrap://ens/wrapper.eth" + ) + .removeInterfaceImplementation( + "wrap://ens/interface.eth", + "wrap://ens/wrapper.eth" + ) + .addInterfaceImplementations("wrap://ens/interface.eth", [ + "wrap://ens/wrapper.eth", + ]); + // add or remove URI redirects + builder + .addRedirect("wrap://ens/from.eth", "wrap://ens/to.eth") + .removeRedirect("wrap://ens/from.eth") + .addRedirects([ + { + from: "wrap://ens/from.eth", + to: "wrap://ens/to.eth", + }, + ]); -// ... + // add resolvers + builder.addResolver(RecursiveResolver.from([])); + builder.addResolvers([]); + + // build + const clientConfig = builder.build(); +``` + +# Reference + +## Types + +```ts +/** + * Client configuration that can be passed to the PolywrapClient + * + * @remarks + * The PolywrapClient converts the ClientConfig to a CoreClientConfig. + */ +export interface ClientConfig { + /** set environmental variables for a wrapper */ + readonly envs: Env[]; + + /** register interface implementations */ + readonly interfaces: InterfaceImplementations[]; + + /** redirect invocations from one uri to another */ + readonly redirects: IUriRedirect[]; + + /** add embedded wrappers */ + readonly wrappers: IUriWrapper[]; + + /** add and configure embedded packages */ + readonly packages: IUriPackage[]; + + /** customize URI resolution + * + * @remarks + * A UriResolverLike can be any one of: + * IUriResolver + * | IUriRedirect + * | IUriPackage + * | IUriWrapper + * | UriResolverLike[] + * */ + readonly resolvers: UriResolverLike[]; +} +``` + +## ClientConfigBuilder + +### Constructor +```ts + /** + * Instantiate a ClientConfigBuilder + * + * @param _wrapperCache?: a wrapper cache to be used in place of the default wrapper cache + * @param _resolver?: a uri resolver to be used in place of any added redirects, wrappers, packages, and resolvers when building a CoreClientConfig + */ + constructor( + private readonly _wrapperCache?: IWrapperCache, + private readonly _resolver?: IUriResolver + ) +``` + +### add +```ts + /** + * Add a partial ClientConfig + * This is equivalent to calling each of the plural add functions: `addEnvs`, `addWrappers`, etc. + * + * @param config: a partial CliengConfig + * @returns IClientConfigBuilder (mutated self) + */ + add(config: Partial): IClientConfigBuilder; +``` + +### addWrapper +```ts + /** + * Add an embedded wrapper + * + * @param uriWrapper: a wrapper and its URI + * @returns IClientConfigBuilder (mutated self) + */ + addWrapper(uriWrapper: IUriWrapper): IClientConfigBuilder; +``` + +### addWrappers +```ts + /** + * Add one or more embedded wrappers. + * This is equivalent to calling addWrapper for each wrapper. + * + * @param uriWrappers: a list of wrappers and their URIs + * @returns IClientConfigBuilder (mutated self) + */ + addWrappers(uriWrappers: IUriWrapper[]): IClientConfigBuilder; +``` -let client = new PolywrapClient(config); +### removeWrapper +```ts + /** + * Remove an embedded wrapper + * + * @param uri: the wrapper's URI + * @returns IClientConfigBuilder (mutated self) + */ + removeWrapper(uri: Uri | string): IClientConfigBuilder; ``` -## Methods +### addPackage +```ts + /** + * Add an embedded wrap package + * + * @param uriPackage: a package and its URI + * @returns IClientConfigBuilder (mutated self) + */ + addPackage(uriPackage: IUriPackage): IClientConfigBuilder; +``` + +### addPackages +```ts + /** + * Add one or more embedded wrap packages + * This is equivalent to calling addPackage for each package + * + * @param uriPackages: a list of packages and their URIs + * @returns IClientConfigBuilder (mutated self) + */ + addPackages(uriPackages: IUriPackage[]): IClientConfigBuilder; +``` + +### removePackage +```ts + /** + * Remove an embedded wrap package + * + * @param uri: the package's URI + * @returns IClientConfigBuilder (mutated self) + */ + removePackage(uri: Uri | string): IClientConfigBuilder; +``` + +### addEnv +```ts + /** + * Add an Env. + * If an Env is already associated with the uri, it is modified. + * + * @param uri: the wrapper's URI to associate with the Env + * @param env: a string-index map of msgpack-serializable environmental variables + * @returns IClientConfigBuilder (mutated self) + */ + addEnv(uri: Uri | string, env: Record): IClientConfigBuilder; +``` + +### addEnvs +```ts + /** + * Add one or more Envs + * This is equivalent to calling addEnv for each Env + * + * @param envs: a list of Envs + * @returns IClientConfigBuilder (mutated self) + */ + addEnvs(envs: Env[]): IClientConfigBuilder; +``` + +### removeEnv +```ts + /** + * Remove an Env + * + * @param uri: the URI associated with the Env + * @returns IClientConfigBuilder (mutated self) + */ + removeEnv(uri: Uri | string): IClientConfigBuilder; +``` + +### setEnv +```ts + /** + * Add an Env. + * If an Env is already associated with the uri, it is replaced. + * + * @param uri: the wrapper's URI to associate with the Env + * @param env: a string-index map of msgpack-serializable environmental variables + * @returns IClientConfigBuilder (mutated self) + */ + setEnv(uri: Uri | string, env: Record): IClientConfigBuilder; +``` + +### addInterfaceImplementation +```ts + /** + * Register an implementation of a single interface + * + * @param interfaceUri: the URI of the interface + * @param implementationUri: the URI of the implementation + * @returns IClientConfigBuilder (mutated self) + */ + addInterfaceImplementation( + interfaceUri: Uri | string, + implementationUri: Uri | string + ): IClientConfigBuilder; +``` + +### addInterfaceImplementations +```ts + /** + * Register one or more implementation of a single interface + * + * @param interfaceUri: the URI of the interface + * @param implementationUris: a list of URIs for the implementations + * @returns IClientConfigBuilder (mutated self) + */ + addInterfaceImplementations( + interfaceUri: Uri | string, + implementationUris: Array + ): IClientConfigBuilder; +``` + +### removeInterfaceImplementation +```ts + /** + * Remove an implementation of a single interface + * + * @param interfaceUri: the URI of the interface + * @param implementationUri: the URI of the implementation + * @returns IClientConfigBuilder (mutated self) + */ + removeInterfaceImplementation( + interfaceUri: Uri | string, + implementationUri: Uri | string + ): IClientConfigBuilder; +``` + +### addRedirect +```ts + /** + * Add a redirect from one URI to another + * + * @param from: the URI to redirect from + * @param to: the URI to redirect to + * @returns IClientConfigBuilder (mutated self) + */ + addRedirect(from: Uri | string, to: Uri | string): IClientConfigBuilder; +``` + +### addRedirects +```ts + /** + * Add an array of URI redirects + * + * @param redirects: a list of URI redirects + * @returns IClientConfigBuilder (mutated self) + */ + addRedirects(redirects: IUriRedirect[]): IClientConfigBuilder; +``` + +### removeRedirect +```ts + /** + * Remove a URI redirect + * + * @param from: the URI that is being redirected + * @returns IClientConfigBuilder (mutated self) + */ + removeRedirect(from: Uri | string): IClientConfigBuilder; +``` + +### addResolver +```ts + /** + * Add a URI Resolver, capable of resolving a URI to a wrapper + * + * @remarks + * A UriResolverLike can be any one of: + * IUriResolver + * | IUriRedirect + * | IUriPackage + * | IUriWrapper + * | UriResolverLike[]; + * + * @param resolver: A UriResolverLike + * @returns IClientConfigBuilder (mutated self) + */ + addResolver(resolver: UriResolverLike): IClientConfigBuilder; +``` + +### addResolvers +```ts + /** + * Add one or more URI Resolvers, capable of resolving URIs to wrappers + * + * @remarks + * A UriResolverLike can be any one of: + * IUriResolver + * | IUriRedirect + * | IUriPackage + * | IUriWrapper + * | UriResolverLike[]; + * + * @param resolvers: A list of UriResolverLike + * @returns IClientConfigBuilder (mutated self) + */ + addResolvers(resolvers: UriResolverLike[]): IClientConfigBuilder; +``` + +### addDefaults +```ts + /** + * Add the default configuration bundle + * + * @returns IClientConfigBuilder (mutated self) + */ + addDefaults(): IClientConfigBuilder; +``` + +### build +```ts + /** + * Build a sanitized client configuration that can be passed to the PolywrapClient constructor + * + * @returns ClientConfig that results from applying all the steps in the builder pipeline + */ + build(): ClientConfig; +``` + +### buildCoreConfig +```ts + /** + * Build a sanitized core client configuration that can be passed to the PolywrapClient or PolywrapCoreClient constructors + * + * @returns CoreClientConfig that results from applying all the steps in the builder pipeline + */ + buildCoreConfig(): CoreClientConfig; +``` + +## Bundles + +### Bundle: DefaultConfig +```ts + +export const defaultIpfsProviders = [ + "https://ipfs.wrappers.io", + "https://ipfs.io", +]; + +export const defaultWrappers = { + sha3: "wrap://ens/goerli/sha3.wrappers.eth", + uts46: "wrap://ens/goerli/uts46-lite.wrappers.eth", + graphNode: "wrap://ens/goerli/graph-node.wrappers.eth", + ensTextRecordResolver: + "wrap://ipfs/QmfRCVA1MSAjUbrXXjya4xA9QHkbWeiKRsT7Um1cvrR7FY", +}; + +export const defaultPackages = { + ipfs: "wrap://ens/ipfs.polywrap.eth", + ensResolver: "wrap://ens/ens-resolver.polywrap.eth", + ethereum: "wrap://ens/ethereum.polywrap.eth", + http: "wrap://ens/http.polywrap.eth", + httpResolver: "wrap://ens/http-resolver.polywrap.eth", + logger: "wrap://plugin/logger", + fileSystem: "wrap://ens/fs.polywrap.eth", + fileSystemResolver: "wrap://ens/fs-resolver.polywrap.eth", + ipfsResolver: "wrap://ens/ipfs-resolver.polywrap.eth", + concurrent: "wrap://plugin/concurrent", +}; -The config builder currently supports 3 methods: +export const defaultInterfaces = { + uriResolver: "wrap://ens/uri-resolver.core.polywrap.eth", + concurrent: "wrap://ens/goerli/interface.concurrent.wrappers.eth", + logger: "wrap://ens/wrappers.polywrap.eth:logger@1.0.0", +}; -#### `add(config: Partial)` -Appends each property of the supplied config object to the corresponding array of the builder's config. +export const getDefaultConfig = (): ClientConfig => { + return { + envs: [ + { + uri: new Uri(defaultWrappers.graphNode), + env: { + provider: "https://api.thegraph.com", + }, + }, + { + uri: new Uri(defaultPackages.ipfs), + env: { + provider: defaultIpfsProviders[0], + fallbackProviders: defaultIpfsProviders.slice(1), + }, + }, + ], + redirects: [ + { + from: new Uri("wrap://ens/sha3.polywrap.eth"), + to: new Uri(defaultWrappers.sha3), + }, + { + from: new Uri("wrap://ens/uts46.polywrap.eth"), + to: new Uri(defaultWrappers.uts46), + }, + { + from: new Uri("wrap://ens/graph-node.polywrap.eth"), + to: new Uri(defaultWrappers.graphNode), + }, + { + from: new Uri(defaultInterfaces.logger), + to: new Uri(defaultPackages.logger), + }, + ], + interfaces: [ + { + interface: new Uri(defaultInterfaces.uriResolver), + implementations: [ + new Uri(defaultPackages.ipfsResolver), + new Uri(defaultPackages.ensResolver), + new Uri(defaultPackages.fileSystemResolver), + new Uri(defaultPackages.httpResolver), + new Uri(defaultWrappers.ensTextRecordResolver), + ], + }, + { + interface: new Uri(defaultInterfaces.logger), + implementations: [new Uri(defaultPackages.logger)], + }, + { + interface: new Uri(defaultInterfaces.concurrent), + implementations: [new Uri(defaultPackages.concurrent)], + }, + ], + packages: getDefaultPlugins(), + wrappers: [], + resolvers: [], + }; +}; -#### `addDefaults()` -Adds the `defaultClientConfig` object. +export const getDefaultPlugins = (): IUriPackage[] => { + return [ + // IPFS is required for downloading Polywrap packages + { + uri: new Uri(defaultPackages.ipfs), + package: ipfsPlugin({}), + }, + // ENS is required for resolving domain to IPFS hashes + { + uri: new Uri(defaultPackages.ensResolver), + package: ensResolverPlugin({}), + }, + { + uri: new Uri(defaultPackages.ethereum), + package: ethereumPlugin({ + connections: new Connections({ + networks: { + mainnet: new Connection({ + provider: + "https://mainnet.infura.io/v3/b00b2c2cc09c487685e9fb061256d6a6", + }), + goerli: new Connection({ + provider: + "https://goerli.infura.io/v3/b00b2c2cc09c487685e9fb061256d6a6", + }), + }, + }), + }), + }, + { + uri: new Uri(defaultPackages.http), + package: httpPlugin({}), + }, + { + uri: new Uri(defaultPackages.httpResolver), + package: httpResolverPlugin({}), + }, + { + uri: new Uri(defaultPackages.logger), + // TODO: remove this once types are updated + package: loggerPlugin({}) as IWrapPackage, + }, + { + uri: new Uri(defaultPackages.fileSystem), + package: fileSystemPlugin({}), + }, + { + uri: new Uri(defaultPackages.fileSystemResolver), + package: fileSystemResolverPlugin({}), + }, + { + uri: new Uri(defaultPackages.ipfsResolver), + package: ipfsResolverPlugin({}), + }, + { + uri: new Uri(defaultPackages.concurrent), + package: concurrentPromisePlugin({}), + }, + ]; +}; -#### `build()` -Returns a sanitized config object from the builder's config. +``` \ No newline at end of file diff --git a/packages/js/client-config-builder/examples/quickstart.ts b/packages/js/client-config-builder/examples/quickstart.ts new file mode 100644 index 0000000000..1790bcceb5 --- /dev/null +++ b/packages/js/client-config-builder/examples/quickstart.ts @@ -0,0 +1,182 @@ +import { ClientConfigBuilder, ClientConfig } from "../build"; + +// eslint-disable-next-line import/no-extraneous-dependencies +import { WasmWrapper } from "@polywrap/wasm-js"; +import { httpPlugin } from "@polywrap/http-plugin-js"; +import { RecursiveResolver, WrapperCache } from "@polywrap/uri-resolvers-js"; +import { fileSystemPlugin } from "@polywrap/fs-plugin-js"; +import { CoreClientConfig, Uri } from "@polywrap/core-js"; + +export function initialize(): ClientConfigBuilder { + // $start: quickstart-initialize + // start with a blank slate (typical usage) + const builder = new ClientConfigBuilder(); + + // instantiate a builder with a custom cache and/or resolver + const _builder = new ClientConfigBuilder( + new WrapperCache(), + RecursiveResolver.from([]) + ); + // $end + + return builder ?? _builder; +} + +export function configure(): ClientConfigBuilder { + const builder = new ClientConfigBuilder(); + + // $start: quickstart-configure + // add multiple items to the configuration using the catch-all `add` method + builder.add({ + envs: [], + interfaces: [], + redirects: [], + wrappers: [], + packages: [], + resolvers: [], + }); + + // add or remove items by chaining method calls + builder + .addPackage({ + uri: "wrap://plugin/package", + package: httpPlugin({}), + }) + .removePackage("wrap://plugin/package") + .addPackages([ + { + uri: "wrap://plugin/http", + package: httpPlugin({}), + }, + { + uri: "wrap://plugin/filesystem", + package: fileSystemPlugin({}), + }, + ]); + // $end + + // $start: quickstart-addDefaults + builder.addDefaults(); + // $end + + return builder; +} + +export function build(): + | ClientConfigBuilder + | ClientConfig + | CoreClientConfig { + const builder = new ClientConfigBuilder(); + + // $start: quickstart-build + // accepted by the PolywrapClient + const clientConfig = builder.build(); + + // accepted by either the PolywrapClient or the PolywrapCoreClient + const coreClientConfig = builder.buildCoreConfig(); + // $end + + return builder ?? clientConfig ?? coreClientConfig; +} + +export async function example(): Promise> { + // $start: quickstart-example + // init + const builder = new ClientConfigBuilder(); + + // add the default bundle first to override its entries later + builder.addDefaults(); + + // add many config items at once + builder.add({ + envs: [], + interfaces: [], + redirects: [], + wrappers: [], + packages: [], + resolvers: [], + }); + + // add and remove wrappers + builder + .addWrapper({ + uri: "wrap://ens/wrapper.eth", + wrapper: await WasmWrapper.from( + new Uint8Array([1, 2, 3]), + new Uint8Array([1, 2, 3]) + ), + }) + .removeWrapper("wrap://ens/wrapper.eth") + .addWrappers([ + { + uri: "wrap://ens/wrapper.eth", + wrapper: await WasmWrapper.from( + new Uint8Array([1, 2, 3]), + new Uint8Array([1, 2, 3]) + ), + }, + ]); + + // add and remove wrap packages + builder + .addPackage({ + uri: "wrap://plugin/package", + package: httpPlugin({}), + }) + .removePackage("wrap://plugin/package") + .addPackages([ + { + uri: "wrap://plugin/package", + package: httpPlugin({}), + }, + ]); + + // add and remove Envs + builder + .addEnv("wrap://ens/wrapper.eth", { key: "value" }) + .removeEnv("wrap://ens/wrapper.eth") + .addEnvs([ + { + uri: "wrap://ens/wrapper.eth", + env: { key: "value" }, + }, + ]); + + // override existing Env, or add new Env if one is not registered at URI + builder.setEnv("wrap://ens/wrapper.eth", { key: "value" }); + + // add or remove registration for an implementation of an interface + builder + .addInterfaceImplementation( + "wrap://ens/interface.eth", + "wrap://ens/wrapper.eth" + ) + .removeInterfaceImplementation( + "wrap://ens/interface.eth", + "wrap://ens/wrapper.eth" + ) + .addInterfaceImplementations("wrap://ens/interface.eth", [ + "wrap://ens/wrapper.eth", + ]); + + // add or remove URI redirects + builder + .addRedirect("wrap://ens/from.eth", "wrap://ens/to.eth") + .removeRedirect("wrap://ens/from.eth") + .addRedirects([ + { + from: "wrap://ens/from.eth", + to: "wrap://ens/to.eth", + }, + ]); + + // add resolvers + builder.addResolver(RecursiveResolver.from([])); + builder.addResolvers([]); + + // build + const clientConfig = builder.build(); + // $end + + return clientConfig; +} diff --git a/packages/js/client-config-builder/examples/tsconfig.examples.json b/packages/js/client-config-builder/examples/tsconfig.examples.json new file mode 100644 index 0000000000..f37de53612 --- /dev/null +++ b/packages/js/client-config-builder/examples/tsconfig.examples.json @@ -0,0 +1,6 @@ +{ + "extends": "../tsconfig.json", + "include": [ + "./**/*.ts" + ], +} \ No newline at end of file diff --git a/packages/js/client-config-builder/package.json b/packages/js/client-config-builder/package.json index 14d27181a2..fdbca4df65 100644 --- a/packages/js/client-config-builder/package.json +++ b/packages/js/client-config-builder/package.json @@ -12,11 +12,14 @@ "build" ], "scripts": { - "build": "rimraf ./build && tsc --project tsconfig.build.json", + "build": "yarn build:fast && yarn build:snippets && yarn build:readme", + "build:fast": "rimraf ./build && tsc --project tsconfig.build.json", "lint": "eslint --color -c ../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", - "test:watch": "jest --watch --passWithNoTests --verbose" + "test:watch": "jest --watch --passWithNoTests --verbose", + "build:snippets": "tsc --project ./examples/tsconfig.examples.json", + "build:readme": "yarn doc-snippets combine" }, "dependencies": { "@polywrap/core-js": "0.10.0-pre.7", @@ -31,9 +34,11 @@ "@polywrap/logger-plugin-js": "0.10.0", "@polywrap/uri-resolver-extensions-js": "0.10.0-pre.7", "@polywrap/uri-resolvers-js": "0.10.0-pre.7", - "concurrent-plugin-js": "0.1.1" + "concurrent-plugin-js": "0.1.1", + "doc-snippets": "^1.0.0" }, "devDependencies": { + "@polywrap/wasm-js": "0.10.0-pre.7", "@types/jest": "26.0.8", "@types/prettier": "2.6.0", "jest": "26.6.3", @@ -45,5 +50,44 @@ "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", "publishConfig": { "access": "public" + }, + "doc-snippets": { + "extract": { + "include": [ + "./src/**/*.{ts,tsx,json,yaml,txt,md,graphql,cue}", + "./examples/**/*.{ts,tsx,json,yaml,txt,md,graphql,cue}" + ], + "ignore": [ + "./**/node_modules/**", + "./**/.polywrap/**", + "./**/__tests__/**" + ], + "dir": "./" + }, + "inject": { + "dir": "./readme", + "include": "./README.md" + }, + "startTokens": [ + { + "pattern": "$start: ", + "inline": false + }, + { + "pattern": "/* $: {SNIPPET_NAME} */", + "inline": true + } + ], + "endTokens": [ + { + "pattern": "$end", + "inline": false + }, + { + "pattern": "/* $ */", + "inline": true + } + ], + "outputDir": "./" } } diff --git a/packages/js/client-config-builder/readme/README.md b/packages/js/client-config-builder/readme/README.md new file mode 100644 index 0000000000..3748e58241 --- /dev/null +++ b/packages/js/client-config-builder/readme/README.md @@ -0,0 +1,177 @@ +# PolywrapClient Config Builder + +A utility class for building the PolywrapClient config. + +Supports building configs using method chaining or imperatively. + +## Quickstart + +### Initialize + +Initialize a ClientConfigBuilder using the [constructor](#constructor) + +```typescript +$snippet: quickstart-initialize +``` + +### Configure + +Add client configuration with [add](#add), or flexibly mix and match builder [configuration methods](#addwrapper) to add and remove configuration items. + +```typescript +$snippet: quickstart-configure +``` + +You can add the entire [default client configuration bundle](#bundle--defaultconfig) at once with [addDefaults](#adddefaults) + +```typescript +$snippet: quickstart-addDefaults +``` + +### Build + +Finally, build a ClientConfig or CoreClientConfig to pass to the PolywrapClient constructor. + +```typescript +$snippet: quickstart-build +``` + +### Example + +A complete example using all or most of the available methods. + +```typescript= +$snippet: quickstart-example +``` + +# Reference + +## Types + +```ts +$snippet: ClientConfig +``` + +## ClientConfigBuilder + +### Constructor +```ts +$snippet: ClientConfigBuilder-constructor +``` + +### add +```ts +$snippet: IClientConfigBuilder-add +``` + +### addWrapper +```ts +$snippet: IClientConfigBuilder-addWrapper +``` + +### addWrappers +```ts +$snippet: IClientConfigBuilder-addWrappers +``` + +### removeWrapper +```ts +$snippet: IClientConfigBuilder-removeWrapper +``` + +### addPackage +```ts +$snippet: IClientConfigBuilder-addPackage +``` + +### addPackages +```ts +$snippet: IClientConfigBuilder-addPackages +``` + +### removePackage +```ts +$snippet: IClientConfigBuilder-removePackage +``` + +### addEnv +```ts +$snippet: IClientConfigBuilder-addEnv +``` + +### addEnvs +```ts +$snippet: IClientConfigBuilder-addEnvs +``` + +### removeEnv +```ts +$snippet: IClientConfigBuilder-removeEnv +``` + +### setEnv +```ts +$snippet: IClientConfigBuilder-setEnv +``` + +### addInterfaceImplementation +```ts +$snippet: IClientConfigBuilder-addInterfaceImplementation +``` + +### addInterfaceImplementations +```ts +$snippet: IClientConfigBuilder-addInterfaceImplementations +``` + +### removeInterfaceImplementation +```ts +$snippet: IClientConfigBuilder-removeInterfaceImplementation +``` + +### addRedirect +```ts +$snippet: IClientConfigBuilder-addRedirect +``` + +### addRedirects +```ts +$snippet: IClientConfigBuilder-addRedirects +``` + +### removeRedirect +```ts +$snippet: IClientConfigBuilder-removeRedirect +``` + +### addResolver +```ts +$snippet: IClientConfigBuilder-addResolver +``` + +### addResolvers +```ts +$snippet: IClientConfigBuilder-addResolvers +``` + +### addDefaults +```ts +$snippet: IClientConfigBuilder-addDefaults +``` + +### build +```ts +$snippet: IClientConfigBuilder-build +``` + +### buildCoreConfig +```ts +$snippet: IClientConfigBuilder-buildCoreConfig +``` + +## Bundles + +### Bundle: DefaultConfig +```ts +$snippet: getDefaultConfig +``` \ No newline at end of file diff --git a/packages/js/client-config-builder/src/ClientConfig.ts b/packages/js/client-config-builder/src/ClientConfig.ts index bb6593efd5..462bf34f86 100644 --- a/packages/js/client-config-builder/src/ClientConfig.ts +++ b/packages/js/client-config-builder/src/ClientConfig.ts @@ -8,11 +8,39 @@ import { } from "@polywrap/core-js"; import { UriResolverLike } from "@polywrap/uri-resolvers-js"; +// $start: ClientConfig +/** + * Client configuration that can be passed to the PolywrapClient + * + * @remarks + * The PolywrapClient converts the ClientConfig to a CoreClientConfig. + */ export interface ClientConfig { + /** set environmental variables for a wrapper */ readonly envs: Env[]; + + /** register interface implementations */ readonly interfaces: InterfaceImplementations[]; + + /** redirect invocations from one uri to another */ readonly redirects: IUriRedirect[]; + + /** add embedded wrappers */ readonly wrappers: IUriWrapper[]; + + /** add and configure embedded packages */ readonly packages: IUriPackage[]; + + /** customize URI resolution + * + * @remarks + * A UriResolverLike can be any one of: + * IUriResolver + * | IUriRedirect + * | IUriPackage + * | IUriWrapper + * | UriResolverLike[] + * */ readonly resolvers: UriResolverLike[]; } +// $end diff --git a/packages/js/client-config-builder/src/ClientConfigBuilder.ts b/packages/js/client-config-builder/src/ClientConfigBuilder.ts index e000cd8996..a580c0ac8c 100644 --- a/packages/js/client-config-builder/src/ClientConfigBuilder.ts +++ b/packages/js/client-config-builder/src/ClientConfigBuilder.ts @@ -12,10 +12,17 @@ import { import { ExtendableUriResolver } from "@polywrap/uri-resolver-extensions-js"; export class ClientConfigBuilder extends BaseClientConfigBuilder { + // $start: ClientConfigBuilder-constructor + /** + * Instantiate a ClientConfigBuilder + * + * @param _wrapperCache?: a wrapper cache to be used in place of the default wrapper cache + * @param _resolver?: a uri resolver to be used in place of any added redirects, wrappers, packages, and resolvers when building a CoreClientConfig + */ constructor( private readonly _wrapperCache?: IWrapperCache, private readonly _resolver?: IUriResolver - ) { + ) /* $ */ { super(); } diff --git a/packages/js/client-config-builder/src/IClientConfigBuilder.ts b/packages/js/client-config-builder/src/IClientConfigBuilder.ts index a9da5352ba..9d398efff5 100644 --- a/packages/js/client-config-builder/src/IClientConfigBuilder.ts +++ b/packages/js/client-config-builder/src/IClientConfigBuilder.ts @@ -11,35 +11,257 @@ import { import { UriResolverLike } from "@polywrap/uri-resolvers-js"; export interface IClientConfigBuilder { + // $start: IClientConfigBuilder-build + /** + * Build a sanitized client configuration that can be passed to the PolywrapClient constructor + * + * @returns ClientConfig that results from applying all the steps in the builder pipeline + */ build(): ClientConfig; + // $end + + // $start: IClientConfigBuilder-buildCoreConfig + /** + * Build a sanitized core client configuration that can be passed to the PolywrapClient or PolywrapCoreClient constructors + * + * @returns CoreClientConfig that results from applying all the steps in the builder pipeline + */ buildCoreConfig(): CoreClientConfig; + // $end + + // $start: IClientConfigBuilder-add + /** + * Add a partial ClientConfig + * This is equivalent to calling each of the plural add functions: `addEnvs`, `addWrappers`, etc. + * + * @param config: a partial CliengConfig + * @returns IClientConfigBuilder (mutated self) + */ add(config: Partial): IClientConfigBuilder; + // $end + + // $start: IClientConfigBuilder-addDefaults + /** + * Add the default configuration bundle + * + * @returns IClientConfigBuilder (mutated self) + */ addDefaults(): IClientConfigBuilder; + // $end + + // $start: IClientConfigBuilder-addWrapper + /** + * Add an embedded wrapper + * + * @param uriWrapper: a wrapper and its URI + * @returns IClientConfigBuilder (mutated self) + */ addWrapper(uriWrapper: IUriWrapper): IClientConfigBuilder; + // $end + + // $start: IClientConfigBuilder-addWrappers + /** + * Add one or more embedded wrappers. + * This is equivalent to calling addWrapper for each wrapper. + * + * @param uriWrappers: a list of wrappers and their URIs + * @returns IClientConfigBuilder (mutated self) + */ addWrappers(uriWrappers: IUriWrapper[]): IClientConfigBuilder; + // $end + + // $start: IClientConfigBuilder-removeWrapper + /** + * Remove an embedded wrapper + * + * @param uri: the wrapper's URI + * @returns IClientConfigBuilder (mutated self) + */ removeWrapper(uri: Uri | string): IClientConfigBuilder; + // $end + + // $start: IClientConfigBuilder-addPackage + /** + * Add an embedded wrap package + * + * @param uriPackage: a package and its URI + * @returns IClientConfigBuilder (mutated self) + */ addPackage(uriPackage: IUriPackage): IClientConfigBuilder; + // $end + + // $start: IClientConfigBuilder-addPackages + /** + * Add one or more embedded wrap packages + * This is equivalent to calling addPackage for each package + * + * @param uriPackages: a list of packages and their URIs + * @returns IClientConfigBuilder (mutated self) + */ addPackages(uriPackages: IUriPackage[]): IClientConfigBuilder; + // $end + + // $start: IClientConfigBuilder-removePackage + /** + * Remove an embedded wrap package + * + * @param uri: the package's URI + * @returns IClientConfigBuilder (mutated self) + */ removePackage(uri: Uri | string): IClientConfigBuilder; + // $end + + // $start: IClientConfigBuilder-addEnv + /** + * Add an Env. + * If an Env is already associated with the uri, it is modified. + * + * @param uri: the wrapper's URI to associate with the Env + * @param env: a string-index map of msgpack-serializable environmental variables + * @returns IClientConfigBuilder (mutated self) + */ addEnv(uri: Uri | string, env: Record): IClientConfigBuilder; + // $end + + // $start: IClientConfigBuilder-addEnvs + /** + * Add one or more Envs + * This is equivalent to calling addEnv for each Env + * + * @param envs: a list of Envs + * @returns IClientConfigBuilder (mutated self) + */ addEnvs(envs: Env[]): IClientConfigBuilder; + // $end + + // $start: IClientConfigBuilder-removeEnv + /** + * Remove an Env + * + * @param uri: the URI associated with the Env + * @returns IClientConfigBuilder (mutated self) + */ removeEnv(uri: Uri | string): IClientConfigBuilder; + // $end + + // $start: IClientConfigBuilder-setEnv + /** + * Add an Env. + * If an Env is already associated with the uri, it is replaced. + * + * @param uri: the wrapper's URI to associate with the Env + * @param env: a string-index map of msgpack-serializable environmental variables + * @returns IClientConfigBuilder (mutated self) + */ setEnv(uri: Uri | string, env: Record): IClientConfigBuilder; + // $end + + // $start: IClientConfigBuilder-addInterfaceImplementation + /** + * Register an implementation of a single interface + * + * @param interfaceUri: the URI of the interface + * @param implementationUri: the URI of the implementation + * @returns IClientConfigBuilder (mutated self) + */ addInterfaceImplementation( interfaceUri: Uri | string, implementationUri: Uri | string ): IClientConfigBuilder; + // $end + + // $start: IClientConfigBuilder-addInterfaceImplementations + /** + * Register one or more implementation of a single interface + * + * @param interfaceUri: the URI of the interface + * @param implementationUris: a list of URIs for the implementations + * @returns IClientConfigBuilder (mutated self) + */ addInterfaceImplementations( interfaceUri: Uri | string, implementationUris: Array ): IClientConfigBuilder; + // $end + + // $start: IClientConfigBuilder-removeInterfaceImplementation + /** + * Remove an implementation of a single interface + * + * @param interfaceUri: the URI of the interface + * @param implementationUri: the URI of the implementation + * @returns IClientConfigBuilder (mutated self) + */ removeInterfaceImplementation( interfaceUri: Uri | string, implementationUri: Uri | string ): IClientConfigBuilder; + // $end + + // $start: IClientConfigBuilder-addRedirect + /** + * Add a redirect from one URI to another + * + * @param from: the URI to redirect from + * @param to: the URI to redirect to + * @returns IClientConfigBuilder (mutated self) + */ addRedirect(from: Uri | string, to: Uri | string): IClientConfigBuilder; + // $end + + // $start: IClientConfigBuilder-addRedirects + /** + * Add an array of URI redirects + * + * @param redirects: a list of URI redirects + * @returns IClientConfigBuilder (mutated self) + */ addRedirects(redirects: IUriRedirect[]): IClientConfigBuilder; + // $end + + // $start: IClientConfigBuilder-removeRedirect + /** + * Remove a URI redirect + * + * @param from: the URI that is being redirected + * @returns IClientConfigBuilder (mutated self) + */ removeRedirect(from: Uri | string): IClientConfigBuilder; + // $end + + // $start: IClientConfigBuilder-addResolver + /** + * Add a URI Resolver, capable of resolving a URI to a wrapper + * + * @remarks + * A UriResolverLike can be any one of: + * IUriResolver + * | IUriRedirect + * | IUriPackage + * | IUriWrapper + * | UriResolverLike[]; + * + * @param resolver: A UriResolverLike + * @returns IClientConfigBuilder (mutated self) + */ addResolver(resolver: UriResolverLike): IClientConfigBuilder; + // $end + + // $start: IClientConfigBuilder-addResolvers + /** + * Add one or more URI Resolvers, capable of resolving URIs to wrappers + * + * @remarks + * A UriResolverLike can be any one of: + * IUriResolver + * | IUriRedirect + * | IUriPackage + * | IUriWrapper + * | UriResolverLike[]; + * + * @param resolvers: A list of UriResolverLike + * @returns IClientConfigBuilder (mutated self) + */ addResolvers(resolvers: UriResolverLike[]): IClientConfigBuilder; + // $end } diff --git a/packages/js/client-config-builder/src/bundles/getDefaultConfig.ts b/packages/js/client-config-builder/src/bundles/getDefaultConfig.ts index 2f23e11e05..9bee88c2b2 100644 --- a/packages/js/client-config-builder/src/bundles/getDefaultConfig.ts +++ b/packages/js/client-config-builder/src/bundles/getDefaultConfig.ts @@ -16,6 +16,8 @@ import { loggerPlugin } from "@polywrap/logger-plugin-js"; import { fileSystemResolverPlugin } from "@polywrap/fs-resolver-plugin-js"; import { concurrentPromisePlugin } from "concurrent-plugin-js"; +// $start: getDefaultConfig + export const defaultIpfsProviders = [ "https://ipfs.wrappers.io", "https://ipfs.io", @@ -169,3 +171,5 @@ export const getDefaultPlugins = (): IUriPackage[] => { }, ]; }; + +// $end diff --git a/packages/js/client-config-builder/tsconfig.build.json b/packages/js/client-config-builder/tsconfig.build.json index 9708b5768a..ccebf665da 100644 --- a/packages/js/client-config-builder/tsconfig.build.json +++ b/packages/js/client-config-builder/tsconfig.build.json @@ -1,9 +1,12 @@ { "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "build" + }, "include": [ "./src/**/*.ts" ], "exclude": [ - "./src/**/__tests__" + "./src/**/__tests__", ] } \ No newline at end of file diff --git a/packages/js/client-config-builder/tsconfig.json b/packages/js/client-config-builder/tsconfig.json index 5d37204c00..02827831c0 100644 --- a/packages/js/client-config-builder/tsconfig.json +++ b/packages/js/client-config-builder/tsconfig.json @@ -1,10 +1,8 @@ { "extends": "../../../tsconfig", - "compilerOptions": { - "outDir": "build" - }, "include": [ - "./src/**/*.ts" + "./src/**/*.ts", + "./examples/**/*.ts" ], "exclude": [] } diff --git a/packages/js/client/.gitignore b/packages/js/client/.gitignore new file mode 100644 index 0000000000..dbb01bb64d --- /dev/null +++ b/packages/js/client/.gitignore @@ -0,0 +1,3 @@ +/examples/**/*.d.ts +/examples/**/*.js +/examples/**/*.js.map diff --git a/packages/js/client/README.md b/packages/js/client/README.md index 1ff5cf7bd4..a40f7e1fc9 100644 --- a/packages/js/client/README.md +++ b/packages/js/client/README.md @@ -5,7 +5,7 @@

-The Polywrap JavaScript client invokes functions of wrappers and plugins. It's designed to run in any environment that can execute JavaScript (think websites, node scripts, etc.). It has TypeScript support. +The Polywrap client extends the PolywrapCoreClient to provide UX features, such as an additional constructor and additional configuration options. ## Installation @@ -15,367 +15,86 @@ npm install --save @polywrap/client-js ## Usage -### Instantiate the client -```ts -import { PolywrapClient } from "@polywrap/client-js"; - -const client = new PolywrapClient(); -``` - -### Invoke a wrapper +### Instantiate -```ts -await client.invoke({ - uri: "ens/rinkeby/helloworld.dev.polywrap.eth", - method: "logMessage", - args: { - message: "Hello World!" - } -}); -``` - -### Configure the client +Use the PolywrapClient [constructor](#constructor) to instantiate the client with the default configuration bundle. ```ts -const config = { - // redirect queries from one uri to another - redirects: [ - { - from: "wrap://ens/from.eth", - to: "wrap://ens/to.eth", - } - ], - // declare and configure plugin wrappers - plugins: [ - { - uri: "wrap://ens/ipfs.polywrap.eth", - plugin: ipfsPlugin({}), - }, - ], - // declare interface implementations - interfaces: [ - { - interface: "wrap://ens/uri-resolver.core.polywrap.eth", - implementations: [ - "wrap://ens/ipfs-resolver.polywrap.eth", - ], - }, - ], - // set environmental variables for a wrapper - envs: [ - { - uri: "wrap://ens/ipfs.polywrap.eth", - env: { - provider: "https://ipfs.wrappers.io", - }, - }, - ], - - // ADVANCED USAGE: - - // customize URI resolution - resolver: new RecursiveResolver( - new PackageToWrapperCacheResolver(wrapperCache, [ - new ExtendableUriResolver(), - ]) - ), + import { PolywrapClient } from "@polywrap/client-js"; - // custom wrapper cache - wrapperCache: new WrapperCache(), - - // tracer configuration - see @polywrap/tracing-js package - tracerConfig: { ... }, -}; -``` -```ts -// create a client by modifying the default configuration bundle -const client = new PolywrapClient(config); - -// or remove and replace the default configuration -const altClient = new PolywrapClient(config, { noDefaults: true }); + const client = new PolywrapClient(); ``` -## Reference +### Configure -### Constructor -```ts -/** - * Instantiate a PolywrapClient - * - * @param config - a whole or partial client configuration - * @param options - { noDefaults?: boolean } - */ -constructor(config?: Partial>, options?: { - noDefaults?: boolean; -}); -``` +Use the `@polywrap/client-config-builder-js` package to build a custom configuration for your project. -### getConfig ```ts -/** - * Returns the configuration used to instantiate the client - * - * @returns an immutable Polywrap client config - */ -getConfig(): PolywrapCoreClientConfig; -``` + const config = new ClientConfigBuilder().addDefaults().buildCoreConfig(); -### setTracingEnabled -```ts -/** - * Enable tracing for intricate debugging - * - * @remarks - * Tracing uses the @polywrap/tracing-js package - * - * @param tracerConfig - configure options such as the tracing level - * @returns void - */ -setTracingEnabled(tracerConfig?: Partial): void; + const client = new PolywrapClient(config, { noDefaults: true }); ``` -### getInterfaces -```ts -/** - * returns all interfaces from the configuration used to instantiate the client - * - * @returns an array of interfaces and their registered implementations - */ -getInterfaces(): readonly InterfaceImplementations[]; -``` +### Invoke -### getEnvs -```ts -/** - * returns all env registrations from the configuration used to instantiate the client - * - * @returns an array of env objects containing wrapper environmental variables - */ -getEnvs(): readonly Env[]; -``` +Invoke a wrapper. -### getResolver ```ts -/** - * returns the URI resolver from the configuration used to instantiate the client - * - * @returns an object that implements the IUriResolver interface - */ -getResolver(): IUriResolver; -``` + const result = await client.invoke({ + uri: "ens/helloworld.dev.polywrap.eth", + method: "logMessage", + args: { + message: "Hello World!" + } + }); -### getEnvByUri -```ts -/** - * returns an env (a set of environmental variables) from the configuration used to instantiate the client - * - * @param uri - the URI used to register the env - * @returns an env, or undefined if an env is not found at the given URI - */ -getEnvByUri(uri: TUri): Env | undefined; -``` + if (!result.ok) throw result.error; -### getManifest -```ts -/** - * returns a package's wrap manifest - * - * @param uri - a wrap URI - * @param options - { noValidate?: boolean } - * @returns a Result containing the WrapManifest if the request was successful - */ -getManifest(uri: TUri, options?: GetManifestOptions): Promise>; + const value = result.value; ``` -### getFile -```ts -/** - * returns a file contained in a wrap package - * - * @param uri - a wrap URI - * @param options - { path: string; encoding?: "utf-8" | string } - * @returns a Promise of a Result containing a file if the request was successful - */ -getFile(uri: TUri, options: GetFileOptions): Promise>; -``` +# Reference -### getImplementations -```ts -/** - * returns the interface implementations associated with an interface URI - * from the configuration used to instantiate the client - * - * @param uri - a wrap URI - * @param options - { applyResolution?: boolean } - * @returns a Result containing URI array if the request was successful - */ -getImplementations(uri: TUri, options?: GetImplementationsOptions): Result; -``` +## Types -### query ```ts /** - * Invoke a wrapper using GraphQL query syntax + * Client configuration that can be passed to the PolywrapClient. * * @remarks - * This method behaves similar to the invoke method and allows parallel requests, - * but the syntax is more verbose. If the query is successful, data will be returned - * and the `error` value of the returned object will be undefined. If the query fails, - * the data property will be undefined and the error property will be populated. - * - * @param options - { - * // The Wrapper's URI - * uri: TUri; - * - * // The GraphQL query to parse and execute, leading to one or more Wrapper invocations. - * query: string | QueryDocument; - * - * // Variables referenced within the query string via GraphQL's '$variable' syntax. - * variables?: TVariables; - * } - * - * @returns A Promise containing an object with either the data or an error - */ -query = Record, TVariables extends Record = Record, TUri extends Uri | string = string>(options: QueryOptions): Promise>; -``` - -### invokeWrapper -```ts -/** - * Invoke a wrapper using standard syntax and an instance of the wrapper - * - * @param options - { - * // The Wrapper's URI - * uri: TUri; - * - * // Method to be executed. - * method: string; - * - * //Arguments for the method, structured as a map, removing the chance of incorrectly ordering arguments. - * args?: Record | Uint8Array; - * - * // Env variables for the wrapper invocation. - * env?: Record; - * - * resolutionContext?: IUriResolutionContext; - * - * // if true, return value is a msgpack-encoded byte array - * encodeResult?: boolean; - * } - * - * @returns A Promise with a Result containing the return value or an error + * Extends ClientConfig from @polywrap/client-config-builder-js. + * The PolywrapClient converts the PolywrapClientConfig to a CoreClientConfig. */ -invokeWrapper(options: InvokerOptions & { - wrapper: Wrapper; -}): Promise>; -``` - -### invoke -```ts -/** - * Invoke a wrapper using standard syntax. - * Unlike `invokeWrapper`, this method automatically retrieves and caches the wrapper. - * - * @param options - { - * // The Wrapper's URI - * uri: TUri; - * - * // Method to be executed. - * method: string; - * - * //Arguments for the method, structured as a map, removing the chance of incorrectly ordering arguments. - * args?: Record | Uint8Array; - * - * // Env variables for the wrapper invocation. - * env?: Record; - * - * resolutionContext?: IUriResolutionContext; - * - * // if true, return value is a msgpack-encoded byte array - * encodeResult?: boolean; - * } - * - * @returns A Promise with a Result containing the return value or an error - */ -invoke(options: InvokerOptions): Promise>; -``` +export interface PolywrapClientConfig + extends ClientConfig { + /** a wrapper cache to be used in place of the default wrapper cache */ + readonly wrapperCache?: IWrapperCache; -### subscribe -```ts -/** - * Invoke a wrapper at a regular frequency (within ~16ms) - * - * @param options - { - * // The Wrapper's URI - * uri: TUri; - * - * // Method to be executed. - * method: string; - * - * //Arguments for the method, structured as a map, removing the chance of incorrectly ordering arguments. - * args?: Record | Uint8Array; - * - * // Env variables for the wrapper invocation. - * env?: Record; - * - * resolutionContext?: IUriResolutionContext; - * - * // if true, return value is a msgpack-encoded byte array - * encodeResult?: boolean; - * - * // the frequency at which to perform the invocation - * frequency?: { - * ms?: number; - * sec?: number; - * min?: number; - * hours?: number; - * } - * } - * - * @returns A Promise with a Result containing the return value or an error - */ -subscribe(options: SubscribeOptions): Subscription; + /** configuration for opentelemetry tracing to aid in debugging */ + readonly tracerConfig?: Readonly>; +} ``` -### tryResolveUri -```ts -/** - * Resolve a URI to a wrap package, a wrapper, or a uri - * - * @param options - { uri: TUri; resolutionContext?: IUriResolutionContext } - * @returns A Promise with a Result containing either a wrap package, a wrapper, or a URI if successful - */ -tryResolveUri(options: TryResolveUriOptions): Promise>; -``` +## PolywrapClient -### loadWrapper +### Constructor ```ts -/** - * Resolve a URI to a wrap package or wrapper. - * If the URI resolves to wrap package, load the wrapper. - * - * @remarks - * Unlike other methods, `loadWrapper` does not accept a string URI. - * You can create a Uri (from the `@polywrap/core-js` package) using `Uri.from("wrap://...")` - * - * @param uri: the Uri to resolve - * @param resolutionContext? a resolution context - * @param options - { noValidate?: boolean } - * @returns A Promise with a Result containing either a wrapper if successful - */ -loadWrapper(uri: Uri, resolutionContext?: IUriResolutionContext, options?: DeserializeManifestOptions): Promise>; -``` - -## Development - -The Polywrap JavaScript client is open-source. It lives within the [Polywrap toolchain monorepo](https://github.com/polywrap/toolchain/tree/origin/packages/js/client). Contributions from the community are welcomed! - -### Build -```bash -nvm use && yarn install && yarn build -``` - -### Test -```bash -yarn test + /** + * Instantiate a PolywrapClient + * + * @param config - a whole or partial client configuration + * @param options - { noDefaults?: boolean } + */ + constructor( + config?: Partial, + options?: { noDefaults?: false } + ); + constructor(config: PolywrapCoreClientConfig, options: { noDefaults: true }); + constructor( + config: + | Partial + | undefined + | PolywrapCoreClientConfig, + options?: { noDefaults?: boolean } + ) ``` \ No newline at end of file diff --git a/packages/js/client/examples/quickstart.ts b/packages/js/client/examples/quickstart.ts new file mode 100644 index 0000000000..1f7470ce0d --- /dev/null +++ b/packages/js/client/examples/quickstart.ts @@ -0,0 +1,38 @@ +import { ClientConfigBuilder, PolywrapClient } from "../build"; + +export function instantiate(): PolywrapClient { + // /* $: quickstart-instantiate */ import { PolywrapClient } from "@polywrap/client-js"; + + const client = new PolywrapClient(); + // $end + + return client; +} + +export function configure(): PolywrapClient { + // $start: quickstart-configure + const config = new ClientConfigBuilder().addDefaults().buildCoreConfig(); + + const client = new PolywrapClient(config, { noDefaults: true }); + // $end + + return client; +} + +export async function invoke(): Promise { + const client = new PolywrapClient(); + // $start: quickstart-invoke + const result = await client.invoke({ + uri: "ens/helloworld.dev.polywrap.eth", + method: "logMessage", + args: { + message: "Hello World!" + } + }); + + if (!result.ok) throw result.error; + + const value = result.value; + // $end + return value; +} diff --git a/packages/js/client/examples/tsconfig.examples.json b/packages/js/client/examples/tsconfig.examples.json new file mode 100644 index 0000000000..f37de53612 --- /dev/null +++ b/packages/js/client/examples/tsconfig.examples.json @@ -0,0 +1,6 @@ +{ + "extends": "../tsconfig.json", + "include": [ + "./**/*.ts" + ], +} \ No newline at end of file diff --git a/packages/js/client/package.json b/packages/js/client/package.json index c7b2f5c104..eac43c213f 100644 --- a/packages/js/client/package.json +++ b/packages/js/client/package.json @@ -12,12 +12,15 @@ "build" ], "scripts": { - "build": "rimraf ./build && tsc --project tsconfig.build.json", + "build": "yarn build:fast && yarn build:snippets && yarn build:readme", + "build:fast": "rimraf ./build && tsc --project tsconfig.build.json", "lint": "eslint --color -c ../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose=true --detectOpenHandles --forceExit", "test:ci": "jest --passWithNoTests --runInBand --verbose --detectOpenHandles --forceExit", "test:rust": "jest --passWithNoTests --runInBand --verbose --detectOpenHandles --forceExit --config ./jest.rs.config.js", - "test:watch": "jest --watch --passWithNoTests --verbose --detectOpenHandles" + "test:watch": "jest --watch --passWithNoTests --verbose --detectOpenHandles", + "build:snippets": "tsc --project ./examples/tsconfig.examples.json", + "build:readme": "yarn doc-snippets combine" }, "dependencies": { "@polywrap/client-config-builder-js": "0.10.0-pre.7", @@ -40,7 +43,7 @@ "@polywrap/http-resolver-plugin-js": "0.10.0-pre.7", "@polywrap/ipfs-plugin-js": "0.10.0-pre.7", "@polywrap/ipfs-resolver-plugin-js": "0.10.0-pre.7", - "@polywrap/plugin-js": "0.10.0-pre.6", + "@polywrap/plugin-js": "0.10.0-pre.7", "@polywrap/test-cases": "0.10.0-pre.7", "@polywrap/test-env-js": "0.10.0-pre.7", "@types/jest": "26.0.8", @@ -54,10 +57,50 @@ "ts-loader": "8.0.17", "ts-node": "8.10.2", "typescript": "4.1.6", - "yaml": "2.1.3" + "yaml": "2.1.3", + "doc-snippets": "^1.0.0" }, "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", "publishConfig": { "access": "public" + }, + "doc-snippets": { + "extract": { + "include": [ + "./src/**/*.{ts,tsx,json,yaml,txt,md,graphql,cue}", + "./examples/**/*.{ts,tsx,json,yaml,txt,md,graphql,cue}" + ], + "ignore": [ + "./**/node_modules/**", + "./**/.polywrap/**", + "./**/__tests__/**" + ], + "dir": "./" + }, + "inject": { + "dir": "./readme", + "include": "./README.md" + }, + "startTokens": [ + { + "pattern": "$start: ", + "inline": false + }, + { + "pattern": "/* $: {SNIPPET_NAME} */", + "inline": true + } + ], + "endTokens": [ + { + "pattern": "$end", + "inline": false + }, + { + "pattern": "/* $ */", + "inline": true + } + ], + "outputDir": "./" } } diff --git a/packages/js/client/readme/README.md b/packages/js/client/readme/README.md new file mode 100644 index 0000000000..63c1cf1e63 --- /dev/null +++ b/packages/js/client/readme/README.md @@ -0,0 +1,55 @@ +# @polywrap/client-js + +npm + + +
+
+The Polywrap client extends the PolywrapCoreClient to provide UX features, such as an additional constructor and additional configuration options. + +## Installation + +```bash +npm install --save @polywrap/client-js +``` + +## Usage + +### Instantiate + +Use the PolywrapClient [constructor](#constructor) to instantiate the client with the default configuration bundle. + +```ts +$snippet: quickstart-instantiate +``` + +### Configure + +Use the `@polywrap/client-config-builder-js` package to build a custom configuration for your project. + +```ts +$snippet: quickstart-configure +``` + +### Invoke + +Invoke a wrapper. + +```ts +$snippet: quickstart-invoke +``` + +# Reference + +## Types + +```ts +$snippet: PolywrapClientConfig +``` + +## PolywrapClient + +### Constructor +```ts +$snippet: PolywrapClient-constructor +``` \ No newline at end of file diff --git a/packages/js/client/src/PolywrapClient.ts b/packages/js/client/src/PolywrapClient.ts index 53357ac841..ae7a8c1fb8 100644 --- a/packages/js/client/src/PolywrapClient.ts +++ b/packages/js/client/src/PolywrapClient.ts @@ -7,6 +7,7 @@ import { } from "@polywrap/core-client-js"; export class PolywrapClient extends PolywrapCoreClient { + // $start: PolywrapClient-constructor /** * Instantiate a PolywrapClient * @@ -24,7 +25,7 @@ export class PolywrapClient extends PolywrapCoreClient { | undefined | PolywrapCoreClientConfig, options?: { noDefaults?: boolean } - ) { + ) /* $ */ { super( !options?.noDefaults ? buildPolywrapCoreClientConfig( diff --git a/packages/js/client/src/PolywrapClientConfig.ts b/packages/js/client/src/PolywrapClientConfig.ts index d20f424276..ee72627faa 100644 --- a/packages/js/client/src/PolywrapClientConfig.ts +++ b/packages/js/client/src/PolywrapClientConfig.ts @@ -3,8 +3,20 @@ import { IWrapperCache } from "@polywrap/uri-resolvers-js"; import { TracerConfig } from "@polywrap/tracing-js"; import { ClientConfig } from "@polywrap/client-config-builder-js"; +// $start: PolywrapClientConfig +/** + * Client configuration that can be passed to the PolywrapClient. + * + * @remarks + * Extends ClientConfig from @polywrap/client-config-builder-js. + * The PolywrapClient converts the PolywrapClientConfig to a CoreClientConfig. + */ export interface PolywrapClientConfig extends ClientConfig { + /** a wrapper cache to be used in place of the default wrapper cache */ readonly wrapperCache?: IWrapperCache; + + /** configuration for opentelemetry tracing to aid in debugging */ readonly tracerConfig?: Readonly>; } +// $end diff --git a/packages/js/client/tsconfig.build.json b/packages/js/client/tsconfig.build.json index 77aadfdd2f..ec6eea7b58 100644 --- a/packages/js/client/tsconfig.build.json +++ b/packages/js/client/tsconfig.build.json @@ -1,5 +1,8 @@ { "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "build" + }, "include": [ "./src/**/*.ts" ], diff --git a/packages/js/client/tsconfig.json b/packages/js/client/tsconfig.json index a708147fab..61edd1723e 100644 --- a/packages/js/client/tsconfig.json +++ b/packages/js/client/tsconfig.json @@ -7,10 +7,10 @@ "es5", "dom" ], - "outDir": "build" }, "include": [ - "./src/**/*.ts" + "./src/**/*.ts", + "./examples/**/*.ts" ], "exclude": [] } diff --git a/packages/js/core-client/.gitignore b/packages/js/core-client/.gitignore new file mode 100644 index 0000000000..dbb01bb64d --- /dev/null +++ b/packages/js/core-client/.gitignore @@ -0,0 +1,3 @@ +/examples/**/*.d.ts +/examples/**/*.js +/examples/**/*.js.map diff --git a/packages/js/core-client/README.md b/packages/js/core-client/README.md index 9c8f008f36..b9e74ad8ae 100644 --- a/packages/js/core-client/README.md +++ b/packages/js/core-client/README.md @@ -5,4 +5,331 @@

-The Polywrap JavaScript core client. +The Polywrap JavaScript core client invokes wrapper functions. It's designed to run in any environment that can execute JavaScript (think websites, node scripts, etc.). It has TypeScript support. + +## Installation + +```bash +npm install --save @polywrap/core-client-js +``` + +## Usage + +### Instantiate + +Use the `@polywrap/client-config-builder-js` package to build a CoreClientConfig for your project, then use the PolywrapCoreClient [constructor](#constructor) to instantiate the client with your config. + +```ts + const config = new ClientConfigBuilder().addDefaults().buildCoreConfig(); + + const client = new PolywrapCoreClient(config); +``` + +### Invoke + +Invoke a wrapper. + +```ts + const result = await client.invoke({ + uri: "ens/helloworld.dev.polywrap.eth", + method: "logMessage", + args: { + message: "Hello World!" + } + }); + + if (!result.ok) throw result.error; + + const value = result.value; +``` + +# Reference + +## Types + +```ts +/** + * Core Client configuration that can be passed to the PolywrapClient or PolywrapCoreClient constructors. + * + * @remarks + * Extends CoreClientConfig from @polywrap/core-js. + * The PolywrapClient and PolywrapCoreClient convert the PolywrapCoreClientConfig to a CoreClientConfig. + */ +export interface PolywrapCoreClientConfig< + TUri extends Uri | string = Uri | string +> extends CoreClientConfig { + /** configuration for opentelemetry tracing to aid in debugging */ + readonly tracerConfig?: Readonly>; +} +``` + +## PolywrapCoreClient + +### Constructor +```ts + /** + * Instantiate a PolywrapClient + * + * @param config - a core client configuration + */ + constructor(config: PolywrapCoreClientConfig) +``` + +### getConfig +```ts + /** + * Returns the configuration used to instantiate the client + * + * @returns an immutable Polywrap client config + */ + public getConfig(): PolywrapCoreClientConfig +``` + +### setTracingEnabled +```ts + /** + * Enable tracing for intricate debugging + * + * @remarks + * Tracing uses the @polywrap/tracing-js package + * + * @param tracerConfig - configure options such as the tracing level + * @returns void + */ + public setTracingEnabled(tracerConfig?: Partial): void +``` + +### getInterfaces +```ts + /** + * returns all interfaces from the configuration used to instantiate the client + * + * @returns an array of interfaces and their registered implementations + */ + @Tracer.traceMethod("PolywrapClient: getInterfaces") + public getInterfaces(): readonly InterfaceImplementations[] | undefined +``` + +### getEnvs +```ts + /** + * returns all env registrations from the configuration used to instantiate the client + * + * @returns an array of env objects containing wrapper environmental variables + */ + @Tracer.traceMethod("PolywrapClient: getEnvs") + public getEnvs(): readonly Env[] | undefined +``` + +### getResolver +```ts + /** + * returns the URI resolver from the configuration used to instantiate the client + * + * @returns an object that implements the IUriResolver interface + */ + @Tracer.traceMethod("PolywrapClient: getUriResolver") + public getResolver(): IUriResolver +``` + +### getEnvByUri +```ts + /** + * returns an env (a set of environmental variables) from the configuration used to instantiate the client + * + * @param uri - the URI used to register the env + * @returns an env, or undefined if an env is not found at the given URI + */ + @Tracer.traceMethod("PolywrapClient: getEnvByUri") + public getEnvByUri( + uri: TUri + ): Env | undefined +``` + +### getManifest +```ts + /** + * returns a package's wrap manifest + * + * @param uri - a wrap URI + * @returns a Result containing the WrapManifest if the request was successful + */ + @Tracer.traceMethod("PolywrapClient: getManifest") + public async getManifest( + uri: TUri + ): Promise> +``` + +### getFile +```ts + /** + * returns a file contained in a wrap package + * + * @param uri - a wrap URI + * @param options - { path: string; encoding?: "utf-8" | string } + * @returns a Promise of a Result containing a file if the request was successful + */ + @Tracer.traceMethod("PolywrapClient: getFile") + public async getFile( + uri: TUri, + options: GetFileOptions + ): Promise> +``` + +### getImplementations +```ts + /** + * returns the interface implementations associated with an interface URI + * from the configuration used to instantiate the client + * + * @param uri - a wrap URI + * @param options - { applyResolution?: boolean; resolutionContext?: IUriResolutionContext } + * @returns a Result containing URI array if the request was successful + */ + @Tracer.traceMethod("PolywrapClient: getImplementations") + public async getImplementations( + uri: TUri, + options: GetImplementationsOptions = {} + ): Promise> +``` + +### invokeWrapper +```ts + /** + * Invoke a wrapper using an instance of the wrapper. + * + * @param options - { + * // The Wrapper's URI + * uri: TUri; + * + * // Method to be executed. + * method: string; + * + * //Arguments for the method, structured as a map, removing the chance of incorrectly ordered arguments. + * args?: Record | Uint8Array; + * + * // Env variables for the wrapper invocation. + * env?: Record; + * + * // A Uri resolution context + * resolutionContext?: IUriResolutionContext; + * + * // if true, return value is a msgpack-encoded byte array + * encodeResult?: boolean; + * + * // The wrapper to invoke + * wrapper: Wrapper + * } + * @returns A Promise with a Result containing the return value or an error + */ + @Tracer.traceMethod("PolywrapClient: invokeWrapper") + public async invokeWrapper< + TData = unknown, + TUri extends Uri | string = string + >( + options: InvokerOptions & { wrapper: Wrapper } + ): Promise> +``` + +### invoke +```ts + /** + * Invoke a wrapper. + * + * @remarks + * Unlike `invokeWrapper`, this method automatically retrieves and caches the wrapper. + * + * @param options - { + * // The Wrapper's URI + * uri: TUri; + * + * // Method to be executed. + * method: string; + * + * //Arguments for the method, structured as a map, removing the chance of incorrectly ordered arguments. + * args?: Record | Uint8Array; + * + * // Env variables for the wrapper invocation. + * env?: Record; + * + * // A Uri resolution context + * resolutionContext?: IUriResolutionContext; + * + * // if true, return value is a msgpack-encoded byte array + * encodeResult?: boolean; + * } + * @returns A Promise with a Result containing the return value or an error + */ + @Tracer.traceMethod("PolywrapClient: invoke") + public async invoke( + options: InvokerOptions + ): Promise> +``` + +### tryResolveUri +```ts + /** + * Resolve a URI to a wrap package, a wrapper, or a uri + * + * @param options - { uri: TUri; resolutionContext?: IUriResolutionContext } + * @returns A Promise with a Result containing either a wrap package, a wrapper, or a URI if successful + */ + @Tracer.traceMethod("PolywrapClient: tryResolveUri", TracingLevel.High) + public async tryResolveUri( + options: TryResolveUriOptions + ): Promise> +``` + +### loadWrapper +```ts + /** + * Resolve a URI to a wrap package or wrapper. + * If the URI resolves to wrap package, load the wrapper. + * + * @remarks + * Unlike other methods, `loadWrapper` does not accept a string URI. + * You can create a Uri (from the `@polywrap/core-js` package) using `Uri.from("wrap://...")` + * + * @param uri - the Uri to resolve + * @param resolutionContext? - a resolution context + * @param options - { noValidate?: boolean } + * @returns A Promise with a Result containing a Wrapper or Error + */ + @Tracer.traceMethod("PolywrapClient: loadWrapper", TracingLevel.High) + public async loadWrapper( + uri: Uri, + resolutionContext?: IUriResolutionContext, + options?: DeserializeManifestOptions + ): Promise> +``` + +### validate +```ts + /** + * Validate a wrapper, given a URI. + * Optionally, validate the full ABI and/or recursively validate imports. + * + * @param uri - the Uri to resolve + * @param options - { abi?: boolean; recursive?: boolean } + * @returns A Promise with a Result containing a boolean or Error + */ + @Tracer.traceMethod("PolywrapClient: validate") + public async validate( + uri: TUri, + options: ValidateOptions + ): Promise> +``` + +## Development + +The Polywrap JavaScript client is open-source. It lives within the [Polywrap toolchain monorepo](https://github.com/polywrap/toolchain/tree/origin/packages/js/client). Contributions from the community are welcomed! + +### Build +```bash +nvm use && yarn install && yarn build +``` + +### Test +```bash +yarn test +`` \ No newline at end of file diff --git a/packages/js/core-client/examples/quickstart.ts b/packages/js/core-client/examples/quickstart.ts new file mode 100644 index 0000000000..753cfc0fb5 --- /dev/null +++ b/packages/js/core-client/examples/quickstart.ts @@ -0,0 +1,33 @@ +import { PolywrapCoreClient } from "../build"; +import { ClientConfigBuilder } from "@polywrap/client-config-builder-js"; + +export function instantiate(): PolywrapCoreClient { + // $start: quickstart-instantiate + const config = new ClientConfigBuilder().addDefaults().buildCoreConfig(); + + const client = new PolywrapCoreClient(config); + // $end + + return client; +} + +export async function invoke(): Promise { + const config = new ClientConfigBuilder().addDefaults().buildCoreConfig(); + + const client = new PolywrapCoreClient(config); + + // $start: quickstart-invoke + const result = await client.invoke({ + uri: "ens/helloworld.dev.polywrap.eth", + method: "logMessage", + args: { + message: "Hello World!" + } + }); + + if (!result.ok) throw result.error; + + const value = result.value; + // $end + return value; +} diff --git a/packages/js/core-client/examples/tsconfig.examples.json b/packages/js/core-client/examples/tsconfig.examples.json new file mode 100644 index 0000000000..f37de53612 --- /dev/null +++ b/packages/js/core-client/examples/tsconfig.examples.json @@ -0,0 +1,6 @@ +{ + "extends": "../tsconfig.json", + "include": [ + "./**/*.ts" + ], +} \ No newline at end of file diff --git a/packages/js/core-client/package.json b/packages/js/core-client/package.json index f20c183e41..172e8abb74 100644 --- a/packages/js/core-client/package.json +++ b/packages/js/core-client/package.json @@ -12,9 +12,12 @@ "build" ], "scripts": { - "build": "rimraf ./build && tsc --project tsconfig.build.json", + "build": "yarn build:fast && yarn build:snippets && yarn build:readme", + "build:fast": "rimraf ./build && tsc --project tsconfig.build.json", "lint": "eslint --color -c ../../../.eslintrc.js src/", - "test": "jest --passWithNoTests --runInBand --verbose=true --detectOpenHandles --forceExit" + "test": "jest --passWithNoTests --runInBand --verbose=true --detectOpenHandles --forceExit", + "build:snippets": "tsc --project ./examples/tsconfig.examples.json", + "build:readme": "yarn doc-snippets combine" }, "dependencies": { "@polywrap/core-js": "0.10.0-pre.7", @@ -32,10 +35,50 @@ "ts-jest": "26.5.4", "ts-loader": "8.0.17", "ts-node": "8.10.2", - "typescript": "4.1.6" + "typescript": "4.1.6", + "doc-snippets": "^1.0.0" }, "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", "publishConfig": { "access": "public" + }, + "doc-snippets": { + "extract": { + "include": [ + "./src/**/*.{ts,tsx,json,yaml,txt,md,graphql,cue}", + "./examples/**/*.{ts,tsx,json,yaml,txt,md,graphql,cue}" + ], + "ignore": [ + "./**/node_modules/**", + "./**/.polywrap/**", + "./**/__tests__/**" + ], + "dir": "./" + }, + "inject": { + "dir": "./readme", + "include": "./README.md" + }, + "startTokens": [ + { + "pattern": "$start: ", + "inline": false + }, + { + "pattern": "/* $: {SNIPPET_NAME} */", + "inline": true + } + ], + "endTokens": [ + { + "pattern": "$end", + "inline": false + }, + { + "pattern": "/* $ */", + "inline": true + } + ], + "outputDir": "./" } } diff --git a/packages/js/core-client/readme/README.md b/packages/js/core-client/readme/README.md new file mode 100644 index 0000000000..1cf94bd408 --- /dev/null +++ b/packages/js/core-client/readme/README.md @@ -0,0 +1,131 @@ +# @polywrap/core-client-js + +npm + + +
+
+The Polywrap JavaScript core client invokes wrapper functions. It's designed to run in any environment that can execute JavaScript (think websites, node scripts, etc.). It has TypeScript support. + +## Installation + +```bash +npm install --save @polywrap/core-client-js +``` + +## Usage + +### Instantiate + +Use the `@polywrap/client-config-builder-js` package to build a CoreClientConfig for your project, then use the PolywrapCoreClient [constructor](#constructor) to instantiate the client with your config. + +```ts +$snippet: quickstart-instantiate +``` + +### Invoke + +Invoke a wrapper. + +```ts +$snippet: quickstart-invoke +``` + +# Reference + +## Types + +```ts +$snippet: PolywrapCoreClientConfig +``` + +## PolywrapCoreClient + +### Constructor +```ts +$snippet: PolywrapCoreClient-constructor +``` + +### getConfig +```ts +$snippet: PolywrapCoreClient-getConfig +``` + +### setTracingEnabled +```ts +$snippet: PolywrapCoreClient-setTracingEnabled +``` + +### getInterfaces +```ts +$snippet: PolywrapCoreClient-getInterfaces +``` + +### getEnvs +```ts +$snippet: PolywrapCoreClient-getEnvs +``` + +### getResolver +```ts +$snippet: PolywrapCoreClient-getResolver +``` + +### getEnvByUri +```ts +$snippet: PolywrapCoreClient-getEnvByUri +``` + +### getManifest +```ts +$snippet: PolywrapCoreClient-getManifest +``` + +### getFile +```ts +$snippet: PolywrapCoreClient-getFile +``` + +### getImplementations +```ts +$snippet: PolywrapCoreClient-getImplementations +``` + +### invokeWrapper +```ts +$snippet: PolywrapCoreClient-invokeWrapper +``` + +### invoke +```ts +$snippet: PolywrapCoreClient-invoke +``` + +### tryResolveUri +```ts +$snippet: PolywrapCoreClient-tryResolveUri +``` + +### loadWrapper +```ts +$snippet: PolywrapCoreClient-loadWrapper +``` + +### validate +```ts +$snippet: PolywrapCoreClient-validate +``` + +## Development + +The Polywrap JavaScript client is open-source. It lives within the [Polywrap toolchain monorepo](https://github.com/polywrap/toolchain/tree/origin/packages/js/client). Contributions from the community are welcomed! + +### Build +```bash +nvm use && yarn install && yarn build +``` + +### Test +```bash +yarn test +`` \ No newline at end of file diff --git a/packages/js/core-client/src/PolywrapCoreClient.ts b/packages/js/core-client/src/PolywrapCoreClient.ts index e4cb6deb5b..741c37fc19 100644 --- a/packages/js/core-client/src/PolywrapCoreClient.ts +++ b/packages/js/core-client/src/PolywrapCoreClient.ts @@ -36,12 +36,13 @@ import { Result, ResultErr, ResultOk } from "@polywrap/result"; export class PolywrapCoreClient implements CoreClient { private _config: PolywrapCoreClientConfig; + // $start: PolywrapCoreClient-constructor /** * Instantiate a PolywrapClient * * @param config - a core client configuration */ - constructor(config: PolywrapCoreClientConfig) { + constructor(config: PolywrapCoreClientConfig) /* $ */ { try { this.setTracingEnabled(config?.tracerConfig); @@ -58,15 +59,17 @@ export class PolywrapCoreClient implements CoreClient { } } + // $start: PolywrapCoreClient-getConfig /** * Returns the configuration used to instantiate the client * * @returns an immutable Polywrap client config */ - public getConfig(): PolywrapCoreClientConfig { + public getConfig(): PolywrapCoreClientConfig /* $ */ { return this._config; } + // $start: PolywrapCoreClient-setTracingEnabled /** * Enable tracing for intricate debugging * @@ -76,7 +79,7 @@ export class PolywrapCoreClient implements CoreClient { * @param tracerConfig - configure options such as the tracing level * @returns void */ - public setTracingEnabled(tracerConfig?: Partial): void { + public setTracingEnabled(tracerConfig?: Partial): void /* $ */ { if (tracerConfig?.consoleEnabled || tracerConfig?.httpEnabled) { Tracer.enableTracing("PolywrapClient", tracerConfig); } else { @@ -84,47 +87,40 @@ export class PolywrapCoreClient implements CoreClient { } } - /** - * returns all plugin registrations from the configuration used to instantiate the client - * - * @returns an array of plugin registrations - */ - /** - * returns a plugin package from the configuration used to instantiate the client - * - * @param uri - the uri used to register the plugin - * @returns a plugin package, or undefined if a plugin is not found at the given uri - */ + // $start: PolywrapCoreClient-getInterfaces /** * returns all interfaces from the configuration used to instantiate the client * * @returns an array of interfaces and their registered implementations */ @Tracer.traceMethod("PolywrapClient: getInterfaces") - public getInterfaces(): readonly InterfaceImplementations[] | undefined { + public getInterfaces(): readonly InterfaceImplementations[] | undefined /* $ */ { // eslint-disable-line return this._config.interfaces; } + // $start: PolywrapCoreClient-getEnvs /** * returns all env registrations from the configuration used to instantiate the client * * @returns an array of env objects containing wrapper environmental variables */ @Tracer.traceMethod("PolywrapClient: getEnvs") - public getEnvs(): readonly Env[] | undefined { + public getEnvs(): readonly Env[] | undefined /* $ */ { return this._config.envs; } + // $start: PolywrapCoreClient-getResolver /** * returns the URI resolver from the configuration used to instantiate the client * * @returns an object that implements the IUriResolver interface */ @Tracer.traceMethod("PolywrapClient: getUriResolver") - public getResolver(): IUriResolver { + public getResolver(): IUriResolver /* $ */ { return this._config.resolver; } + // $start: PolywrapCoreClient-getEnvByUri /** * returns an env (a set of environmental variables) from the configuration used to instantiate the client * @@ -134,7 +130,7 @@ export class PolywrapCoreClient implements CoreClient { @Tracer.traceMethod("PolywrapClient: getEnvByUri") public getEnvByUri( uri: TUri - ): Env | undefined { + ): Env | undefined /* $ */ { const uriUri = Uri.from(uri); const envs = this.getEnvs(); @@ -145,6 +141,7 @@ export class PolywrapCoreClient implements CoreClient { return envs.find((environment) => Uri.equals(environment.uri, uriUri)); } + // $start: PolywrapCoreClient-getManifest /** * returns a package's wrap manifest * @@ -154,7 +151,7 @@ export class PolywrapCoreClient implements CoreClient { @Tracer.traceMethod("PolywrapClient: getManifest") public async getManifest( uri: TUri - ): Promise> { + ): Promise> /* $ */ { const load = await this.loadWrapper(Uri.from(uri), undefined); if (!load.ok) { return load; @@ -165,6 +162,7 @@ export class PolywrapCoreClient implements CoreClient { return ResultOk(manifest); } + // $start: PolywrapCoreClient-getFile /** * returns a file contained in a wrap package * @@ -176,7 +174,7 @@ export class PolywrapCoreClient implements CoreClient { public async getFile( uri: TUri, options: GetFileOptions - ): Promise> { + ): Promise> /* $ */ { const load = await this.loadWrapper(Uri.from(uri), undefined); if (!load.ok) { return load; @@ -194,19 +192,20 @@ export class PolywrapCoreClient implements CoreClient { return ResultOk(result.value); } + // $start: PolywrapCoreClient-getImplementations /** * returns the interface implementations associated with an interface URI * from the configuration used to instantiate the client * * @param uri - a wrap URI - * @param options - { applyResolution?: boolean } + * @param options - { applyResolution?: boolean; resolutionContext?: IUriResolutionContext } * @returns a Result containing URI array if the request was successful */ @Tracer.traceMethod("PolywrapClient: getImplementations") public async getImplementations( uri: TUri, options: GetImplementationsOptions = {} - ): Promise> { + ): Promise> /* $ */ { const isUriTypeString = typeof uri === "string"; const applyResolution = !!options.applyResolution; @@ -228,8 +227,9 @@ export class PolywrapCoreClient implements CoreClient { return ResultOk(uris); } + // $start: PolywrapCoreClient-invokeWrapper /** - * Invoke a wrapper using standard syntax and an instance of the wrapper + * Invoke a wrapper using an instance of the wrapper. * * @param options - { * // The Wrapper's URI @@ -238,18 +238,21 @@ export class PolywrapCoreClient implements CoreClient { * // Method to be executed. * method: string; * - * //Arguments for the method, structured as a map, removing the chance of incorrectly ordering arguments. + * //Arguments for the method, structured as a map, removing the chance of incorrectly ordered arguments. * args?: Record | Uint8Array; * * // Env variables for the wrapper invocation. * env?: Record; * + * // A Uri resolution context * resolutionContext?: IUriResolutionContext; * * // if true, return value is a msgpack-encoded byte array * encodeResult?: boolean; - * } * + * // The wrapper to invoke + * wrapper: Wrapper + * } * @returns A Promise with a Result containing the return value or an error */ @Tracer.traceMethod("PolywrapClient: invokeWrapper") @@ -258,7 +261,7 @@ export class PolywrapCoreClient implements CoreClient { TUri extends Uri | string = string >( options: InvokerOptions & { wrapper: Wrapper } - ): Promise> { + ): Promise> /* $ */ { try { const typedOptions: InvokeOptions = { ...options, @@ -288,8 +291,11 @@ export class PolywrapCoreClient implements CoreClient { } } + // $start: PolywrapCoreClient-invoke /** - * Invoke a wrapper using standard syntax. + * Invoke a wrapper. + * + * @remarks * Unlike `invokeWrapper`, this method automatically retrieves and caches the wrapper. * * @param options - { @@ -299,24 +305,24 @@ export class PolywrapCoreClient implements CoreClient { * // Method to be executed. * method: string; * - * //Arguments for the method, structured as a map, removing the chance of incorrectly ordering arguments. + * //Arguments for the method, structured as a map, removing the chance of incorrectly ordered arguments. * args?: Record | Uint8Array; * * // Env variables for the wrapper invocation. * env?: Record; * + * // A Uri resolution context * resolutionContext?: IUriResolutionContext; * * // if true, return value is a msgpack-encoded byte array * encodeResult?: boolean; * } - * * @returns A Promise with a Result containing the return value or an error */ @Tracer.traceMethod("PolywrapClient: invoke") public async invoke( options: InvokerOptions - ): Promise> { + ): Promise> /* $ */ { try { const typedOptions: InvokeOptions = { ...options, @@ -358,6 +364,7 @@ export class PolywrapCoreClient implements CoreClient { } } + // $start: PolywrapCoreClient-tryResolveUri /** * Resolve a URI to a wrap package, a wrapper, or a uri * @@ -367,7 +374,7 @@ export class PolywrapCoreClient implements CoreClient { @Tracer.traceMethod("PolywrapClient: tryResolveUri", TracingLevel.High) public async tryResolveUri( options: TryResolveUriOptions - ): Promise> { + ): Promise> /* $ */ { const uri = Uri.from(options.uri); const uriResolver = this.getResolver(); @@ -392,6 +399,7 @@ export class PolywrapCoreClient implements CoreClient { return response; } + // $start: PolywrapCoreClient-loadWrapper /** * Resolve a URI to a wrap package or wrapper. * If the URI resolves to wrap package, load the wrapper. @@ -400,17 +408,17 @@ export class PolywrapCoreClient implements CoreClient { * Unlike other methods, `loadWrapper` does not accept a string URI. * You can create a Uri (from the `@polywrap/core-js` package) using `Uri.from("wrap://...")` * - * @param uri: the Uri to resolve - * @param resolutionContext? a resolution context + * @param uri - the Uri to resolve + * @param resolutionContext? - a resolution context * @param options - { noValidate?: boolean } - * @returns A Promise with a Result containing either a wrapper if successful + * @returns A Promise with a Result containing a Wrapper or Error */ @Tracer.traceMethod("PolywrapClient: loadWrapper", TracingLevel.High) public async loadWrapper( uri: Uri, resolutionContext?: IUriResolutionContext, options?: DeserializeManifestOptions - ): Promise> { + ): Promise> /* $ */ { Tracer.setAttribute("label", `Wrapper loaded: ${uri}`, TracingLevel.High); if (!resolutionContext) { @@ -475,11 +483,20 @@ export class PolywrapCoreClient implements CoreClient { } } + // $start: PolywrapCoreClient-validate + /** + * Validate a wrapper, given a URI. + * Optionally, validate the full ABI and/or recursively validate imports. + * + * @param uri - the Uri to resolve + * @param options - { abi?: boolean; recursive?: boolean } + * @returns A Promise with a Result containing a boolean or Error + */ @Tracer.traceMethod("PolywrapClient: validate") public async validate( uri: TUri, options: ValidateOptions - ): Promise> { + ): Promise> /* $ */ { const wrapper = await this.loadWrapper(Uri.from(uri)); if (!wrapper.ok) { return wrapper; diff --git a/packages/js/core-client/src/PolywrapCoreClientConfig.ts b/packages/js/core-client/src/PolywrapCoreClientConfig.ts index aa5baf913c..134298c6a3 100644 --- a/packages/js/core-client/src/PolywrapCoreClientConfig.ts +++ b/packages/js/core-client/src/PolywrapCoreClientConfig.ts @@ -1,8 +1,18 @@ import { CoreClientConfig, Uri } from "@polywrap/core-js"; import { TracerConfig } from "@polywrap/tracing-js"; +// $start: PolywrapCoreClientConfig +/** + * Core Client configuration that can be passed to the PolywrapClient or PolywrapCoreClient constructors. + * + * @remarks + * Extends CoreClientConfig from @polywrap/core-js. + * The PolywrapClient and PolywrapCoreClient convert the PolywrapCoreClientConfig to a CoreClientConfig. + */ export interface PolywrapCoreClientConfig< TUri extends Uri | string = Uri | string > extends CoreClientConfig { + /** configuration for opentelemetry tracing to aid in debugging */ readonly tracerConfig?: Readonly>; } +// $end diff --git a/packages/js/core-client/tsconfig.build.json b/packages/js/core-client/tsconfig.build.json index 77aadfdd2f..ec6eea7b58 100644 --- a/packages/js/core-client/tsconfig.build.json +++ b/packages/js/core-client/tsconfig.build.json @@ -1,5 +1,8 @@ { "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "build" + }, "include": [ "./src/**/*.ts" ], diff --git a/packages/js/core-client/tsconfig.json b/packages/js/core-client/tsconfig.json index a708147fab..61edd1723e 100644 --- a/packages/js/core-client/tsconfig.json +++ b/packages/js/core-client/tsconfig.json @@ -7,10 +7,10 @@ "es5", "dom" ], - "outDir": "build" }, "include": [ - "./src/**/*.ts" + "./src/**/*.ts", + "./examples/**/*.ts" ], "exclude": [] } diff --git a/packages/js/core/.gitignore b/packages/js/core/.gitignore new file mode 100644 index 0000000000..b78cae4e43 --- /dev/null +++ b/packages/js/core/.gitignore @@ -0,0 +1 @@ +readme/sub-sections/injected \ No newline at end of file diff --git a/packages/js/core/README.md b/packages/js/core/README.md index abaa064f6d..e00128685f 100644 --- a/packages/js/core/README.md +++ b/packages/js/core/README.md @@ -1,3 +1,755 @@ # @polywrap/core-js A TypeScript / JavaScript implementation of the WRAP standard, including all fundamental types & algorithms. + +# Reference + +## Types + +### CoreClient + +```ts + +/** Core Client configuration that can be passed to the PolywrapClient or PolywrapCoreClient constructors */ +export interface CoreClientConfig { + /** set environmental variables for a wrapper */ + readonly interfaces?: Readonly[]>; + + /** register interface implementations */ + readonly envs?: Readonly[]>; + + /** configure URI resolution for redirects, packages, and wrappers */ + readonly resolver: Readonly>; +} + +/** Options for CoreClient's getFile method */ +export interface GetFileOptions { + /** file path from wrapper root */ + path: string; + + /** file encoding */ + encoding?: "utf-8" | string; +} + +/** Options for CoreClient's getImplementations method */ +export interface GetImplementationsOptions { + /** If true, follow redirects to resolve URIs */ + applyResolution?: boolean; + + /** Use and update an existing resolution context */ + resolutionContext?: IUriResolutionContext; +} + +/** Options for CoreClient's validate method */ +export interface ValidateOptions { + /** Validate full ABI */ + abi?: boolean; + + /** Recursively validate import URIs */ + recursive?: boolean; +} + +/** CoreClient invokes wrappers and interacts with wrap packages. */ +export interface CoreClient extends Invoker, UriResolverHandler { + /** + * Returns the configuration used to instantiate the client + * + * @returns an immutable core client config + */ + getConfig(): CoreClientConfig; + + /** + * returns all interfaces from the configuration used to instantiate the client + * + * @returns an array of interfaces and their registered implementations + */ + getInterfaces(): readonly InterfaceImplementations[] | undefined; + + /** + * returns all env registrations from the configuration used to instantiate the client + * + * @returns an array of env objects containing wrapper environmental variables + */ + getEnvs(): readonly Env[] | undefined; + + /** + * returns an env (a set of environmental variables) from the configuration used to instantiate the client + * + * @param uri - the URI used to register the env + * @returns an env, or undefined if an env is not found at the given URI + */ + getEnvByUri(uri: TUri): Env | undefined; + + /** + * returns the URI resolver from the configuration used to instantiate the client + * + * @returns an object that implements the IUriResolver interface + */ + getResolver(): IUriResolver; + + /** + * returns a package's wrap manifest + * + * @param uri - a wrap URI + * @returns a Result containing the WrapManifest if the request was successful + */ + getManifest( + uri: TUri + ): Promise>; + + /** + * returns a file contained in a wrap package + * + * @param uri - a wrap URI + * @param options - { path: string; encoding?: "utf-8" | string } + * @returns a Promise of a Result containing a file if the request was successful + */ + getFile( + uri: TUri, + options: GetFileOptions + ): Promise>; + + /** + * returns the interface implementations associated with an interface URI + * from the configuration used to instantiate the client + * + * @param uri - a wrap URI + * @param options - { applyResolution?: boolean; resolutionContext?: IUriResolutionContext } + * @returns a Result containing URI array if the request was successful + */ + getImplementations( + uri: TUri, + options: GetImplementationsOptions + ): Promise>; + + /** + * Validate a wrapper, given a URI. + * Optionally, validate the full ABI and/or recursively validate imports. + * + * @param uri: the Uri to resolve + * @param options - { abi?: boolean; recursive?: boolean } + * @returns A Promise with a Result containing a boolean or Error + */ + validate( + uri: TUri, + options?: ValidateOptions + ): Promise>; +} + +``` + +### Env + +```ts + +/** A map of string-indexed, Msgpack-serializable environmental variables associated with a wrapper */ +export interface Env { + /** Uri of wrapper */ + uri: TUri; + + /** Env variables used by the module */ + env: Record; +} + +``` + +### InterfaceImplementations + +```ts + +/** An interface and a list of wrappers that implement the interface */ +export interface InterfaceImplementations { + /** Uri of interface */ + interface: TUri; + + /** Uris of implementations */ + implementations: TUri[]; +} + +``` + +### Invoke + +```ts + +/** Options required for an Wrapper invocation. */ +export interface InvokeOptions { + /** The Wrapper's URI */ + uri: TUri; + + /** Method to be executed. */ + method: string; + + /** Arguments for the method, structured as a map, removing the chance of incorrectly ordered arguments. */ + args?: Record | Uint8Array; + + /** Env variables for the wrapper invocation. */ + env?: Record; + + /** A Uri resolution context */ + resolutionContext?: IUriResolutionContext; +} + +/** + * Result of an Wrapper invocation. + * + * @template TData Type of the invoke result data. + */ +export type InvokeResult = Result; + +/** + * Provides options for the invoker to set based on the state of the invocation. + * Extends InvokeOptions. + */ +export interface InvokerOptions + extends InvokeOptions { + /** If true, the InvokeResult will (if successful) contain a Msgpack-encoded byte array */ + encodeResult?: boolean; +} + +/** + * An entity capable of invoking wrappers. + * + * @template TData Type of the invoke result data. + */ +export interface Invoker { + /** + * Invoke a wrapper using an instance of the wrapper. + * + * @param options - invoker options and a wrapper instance to invoke + * @returns A Promise with a Result containing the return value or an error + */ + invokeWrapper( + options: InvokerOptions & { wrapper: Wrapper } + ): Promise>; + + /** + * Invoke a wrapper. + * + * @remarks + * Unlike `invokeWrapper`, this method automatically retrieves and caches the wrapper. + * + * @param options - invoker options + * @returns A Promise with a Result containing the return value or an error + */ + invoke( + options: InvokerOptions + ): Promise>; +} + +/** + * Result of a Wrapper invocation, possibly Msgpack-encoded. + * + * @template TData Type of the invoke result data. + */ +export type InvocableResult = InvokeResult & { + /** If true, result (if successful) contains a Msgpack-encoded byte array */ + encoded?: boolean; +}; + +/** An invocable entity, such as a wrapper. */ +export interface Invocable { + /** + * Invoke this object. + * + * @param options - invoke options + * @param invoker - an Invoker, capable of invoking this object + * @returns A Promise with a Result containing the return value or an error + */ + invoke( + options: InvokeOptions, + invoker: Invoker + ): Promise>; +} + +``` + +### IUriPackage + +```ts + +/** Associates a URI with an embedded wrap package */ +export interface IUriPackage { + /** The package's URI */ + uri: TUri; + + /** The wrap package */ + package: IWrapPackage; +} + +``` + +### IUriRedirect + +```ts + +/** Redirect invocations from one URI to another */ +export interface IUriRedirect { + /** URI to redirect from */ + from: TUri; + + /** URI to redirect to */ + to: TUri; +} + +``` + +### IUriWrapper + +```ts + +/** Associates a URI with an embedded wrapper */ +export interface IUriWrapper { + /** The URI to resolve to the wrapper */ + uri: TUri; + + /** A wrapper instance */ + wrapper: Wrapper; +} + +``` + +### IWrapPackage + +```ts + +/** Options for IWrapPackage's getManifest method */ +export interface GetManifestOptions { + /** If true, manifest validation step will be skipped */ + noValidate?: boolean; +} + +/** A wrap package, capable of producing instances of a wrapper and its manifest */ +export interface IWrapPackage { + /** + * Produce an instance of the wrap manifest + * + * @param options - GetManifestOptions; customize manifest retrieval + * @returns A Promise with a Result containing the wrap manifest or an error + */ + getManifest( + options?: GetManifestOptions + ): Promise>; + + /** + * Produce an instance of the wrapper + * + * @param options - DeserializeManifestOptions; customize manifest deserialization + * @returns A Promise with a Result containing the wrapper or an error + */ + createWrapper( + options?: DeserializeManifestOptions + ): Promise>; +} + +``` + +### MaybeAsync + +```ts + +/** Alias for a type that is either a value or a promise that resolves to the value */ +export type MaybeAsync = Promise | T; + +``` + +### Uri + +#### UriConfig +```ts +/** URI configuration */ +export interface UriConfig { + /** URI Authority: allows the Polywrap URI resolution algorithm to determine an authoritative URI resolver. */ + authority: string; + + /** URI Path: tells the Authority where the Wrapper resides. */ + path: string; + + /** Full string representation of URI */ + uri: string; +} +``` + +#### Uri + +```ts +/** + * A Polywrap URI. Some examples of valid URIs are: + * wrap://ipfs/QmHASH + * wrap://ens/sub.dimain.eth + * wrap://fs/directory/file.txt + * wrap://uns/domain.crypto + * + * Breaking down the various parts of the URI, as it applies + * to [the URI standard](https://tools.ietf.org/html/rfc3986#section-3): + * **wrap://** - URI Scheme: differentiates Polywrap URIs. + * **ipfs/** - URI Authority: allows the Polywrap URI resolution algorithm to determine an authoritative URI resolver. + * **sub.domain.eth** - URI Path: tells the Authority where the Wrapper resides. + */ +export class Uri { +``` + +##### constructor +```ts + /** + * Construct a Uri instance from a wrap URI string + * + * @remarks + * Throws if URI string is invalid + * + * @param uri - a string representation of a wrap URI + */ + constructor(uri: string) +``` + +##### authority +```ts + /** @returns Uri authority */ + public get authority(): string +``` + +##### path +```ts + /** @returns Uri path */ + public get path(): string +``` + +##### uri +```ts + /** @returns Uri string representation */ + public get uri(): string +``` + +##### equals +```ts + /** Test two Uri instances for equality */ + public static equals(a: Uri, b: Uri): boolean +``` + +##### isUri +```ts + /** + * Check if a value is an instance of Uri + * + * @param value - value to check + * @returns true if value is a Uri instance */ + public static isUri(value: unknown): value is Uri +``` + +##### isValidUri +```ts + /** + * Test if a URI string is a valid wrap URI + * + * @param uri - URI string + * @param parsed? - UriConfig to update (mutate) with content of URI string + * @returns true if input string is a valid wrap URI */ + public static isValidUri(uri: string, parsed?: UriConfig): boolean +``` + +##### toString +```ts + /** @returns Uri string representation */ + public toString(): string +``` + +##### toJSON +```ts + /** @returns Uri string representation */ + public toJSON(): string +``` + +##### parseUri +```ts + /** + * Parse a wrap URI string into its authority and path + * + * @param uri - a string representation of a wrap URI + * @returns A Result containing a UriConfig, if successful, or an error + */ + @Tracer.traceMethod("Uri: parseUri") + public static parseUri(uri: string): Result +``` + +##### from +```ts + /** + * Construct a Uri instance from a Uri or a wrap URI string + * + * @remarks + * Throws if URI string is invalid + * + * @param uri - a Uri instance or a string representation of a wrap URI + */ + @Tracer.traceMethod("Uri: from") + public static from(uri: Uri | string): Uri +``` + +### UriResolver + +```ts + +/** Options required for URI resolution. */ +export interface TryResolveUriOptions { + /** The Wrapper's URI */ + uri: TUri; + + /** A URI resolution context */ + resolutionContext?: IUriResolutionContext; +} + +/** An entity capable of resolving a wrap URI, typically by using an IUriResolver implementation */ +export interface UriResolverHandler { + /** + * Resolve a URI to a wrap package, a wrapper, or a uri + * + * @param options - TryResolveUriOptions + * @returns A Promise with a Result containing either a wrap package, a wrapper, or a URI if successful + */ + tryResolveUri( + options?: TryResolveUriOptions + ): Promise>; +} + +``` + +### Wrapper + +```ts + +/** + * The Wrapper definition, which can be used to spawn + * many invocations of this particular Wrapper. Internally + * this class may do things like caching WASM bytecode, spawning + * worker threads, or indexing into resolvers to find the requested method. + */ +export interface Wrapper extends Invocable { + /** + * Invoke the Wrapper based on the provided [[InvokeOptions]] + * + * @param options Options for this invocation. + * @param invoker The client instance requesting this invocation. + * This client will be used for any sub-invokes that occur. + */ + invoke( + options: InvokeOptions, + invoker: Invoker + ): Promise>; + + /** + * Get a file from the Wrapper package. + * + * @param options Configuration options for file retrieval + */ + getFile(options: GetFileOptions): Promise>; + + /** + * Get a manifest from the Wrapper package. + */ + getManifest(): WrapManifest; +} + +``` + +## UriResolverInterface + +### MaybeUriOrManifest +```ts +/** Contains either a Uri, a manifest, or neither */ +export interface MaybeUriOrManifest { + /** wrap URI */ + uri?: string | null; + + /** Serialized wrap manifest */ + manifest?: Uint8Array | null; +} +``` + +### Module + +#### tryResolveUri +```ts + /** + * Use an invoker to try to resolve a URI using a wrapper that implements the UriResolver interface + * + * @param invoker - invokes the wrapper with the resolution URI as an argument + * @param wrapper - URI for wrapper that implements the UriResolver interface + * @param uri - the URI to resolve + */ + tryResolveUri: Tracer.traceFunc( + "core: uri-resolver: tryResolveUri", + async ( + invoker: Invoker, + wrapper: Uri, + uri: Uri + ): Promise> +``` + +#### getFile +```ts + /** + * Use an invoker to fetch a file using a wrapper that implements the UriResolver interface + * + * @param invoker - invokes the wrapper with the filepath as an argument + * @param wrapper - URI for wrapper that implements the UriResolver interface + * @param path - a filepath, the format of which depends on the UriResolver + */ + getFile: Tracer.traceFunc( + "core: uri-resolver: getFile", + async ( + invoker: Invoker, + wrapper: Uri, + path: string + ): Promise> +``` + +## Uri Resolution + +### IUriResolutionContext + +```ts +/** Track and output URI resolution state, path, and history */ +export interface IUriResolutionContext { + /** + * Check if a URI is in the process of being resolved + * + * @param uri - URI to check + * @return true if URI resolution is in process, false otherwise + */ + isResolving(uri: Uri): boolean; + + /** + * Start resolving a URI + * + * @param uri - Uri to resolve + */ + startResolving(uri: Uri): void; + + /** + * Stop resolving a URI + * + * @param uri - Uri being resolved + */ + stopResolving(uri: Uri): void; + + /** + * Push a step onto the resolution history stack + * + * @param step - A completed resolution step + */ + trackStep(step: IUriResolutionStep): void; + + /** @return history of all URI resolution steps completed */ + getHistory(): IUriResolutionStep[]; + + /** @return current URI resolution path */ + getResolutionPath(): Uri[]; + + /** + * Create a new resolution context using the current URI resolution path + * + * @return a UriResolutionContext + */ + createSubHistoryContext(): IUriResolutionContext; + + /** + * Create a new resolution context using the current URI resolution history + * + * @return a UriResolutionContext + */ + createSubContext(): IUriResolutionContext; +} +``` + +### IUriResolutionStep + +```ts +/** A step in the URI resolution algorithm */ +export interface IUriResolutionStep { + /** The current URI being resolved */ + sourceUri: Uri; + + /** The resolution result for the current URI */ + result: Result; + + /** A text/visual description of this URI step */ + description?: string; + + /** History of sub-steps that exist within the context of this URI resolution step */ + subHistory?: IUriResolutionStep[]; +} +``` + +### IUriResolver + +```ts +/** Defines entity capable of resolving a wrap URI */ +export interface IUriResolver { + /** + * Resolve a URI to a wrap package, a wrapper, or a uri + * + * @param uri - the URI to resolve + * @param client - a CoreClient instance that may be used to invoke a wrapper that implements the UriResolver interface + * @param resolutionContext - the current URI resolution context + * @returns A Promise with a Result containing either a wrap package, a wrapper, or a URI if successful + */ + tryResolveUri( + uri: Uri, + client: CoreClient, + resolutionContext: IUriResolutionContext + ): Promise>; +} +``` + +### UriPackageOrWrapper + +```ts + +/** Indicates that a URI resolved to a Uri */ +export type UriValue = { + type: "uri"; + uri: Uri; +}; + +/** Indicates that a URI resolved to a wrap package */ +export type UriPackageValue = IUriPackage & { + type: "package"; +}; + +/** Indicates that a URI resolved to a wrapper */ +export type UriWrapperValue = IUriWrapper & { + type: "wrapper"; +}; + +/** indicates that a URI resolved to either a wrap package, a wrapper, or a URI */ +export type UriPackageOrWrapper = UriValue | UriPackageValue | UriWrapperValue; + +``` + +### UriResolutionContext + +```ts +/** An implementation of the IUriResolutionContext interface */ +// $start: UriResolutionContext +/** An implementation of the IUriResolutionContext interface */ +export class UriResolutionContext implements IUriResolutionContext { +``` + +#### constructor + +```ts + /** Construct a UriResolutionContext */ + constructor(); + constructor( + resolvingUriMap: Map, + resolutionPath: Set + ); + constructor( + resolvingUriMap: Map, + history: IUriResolutionStep[] + ); + constructor( + resolvingUriMap?: Map, + resolutionPathOrHistory?: Set | IUriResolutionStep[] + ) +``` diff --git a/packages/js/core/package.json b/packages/js/core/package.json index 6214e3855a..777cdfbd46 100644 --- a/packages/js/core/package.json +++ b/packages/js/core/package.json @@ -12,11 +12,15 @@ "build" ], "scripts": { - "build": "rimraf ./build && tsc --project tsconfig.build.json", + "build": "yarn build:fast && yarn build:readme", + "build:fast": "rimraf ./build && tsc --project tsconfig.build.json", "lint": "eslint --color -c ../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", - "test:watch": "jest --watch --passWithNoTests --verbose" + "test:watch": "jest --watch --passWithNoTests --verbose", + "build:readme:subsections": "yarn doc-snippets combine -c ./readme/config/sub-sections.json", + "build:readme:final": "yarn doc-snippets combine -c ./readme/config/final.json", + "build:readme": "yarn build:readme:subsections && yarn build:readme:final" }, "dependencies": { "@polywrap/result": "0.10.0-pre.7", @@ -24,6 +28,7 @@ "@polywrap/wrap-manifest-types-js": "0.10.0-pre.7" }, "devDependencies": { + "doc-snippets": "^1.0.0", "@types/jest": "26.0.8", "@types/mustache": "4.0.1", "@types/prettier": "2.6.0", diff --git a/packages/js/core/readme/README.md b/packages/js/core/readme/README.md new file mode 100644 index 0000000000..27479ac1c0 --- /dev/null +++ b/packages/js/core/readme/README.md @@ -0,0 +1,85 @@ +# @polywrap/core-js + +A TypeScript / JavaScript implementation of the WRAP standard, including all fundamental types & algorithms. + +# Reference + +## Types + +### CoreClient + +```ts +$snippet: CoreClient.ts +``` + +### Env + +```ts +$snippet: Env.ts +``` + +### InterfaceImplementations + +```ts +$snippet: InterfaceImplementations.ts +``` + +### Invoke + +```ts +$snippet: Invoke.ts +``` + +### IUriPackage + +```ts +$snippet: IUriPackage.ts +``` + +### IUriRedirect + +```ts +$snippet: IUriRedirect.ts +``` + +### IUriWrapper + +```ts +$snippet: IUriWrapper.ts +``` + +### IWrapPackage + +```ts +$snippet: IWrapPackage.ts +``` + +### MaybeAsync + +```ts +$snippet: MaybeAsync.ts +``` + +### Uri + +$snippet: Uri.md + +### UriResolver + +```ts +$snippet: UriResolver.ts +``` + +### Wrapper + +```ts +$snippet: Wrapper.ts +``` + +## UriResolverInterface + +$snippet: UriResolverInterface + +## Uri Resolution + +$snippet: uri-resolution.md diff --git a/packages/js/core/readme/config/final.json b/packages/js/core/readme/config/final.json new file mode 100644 index 0000000000..611ddc1e3e --- /dev/null +++ b/packages/js/core/readme/config/final.json @@ -0,0 +1,41 @@ +{ + "doc-snippets": { + "extract": { + "include": [ + "./src/**/*.{ts,tsx,json,yaml,txt,md,graphql,cue}", + "./readme/sub-sections/injected/**/*.{ts,tsx,json,yaml,txt,md,graphql,cue}" + ], + "ignore": [ + "./**/node_modules/**", + "./**/.polywrap/**", + "./**/__tests__/**" + ], + "dir": "./" + }, + "inject": { + "dir": "./readme", + "include": "./README.md" + }, + "startTokens": [ + { + "pattern": "$start: ", + "inline": false + }, + { + "pattern": "/* $: {SNIPPET_NAME} */", + "inline": true + } + ], + "endTokens": [ + { + "pattern": "$end", + "inline": false + }, + { + "pattern": "/* $ */", + "inline": true + } + ], + "outputDir": "./" + } +} \ No newline at end of file diff --git a/packages/js/core/readme/config/sub-sections.json b/packages/js/core/readme/config/sub-sections.json new file mode 100644 index 0000000000..cfde3d90eb --- /dev/null +++ b/packages/js/core/readme/config/sub-sections.json @@ -0,0 +1,38 @@ +{ + "doc-snippets": { + "extract": { + "include": "./**/*.{ts,tsx,json,yaml,txt,md,graphql,cue}", + "ignore": [ + "./**/node_modules/**", + "./**/.polywrap/**", + "./**/__tests__/**" + ], + "dir": "./src" + }, + "inject": { + "dir": "./readme/sub-sections/base", + "include": "./**/*.md" + }, + "startTokens": [ + { + "pattern": "$start: ", + "inline": false + }, + { + "pattern": "/* $: {SNIPPET_NAME} */", + "inline": true + } + ], + "endTokens": [ + { + "pattern": "$end", + "inline": false + }, + { + "pattern": "/* $ */", + "inline": true + } + ], + "outputDir": "./readme/sub-sections/injected" + } +} \ No newline at end of file diff --git a/packages/js/core/readme/sub-sections/base/Uri.md b/packages/js/core/readme/sub-sections/base/Uri.md new file mode 100644 index 0000000000..f808bd0eb5 --- /dev/null +++ b/packages/js/core/readme/sub-sections/base/Uri.md @@ -0,0 +1,67 @@ +$start: Uri.md +#### UriConfig +```ts +$snippet: UriConfig +``` + +#### Uri + +```ts +$snippet: Uri +``` + +##### constructor +```ts +$snippet: Uri-constructor +``` + +##### authority +```ts +$snippet: Uri-authority +``` + +##### path +```ts +$snippet: Uri-path +``` + +##### uri +```ts +$snippet: Uri-uri +``` + +##### equals +```ts +$snippet: Uri-equals +``` + +##### isUri +```ts +$snippet: Uri-isUri +``` + +##### isValidUri +```ts +$snippet: Uri-isValidUri +``` + +##### toString +```ts +$snippet: Uri-toString +``` + +##### toJSON +```ts +$snippet: Uri-toJSON +``` + +##### parseUri +```ts +$snippet: Uri-parseUri +``` + +##### from +```ts +$snippet: Uri-from +``` +$end \ No newline at end of file diff --git a/packages/js/core/readme/sub-sections/base/UriResolverInterface.md b/packages/js/core/readme/sub-sections/base/UriResolverInterface.md new file mode 100644 index 0000000000..b290457e39 --- /dev/null +++ b/packages/js/core/readme/sub-sections/base/UriResolverInterface.md @@ -0,0 +1,18 @@ +$start: UriResolverInterface +### MaybeUriOrManifest +```ts +$snippet: MaybeUriOrManifest +``` + +### Module + +#### tryResolveUri +```ts +$snippet: UriResolverInterface-tryResolveUri +``` + +#### getFile +```ts +$snippet: UriResolverInterface-getFile +``` +$end \ No newline at end of file diff --git a/packages/js/core/readme/sub-sections/base/uri-resolution.md b/packages/js/core/readme/sub-sections/base/uri-resolution.md new file mode 100644 index 0000000000..5e226e9cf9 --- /dev/null +++ b/packages/js/core/readme/sub-sections/base/uri-resolution.md @@ -0,0 +1,37 @@ +$start: uri-resolution.md +### IUriResolutionContext + +```ts +$snippet: IUriResolutionContext +``` + +### IUriResolutionStep + +```ts +$snippet: IUriResolutionStep +``` + +### IUriResolver + +```ts +$snippet: IUriResolver +``` + +### UriPackageOrWrapper + +```ts +$snippet: UriPackageOrWrapper.ts +``` + +### UriResolutionContext + +```ts +$snippet: UriResolutionContext +``` + +#### constructor + +```ts +$snippet: UriResolutionContext-constructor +``` +$end \ No newline at end of file diff --git a/packages/js/core/src/interfaces/uri-resolver.ts b/packages/js/core/src/interfaces/uri-resolver.ts index 9690c02299..50f7593f92 100644 --- a/packages/js/core/src/interfaces/uri-resolver.ts +++ b/packages/js/core/src/interfaces/uri-resolver.ts @@ -3,19 +3,33 @@ import { Uri, Invoker, WrapError } from "../"; import { Tracer } from "@polywrap/tracing-js"; import { Result } from "@polywrap/result"; +// $start: MaybeUriOrManifest +/** Contains either a Uri, a manifest, or neither */ export interface MaybeUriOrManifest { + /** wrap URI */ uri?: string | null; + + /** Serialized wrap manifest */ manifest?: Uint8Array | null; } +// $end export const module = { + // $start: UriResolverInterface-tryResolveUri + /** + * Use an invoker to try to resolve a URI using a wrapper that implements the UriResolver interface + * + * @param invoker - invokes the wrapper with the resolution URI as an argument + * @param wrapper - URI for wrapper that implements the UriResolver interface + * @param uri - the URI to resolve + */ tryResolveUri: Tracer.traceFunc( "core: uri-resolver: tryResolveUri", async ( invoker: Invoker, wrapper: Uri, uri: Uri - ): Promise> => { + ): Promise> /* $ */ => { return invoker.invoke({ uri: wrapper.uri, method: `tryResolveUri`, @@ -26,13 +40,21 @@ export const module = { }); } ), + // $start: UriResolverInterface-getFile + /** + * Use an invoker to fetch a file using a wrapper that implements the UriResolver interface + * + * @param invoker - invokes the wrapper with the filepath as an argument + * @param wrapper - URI for wrapper that implements the UriResolver interface + * @param path - a filepath, the format of which depends on the UriResolver + */ getFile: Tracer.traceFunc( "core: uri-resolver: getFile", async ( invoker: Invoker, wrapper: Uri, path: string - ): Promise> => { + ): Promise> /* $ */ => { return invoker.invoke({ uri: wrapper.uri, method: "getFile", diff --git a/packages/js/core/src/types/CoreClient.ts b/packages/js/core/src/types/CoreClient.ts index eb40e1364a..c0243346a4 100644 --- a/packages/js/core/src/types/CoreClient.ts +++ b/packages/js/core/src/types/CoreClient.ts @@ -5,58 +5,132 @@ import { UriResolverHandler } from "./UriResolver"; import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; import { Result } from "@polywrap/result"; +// $start: CoreClient.ts + +/** Core Client configuration that can be passed to the PolywrapClient or PolywrapCoreClient constructors */ export interface CoreClientConfig { + /** set environmental variables for a wrapper */ readonly interfaces?: Readonly[]>; + + /** register interface implementations */ readonly envs?: Readonly[]>; - readonly resolver: Readonly>; -} -export interface GetManifestOptions { - noValidate?: boolean; + /** configure URI resolution for redirects, packages, and wrappers */ + readonly resolver: Readonly>; } +/** Options for CoreClient's getFile method */ export interface GetFileOptions { + /** file path from wrapper root */ path: string; + + /** file encoding */ encoding?: "utf-8" | string; } +/** Options for CoreClient's getImplementations method */ export interface GetImplementationsOptions { + /** If true, follow redirects to resolve URIs */ applyResolution?: boolean; + + /** Use and update an existing resolution context */ resolutionContext?: IUriResolutionContext; } +/** Options for CoreClient's validate method */ export interface ValidateOptions { + /** Validate full ABI */ abi?: boolean; + + /** Recursively validate import URIs */ recursive?: boolean; } +/** CoreClient invokes wrappers and interacts with wrap packages. */ export interface CoreClient extends Invoker, UriResolverHandler { + /** + * Returns the configuration used to instantiate the client + * + * @returns an immutable core client config + */ getConfig(): CoreClientConfig; + /** + * returns all interfaces from the configuration used to instantiate the client + * + * @returns an array of interfaces and their registered implementations + */ getInterfaces(): readonly InterfaceImplementations[] | undefined; + /** + * returns all env registrations from the configuration used to instantiate the client + * + * @returns an array of env objects containing wrapper environmental variables + */ getEnvs(): readonly Env[] | undefined; + /** + * returns an env (a set of environmental variables) from the configuration used to instantiate the client + * + * @param uri - the URI used to register the env + * @returns an env, or undefined if an env is not found at the given URI + */ getEnvByUri(uri: TUri): Env | undefined; + /** + * returns the URI resolver from the configuration used to instantiate the client + * + * @returns an object that implements the IUriResolver interface + */ getResolver(): IUriResolver; + /** + * returns a package's wrap manifest + * + * @param uri - a wrap URI + * @returns a Result containing the WrapManifest if the request was successful + */ getManifest( uri: TUri ): Promise>; + /** + * returns a file contained in a wrap package + * + * @param uri - a wrap URI + * @param options - { path: string; encoding?: "utf-8" | string } + * @returns a Promise of a Result containing a file if the request was successful + */ getFile( uri: TUri, options: GetFileOptions ): Promise>; + /** + * returns the interface implementations associated with an interface URI + * from the configuration used to instantiate the client + * + * @param uri - a wrap URI + * @param options - { applyResolution?: boolean; resolutionContext?: IUriResolutionContext } + * @returns a Result containing URI array if the request was successful + */ getImplementations( uri: TUri, options: GetImplementationsOptions ): Promise>; + /** + * Validate a wrapper, given a URI. + * Optionally, validate the full ABI and/or recursively validate imports. + * + * @param uri: the Uri to resolve + * @param options - { abi?: boolean; recursive?: boolean } + * @returns A Promise with a Result containing a boolean or Error + */ validate( uri: TUri, options?: ValidateOptions ): Promise>; } + +// $end diff --git a/packages/js/core/src/types/Env.ts b/packages/js/core/src/types/Env.ts index df02244e33..d6174370e1 100644 --- a/packages/js/core/src/types/Env.ts +++ b/packages/js/core/src/types/Env.ts @@ -2,6 +2,9 @@ import { Uri } from "."; import { Tracer } from "@polywrap/tracing-js"; +// $start: Env.ts + +/** A map of string-indexed, Msgpack-serializable environmental variables associated with a wrapper */ export interface Env { /** Uri of wrapper */ uri: TUri; @@ -10,6 +13,8 @@ export interface Env { env: Record; } +// $end + export const sanitizeEnvs = Tracer.traceFunc( "core: sanitizeEnvs", (environments: Env[]): Env[] => { diff --git a/packages/js/core/src/types/IUriPackage.ts b/packages/js/core/src/types/IUriPackage.ts index f7b27f64e0..1defddcd75 100644 --- a/packages/js/core/src/types/IUriPackage.ts +++ b/packages/js/core/src/types/IUriPackage.ts @@ -1,6 +1,14 @@ import { Uri, IWrapPackage } from "."; +// $start: IUriPackage.ts + +/** Associates a URI with an embedded wrap package */ export interface IUriPackage { + /** The package's URI */ uri: TUri; + + /** The wrap package */ package: IWrapPackage; } + +// $end diff --git a/packages/js/core/src/types/IUriRedirect.ts b/packages/js/core/src/types/IUriRedirect.ts index 3475f727a0..eb10b707cd 100644 --- a/packages/js/core/src/types/IUriRedirect.ts +++ b/packages/js/core/src/types/IUriRedirect.ts @@ -1,6 +1,14 @@ import { Uri } from "."; +// $start: IUriRedirect.ts + +/** Redirect invocations from one URI to another */ export interface IUriRedirect { + /** URI to redirect from */ from: TUri; + + /** URI to redirect to */ to: TUri; } + +// $end diff --git a/packages/js/core/src/types/IUriWrapper.ts b/packages/js/core/src/types/IUriWrapper.ts index 0a5aa5c622..e5c0fe9496 100644 --- a/packages/js/core/src/types/IUriWrapper.ts +++ b/packages/js/core/src/types/IUriWrapper.ts @@ -1,6 +1,14 @@ import { Uri, Wrapper } from "."; +// $start: IUriWrapper.ts + +/** Associates a URI with an embedded wrapper */ export interface IUriWrapper { + /** The URI to resolve to the wrapper */ uri: TUri; + + /** A wrapper instance */ wrapper: Wrapper; } + +// $end diff --git a/packages/js/core/src/types/IWrapPackage.ts b/packages/js/core/src/types/IWrapPackage.ts index 9afe7fc5aa..ac28aa4726 100644 --- a/packages/js/core/src/types/IWrapPackage.ts +++ b/packages/js/core/src/types/IWrapPackage.ts @@ -1,4 +1,4 @@ -import { Wrapper, GetManifestOptions } from "."; +import { Wrapper } from "."; import { DeserializeManifestOptions, @@ -6,11 +6,35 @@ import { } from "@polywrap/wrap-manifest-types-js"; import { Result } from "@polywrap/result"; +// $start: IWrapPackage.ts + +/** Options for IWrapPackage's getManifest method */ +export interface GetManifestOptions { + /** If true, manifest validation step will be skipped */ + noValidate?: boolean; +} + +/** A wrap package, capable of producing instances of a wrapper and its manifest */ export interface IWrapPackage { + /** + * Produce an instance of the wrap manifest + * + * @param options - GetManifestOptions; customize manifest retrieval + * @returns A Promise with a Result containing the wrap manifest or an error + */ getManifest( options?: GetManifestOptions ): Promise>; + + /** + * Produce an instance of the wrapper + * + * @param options - DeserializeManifestOptions; customize manifest deserialization + * @returns A Promise with a Result containing the wrapper or an error + */ createWrapper( options?: DeserializeManifestOptions ): Promise>; } + +// $end diff --git a/packages/js/core/src/types/InterfaceImplementations.ts b/packages/js/core/src/types/InterfaceImplementations.ts index d38fd3f55d..9d42a8ab91 100644 --- a/packages/js/core/src/types/InterfaceImplementations.ts +++ b/packages/js/core/src/types/InterfaceImplementations.ts @@ -2,11 +2,19 @@ import { Uri } from "."; import { Tracer } from "@polywrap/tracing-js"; +// $start: InterfaceImplementations.ts + +/** An interface and a list of wrappers that implement the interface */ export interface InterfaceImplementations { + /** Uri of interface */ interface: TUri; + + /** Uris of implementations */ implementations: TUri[]; } +// $end + export const sanitizeInterfaceImplementations = Tracer.traceFunc( "core: sanitizeInterfaceImplementations", ( diff --git a/packages/js/core/src/types/Invoke.ts b/packages/js/core/src/types/Invoke.ts index 38bce7d87d..da17ed98ce 100644 --- a/packages/js/core/src/types/Invoke.ts +++ b/packages/js/core/src/types/Invoke.ts @@ -3,6 +3,8 @@ import { IUriResolutionContext } from "../uri-resolution"; import { Result } from "@polywrap/result"; +// $start: Invoke.ts + /** Options required for an Wrapper invocation. */ export interface InvokeOptions { /** The Wrapper's URI */ @@ -11,17 +13,13 @@ export interface InvokeOptions { /** Method to be executed. */ method: string; - /** - * Arguments for the method, structured as a map, - * removing the chance of incorrectly ordering arguments. - */ + /** Arguments for the method, structured as a map, removing the chance of incorrectly ordered arguments. */ args?: Record | Uint8Array; - /** - * Env variables for the wrapper invocation. - */ + /** Env variables for the wrapper invocation. */ env?: Record; + /** A Uri resolution context */ resolutionContext?: IUriResolutionContext; } @@ -32,27 +30,69 @@ export interface InvokeOptions { */ export type InvokeResult = Result; +/** + * Provides options for the invoker to set based on the state of the invocation. + * Extends InvokeOptions. + */ export interface InvokerOptions extends InvokeOptions { + /** If true, the InvokeResult will (if successful) contain a Msgpack-encoded byte array */ encodeResult?: boolean; } +/** + * An entity capable of invoking wrappers. + * + * @template TData Type of the invoke result data. + */ export interface Invoker { + /** + * Invoke a wrapper using an instance of the wrapper. + * + * @param options - invoker options and a wrapper instance to invoke + * @returns A Promise with a Result containing the return value or an error + */ invokeWrapper( options: InvokerOptions & { wrapper: Wrapper } ): Promise>; + + /** + * Invoke a wrapper. + * + * @remarks + * Unlike `invokeWrapper`, this method automatically retrieves and caches the wrapper. + * + * @param options - invoker options + * @returns A Promise with a Result containing the return value or an error + */ invoke( options: InvokerOptions ): Promise>; } +/** + * Result of a Wrapper invocation, possibly Msgpack-encoded. + * + * @template TData Type of the invoke result data. + */ export type InvocableResult = InvokeResult & { + /** If true, result (if successful) contains a Msgpack-encoded byte array */ encoded?: boolean; }; +/** An invocable entity, such as a wrapper. */ export interface Invocable { + /** + * Invoke this object. + * + * @param options - invoke options + * @param invoker - an Invoker, capable of invoking this object + * @returns A Promise with a Result containing the return value or an error + */ invoke( options: InvokeOptions, invoker: Invoker ): Promise>; } + +// $end diff --git a/packages/js/core/src/types/MaybeAsync.ts b/packages/js/core/src/types/MaybeAsync.ts index 1e3bb3d1ad..9c47e84aaa 100644 --- a/packages/js/core/src/types/MaybeAsync.ts +++ b/packages/js/core/src/types/MaybeAsync.ts @@ -1 +1,6 @@ +// $start: MaybeAsync.ts + +/** Alias for a type that is either a value or a promise that resolves to the value */ export type MaybeAsync = Promise | T; + +// $end diff --git a/packages/js/core/src/types/Uri.ts b/packages/js/core/src/types/Uri.ts index cc8afb7c2a..b1226264b4 100644 --- a/packages/js/core/src/types/Uri.ts +++ b/packages/js/core/src/types/Uri.ts @@ -1,13 +1,21 @@ import { Tracer } from "@polywrap/tracing-js"; import { Result, ResultErr, ResultOk } from "@polywrap/result"; +// $start: UriConfig /** URI configuration */ export interface UriConfig { + /** URI Authority: allows the Polywrap URI resolution algorithm to determine an authoritative URI resolver. */ authority: string; + + /** URI Path: tells the Authority where the Wrapper resides. */ path: string; + + /** Full string representation of URI */ uri: string; } +// $end +// $start: Uri /** * A Polywrap URI. Some examples of valid URIs are: * wrap://ipfs/QmHASH @@ -22,21 +30,37 @@ export interface UriConfig { * **sub.domain.eth** - URI Path: tells the Authority where the Wrapper resides. */ export class Uri { + // $end private _config: UriConfig; - public get authority(): string { + // $start: Uri-authority + /** @returns Uri authority */ + public get authority(): string /* $ */ { return this._config.authority; } - public get path(): string { + // $start: Uri-path + /** @returns Uri path */ + public get path(): string /* $ */ { return this._config.path; } - public get uri(): string { + // $start: Uri-uri + /** @returns Uri string representation */ + public get uri(): string /* $ */ { return this._config.uri; } - constructor(uri: string) { + // $start: Uri-constructor + /** + * Construct a Uri instance from a wrap URI string + * + * @remarks + * Throws if URI string is invalid + * + * @param uri - a string representation of a wrap URI + */ + constructor(uri: string) /* $ */ { const result = Uri.parseUri(uri); if (!result.ok) { throw result.error; @@ -44,15 +68,30 @@ export class Uri { this._config = result.value; } - public static equals(a: Uri, b: Uri): boolean { + // $start: Uri-equals + /** Test two Uri instances for equality */ + public static equals(a: Uri, b: Uri): boolean /* $ */ { return a.uri === b.uri; } - public static isUri(value: unknown): value is Uri { + // $start: Uri-isUri + /** + * Check if a value is an instance of Uri + * + * @param value - value to check + * @returns true if value is a Uri instance */ + public static isUri(value: unknown): value is Uri /* $ */ { return typeof value === "object" && (value as Uri).uri !== undefined; } - public static isValidUri(uri: string, parsed?: UriConfig): boolean { + // $start: Uri-isValidUri + /** + * Test if a URI string is a valid wrap URI + * + * @param uri - URI string + * @param parsed? - UriConfig to update (mutate) with content of URI string + * @returns true if input string is a valid wrap URI */ + public static isValidUri(uri: string, parsed?: UriConfig): boolean /* $ */ { const result = Uri.parseUri(uri); if (parsed && result.ok) { @@ -62,16 +101,27 @@ export class Uri { return result.ok; } - public toString(): string { + // $start: Uri-toString + /** @returns Uri string representation */ + public toString(): string /* $ */ { return this._config.uri; } - public toJSON(): string { + // $start: Uri-toJSON + /** @returns Uri string representation */ + public toJSON(): string /* $ */ { return this._config.uri; } + // $start: Uri-parseUri + /** + * Parse a wrap URI string into its authority and path + * + * @param uri - a string representation of a wrap URI + * @returns A Result containing a UriConfig, if successful, or an error + */ @Tracer.traceMethod("Uri: parseUri") - public static parseUri(uri: string): Result { + public static parseUri(uri: string): Result /* $ */ { if (!uri) { return ResultErr(Error("The provided URI is empty")); } @@ -125,8 +175,17 @@ export class Uri { }); } + // $start: Uri-from + /** + * Construct a Uri instance from a Uri or a wrap URI string + * + * @remarks + * Throws if URI string is invalid + * + * @param uri - a Uri instance or a string representation of a wrap URI + */ @Tracer.traceMethod("Uri: from") - public static from(uri: Uri | string): Uri { + public static from(uri: Uri | string): Uri /* $ */ { if (typeof uri === "string") { return new Uri(uri); } else if (Uri.isUri(uri)) { diff --git a/packages/js/core/src/types/UriResolver.ts b/packages/js/core/src/types/UriResolver.ts index fb0552dc7a..b4976f19d7 100644 --- a/packages/js/core/src/types/UriResolver.ts +++ b/packages/js/core/src/types/UriResolver.ts @@ -3,16 +3,28 @@ import { IUriResolutionContext, UriPackageOrWrapper } from "../uri-resolution"; import { Result } from "@polywrap/result"; -/** Options required for an URI resolution. */ +// $start: UriResolver.ts + +/** Options required for URI resolution. */ export interface TryResolveUriOptions { /** The Wrapper's URI */ uri: TUri; + /** A URI resolution context */ resolutionContext?: IUriResolutionContext; } +/** An entity capable of resolving a wrap URI, typically by using an IUriResolver implementation */ export interface UriResolverHandler { + /** + * Resolve a URI to a wrap package, a wrapper, or a uri + * + * @param options - TryResolveUriOptions + * @returns A Promise with a Result containing either a wrap package, a wrapper, or a URI if successful + */ tryResolveUri( options?: TryResolveUriOptions ): Promise>; } + +// $end diff --git a/packages/js/core/src/types/Wrapper.ts b/packages/js/core/src/types/Wrapper.ts index d2051d8b4f..2f6578dded 100644 --- a/packages/js/core/src/types/Wrapper.ts +++ b/packages/js/core/src/types/Wrapper.ts @@ -10,6 +10,8 @@ import { import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; import { Result } from "@polywrap/result"; +// $start: Wrapper.ts + /** * The Wrapper definition, which can be used to spawn * many invocations of this particular Wrapper. Internally @@ -41,3 +43,5 @@ export interface Wrapper extends Invocable { */ getManifest(): WrapManifest; } + +// $end diff --git a/packages/js/core/src/uri-resolution/IUriResolutionContext.ts b/packages/js/core/src/uri-resolution/IUriResolutionContext.ts index 52350fa5bf..7e04869a88 100644 --- a/packages/js/core/src/uri-resolution/IUriResolutionContext.ts +++ b/packages/js/core/src/uri-resolution/IUriResolutionContext.ts @@ -1,13 +1,56 @@ import { IUriResolutionStep } from "./IUriResolutionStep"; import { Uri } from ".."; +// $start: IUriResolutionContext +/** Track and output URI resolution state, path, and history */ export interface IUriResolutionContext { + /** + * Check if a URI is in the process of being resolved + * + * @param uri - URI to check + * @return true if URI resolution is in process, false otherwise + */ isResolving(uri: Uri): boolean; + + /** + * Start resolving a URI + * + * @param uri - Uri to resolve + */ startResolving(uri: Uri): void; + + /** + * Stop resolving a URI + * + * @param uri - Uri being resolved + */ stopResolving(uri: Uri): void; + + /** + * Push a step onto the resolution history stack + * + * @param step - A completed resolution step + */ trackStep(step: IUriResolutionStep): void; + + /** @return history of all URI resolution steps completed */ getHistory(): IUriResolutionStep[]; + + /** @return current URI resolution path */ getResolutionPath(): Uri[]; + + /** + * Create a new resolution context using the current URI resolution path + * + * @return a UriResolutionContext + */ createSubHistoryContext(): IUriResolutionContext; + + /** + * Create a new resolution context using the current URI resolution history + * + * @return a UriResolutionContext + */ createSubContext(): IUriResolutionContext; } +// $end diff --git a/packages/js/core/src/uri-resolution/IUriResolutionStep.ts b/packages/js/core/src/uri-resolution/IUriResolutionStep.ts index 731db57b68..535796f78f 100644 --- a/packages/js/core/src/uri-resolution/IUriResolutionStep.ts +++ b/packages/js/core/src/uri-resolution/IUriResolutionStep.ts @@ -3,9 +3,19 @@ import { UriPackageOrWrapper } from "./UriPackageOrWrapper"; import { Result } from "@polywrap/result"; +// $start: IUriResolutionStep +/** A step in the URI resolution algorithm */ export interface IUriResolutionStep { + /** The current URI being resolved */ sourceUri: Uri; + + /** The resolution result for the current URI */ result: Result; + + /** A text/visual description of this URI step */ description?: string; + + /** History of sub-steps that exist within the context of this URI resolution step */ subHistory?: IUriResolutionStep[]; } +// $end diff --git a/packages/js/core/src/uri-resolution/IUriResolver.ts b/packages/js/core/src/uri-resolution/IUriResolver.ts index f714219241..4d7d0667c9 100644 --- a/packages/js/core/src/uri-resolution/IUriResolver.ts +++ b/packages/js/core/src/uri-resolution/IUriResolver.ts @@ -4,10 +4,21 @@ import { UriPackageOrWrapper } from "./UriPackageOrWrapper"; import { Result } from "@polywrap/result"; +// $start: IUriResolver +/** Defines entity capable of resolving a wrap URI */ export interface IUriResolver { + /** + * Resolve a URI to a wrap package, a wrapper, or a uri + * + * @param uri - the URI to resolve + * @param client - a CoreClient instance that may be used to invoke a wrapper that implements the UriResolver interface + * @param resolutionContext - the current URI resolution context + * @returns A Promise with a Result containing either a wrap package, a wrapper, or a URI if successful + */ tryResolveUri( uri: Uri, client: CoreClient, resolutionContext: IUriResolutionContext ): Promise>; } +// $end diff --git a/packages/js/core/src/uri-resolution/UriPackageOrWrapper.ts b/packages/js/core/src/uri-resolution/UriPackageOrWrapper.ts index ce662e6a76..319231f8b9 100644 --- a/packages/js/core/src/uri-resolution/UriPackageOrWrapper.ts +++ b/packages/js/core/src/uri-resolution/UriPackageOrWrapper.ts @@ -1,17 +1,25 @@ import { Uri } from ".."; import { IUriPackage, IUriWrapper } from "../types"; +// $start: UriPackageOrWrapper.ts + +/** Indicates that a URI resolved to a Uri */ export type UriValue = { type: "uri"; uri: Uri; }; +/** Indicates that a URI resolved to a wrap package */ export type UriPackageValue = IUriPackage & { type: "package"; }; +/** Indicates that a URI resolved to a wrapper */ export type UriWrapperValue = IUriWrapper & { type: "wrapper"; }; +/** indicates that a URI resolved to either a wrap package, a wrapper, or a URI */ export type UriPackageOrWrapper = UriValue | UriPackageValue | UriWrapperValue; + +// $end diff --git a/packages/js/core/src/uri-resolution/UriResolutionContext.ts b/packages/js/core/src/uri-resolution/UriResolutionContext.ts index e88b6c4cf2..133c7e14b4 100644 --- a/packages/js/core/src/uri-resolution/UriResolutionContext.ts +++ b/packages/js/core/src/uri-resolution/UriResolutionContext.ts @@ -2,11 +2,18 @@ import { IUriResolutionStep } from "./IUriResolutionStep"; import { IUriResolutionContext } from "./IUriResolutionContext"; import { Uri } from "../types"; +// $start: UriResolutionContext +/** An implementation of the IUriResolutionContext interface */ +// $start: UriResolutionContext +/** An implementation of the IUriResolutionContext interface */ export class UriResolutionContext implements IUriResolutionContext { + // $end private _resolvingUriMap: Map; private _resolutionPath: Set; private _history: IUriResolutionStep[]; + // $start: UriResolutionContext-constructor + /** Construct a UriResolutionContext */ constructor(); constructor( resolvingUriMap: Map, @@ -19,7 +26,7 @@ export class UriResolutionContext implements IUriResolutionContext { constructor( resolvingUriMap?: Map, resolutionPathOrHistory?: Set | IUriResolutionStep[] - ) { + ) /* $ */ { this._resolvingUriMap = resolvingUriMap ?? new Map(); if (Array.isArray(resolutionPathOrHistory)) { diff --git a/packages/js/test-env/.gitignore b/packages/js/test-env/.gitignore new file mode 100644 index 0000000000..dbb01bb64d --- /dev/null +++ b/packages/js/test-env/.gitignore @@ -0,0 +1,3 @@ +/examples/**/*.d.ts +/examples/**/*.js +/examples/**/*.js.map diff --git a/packages/js/test-env/README.md b/packages/js/test-env/README.md index a5585a7e15..d5960f9cbe 100644 --- a/packages/js/test-env/README.md +++ b/packages/js/test-env/README.md @@ -8,26 +8,27 @@ It allows user to initiate the test environment through a javascript function (i # Usage -Initialization with the simple-storage wrapper. +## Init test env + +Spin up docker containers for Ganache and IPFS. ``` typescript -import path from "path"; -import { PolywrapClient } from "@polywrap/client-js"; -import { - buildWrapper, - initTestEnvironment, - stopTestEnvironment, - providers, - ensAddresses -} from "@polywrap/test-env-js"; -import * as App from "../types/wrap"; - -// test wrapper in a test environment -export async function foo({ - // spin up docker containers for Ganache and IPFS. await initTestEnvironment(); - const CONNECTION = { networkNameOrChainId: "testnet" }; +``` + +## Stop test env + +Stop docker containers for Ganache and IPFS. + +``` typescript + await stopTestEnvironment(); +``` + +## Build a wrapper +Build a local wrapper project. + +``` typescript // get path to the wrapper in testing const wrapperPath: string = path.join(path.resolve(__dirname), ".."); @@ -35,34 +36,182 @@ export async function foo({ await buildWrapper(wrapperPath, undefined, true); // get URI to the local wrapper build - const wrapperUri = `fs/${wrapperPath}/build`; - - // invoke the wrapper to deploy a contract to the test env - const deployContractResponse = await App.SimpleStorage_Module.deployContract( - { connection: CONNECTION }, - client, - wrapperUri - ); - const contractAddress = deployContractResponse.data as string; - - // invoke the wrapper to query a contract in the test env - const response = await App.SimpleStorage_Module.getData( - { - address: contractAddr, - connection: CONNECTION, - }, - client, - wrapperUri - ); -}); + const wrapperUri = `wrap://fs/${wrapperPath}/build`; +``` + +## Execute the CLI + +Execute a command with the Polywrap CLI. + +``` typescript + const { exitCode, stderr, stdout } = await runCLI({ + args: ["infra", "up", "--verbose"], + }); +``` + +## Constants + +### providers + +```typescript +/** The URIs for the default providers used by the default infrastructure module. */ +export const providers = { + ipfs: "http://localhost:5001", + ethereum: "http://localhost:8545", + http: "http://localhost:3500", +}; +``` + +### ensAddresses + +```typescript +/** The Ethereum addresses of the default infrastructure module's locally-deployed ENS smart contracts. */ +export const ensAddresses = { + ensAddress: "0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab", + resolverAddress: "0x5b1869D9A4C187F2EAa108f3062412ecf0526b24", + registrarAddress: "0xD833215cBcc3f914bD1C9ece3EE7BF8B14f841bb", + reverseAddress: "0xe982E462b094850F12AF94d21D470e21bE9D0E9C", +} as const; +``` + +### embeddedWrappers + +```typescript +/** Wasm wrappers embedded in the package */ +export const embeddedWrappers = { + ens: `wrap://fs/${path.join(__dirname, "wrappers", "ens")}`, + uts46: `wrap://fs/${path.join(__dirname, "wrappers", "uts46")}`, + sha3: `wrap://fs/${path.join(__dirname, "wrappers", "sha3")}`, +}; +``` + +## Methods + +### initTestEnvironment + +```typescript +/** + * Starts a local test environment using the default infrastructure module. + * + * @param cli? - a path to a Polywrap CLI binary. + */ +export const initTestEnvironment = async ( + cli?: string +): Promise +``` + +### stopTestEnvironment + +```typescript +/** + * Stops the local test environment (default infrastructure module) if one is running. + * + * @param cli? - a path to a Polywrap CLI binary. + */ +export const stopTestEnvironment = async ( + cli?: string +): Promise +``` + +### buildWrapper + +```typescript +/** + * Build the wrapper located at the given path + * + * @param wrapperAbsPath - absolute path of wrapper to build + * @param manifestPathOverride? - path to polywrap manifest + * @param codegen? - run codegen before build + */ +export async function buildWrapper( + wrapperAbsPath: string, + manifestPathOverride?: string, + codegen?: boolean +): Promise +``` + +### buildAndDeployWrapper + +```typescript +/** + * Build the wrapper located at the given path, and then deploy it to IPFS and ENS. + * If an ENS domain is not provided, a randomly selected human-readable ENS domain name is used. + * + * @param wrapperAbsPath - absolute path of wrapper to build + * @param ipfsProvider - ipfs provider to use for deployment + * @param ethereumProvider - ethereum provider to use for ENS registration + * @param ensName? - an ENS domain name to register and assign to the wrapper + * @param codegen? - run codegen before build + * + * @returns registered ens domain name and IPFS hash + */ +export async function buildAndDeployWrapper({ + wrapperAbsPath, + ipfsProvider, + ethereumProvider, + ensName, + codegen, +}: { + wrapperAbsPath: string; + ipfsProvider: string; + ethereumProvider: string; + ensName?: string; + codegen?: boolean; +}): Promise<{ + ensDomain: string; + ipfsCid: string; +}> +``` + +### buildAndDeployWrapperToHttp +```typescript +/** + * Build the wrapper located at the given path, and then deploy it to HTTP. + * If a domain name is not provided, a randomly selected human-readable domain name is used. + * + * @param wrapperAbsPath - absolute path of wrapper to build + * @param httpProvider - http provider used for deployment and domain registration + * @param name? - a domain name to register and assign to the wrapper + * @param codegen? - run codegen before build + * + * @returns http uri + */ +export async function buildAndDeployWrapperToHttp({ + wrapperAbsPath, + httpProvider, + name, + codegen, +}: { + wrapperAbsPath: string; + httpProvider: string; + name?: string; + codegen?: boolean; +}): Promise<{ uri: string }> ``` -# API +### runCLI -- ensAddresses, providers - constant addresses and urls -- runCLI - run arbitrary Polywrap CLI commands -- initTestEnvironment - spin up Ganache and IPFS Docker instances -- stopTestEnvironment - stop Docker -- buildWrapper - compile wasm and bindings -- buildAndDeployWrapper - deploy wrapper to the testnet ENS +```typescript +/** + * Runs the polywrap CLI programmatically. + * + * @param options - an object containing: + * args - an array of command line arguments + * cwd? - a current working directory + * cli? - a path to a Polywrap CLI binary + * env? - a map of environmental variables + * + * @returns exit code, standard output, and standard error logs + */ +export const runCLI = async (options: { + args: string[]; + cwd?: string; + cli?: string; + env?: Record; +}): Promise<{ + exitCode: number; + stdout: string; + stderr: string; +}> +``` \ No newline at end of file diff --git a/packages/js/test-env/examples/quickstart.ts b/packages/js/test-env/examples/quickstart.ts new file mode 100644 index 0000000000..4bfb9044f0 --- /dev/null +++ b/packages/js/test-env/examples/quickstart.ts @@ -0,0 +1,49 @@ +import { + buildWrapper, + initTestEnvironment, + runCLI, + stopTestEnvironment, +} from "../build"; + +import path from "path"; + +export async function init(): Promise { + // $start: quickstart-init + await initTestEnvironment(); + // $end +} + +export async function stop(): Promise { + // $start: quickstart-stop + await stopTestEnvironment(); + // $end +} + +export async function build(): Promise { + // $start: quickstart-build + // get path to the wrapper in testing + const wrapperPath: string = path.join(path.resolve(__dirname), ".."); + + // build current wrapper with CLI, invoking codegen before build + await buildWrapper(wrapperPath, undefined, true); + + // get URI to the local wrapper build + const wrapperUri = `wrap://fs/${wrapperPath}/build`; + // $end + + return wrapperUri; +} + +export async function cli(): Promise<{ + exitCode: number; + stdout: string; + stderr: string; +}> { + // $start: quickstart-runCLI + const { exitCode, stderr, stdout } = await runCLI({ + args: ["infra", "up", "--verbose"], + }); + // $end + + return { exitCode, stderr, stdout }; +} diff --git a/packages/js/test-env/examples/tsconfig.examples.json b/packages/js/test-env/examples/tsconfig.examples.json new file mode 100644 index 0000000000..f37de53612 --- /dev/null +++ b/packages/js/test-env/examples/tsconfig.examples.json @@ -0,0 +1,6 @@ +{ + "extends": "../tsconfig.json", + "include": [ + "./**/*.ts" + ], +} \ No newline at end of file diff --git a/packages/js/test-env/package.json b/packages/js/test-env/package.json index ff77c33f50..871986e5b4 100644 --- a/packages/js/test-env/package.json +++ b/packages/js/test-env/package.json @@ -12,9 +12,12 @@ "build" ], "scripts": { - "build": "rimraf ./build && tsc --project tsconfig.build.json && yarn copy:wrappers", + "build": "yarn build:fast && yarn build:snippets && yarn build:readme", + "build:fast": "rimraf ./build && tsc --project tsconfig.build.json && yarn copy:wrappers", "lint": "eslint --color -c ../../../.eslintrc.js src/", - "copy:wrappers": "copyfiles ./src/wrappers/**/**/* ./build/wrappers/ -u 2" + "copy:wrappers": "copyfiles ./src/wrappers/**/**/* ./build/wrappers/ -u 2", + "build:snippets": "tsc --project ./examples/tsconfig.examples.json", + "build:readme": "yarn doc-snippets combine" }, "dependencies": { "@polywrap/core-js": "0.10.0-pre.7", @@ -24,6 +27,7 @@ "yaml": "2.1.3" }, "devDependencies": { + "doc-snippets": "^1.0.0", "copyfiles": "2.4.1", "rimraf": "3.0.2", "ts-node": "8.10.2", @@ -32,5 +36,44 @@ "gitHead": "7346adaf5adb7e6bbb70d9247583e995650d390a", "publishConfig": { "access": "public" + }, + "doc-snippets": { + "extract": { + "include": [ + "./src/**/*.{ts,tsx,json,yaml,txt,md,graphql,cue}", + "./examples/**/*.{ts,tsx,json,yaml,txt,md,graphql,cue}" + ], + "ignore": [ + "./**/node_modules/**", + "./**/.polywrap/**", + "./**/__tests__/**" + ], + "dir": "./" + }, + "inject": { + "dir": "./readme", + "include": "./README.md" + }, + "startTokens": [ + { + "pattern": "$start: ", + "inline": false + }, + { + "pattern": "/* $: {SNIPPET_NAME} */", + "inline": true + } + ], + "endTokens": [ + { + "pattern": "$end", + "inline": false + }, + { + "pattern": "/* $ */", + "inline": true + } + ], + "outputDir": "./" } } diff --git a/packages/js/test-env/readme/README.md b/packages/js/test-env/readme/README.md new file mode 100644 index 0000000000..e7c33cf883 --- /dev/null +++ b/packages/js/test-env/readme/README.md @@ -0,0 +1,99 @@ +# @polywrap/test-env-js + +Provides functions to setup a test environment with Polywrap CLI and Docker. + +# Description + +It allows user to initiate the test environment through a javascript function (it's the `infra` command in the CLI). It also exports the providers and ens addresses expected in the deployments (They are hard coded, because the initiation of the environment is deterministic) + +# Usage + +## Init test env + +Spin up docker containers for Ganache and IPFS. + +``` typescript +$snippet: quickstart-init +``` + +## Stop test env + +Stop docker containers for Ganache and IPFS. + +``` typescript +$snippet: quickstart-stop +``` + +## Build a wrapper + +Build a local wrapper project. + +``` typescript +$snippet: quickstart-build +``` + +## Execute the CLI + +Execute a command with the Polywrap CLI. + +``` typescript +$snippet: quickstart-runCLI +``` + +## Constants + +### providers + +```typescript +$snippet: providers +``` + +### ensAddresses + +```typescript +$snippet: ensAddresses +``` + +### embeddedWrappers + +```typescript +$snippet: embeddedWrappers +``` + +## Methods + +### initTestEnvironment + +```typescript +$snippet: initTestEnvironment +``` + +### stopTestEnvironment + +```typescript +$snippet: stopTestEnvironment +``` + +### buildWrapper + +```typescript +$snippet: buildWrapper +``` + +### buildAndDeployWrapper + +```typescript +$snippet: buildAndDeployWrapper +``` + +### buildAndDeployWrapperToHttp + +```typescript +$snippet: buildAndDeployWrapperToHttp +``` + +### runCLI + +```typescript +$snippet: runCLI +``` \ No newline at end of file diff --git a/packages/js/test-env/src/index.ts b/packages/js/test-env/src/index.ts index c27b0dd97c..1cbb836a75 100644 --- a/packages/js/test-env/src/index.ts +++ b/packages/js/test-env/src/index.ts @@ -9,24 +9,33 @@ import yaml from "yaml"; import { Uri } from "@polywrap/core-js"; import { DeployManifest } from "@polywrap/polywrap-manifest-types-js"; +// $start: ensAddresses +/** The Ethereum addresses of the default infrastructure module's locally-deployed ENS smart contracts. */ export const ensAddresses = { ensAddress: "0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab", resolverAddress: "0x5b1869D9A4C187F2EAa108f3062412ecf0526b24", registrarAddress: "0xD833215cBcc3f914bD1C9ece3EE7BF8B14f841bb", reverseAddress: "0xe982E462b094850F12AF94d21D470e21bE9D0E9C", } as const; +// $end +// $start: providers +/** The URIs for the default providers used by the default infrastructure module. */ export const providers = { ipfs: "http://localhost:5001", ethereum: "http://localhost:8545", http: "http://localhost:3500", }; +// $end +// $start: embeddedWrappers +/** Wasm wrappers embedded in the package */ export const embeddedWrappers = { ens: `wrap://fs/${path.join(__dirname, "wrappers", "ens")}`, uts46: `wrap://fs/${path.join(__dirname, "wrappers", "uts46")}`, sha3: `wrap://fs/${path.join(__dirname, "wrappers", "sha3")}`, }; +// $end: embeddedWrappers const monorepoCli = `${__dirname}/../../../cli/bin/polywrap`; const npmCli = `${__dirname}/../../../polywrap/bin/polywrap`; @@ -66,7 +75,15 @@ async function awaitResponse( return false; } -export const initTestEnvironment = async (cli?: string): Promise => { +// $start: initTestEnvironment +/** + * Starts a local test environment using the default infrastructure module. + * + * @param cli? - a path to a Polywrap CLI binary. + */ +export const initTestEnvironment = async ( + cli?: string +): Promise /* $ */ => { // Start the test environment const { exitCode, stderr, stdout } = await runCLI({ args: ["infra", "up", "--modules=eth-ens-ipfs", "--verbose"], @@ -124,7 +141,15 @@ export const initTestEnvironment = async (cli?: string): Promise => { } }; -export const stopTestEnvironment = async (cli?: string): Promise => { +// $start: stopTestEnvironment +/** + * Stops the local test environment (default infrastructure module) if one is running. + * + * @param cli? - a path to a Polywrap CLI binary. + */ +export const stopTestEnvironment = async ( + cli?: string +): Promise /* $ */ => { // Stop the test environment const { exitCode, stderr } = await runCLI({ args: ["infra", "down", "--modules=eth-ens-ipfs"], @@ -140,6 +165,18 @@ export const stopTestEnvironment = async (cli?: string): Promise => { return Promise.resolve(); }; +// $start: runCLI +/** + * Runs the polywrap CLI programmatically. + * + * @param options - an object containing: + * args - an array of command line arguments + * cwd? - a current working directory + * cli? - a path to a Polywrap CLI binary + * env? - a map of environmental variables + * + * @returns exit code, standard output, and standard error logs + */ export const runCLI = async (options: { args: string[]; cwd?: string; @@ -149,7 +186,7 @@ export const runCLI = async (options: { exitCode: number; stdout: string; stderr: string; -}> => { +}> /* $ */ => { const [exitCode, stdout, stderr] = await new Promise((resolve, reject) => { if (!options.cwd) { // Make sure to set an absolute working directory @@ -198,11 +235,19 @@ export const runCLI = async (options: { }; }; +// $start: buildWrapper +/** + * Build the wrapper located at the given path + * + * @param wrapperAbsPath - absolute path of wrapper to build + * @param manifestPathOverride? - path to polywrap manifest + * @param codegen? - run codegen before build + */ export async function buildWrapper( wrapperAbsPath: string, manifestPathOverride?: string, codegen?: boolean -): Promise { +): Promise /* $ */ { const manifestPath = manifestPathOverride ? path.join(wrapperAbsPath, manifestPathOverride) : `${wrapperAbsPath}/polywrap.yaml`; @@ -247,6 +292,19 @@ export async function buildWrapper( } } +// $start: buildAndDeployWrapper +/** + * Build the wrapper located at the given path, and then deploy it to IPFS and ENS. + * If an ENS domain is not provided, a randomly selected human-readable ENS domain name is used. + * + * @param wrapperAbsPath - absolute path of wrapper to build + * @param ipfsProvider - ipfs provider to use for deployment + * @param ethereumProvider - ethereum provider to use for ENS registration + * @param ensName? - an ENS domain name to register and assign to the wrapper + * @param codegen? - run codegen before build + * + * @returns registered ens domain name and IPFS hash + */ export async function buildAndDeployWrapper({ wrapperAbsPath, ipfsProvider, @@ -262,7 +320,7 @@ export async function buildAndDeployWrapper({ }): Promise<{ ensDomain: string; ipfsCid: string; -}> { +}> /* $ */ { const tempDeployManifestFilename = `polywrap.deploy-temp.yaml`; const tempDeployManifestPath = path.join( wrapperAbsPath, @@ -353,6 +411,18 @@ export async function buildAndDeployWrapper({ }; } +// $start: buildAndDeployWrapperToHttp +/** + * Build the wrapper located at the given path, and then deploy it to HTTP. + * If a domain name is not provided, a randomly selected human-readable domain name is used. + * + * @param wrapperAbsPath - absolute path of wrapper to build + * @param httpProvider - http provider used for deployment and domain registration + * @param name? - a domain name to register and assign to the wrapper + * @param codegen? - run codegen before build + * + * @returns http uri + */ export async function buildAndDeployWrapperToHttp({ wrapperAbsPath, httpProvider, @@ -363,7 +433,7 @@ export async function buildAndDeployWrapperToHttp({ httpProvider: string; name?: string; codegen?: boolean; -}): Promise<{ uri: string }> { +}): Promise<{ uri: string }> /* $ */ { const tempDeployManifestFilename = `polywrap.deploy-temp.yaml`; const tempDeployManifestPath = path.join( wrapperAbsPath, diff --git a/packages/js/test-env/tsconfig.build.json b/packages/js/test-env/tsconfig.build.json index 77aadfdd2f..ec6eea7b58 100644 --- a/packages/js/test-env/tsconfig.build.json +++ b/packages/js/test-env/tsconfig.build.json @@ -1,5 +1,8 @@ { "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "build" + }, "include": [ "./src/**/*.ts" ], diff --git a/packages/js/test-env/tsconfig.json b/packages/js/test-env/tsconfig.json index 5d37204c00..02827831c0 100644 --- a/packages/js/test-env/tsconfig.json +++ b/packages/js/test-env/tsconfig.json @@ -1,10 +1,8 @@ { "extends": "../../../tsconfig", - "compilerOptions": { - "outDir": "build" - }, "include": [ - "./src/**/*.ts" + "./src/**/*.ts", + "./examples/**/*.ts" ], "exclude": [] } diff --git a/yarn.lock b/yarn.lock index 2d7fa83f0f..aeb41a73bf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -124,10 +124,10 @@ dependencies: "@babel/highlight" "^7.18.6" -"@babel/compat-data@^7.17.7", "@babel/compat-data@^7.20.1", "@babel/compat-data@^7.20.5", "@babel/compat-data@^7.9.0": - version "7.20.10" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.20.10.tgz#9d92fa81b87542fff50e848ed585b4212c1d34ec" - integrity sha512-sEnuDPpOJR/fcafHMjpcpGN5M2jbUGUHwmuWKM/YdPzeEDJg8bgmbcWQFUfE32MQjti1koACvoPVsDe8Uq+idg== +"@babel/compat-data@^7.17.7", "@babel/compat-data@^7.20.0", "@babel/compat-data@^7.20.1", "@babel/compat-data@^7.9.0": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.20.5.tgz#86f172690b093373a933223b4745deeb6049e733" + integrity sha512-KZXo2t10+/jxmkhNXc7pZTqRvSOIvVv/+lJwHS+B2rErwOyjuVRh60yVpb7liQ1U5t7lLJ1bz+t8tSypUZdm0g== "@babel/core@7.9.0": version "7.9.0" @@ -152,32 +152,32 @@ source-map "^0.5.0" "@babel/core@^7.1.0", "@babel/core@^7.12.3", "@babel/core@^7.4.5", "@babel/core@^7.7.5": - version "7.20.12" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.20.12.tgz#7930db57443c6714ad216953d1356dac0eb8496d" - integrity sha512-XsMfHovsUYHFMdrIHkZphTN/2Hzzi78R08NuHfDBehym2VsPDL6Zn/JAD/JQdnRvbSsbQc4mVaU1m6JgtTEElg== + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.20.5.tgz#45e2114dc6cd4ab167f81daf7820e8fa1250d113" + integrity sha512-UdOWmk4pNWTm/4DlPUl/Pt4Gz4rcEMb7CY0Y3eJl5Yz1vI8ZJGmHWaVE55LoxRjdpx0z259GE9U5STA9atUinQ== dependencies: "@ampproject/remapping" "^2.1.0" "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.20.7" - "@babel/helper-compilation-targets" "^7.20.7" - "@babel/helper-module-transforms" "^7.20.11" - "@babel/helpers" "^7.20.7" - "@babel/parser" "^7.20.7" - "@babel/template" "^7.20.7" - "@babel/traverse" "^7.20.12" - "@babel/types" "^7.20.7" + "@babel/generator" "^7.20.5" + "@babel/helper-compilation-targets" "^7.20.0" + "@babel/helper-module-transforms" "^7.20.2" + "@babel/helpers" "^7.20.5" + "@babel/parser" "^7.20.5" + "@babel/template" "^7.18.10" + "@babel/traverse" "^7.20.5" + "@babel/types" "^7.20.5" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.2" - json5 "^2.2.2" + json5 "^2.2.1" semver "^6.3.0" -"@babel/generator@^7.20.7", "@babel/generator@^7.4.0", "@babel/generator@^7.9.0": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.20.7.tgz#f8ef57c8242665c5929fe2e8d82ba75460187b4a" - integrity sha512-7wqMOJq8doJMZmP4ApXTzLxSr7+oO2jroJURrVEp6XShrQUObV8Tq/D0NCcoYg2uHqUrjzO0zwBjoYzelxK+sw== +"@babel/generator@^7.20.5", "@babel/generator@^7.4.0", "@babel/generator@^7.9.0": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.20.5.tgz#cb25abee3178adf58d6814b68517c62bdbfdda95" + integrity sha512-jl7JY2Ykn9S0yj4DQP82sYvPU+T3g0HFcWTqDLqiuA9tGRNIj9VfbtXGAYTTkyNEnQk1jkMGOdYka8aG/lulCA== dependencies: - "@babel/types" "^7.20.7" + "@babel/types" "^7.20.5" "@jridgewell/gen-mapping" "^0.3.2" jsesc "^2.5.1" @@ -196,29 +196,27 @@ "@babel/helper-explode-assignable-expression" "^7.18.6" "@babel/types" "^7.18.9" -"@babel/helper-compilation-targets@^7.17.7", "@babel/helper-compilation-targets@^7.18.9", "@babel/helper-compilation-targets@^7.20.0", "@babel/helper-compilation-targets@^7.20.7", "@babel/helper-compilation-targets@^7.8.7": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.7.tgz#a6cd33e93629f5eb473b021aac05df62c4cd09bb" - integrity sha512-4tGORmfQcrc+bvrjb5y3dG9Mx1IOZjsHqQVUz7XCNHO+iTmqxWnVg3KRygjGmpRLJGdQSKuvFinbIb0CnZwHAQ== +"@babel/helper-compilation-targets@^7.17.7", "@babel/helper-compilation-targets@^7.18.9", "@babel/helper-compilation-targets@^7.20.0", "@babel/helper-compilation-targets@^7.8.7": + version "7.20.0" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.0.tgz#6bf5374d424e1b3922822f1d9bdaa43b1a139d0a" + integrity sha512-0jp//vDGp9e8hZzBc6N/KwA5ZK3Wsm/pfm4CrY7vzegkVxc65SgSn6wYOnwHe9Js9HRQ1YTCKLGPzDtaS3RoLQ== dependencies: - "@babel/compat-data" "^7.20.5" + "@babel/compat-data" "^7.20.0" "@babel/helper-validator-option" "^7.18.6" browserslist "^4.21.3" - lru-cache "^5.1.1" semver "^6.3.0" -"@babel/helper-create-class-features-plugin@^7.18.6", "@babel/helper-create-class-features-plugin@^7.20.5", "@babel/helper-create-class-features-plugin@^7.20.7", "@babel/helper-create-class-features-plugin@^7.8.3": - version "7.20.12" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.20.12.tgz#4349b928e79be05ed2d1643b20b99bb87c503819" - integrity sha512-9OunRkbT0JQcednL0UFvbfXpAsUXiGjUk0a7sN8fUXX7Mue79cUSMjHGDRRi/Vz9vYlpIhLV5fMD5dKoMhhsNQ== +"@babel/helper-create-class-features-plugin@^7.18.6", "@babel/helper-create-class-features-plugin@^7.20.2", "@babel/helper-create-class-features-plugin@^7.20.5", "@babel/helper-create-class-features-plugin@^7.8.3": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.20.5.tgz#327154eedfb12e977baa4ecc72e5806720a85a06" + integrity sha512-3RCdA/EmEaikrhayahwToF0fpweU/8o2p8vhc1c/1kftHOdTKuC65kik/TLc+qfbS8JKw4qqJbne4ovICDhmww== dependencies: "@babel/helper-annotate-as-pure" "^7.18.6" "@babel/helper-environment-visitor" "^7.18.9" "@babel/helper-function-name" "^7.19.0" - "@babel/helper-member-expression-to-functions" "^7.20.7" + "@babel/helper-member-expression-to-functions" "^7.18.9" "@babel/helper-optimise-call-expression" "^7.18.6" - "@babel/helper-replace-supers" "^7.20.7" - "@babel/helper-skip-transparent-expression-wrappers" "^7.20.0" + "@babel/helper-replace-supers" "^7.19.1" "@babel/helper-split-export-declaration" "^7.18.6" "@babel/helper-create-regexp-features-plugin@^7.18.6", "@babel/helper-create-regexp-features-plugin@^7.20.5": @@ -268,12 +266,12 @@ dependencies: "@babel/types" "^7.18.6" -"@babel/helper-member-expression-to-functions@^7.20.7": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.20.7.tgz#a6f26e919582275a93c3aa6594756d71b0bb7f05" - integrity sha512-9J0CxJLq315fEdi4s7xK5TQaNYjZw+nDVpVqr1axNGKzdrdwYBD5b4uKv3n75aABG0rCCTK8Im8Ww7eYfMrZgw== +"@babel/helper-member-expression-to-functions@^7.18.9": + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.18.9.tgz#1531661e8375af843ad37ac692c132841e2fd815" + integrity sha512-RxifAh2ZoVU67PyKIO4AMi1wTenGfMR/O/ae0CCRqwgBAt5v7xjdtRw7UoSbsreKrQn5t7r89eruK/9JjYHuDg== dependencies: - "@babel/types" "^7.20.7" + "@babel/types" "^7.18.9" "@babel/helper-module-imports@^7.18.6", "@babel/helper-module-imports@^7.8.3": version "7.18.6" @@ -282,19 +280,19 @@ dependencies: "@babel/types" "^7.18.6" -"@babel/helper-module-transforms@^7.18.6", "@babel/helper-module-transforms@^7.20.11", "@babel/helper-module-transforms@^7.9.0": - version "7.20.11" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.20.11.tgz#df4c7af713c557938c50ea3ad0117a7944b2f1b0" - integrity sha512-uRy78kN4psmji1s2QtbtcCSaj/LILFDp0f/ymhpQH5QY3nljUZCaNWz9X1dEj/8MBdBEFECs7yRhKn8i7NjZgg== +"@babel/helper-module-transforms@^7.18.6", "@babel/helper-module-transforms@^7.19.6", "@babel/helper-module-transforms@^7.20.2", "@babel/helper-module-transforms@^7.9.0": + version "7.20.2" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.20.2.tgz#ac53da669501edd37e658602a21ba14c08748712" + integrity sha512-zvBKyJXRbmK07XhMuujYoJ48B5yvvmM6+wcpv6Ivj4Yg6qO7NOZOSnvZN9CRl1zz1Z4cKf8YejmCMh8clOoOeA== dependencies: "@babel/helper-environment-visitor" "^7.18.9" "@babel/helper-module-imports" "^7.18.6" "@babel/helper-simple-access" "^7.20.2" "@babel/helper-split-export-declaration" "^7.18.6" "@babel/helper-validator-identifier" "^7.19.1" - "@babel/template" "^7.20.7" - "@babel/traverse" "^7.20.10" - "@babel/types" "^7.20.7" + "@babel/template" "^7.18.10" + "@babel/traverse" "^7.20.1" + "@babel/types" "^7.20.2" "@babel/helper-optimise-call-expression@^7.18.6": version "7.18.6" @@ -308,7 +306,7 @@ resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz#d1b9000752b18d0877cff85a5c376ce5c3121629" integrity sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ== -"@babel/helper-remap-async-to-generator@^7.18.9": +"@babel/helper-remap-async-to-generator@^7.18.6", "@babel/helper-remap-async-to-generator@^7.18.9": version "7.18.9" resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.18.9.tgz#997458a0e3357080e54e1d79ec347f8a8cd28519" integrity sha512-dI7q50YKd8BAv3VEfgg7PS7yD3Rtbi2J1XMXaalXO0W0164hYLnh8zpjRS0mte9MfVp/tltvr/cfdXPvJr1opA== @@ -318,26 +316,25 @@ "@babel/helper-wrap-function" "^7.18.9" "@babel/types" "^7.18.9" -"@babel/helper-replace-supers@^7.18.6", "@babel/helper-replace-supers@^7.20.7": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.20.7.tgz#243ecd2724d2071532b2c8ad2f0f9f083bcae331" - integrity sha512-vujDMtB6LVfNW13jhlCrp48QNslK6JXi7lQG736HVbHz/mbf4Dc7tIRh1Xf5C0rF7BP8iiSxGMCmY6Ci1ven3A== +"@babel/helper-replace-supers@^7.18.6", "@babel/helper-replace-supers@^7.19.1": + version "7.19.1" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.19.1.tgz#e1592a9b4b368aa6bdb8784a711e0bcbf0612b78" + integrity sha512-T7ahH7wV0Hfs46SFh5Jz3s0B6+o8g3c+7TMxu7xKfmHikg7EAZ3I2Qk9LFhjxXq8sL7UkP5JflezNwoZa8WvWw== dependencies: "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-member-expression-to-functions" "^7.20.7" + "@babel/helper-member-expression-to-functions" "^7.18.9" "@babel/helper-optimise-call-expression" "^7.18.6" - "@babel/template" "^7.20.7" - "@babel/traverse" "^7.20.7" - "@babel/types" "^7.20.7" + "@babel/traverse" "^7.19.1" + "@babel/types" "^7.19.0" -"@babel/helper-simple-access@^7.20.2": +"@babel/helper-simple-access@^7.19.4", "@babel/helper-simple-access@^7.20.2": version "7.20.2" resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz#0ab452687fe0c2cfb1e2b9e0015de07fc2d62dd9" integrity sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA== dependencies: "@babel/types" "^7.20.2" -"@babel/helper-skip-transparent-expression-wrappers@^7.20.0": +"@babel/helper-skip-transparent-expression-wrappers@^7.18.9": version "7.20.0" resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.20.0.tgz#fbe4c52f60518cab8140d77101f0e63a8a230684" integrity sha512-5y1JYeNKfvnT8sZcK9DVRtpTbGiomYIHviSP3OQWmDPU3DeH4a1ZlT/N2lyQ5P8egjcRaT/Y9aNqUxK0WsnIIg== @@ -376,14 +373,14 @@ "@babel/traverse" "^7.20.5" "@babel/types" "^7.20.5" -"@babel/helpers@^7.20.7", "@babel/helpers@^7.9.0": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.20.7.tgz#04502ff0feecc9f20ecfaad120a18f011a8e6dce" - integrity sha512-PBPjs5BppzsGaxHQCDKnZ6Gd9s6xl8bBCluz3vEInLGRJmnZan4F6BYCeqtyXqkk4W5IlPmjK4JlOuZkpJ3xZA== +"@babel/helpers@^7.20.5", "@babel/helpers@^7.9.0": + version "7.20.6" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.20.6.tgz#e64778046b70e04779dfbdf924e7ebb45992c763" + integrity sha512-Pf/OjgfgFRW5bApskEz5pvidpim7tEDPlFtKcNRXWmfHGn9IEI2W2flqRQXTFb7gIPTyK++N6rVHuwKut4XK6w== dependencies: - "@babel/template" "^7.20.7" - "@babel/traverse" "^7.20.7" - "@babel/types" "^7.20.7" + "@babel/template" "^7.18.10" + "@babel/traverse" "^7.20.5" + "@babel/types" "^7.20.5" "@babel/highlight@^7.18.6", "@babel/highlight@^7.8.3": version "7.18.6" @@ -394,10 +391,10 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.4.3", "@babel/parser@^7.7.0", "@babel/parser@^7.9.0": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.7.tgz#66fe23b3c8569220817d5feb8b9dcdc95bb4f71b" - integrity sha512-T3Z9oHybU+0vZlY9CiDSJQTD5ZapcW18ZctFMi0MOAl/4BjFF4ul7NVSARLdbGO5vDqy9eQiGTV0LtKfvCYvcg== +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.18.10", "@babel/parser@^7.20.5", "@babel/parser@^7.4.3", "@babel/parser@^7.7.0", "@babel/parser@^7.9.0": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.5.tgz#7f3c7335fe417665d929f34ae5dceae4c04015e8" + integrity sha512-r27t/cy/m9uKLXQNWWebeCUHgnAZq0CpG1OwKRxzJMP1vpSU4bSIK2hq+/cp0bQxetkXx38n09rNu8jVkcK/zA== "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.18.6": version "7.18.6" @@ -407,21 +404,21 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.18.9": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.20.7.tgz#d9c85589258539a22a901033853101a6198d4ef1" - integrity sha512-sbr9+wNE5aXMBBFBICk01tt7sBf2Oc9ikRFEcem/ZORup9IMUdNhW7/wVLEbbtlWOsEubJet46mHAL2C8+2jKQ== + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.18.9.tgz#a11af19aa373d68d561f08e0a57242350ed0ec50" + integrity sha512-AHrP9jadvH7qlOj6PINbgSuphjQUAK7AOT7DPjBo9EHoLhQTnnK5u45e1Hd4DbSQEO9nqPWtQ89r+XEOWFScKg== dependencies: - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/helper-skip-transparent-expression-wrappers" "^7.20.0" - "@babel/plugin-proposal-optional-chaining" "^7.20.7" + "@babel/helper-plugin-utils" "^7.18.9" + "@babel/helper-skip-transparent-expression-wrappers" "^7.18.9" + "@babel/plugin-proposal-optional-chaining" "^7.18.9" "@babel/plugin-proposal-async-generator-functions@^7.20.1", "@babel/plugin-proposal-async-generator-functions@^7.8.3": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.20.7.tgz#bfb7276d2d573cb67ba379984a2334e262ba5326" - integrity sha512-xMbiLsn/8RK7Wq7VeVytytS2L6qE69bXPB10YCmMdDZbKF4okCqY74pI/jJQ/8U0b/F6NrT2+14b8/P9/3AMGA== + version "7.20.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.20.1.tgz#352f02baa5d69f4e7529bdac39aaa02d41146af9" + integrity sha512-Gh5rchzSwE4kC+o/6T8waD0WHEQIsDmjltY8WnWRXHUdH8axZhuH86Ov9M72YhJfDrZseQwuuWaaIT/TmePp3g== dependencies: "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-plugin-utils" "^7.20.2" + "@babel/helper-plugin-utils" "^7.19.0" "@babel/helper-remap-async-to-generator" "^7.18.9" "@babel/plugin-syntax-async-generators" "^7.8.4" @@ -442,12 +439,12 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-proposal-class-static-block@^7.18.6": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.20.7.tgz#92592e9029b13b15be0f7ce6a7aedc2879ca45a7" - integrity sha512-AveGOoi9DAjUYYuUAG//Ig69GlazLnoyzMw68VCDux+c1tsnnH/OkYcpz/5xzMkEFC6UxjR5Gw1c+iY2wOGVeQ== + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.18.6.tgz#8aa81d403ab72d3962fc06c26e222dacfc9b9020" + integrity sha512-+I3oIiNxrCpup3Gi8n5IGMwj0gOCAjcJUSQEcotNnCCPMEnixawOQ+KeJPlgfjzx+FKQ1QSyZOWe7wmoJp7vhw== dependencies: - "@babel/helper-create-class-features-plugin" "^7.20.7" - "@babel/helper-plugin-utils" "^7.20.2" + "@babel/helper-create-class-features-plugin" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-class-static-block" "^7.14.5" "@babel/plugin-proposal-decorators@7.8.3": @@ -484,11 +481,11 @@ "@babel/plugin-syntax-json-strings" "^7.8.3" "@babel/plugin-proposal-logical-assignment-operators@^7.18.9": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.20.7.tgz#dfbcaa8f7b4d37b51e8bfb46d94a5aea2bb89d83" - integrity sha512-y7C7cZgpMIjWlKE5T7eJwp+tnRYM89HmRvWM5EQuB5BoHEONjmQ8lSNmBUwOyy/GFRsohJED51YBF79hE1djug== + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.18.9.tgz#8148cbb350483bf6220af06fa6db3690e14b2e23" + integrity sha512-128YbMpjCrP35IOExw2Fq+x55LMP42DzhOhX2aNNIdI9avSWl2PI0yuBWarr3RYpZBSPtabfadkH2yeRiMD61Q== dependencies: - "@babel/helper-plugin-utils" "^7.20.2" + "@babel/helper-plugin-utils" "^7.18.9" "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" "@babel/plugin-proposal-nullish-coalescing-operator@7.8.3": @@ -524,15 +521,15 @@ "@babel/plugin-syntax-numeric-separator" "^7.10.4" "@babel/plugin-proposal-object-rest-spread@^7.20.2", "@babel/plugin-proposal-object-rest-spread@^7.9.0": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.20.7.tgz#aa662940ef425779c75534a5c41e9d936edc390a" - integrity sha512-d2S98yCiLxDVmBmE8UjGcfPvNEUbA1U5q5WxaWFUGRzJSVAZqm5W6MbPct0jxnegUZ0niLeNX+IOzEs7wYg9Dg== + version "7.20.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.20.2.tgz#a556f59d555f06961df1e572bb5eca864c84022d" + integrity sha512-Ks6uej9WFK+fvIMesSqbAto5dD8Dz4VuuFvGJFKgIGSkJuRGcrwGECPA1fDgQK3/DbExBJpEkTeYeB8geIFCSQ== dependencies: - "@babel/compat-data" "^7.20.5" - "@babel/helper-compilation-targets" "^7.20.7" + "@babel/compat-data" "^7.20.1" + "@babel/helper-compilation-targets" "^7.20.0" "@babel/helper-plugin-utils" "^7.20.2" "@babel/plugin-syntax-object-rest-spread" "^7.8.3" - "@babel/plugin-transform-parameters" "^7.20.7" + "@babel/plugin-transform-parameters" "^7.20.1" "@babel/plugin-proposal-optional-catch-binding@^7.18.6", "@babel/plugin-proposal-optional-catch-binding@^7.8.3": version "7.18.6" @@ -550,13 +547,13 @@ "@babel/helper-plugin-utils" "^7.8.3" "@babel/plugin-syntax-optional-chaining" "^7.8.0" -"@babel/plugin-proposal-optional-chaining@^7.18.9", "@babel/plugin-proposal-optional-chaining@^7.20.7", "@babel/plugin-proposal-optional-chaining@^7.9.0": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.20.7.tgz#49f2b372519ab31728cc14115bb0998b15bfda55" - integrity sha512-T+A7b1kfjtRM51ssoOfS1+wbyCVqorfyZhT99TvxxLMirPShD8CzKMRepMlCBGM5RpHMbn8s+5MMHnPstJH6mQ== +"@babel/plugin-proposal-optional-chaining@^7.18.9", "@babel/plugin-proposal-optional-chaining@^7.9.0": + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.18.9.tgz#e8e8fe0723f2563960e4bf5e9690933691915993" + integrity sha512-v5nwt4IqBXihxGsW2QmCWMDS3B3bzGIk/EQVZz2ei7f3NJl8NzAJVvUmpDW5q1CRNY+Beb/k58UAH1Km1N411w== dependencies: - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/helper-skip-transparent-expression-wrappers" "^7.20.0" + "@babel/helper-plugin-utils" "^7.18.9" + "@babel/helper-skip-transparent-expression-wrappers" "^7.18.9" "@babel/plugin-syntax-optional-chaining" "^7.8.3" "@babel/plugin-proposal-private-methods@^7.18.6": @@ -733,20 +730,20 @@ "@babel/helper-plugin-utils" "^7.19.0" "@babel/plugin-transform-arrow-functions@^7.18.6", "@babel/plugin-transform-arrow-functions@^7.8.3": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.20.7.tgz#bea332b0e8b2dab3dafe55a163d8227531ab0551" - integrity sha512-3poA5E7dzDomxj9WXWwuD6A5F3kc7VXwIJO+E+J8qtDtS+pXPAhrgEyh+9GBwBgPq1Z+bB+/JD60lp5jsN7JPQ== + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.18.6.tgz#19063fcf8771ec7b31d742339dac62433d0611fe" + integrity sha512-9S9X9RUefzrsHZmKMbDXxweEH+YlE8JJEuat9FdvW9Qh1cw7W64jELCtWNkPBPX5En45uy28KGvA/AySqUh8CQ== dependencies: - "@babel/helper-plugin-utils" "^7.20.2" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-transform-async-to-generator@^7.18.6", "@babel/plugin-transform-async-to-generator@^7.8.3": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.20.7.tgz#dfee18623c8cb31deb796aa3ca84dda9cea94354" - integrity sha512-Uo5gwHPT9vgnSXQxqGtpdufUiWp96gk7yiP4Mp5bm1QMkEmLXBO7PAGYbKoJ6DhAwiNkcHFBol/x5zZZkL/t0Q== + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.18.6.tgz#ccda3d1ab9d5ced5265fdb13f1882d5476c71615" + integrity sha512-ARE5wZLKnTgPW7/1ftQmSi1CmkqqHo2DNmtztFhvgtOWSDfq0Cq9/9L+KnZNYSNrydBekhW3rwShduf59RoXag== dependencies: "@babel/helper-module-imports" "^7.18.6" - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/helper-remap-async-to-generator" "^7.18.9" + "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-remap-async-to-generator" "^7.18.6" "@babel/plugin-transform-block-scoped-functions@^7.18.6", "@babel/plugin-transform-block-scoped-functions@^7.8.3": version "7.18.6" @@ -756,39 +753,38 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-transform-block-scoping@^7.20.2", "@babel/plugin-transform-block-scoping@^7.8.3": - version "7.20.11" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.20.11.tgz#9f5a3424bd112a3f32fe0cf9364fbb155cff262a" - integrity sha512-tA4N427a7fjf1P0/2I4ScsHGc5jcHPbb30xMbaTke2gxDuWpUfXDuX1FEymJwKk4tuGUvGcejAR6HdZVqmmPyw== + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.20.5.tgz#401215f9dc13dc5262940e2e527c9536b3d7f237" + integrity sha512-WvpEIW9Cbj9ApF3yJCjIEEf1EiNJLtXagOrL5LNWEZOo3jv8pmPoYTSNJQvqej8OavVlgOoOPw6/htGZro6IkA== dependencies: "@babel/helper-plugin-utils" "^7.20.2" "@babel/plugin-transform-classes@^7.20.2", "@babel/plugin-transform-classes@^7.9.0": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.20.7.tgz#f438216f094f6bb31dc266ebfab8ff05aecad073" - integrity sha512-LWYbsiXTPKl+oBlXUGlwNlJZetXD5Am+CyBdqhPsDVjM9Jc8jwBJFrKhHf900Kfk2eZG1y9MAG3UNajol7A4VQ== + version "7.20.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.20.2.tgz#c0033cf1916ccf78202d04be4281d161f6709bb2" + integrity sha512-9rbPp0lCVVoagvtEyQKSo5L8oo0nQS/iif+lwlAz29MccX2642vWDlSZK+2T2buxbopotId2ld7zZAzRfz9j1g== dependencies: "@babel/helper-annotate-as-pure" "^7.18.6" - "@babel/helper-compilation-targets" "^7.20.7" + "@babel/helper-compilation-targets" "^7.20.0" "@babel/helper-environment-visitor" "^7.18.9" "@babel/helper-function-name" "^7.19.0" "@babel/helper-optimise-call-expression" "^7.18.6" "@babel/helper-plugin-utils" "^7.20.2" - "@babel/helper-replace-supers" "^7.20.7" + "@babel/helper-replace-supers" "^7.19.1" "@babel/helper-split-export-declaration" "^7.18.6" globals "^11.1.0" "@babel/plugin-transform-computed-properties@^7.18.9", "@babel/plugin-transform-computed-properties@^7.8.3": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.20.7.tgz#704cc2fd155d1c996551db8276d55b9d46e4d0aa" - integrity sha512-Lz7MvBK6DTjElHAmfu6bfANzKcxpyNPeYBGEafyA6E5HtRpjpZwU+u7Qrgz/2OR0z+5TvKYbPdphfSaAcZBrYQ== + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.18.9.tgz#2357a8224d402dad623caf6259b611e56aec746e" + integrity sha512-+i0ZU1bCDymKakLxn5srGHrsAPRELC2WIbzwjLhHW9SIE1cPYkLCL0NlnXMZaM1vhfgA2+M7hySk42VBvrkBRw== dependencies: - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/template" "^7.20.7" + "@babel/helper-plugin-utils" "^7.18.9" "@babel/plugin-transform-destructuring@^7.20.2", "@babel/plugin-transform-destructuring@^7.8.3": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.20.7.tgz#8bda578f71620c7de7c93af590154ba331415454" - integrity sha512-Xwg403sRrZb81IVB79ZPqNQME23yhugYVqgTxAhT99h485F4f+GMELFhhOsscDUB7HCswepKeCKLn/GZvUKoBA== + version "7.20.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.20.2.tgz#c23741cfa44ddd35f5e53896e88c75331b8b2792" + integrity sha512-mENM+ZHrvEgxLTBXUiQ621rRXZes3KWUv6NdQlrnr1TkWVw+hUjQBZuP2X32qKlrlG2BzgR95gkuCRSkJl8vIw== dependencies: "@babel/helper-plugin-utils" "^7.20.2" @@ -854,30 +850,30 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-transform-modules-amd@^7.19.6", "@babel/plugin-transform-modules-amd@^7.9.0": - version "7.20.11" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.20.11.tgz#3daccca8e4cc309f03c3a0c4b41dc4b26f55214a" - integrity sha512-NuzCt5IIYOW0O30UvqktzHYR2ud5bOWbY0yaxWZ6G+aFzOMJvrs5YHNikrbdaT15+KNO31nPOy5Fim3ku6Zb5g== + version "7.19.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.19.6.tgz#aca391801ae55d19c4d8d2ebfeaa33df5f2a2cbd" + integrity sha512-uG3od2mXvAtIFQIh0xrpLH6r5fpSQN04gIVovl+ODLdUMANokxQLZnPBHcjmv3GxRjnqwLuHvppjjcelqUFZvg== dependencies: - "@babel/helper-module-transforms" "^7.20.11" - "@babel/helper-plugin-utils" "^7.20.2" + "@babel/helper-module-transforms" "^7.19.6" + "@babel/helper-plugin-utils" "^7.19.0" "@babel/plugin-transform-modules-commonjs@^7.19.6", "@babel/plugin-transform-modules-commonjs@^7.9.0": - version "7.20.11" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.20.11.tgz#8cb23010869bf7669fd4b3098598b6b2be6dc607" - integrity sha512-S8e1f7WQ7cimJQ51JkAaDrEtohVEitXjgCGAS2N8S31Y42E+kWwfSz83LYz57QdBm7q9diARVqanIaH2oVgQnw== + version "7.19.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.19.6.tgz#25b32feef24df8038fc1ec56038917eacb0b730c" + integrity sha512-8PIa1ym4XRTKuSsOUXqDG0YaOlEuTVvHMe5JCfgBMOtHvJKw/4NGovEGN33viISshG/rZNVrACiBmPQLvWN8xQ== dependencies: - "@babel/helper-module-transforms" "^7.20.11" - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/helper-simple-access" "^7.20.2" + "@babel/helper-module-transforms" "^7.19.6" + "@babel/helper-plugin-utils" "^7.19.0" + "@babel/helper-simple-access" "^7.19.4" "@babel/plugin-transform-modules-systemjs@^7.19.6", "@babel/plugin-transform-modules-systemjs@^7.9.0": - version "7.20.11" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.20.11.tgz#467ec6bba6b6a50634eea61c9c232654d8a4696e" - integrity sha512-vVu5g9BPQKSFEmvt2TA4Da5N+QVS66EX21d8uoOihC+OCpUoGvzVsXeqFdtAEfVa5BILAeFt+U7yVmLbQnAJmw== + version "7.19.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.19.6.tgz#59e2a84064b5736a4471b1aa7b13d4431d327e0d" + integrity sha512-fqGLBepcc3kErfR9R3DnVpURmckXP7gj7bAlrTQyBxrigFqszZCkFkcoxzCp2v32XmwXLvbw+8Yq9/b+QqksjQ== dependencies: "@babel/helper-hoist-variables" "^7.18.6" - "@babel/helper-module-transforms" "^7.20.11" - "@babel/helper-plugin-utils" "^7.20.2" + "@babel/helper-module-transforms" "^7.19.6" + "@babel/helper-plugin-utils" "^7.19.0" "@babel/helper-validator-identifier" "^7.19.1" "@babel/plugin-transform-modules-umd@^7.18.6", "@babel/plugin-transform-modules-umd@^7.9.0": @@ -911,10 +907,10 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/helper-replace-supers" "^7.18.6" -"@babel/plugin-transform-parameters@^7.20.1", "@babel/plugin-transform-parameters@^7.20.7", "@babel/plugin-transform-parameters@^7.8.7": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.20.7.tgz#0ee349e9d1bc96e78e3b37a7af423a4078a7083f" - integrity sha512-WiWBIkeHKVOSYPO0pWkxGPfKeWrCJyD3NJ53+Lrp/QMSZbsVPovrVl2aWZ19D/LTVnaDv5Ap7GJ/B2CTOZdrfA== +"@babel/plugin-transform-parameters@^7.20.1", "@babel/plugin-transform-parameters@^7.8.7": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.20.5.tgz#f8f9186c681d10c3de7620c916156d893c8a019e" + integrity sha512-h7plkOmcndIUWXZFLgpbrh2+fXAi47zcUX7IrOQuZdLD0I0KvjJ6cvo3BEcAOsDOcZhVKGJqv07mkSqK0y2isQ== dependencies: "@babel/helper-plugin-utils" "^7.20.2" @@ -968,15 +964,15 @@ "@babel/helper-plugin-utils" "^7.19.0" "@babel/plugin-transform-react-jsx@^7.18.6", "@babel/plugin-transform-react-jsx@^7.9.1": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.20.7.tgz#025d85a1935fd7e19dfdcb1b1d4df34d4da484f7" - integrity sha512-Tfq7qqD+tRj3EoDhY00nn2uP2hsRxgYGi5mLQ5TimKav0a9Lrpd4deE+fcLXU8zFYRjlKPHZhpCvfEA6qnBxqQ== + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.19.0.tgz#b3cbb7c3a00b92ec8ae1027910e331ba5c500eb9" + integrity sha512-UVEvX3tXie3Szm3emi1+G63jyw1w5IcMY0FSKM+CRnKRI5Mr1YbCNgsSTwoTwKphQEG9P+QqmuRFneJPZuHNhg== dependencies: "@babel/helper-annotate-as-pure" "^7.18.6" "@babel/helper-module-imports" "^7.18.6" - "@babel/helper-plugin-utils" "^7.20.2" + "@babel/helper-plugin-utils" "^7.19.0" "@babel/plugin-syntax-jsx" "^7.18.6" - "@babel/types" "^7.20.7" + "@babel/types" "^7.19.0" "@babel/plugin-transform-react-pure-annotations@^7.18.6": version "7.18.6" @@ -1019,12 +1015,12 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-transform-spread@^7.19.0", "@babel/plugin-transform-spread@^7.8.3": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.20.7.tgz#c2d83e0b99d3bf83e07b11995ee24bf7ca09401e" - integrity sha512-ewBbHQ+1U/VnH1fxltbJqDeWBU1oNLG8Dj11uIv3xVf7nrQu0bPGe5Rf716r7K5Qz+SqtAOVswoVunoiBtGhxw== + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.19.0.tgz#dd60b4620c2fec806d60cfaae364ec2188d593b6" + integrity sha512-RsuMk7j6n+r752EtzyScnWkQyuJdli6LdO5Klv8Yx0OfPVTcQkIUfS8clx5e9yHXzlnhOZF3CbQ8C2uP5j074w== dependencies: - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/helper-skip-transparent-expression-wrappers" "^7.20.0" + "@babel/helper-plugin-utils" "^7.19.0" + "@babel/helper-skip-transparent-expression-wrappers" "^7.18.9" "@babel/plugin-transform-sticky-regex@^7.18.6", "@babel/plugin-transform-sticky-regex@^7.8.3": version "7.18.6" @@ -1048,11 +1044,11 @@ "@babel/helper-plugin-utils" "^7.18.9" "@babel/plugin-transform-typescript@^7.9.0": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.20.7.tgz#673f49499cd810ae32a1ea5f3f8fab370987e055" - integrity sha512-m3wVKEvf6SoszD8pu4NZz3PvfKRCMgk6D6d0Qi9hNnlM5M6CFS92EgF4EiHVLKbU0r/r7ty1hg7NPZwE7WRbYw== + version "7.20.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.20.2.tgz#91515527b376fc122ba83b13d70b01af8fe98f3f" + integrity sha512-jvS+ngBfrnTUBfOQq8NfGnSbF9BrqlR6hjJ2yVxMkmO5nL/cdifNbI30EfjRlN4g5wYWNnMPyj5Sa6R1pbLeag== dependencies: - "@babel/helper-create-class-features-plugin" "^7.20.7" + "@babel/helper-create-class-features-plugin" "^7.20.2" "@babel/helper-plugin-utils" "^7.20.2" "@babel/plugin-syntax-typescript" "^7.20.0" @@ -1262,9 +1258,9 @@ "@babel/plugin-transform-typescript" "^7.9.0" "@babel/runtime-corejs3@^7.12.1": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.20.7.tgz#a1e5ea3d758ba6beb715210142912e3f29981d84" - integrity sha512-jr9lCZ4RbRQmCR28Q8U8Fu49zvFqLxTY9AMOUz+iyMohMoAgpEcVxY+wJNay99oXOpOcCTODkk70NDN2aaJEeg== + version "7.20.6" + resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.20.6.tgz#63dae945963539ab0ad578efbf3eff271e7067ae" + integrity sha512-tqeujPiuEfcH067mx+7otTQWROVMKHXEaOQcAeNV5dDdbPWvPcFA8/W9LXw2NfjNmOetqLl03dfnG2WALPlsRQ== dependencies: core-js-pure "^3.25.1" regenerator-runtime "^0.13.11" @@ -1277,41 +1273,41 @@ regenerator-runtime "^0.13.4" "@babel/runtime@^7.0.0", "@babel/runtime@^7.3.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.20.7.tgz#fcb41a5a70550e04a7b708037c7c32f7f356d8fd" - integrity sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ== + version "7.20.6" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.20.6.tgz#facf4879bfed9b5326326273a64220f099b0fce3" + integrity sha512-Q+8MqP7TiHMWzSfwiJwXCjyf4GYA4Dgw3emg/7xmwsdLJOZUp+nMqcOwOzzYheuM1rhDu8FSj2l0aoMygEuXuA== dependencies: regenerator-runtime "^0.13.11" -"@babel/template@^7.18.10", "@babel/template@^7.20.7", "@babel/template@^7.3.3", "@babel/template@^7.4.0", "@babel/template@^7.8.6": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.20.7.tgz#a15090c2839a83b02aa996c0b4994005841fd5a8" - integrity sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw== +"@babel/template@^7.18.10", "@babel/template@^7.3.3", "@babel/template@^7.4.0", "@babel/template@^7.8.6": + version "7.18.10" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.18.10.tgz#6f9134835970d1dbf0835c0d100c9f38de0c5e71" + integrity sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA== dependencies: "@babel/code-frame" "^7.18.6" - "@babel/parser" "^7.20.7" - "@babel/types" "^7.20.7" + "@babel/parser" "^7.18.10" + "@babel/types" "^7.18.10" -"@babel/traverse@^7.1.0", "@babel/traverse@^7.20.10", "@babel/traverse@^7.20.12", "@babel/traverse@^7.20.5", "@babel/traverse@^7.20.7", "@babel/traverse@^7.4.3", "@babel/traverse@^7.7.0", "@babel/traverse@^7.9.0": - version "7.20.12" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.20.12.tgz#7f0f787b3a67ca4475adef1f56cb94f6abd4a4b5" - integrity sha512-MsIbFN0u+raeja38qboyF8TIT7K0BFzz/Yd/77ta4MsUsmP2RAnidIlwq7d5HFQrH/OZJecGV6B71C4zAgpoSQ== +"@babel/traverse@^7.1.0", "@babel/traverse@^7.19.1", "@babel/traverse@^7.20.1", "@babel/traverse@^7.20.5", "@babel/traverse@^7.4.3", "@babel/traverse@^7.7.0", "@babel/traverse@^7.9.0": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.20.5.tgz#78eb244bea8270fdda1ef9af22a5d5e5b7e57133" + integrity sha512-WM5ZNN3JITQIq9tFZaw1ojLU3WgWdtkxnhM1AegMS+PvHjkM5IXjmYEGY7yukz5XS4sJyEf2VzWjI8uAavhxBQ== dependencies: "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.20.7" + "@babel/generator" "^7.20.5" "@babel/helper-environment-visitor" "^7.18.9" "@babel/helper-function-name" "^7.19.0" "@babel/helper-hoist-variables" "^7.18.6" "@babel/helper-split-export-declaration" "^7.18.6" - "@babel/parser" "^7.20.7" - "@babel/types" "^7.20.7" + "@babel/parser" "^7.20.5" + "@babel/types" "^7.20.5" debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.19.0", "@babel/types@^7.20.0", "@babel/types@^7.20.2", "@babel/types@^7.20.5", "@babel/types@^7.20.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.20.7" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.20.7.tgz#54ec75e252318423fc07fb644dc6a58a64c09b7f" - integrity sha512-69OnhBxSSgK0OzTJai4kyPDiKTIe3j+ctaHdIGVbRahTLAT7L3R9oeXHC2aVSuGYt3cVnoAMDmOCgJ2yaiLMvg== +"@babel/types@^7.0.0", "@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.19.0", "@babel/types@^7.20.0", "@babel/types@^7.20.2", "@babel/types@^7.20.5", "@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.20.5" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.20.5.tgz#e206ae370b5393d94dfd1d04cd687cace53efa84" + integrity sha512-c9fst/h2/dcF7H+MJKZ2T0KjEQ8hY/BNnDk/H3XY8C4Aw/eWQXWn/lWntHF9ooUBnGmEvbfGrTgLWc+um0YDUg== dependencies: "@babel/helper-string-parser" "^7.19.4" "@babel/helper-validator-identifier" "^7.19.1" @@ -3211,9 +3207,9 @@ integrity sha512-0nBr+VZNKm9tvNDZFstI3Pq1fCTEDK5OZTnVKNvBNAKgd0yIvmwsP4m61rEv7ZP+tOUjWJhROpxK5MsnlF911g== "@opentelemetry/api@^1.0.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@opentelemetry/api/-/api-1.4.0.tgz#2c91791a9ba6ca0a0f4aaac5e45d58df13639ac8" - integrity sha512-IgMK9i3sFGNUqPMbjABm0G26g0QCKCUBfglhQ7rQq6WcxbKfEHRcmwsoER4hZcuYqJgkYn2OeuoJIv7Jsftp7g== + version "1.3.0" + resolved "https://registry.yarnpkg.com/@opentelemetry/api/-/api-1.3.0.tgz#27c6f776ac3c1c616651e506a89f438a0ed6a055" + integrity sha512-YveTnGNsFFixTKJz09Oi4zYkiLT5af3WpZDu4aIUM7xX+2bHAkOJayFTVQd6zB8kkWPpbua4Ha6Ql00grdLlJQ== "@opentelemetry/core@1.6.0": version "1.6.0" @@ -3830,9 +3826,9 @@ "@types/node" "*" "@types/graceful-fs@^4.1.2": - version "4.1.6" - resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.6.tgz#e14b2576a1c25026b7f02ede1de3b84c3a1efeae" - integrity sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw== + version "4.1.5" + resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.5.tgz#21ffba0d98da4350db64891f92a9e5db3cdb4e15" + integrity sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw== dependencies: "@types/node" "*" @@ -3919,9 +3915,9 @@ integrity sha512-wH6Tu9mbiOt0n5EvdoWy0VGQaJMHfLIxY/6wS0xLC7CV1taM6gESEzcYy0ZlWvxxiiljYvfDIvz4hHbUUDRlhw== "@types/node@*": - version "18.11.18" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.18.tgz#8dfb97f0da23c2293e554c5a50d61ef134d7697f" - integrity sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA== + version "18.11.17" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.17.tgz#5c009e1d9c38f4a2a9d45c0b0c493fe6cdb4bcb5" + integrity sha512-HJSUJmni4BeDHhfzn6nF0sVmd1SMezP7/4F0Lq+aXzmp2xm9O7WXrUtHW/CHlYVtZUbByEvWidHqRtcJXGF2Ng== "@types/node@12.12.26": version "12.12.26" @@ -4021,9 +4017,9 @@ "@types/yargs-parser" "*" "@types/yargs@^15.0.0": - version "15.0.15" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.15.tgz#e609a2b1ef9e05d90489c2f5f45bbfb2be092158" - integrity sha512-IziEYMU9XoVj8hWg7k+UJrXALkGFjWJhn5QFEv9q4p+v40oZhSuC135M38st8XPjICL7Ey4TV64ferBGUoJhBg== + version "15.0.14" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.14.tgz#26d821ddb89e70492160b66d10a0eb6df8f6fb06" + integrity sha512-yEJzHoxf6SyQGhBhIYGXQDSCkJjB6HohDShto7m8vaKg9Yp0Yn8+71J9eakh2bnPg6BfsH9PRMhiRTZnd4eXGQ== dependencies: "@types/yargs-parser" "*" @@ -4499,9 +4495,9 @@ ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.3, ajv@^6.12.4: uri-js "^4.2.2" ajv@^8.0.1: - version "8.12.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.12.0.tgz#d1a0527323e22f53562c567c00991577dfbe19d1" - integrity sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA== + version "8.11.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.11.2.tgz#aecb20b50607acf2569b6382167b65a96008bb78" + integrity sha512-E4bfmKAhGiSTvMfL1Myyycaub+cUEU2/IvpylXkUu7CHBkBj1f/ikdzbD7YQ6FKUbixDxeYvB/xY4fvyroDlQg== dependencies: fast-deep-equal "^3.1.1" json-schema-traverse "^1.0.0" @@ -4917,9 +4913,9 @@ aws-sign2@~0.7.0: integrity sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA== aws4@^1.8.0: - version "1.12.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.12.0.tgz#ce1c9d143389679e253b314241ea9aa5cec980d3" - integrity sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg== + version "1.11.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59" + integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== axios@0.21.2: version "0.21.2" @@ -5745,9 +5741,9 @@ caniuse-api@^3.0.0: lodash.uniq "^4.5.0" caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001035, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001400: - version "1.0.30001445" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001445.tgz#cf2d4eb93f2bcdf0310de9dd6d18be271bc0b447" - integrity sha512-8sdQIdMztYmzfTMO6KfLny878Ln9c2M0fc7EH60IjlP4Dc4PiCy7K2Vl3ITmWgOyPgVQKa5x+UP/KqFsxj4mBg== + version "1.0.30001439" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001439.tgz#ab7371faeb4adff4b74dad1718a6fd122e45d9cb" + integrity sha512-1MgUzEkoMO6gKfXflStpYgZDlFM7M/ck/bgfVCACO5vnAf0fXoNVHdWtqGU+MYca+4bL9Z5bpOVmR33cWW9G2A== capture-exit@^2.0.0: version "2.0.0" @@ -6169,6 +6165,11 @@ commander@^4.1.1: resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== +commander@^9.4.1: + version "9.4.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-9.4.1.tgz#d1dd8f2ce6faf93147295c0df13c7c21141cfbdd" + integrity sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw== + common-tags@^1.8.0: version "1.8.2" resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.8.2.tgz#94ebb3c076d26032745fd54face7f688ef5ac9c6" @@ -6451,16 +6452,16 @@ copyfiles@2.4.1: yargs "^16.1.0" core-js-compat@^3.25.1, core-js-compat@^3.6.2: - version "3.27.1" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.27.1.tgz#b5695eb25c602d72b1d30cbfba3cb7e5e4cf0a67" - integrity sha512-Dg91JFeCDA17FKnneN7oCMz4BkQ4TcffkgHP4OWwp9yx3pi7ubqMDXXSacfNak1PQqjc95skyt+YBLHQJnkJwA== + version "3.26.1" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.26.1.tgz#0e710b09ebf689d719545ac36e49041850f943df" + integrity sha512-622/KzTudvXCDLRw70iHW4KKs1aGpcRcowGWyYJr2DEBfRrd6hNJybxSWJFuZYD4ma86xhrwDDHxmDaIq4EA8A== dependencies: browserslist "^4.21.4" core-js-pure@^3.25.1: - version "3.27.1" - resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.27.1.tgz#ede4a6b8440585c7190062757069c01d37a19dca" - integrity sha512-BS2NHgwwUppfeoqOXqi08mUqS5FiZpuRuJJpKsaME7kJz0xxuk0xkhDdfMIlP/zLa80krBqss1LtD7f889heAw== + version "3.26.1" + resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.26.1.tgz#653f4d7130c427820dcecd3168b594e8bb095a33" + integrity sha512-VVXcDpp/xJ21KdULRq/lXdLzQAtX7+37LzpyfFM973il0tWSsDEoyzG38G14AjTpK9VTfiNM9jnFauq/CpaWGQ== core-js@^2.4.0: version "2.6.12" @@ -6468,9 +6469,9 @@ core-js@^2.4.0: integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== core-js@^3.5.0: - version "3.27.1" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.27.1.tgz#23cc909b315a6bb4e418bf40a52758af2103ba46" - integrity sha512-GutwJLBChfGCpwwhbYoqfv03LAfmiz7e7D/BNxzeMxwQf10GRSzqiOjx7AmtEk+heiD/JWmBuyBPgFtx0Sg1ww== + version "3.26.1" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.26.1.tgz#7a9816dabd9ee846c1c0fe0e8fcad68f3709134e" + integrity sha512-21491RRQVzUn0GGM9Z1Jrpr6PNPxPi+Za8OM9q4tksTSnlbXXGKK1nXNg/QvwFYettXvSX6zWKCtHHfjN4puyA== core-util-is@1.0.2: version "1.0.2" @@ -7204,6 +7205,14 @@ dns-txt@^2.0.2: dependencies: buffer-indexof "^1.0.0" +doc-snippets@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/doc-snippets/-/doc-snippets-1.0.0.tgz#5921d52c6cfe6de0ab9b28f9594232cb6876c37e" + integrity sha512-4wVSd7jxhliPvqZ3sdhKhRla/EYy6DKlflWYd+E7JTGYXy1xBWyMnbSkWshGUiVK8TgZAF45iE4Y6eSo5F2lqg== + dependencies: + commander "^9.4.1" + glob "^8.0.3" + docker-compose@0.23.17: version "0.23.17" resolved "https://registry.yarnpkg.com/docker-compose/-/docker-compose-0.23.17.tgz#8816bef82562d9417dc8c790aa4871350f93a2ba" @@ -7500,32 +7509,26 @@ error-ex@^1.2.0, error-ex@^1.3.1: is-arrayish "^0.2.1" es-abstract@^1.17.2, es-abstract@^1.19.0, es-abstract@^1.20.4: - version "1.21.1" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.21.1.tgz#e6105a099967c08377830a0c9cb589d570dd86c6" - integrity sha512-QudMsPOz86xYz/1dG1OuGBKOELjCh99IIWHLzy5znUB6j8xG2yMA7bfTV86VSqKF+Y/H08vQPR+9jyXpuC6hfg== + version "1.20.5" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.20.5.tgz#e6dc99177be37cacda5988e692c3fa8b218e95d2" + integrity sha512-7h8MM2EQhsCA7pU/Nv78qOXFpD8Rhqd12gYiSJVkrH9+e8VuA8JlPJK/hQjjlLv6pJvx/z1iRFKzYb0XT/RuAQ== dependencies: - available-typed-arrays "^1.0.5" call-bind "^1.0.2" - es-set-tostringtag "^2.0.1" es-to-primitive "^1.2.1" function-bind "^1.1.1" function.prototype.name "^1.1.5" get-intrinsic "^1.1.3" get-symbol-description "^1.0.0" - globalthis "^1.0.3" gopd "^1.0.1" has "^1.0.3" has-property-descriptors "^1.0.0" - has-proto "^1.0.1" has-symbols "^1.0.3" - internal-slot "^1.0.4" - is-array-buffer "^3.0.1" + internal-slot "^1.0.3" is-callable "^1.2.7" is-negative-zero "^2.0.2" is-regex "^1.1.4" is-shared-array-buffer "^1.0.2" is-string "^1.0.7" - is-typed-array "^1.1.10" is-weakref "^1.0.2" object-inspect "^1.12.2" object-keys "^1.1.1" @@ -7534,24 +7537,13 @@ es-abstract@^1.17.2, es-abstract@^1.19.0, es-abstract@^1.20.4: safe-regex-test "^1.0.0" string.prototype.trimend "^1.0.6" string.prototype.trimstart "^1.0.6" - typed-array-length "^1.0.4" unbox-primitive "^1.0.2" - which-typed-array "^1.1.9" es-array-method-boxes-properly@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz#873f3e84418de4ee19c5be752990b2e44718d09e" integrity sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA== -es-set-tostringtag@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz#338d502f6f674301d710b80c8592de8a15f09cd8" - integrity sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg== - dependencies: - get-intrinsic "^1.1.3" - has "^1.0.3" - has-tostringtag "^1.0.0" - es-shim-unscopables@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz#702e632193201e3edf8713635d083d378e510241" @@ -7661,13 +7653,12 @@ eslint-config-react-app@^5.2.1: confusing-browser-globals "^1.0.9" eslint-import-resolver-node@^0.3.2, eslint-import-resolver-node@^0.3.4: - version "0.3.7" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.7.tgz#83b375187d412324a1963d84fa664377a23eb4d7" - integrity sha512-gozW2blMLJCeFpBwugLTGyvVjNoeo1knonXAcatC6bjPBZitotxdWf7Gimr25N4c0AAOo4eOUfaG82IJPDpqCA== + version "0.3.6" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz#4048b958395da89668252001dbd9eca6b83bacbd" + integrity sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw== dependencies: debug "^3.2.7" - is-core-module "^2.11.0" - resolve "^1.22.1" + resolve "^1.20.0" eslint-loader@3.0.3: version "3.0.3" @@ -8316,9 +8307,9 @@ fast-memoize@^2.5.2: integrity sha512-Ue0LwpDYErFbmNnZSF0UH6eImUwDmogUO1jyE+JbN2gsQz/jICm1Ve7t9QT0rNSsfJt+Hs4/S3GnsDVjL4HVrw== fastq@^1.6.0: - version "1.15.0" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.15.0.tgz#d04d07c6a2a68fe4599fea8d2e103a937fae6b3a" - integrity sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw== + version "1.14.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.14.0.tgz#107f69d7295b11e0fccc264e1fc6389f623731ce" + integrity sha512-eR2D+V9/ExcbF9ls441yIuN6TI2ED1Y2ZcA5BmMtJsOkWOFRJQ0Jt0g1UwqXJJVAb+V+umH5Dfr8oh4EVP7VVg== dependencies: reusify "^1.0.4" @@ -8954,6 +8945,17 @@ glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, gl once "^1.3.0" path-is-absolute "^1.0.0" +glob@^8.0.3: + version "8.0.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-8.0.3.tgz#415c6eb2deed9e502c68fa44a272e6da6eeca42e" + integrity sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^5.0.1" + once "^1.3.0" + global-modules@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-2.0.0.tgz#997605ad2345f27f51539bea26574421215c7780" @@ -8982,7 +8984,7 @@ globals@^12.1.0: dependencies: type-fest "^0.8.1" -globalthis@^1.0.1, globalthis@^1.0.3: +globalthis@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.3.tgz#5852882a52b80dc301b0660273e1ed082f0b6ccf" integrity sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA== @@ -9134,11 +9136,6 @@ has-property-descriptors@^1.0.0: dependencies: get-intrinsic "^1.1.1" -has-proto@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.1.tgz#1885c1305538958aff469fef37937c22795408e0" - integrity sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg== - has-symbols@^1.0.1, has-symbols@^1.0.2, has-symbols@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" @@ -9660,7 +9657,7 @@ internal-ip@^4.3.0: default-gateway "^4.2.0" ipaddr.js "^1.9.0" -internal-slot@^1.0.3, internal-slot@^1.0.4: +internal-slot@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.4.tgz#8551e7baf74a7a6ba5f749cfb16aa60722f0d6f3" integrity sha512-tA8URYccNzMo94s5MQZgH8NB/XTa6HsOo0MLfXTKKEnHVVdegzaQoFZ7Jp44bdvLvY2waT5dc+j5ICEswhi7UQ== @@ -9884,15 +9881,6 @@ is-arguments@^1.0.4: call-bind "^1.0.2" has-tostringtag "^1.0.0" -is-array-buffer@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/is-array-buffer/-/is-array-buffer-3.0.1.tgz#deb1db4fcae48308d54ef2442706c0393997052a" - integrity sha512-ASfLknmY8Xa2XtB4wmbz13Wu202baeA18cJBCeCy0wXUHZF0IPyVEXqKEcd+t2fNSLLL1vC6k7lxZEojNbISXQ== - dependencies: - call-bind "^1.0.2" - get-intrinsic "^1.1.3" - is-typed-array "^1.1.10" - is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" @@ -9966,7 +9954,7 @@ is-color-stop@^1.0.0: rgb-regex "^1.0.1" rgba-regex "^1.0.0" -is-core-module@^2.11.0, is-core-module@^2.5.0, is-core-module@^2.9.0: +is-core-module@^2.5.0, is-core-module@^2.9.0: version "2.11.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.11.0.tgz#ad4cb3e3863e814523c96f3f58d26cc570ff0144" integrity sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw== @@ -10277,7 +10265,7 @@ is-text-path@^1.0.1: dependencies: text-extensions "^1.0.0" -is-typed-array@^1.1.10, is-typed-array@^1.1.3, is-typed-array@^1.1.9: +is-typed-array@^1.1.10, is-typed-array@^1.1.3: version "1.1.10" resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.10.tgz#36a5b5cb4189b575d1a3e4b08536bfb485801e3f" integrity sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A== @@ -11562,10 +11550,10 @@ json3@^3.3.2: resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.3.tgz#7fc10e375fc5ae42c4705a5cc0aa6f62be305b81" integrity sha512-c7/8mbUsKigAbLkD5B010BK4D9LZm7A1pNItkEwiUZRpIN66exu/e7YQWysGun+TRKaJp8MhemM+VkfWv42aCA== -json5@2.x, json5@^2.1.2, json5@^2.2.2: - version "2.2.3" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" - integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== +json5@2.x, json5@^2.1.2, json5@^2.2.1: + version "2.2.2" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.2.tgz#64471c5bdcc564c18f7c1d4df2e2297f2457c5ab" + integrity sha512-46Tk9JiOL2z7ytNQWFLpj99RZkVgeHf87yGQKsIkaPz1qSH9UczKH1rO7K3wgRselo0tYMUNfecYpm/p1vC7tQ== json5@^1.0.1: version "1.0.2" @@ -11978,9 +11966,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.10.1" - resolved "https://registry.yarnpkg.com/lottie-web/-/lottie-web-5.10.1.tgz#fde8e6be374afc3906f78b4152ada9be44ce3ccf" - integrity sha512-u17bVNf/vA3oK9Wkyb1Vpo83WUIEQwaT0GeEN0qcvaExizyJ/RjmcbjSDj0CnwQCtpGqTgYhqprCC7cTWuXMNw== + version "5.10.0" + resolved "https://registry.yarnpkg.com/lottie-web/-/lottie-web-5.10.0.tgz#72563f22efdcf2b8f7e8359743514930ebaf5f8c" + integrity sha512-q2hfqKrGXNkwjSSZjKxf3fWMi0e3ZBc03qBkVWoGbwUJ7BcG+9YXjMPtmmhitzk8Nc6VQ5PRnh9yInPdfq0PZg== lower-case@^2.0.2: version "2.0.2" @@ -12338,10 +12326,10 @@ minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== -minimatch@*: - version "6.1.0" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-6.1.0.tgz#e0eafd0a19977f5accebd4b3909a34f6611d4288" - integrity sha512-eqe4xaKs1/JmNylXNFY2f41n3jNZAZTZlmOitWd71YazZlvvXMtzL+gK67jRKhrTQmHfrCbErYWV8z9Nz4aNuQ== +minimatch@*, minimatch@^5.0.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.2.tgz#0939d7d6f0898acbd1508abe534d1929368a8fff" + integrity sha512-bNH9mmM9qsJ2X4r2Nat1B//1dJVcn3+iBLa3IgqJ7EbGaDNepL9QSHOxN4ng33s52VMMhhIfgCYDk3C4ZmlDAg== dependencies: brace-expansion "^2.0.1" @@ -12866,9 +12854,9 @@ nock@13.0.7: propagate "^2.0.0" node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.7: - version "2.6.8" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.8.tgz#a68d30b162bc1d8fd71a367e81b997e1f4d4937e" - integrity sha512-RZ6dBYuj8dRSfxpUSu+NsdF1dpPpluJxwOp+6IoDp/sH2QNDSvurYsAa+F1WxY2RjA1iP93xhcsUoYbF2XBqVg== + version "2.6.7" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" + integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== dependencies: whatwg-url "^5.0.0" @@ -13223,9 +13211,9 @@ object-hash@^2.0.1: integrity sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw== object-inspect@^1.12.2, object-inspect@^1.9.0: - version "1.12.3" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.3.tgz#ba62dffd67ee256c8c086dfae69e016cd1f198b9" - integrity sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g== + version "1.12.2" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.2.tgz#c0641f26394532f28ab8d796ab954e43c009a8ea" + integrity sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ== object-is@^1.0.1: version "1.1.5" @@ -14614,9 +14602,9 @@ prettier@2.2.1: integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== prettier@^2.6.2: - version "2.8.3" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.3.tgz#ab697b1d3dd46fb4626fbe2f543afe0cc98d8632" - integrity sha512-tJ/oJ4amDihPoufT5sM0Z1SKEuKay8LfVAMlbbhnnkvt6BUserZylqo2PN+p9KeljLr0OHa2rXHU1T8reeoTrw== + version "2.8.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.1.tgz#4e1fd11c34e2421bc1da9aea9bd8127cd0a35efc" + integrity sha512-lqGoSJBQNJidqCHE80vqZJHWHRFoNYsSpP9AjFhlhi9ODCJA541svILes/+/1GM3VaL/abZi7cpFzOpdR9UPKg== pretty-bytes@^5.1.0: version "5.6.0" @@ -14853,9 +14841,9 @@ punycode@^1.2.4: integrity sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ== punycode@^2.1.0, punycode@^2.1.1: - version "2.2.0" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.2.0.tgz#2092cc57cd2582c38e4e7e8bb869dc8d3148bc74" - integrity sha512-LN6QV1IJ9ZhxWTNdktaPClrNfp8xdSAYS0Zk2ddX7XsXZAxckMHPCBcHRo0cTcEIgYPRiGEkmji3Idkh2yFtYw== + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== q@^1.1.2, q@^1.5.1: version "1.5.1" @@ -15610,7 +15598,7 @@ resolve@1.15.0: dependencies: path-parse "^1.0.6" -resolve@^1.10.0, resolve@^1.12.0, resolve@^1.14.2, resolve@^1.15.1, resolve@^1.17.0, resolve@^1.18.1, resolve@^1.22.1, resolve@^1.3.2, resolve@^1.8.1: +resolve@^1.10.0, resolve@^1.12.0, resolve@^1.14.2, resolve@^1.15.1, resolve@^1.17.0, resolve@^1.18.1, resolve@^1.20.0, resolve@^1.3.2, resolve@^1.8.1: version "1.22.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== @@ -17247,15 +17235,6 @@ type@^2.7.2: resolved "https://registry.yarnpkg.com/type/-/type-2.7.2.tgz#2376a15a3a28b1efa0f5350dcf72d24df6ef98d0" integrity sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw== -typed-array-length@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.4.tgz#89d83785e5c4098bec72e08b319651f0eac9c1bb" - integrity sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng== - dependencies: - call-bind "^1.0.2" - for-each "^0.3.3" - is-typed-array "^1.1.9" - typedarray-to-buffer@^3.1.5: version "3.1.5" resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" @@ -17961,7 +17940,7 @@ which-module@^2.0.0: resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" integrity sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q== -which-typed-array@^1.1.2, which-typed-array@^1.1.9: +which-typed-array@^1.1.2: version "1.1.9" resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.9.tgz#307cf898025848cf995e795e8423c7f337efbde6" integrity sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==