diff --git a/CHANGELOG.md b/CHANGELOG.md index 60ec939ec1..7fe90ae98f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Polywrap Origin (0.10.0-pre.3) ## Features * [PR-1411](https://github.com/polywrap/toolchain/pull/1411) `@polywrap/client-config-builder-js`: The `ens-text-record-resolver` wrapper @ [`wrap://ipfs/QmfRCVA1MSAjUbrXXjya4xA9QHkbWeiKRsT7Um1cvrR7FY`](https://wrappers.io/v/ipfs/QmfRCVA1MSAjUbrXXjya4xA9QHkbWeiKRsT7Um1cvrR7FY) has been added to the default client config bundle. This resolver enables ENS, text-record based, WRAP URI resolution. The text-record's key must be prepended with the `wrap/...` identifier. For example, the URI `wrap://ens/domain.eth:foo` maps to `domain.eth`'s `wrap/foo` text record. The `wrap/foo` text-record's value must contain another valid WRAP URI. For examples, see [dev.polywrap.eth](https://app.ens.domains/name/dev.polywrap.eth/details). +* [PR-1369](https://github.com/polywrap/toolchain/pull/1369) `@polywrap/core-js`: + * `GetImplementationsOptions` now accepts an optional resolution context, to be used to handle infinite recursion when a resolver uses `getImplementations` + * `GetImplementationsOptions` now accepts an optional `applyResolution`. This can be used to apply URI resolution to interfaces. * [PR-1236](https://github.com/polywrap/toolchain/pull/1236) `@polywrap/client-js`: Polywrap Client now re-exports the config builder and uri-resolvers (in addition to core) packages. This is done to improve dev exp and remove the need for users to import those package themselves. * For users who do not need those packages and are using noDefaults there will be a separate PR that refactor core client functionality into a core-client package that does not depend on the config builder and uri-resolvers packages, but has no defaults. * [PR-1236](https://github.com/polywrap/toolchain/pull/1236) `@polywrap/client-config-builder-js`: @@ -14,7 +17,20 @@ * [PR-1236] `@polywrap/schema-bind`: In `plugin-ts` bindings, the `PluginModule` type is now imported fron `@polywrap/plugin-js` instead of `@polywrap/core-js`. * [PR-1349](https://github.com/polywrap/toolchain/pull/1349) `polywrap` CLI: A `-l, --log-file [path]` option has been added to all commands. Its purpose is to configure a `Log file to save console output to`, useful in situations when the console log overflows. -## Breaking Changes +## Breaking Changes +* [PR-1369](https://github.com/polywrap/toolchain/pull/1369) `@polywrap/client-config-builder-js`: + * Calling `buildCoreConfig` no longer returns a `CoreClientConfig` with redirects since redirects are no longer a part of `CoreClientConfig`. +* [PR-1369](https://github.com/polywrap/toolchain/pull/1369) `@polywrap/uri-resolvers-js`: + * `LegacyRedirectsResolver` has been removed. +* [PR-1369](https://github.com/polywrap/toolchain/pull/1369) `@polywrap/core-js`: + * `redirects` are no longer a part of `CoreClientConfig`. + * `getRedirects` are no longer a part of `CoreClient`. + * `getUriResolver` on `CoreClient` has been renamed to `getResolver`. + * `getImplementations` returns a promise now. + * `GetImplementationsOptions` no longer accepts `applyRedirects`. This has been replaces with `applyResolution`. + * `applyRedirects` helper function has been replaced with `applyResolution`. +* [PR-1369](https://github.com/polywrap/toolchain/pull/1369) `@polywrap/client-js`: + * `PolywrapClient` config when using `noDefaults: true` no longer accepts `redirects` (Since redirects have been removed from `CoreClientConfig`). * [PR-1367](https://github.com/polywrap/toolchain/pull/1367) `polywrap` CLI: The JS/TS module passed into the `--client-config` option has a new entrypoint signature. * Instead of `getCustomConfig`, users should export the following `configure(builder: IClientConfigBuilder): IClientConfigBuilder`. * `IClientConfigBuilder` can be imported from the `@polywrap/client-config-builder-js` package. diff --git a/packages/js/client-config-builder/src/ClientConfigBuilder.ts b/packages/js/client-config-builder/src/ClientConfigBuilder.ts index df03629544..4cc1e04edb 100644 --- a/packages/js/client-config-builder/src/ClientConfigBuilder.ts +++ b/packages/js/client-config-builder/src/ClientConfigBuilder.ts @@ -4,7 +4,6 @@ import { BaseClientConfigBuilder } from "./BaseClientConfigBuilder"; import { CoreClientConfig, Uri, IUriResolver } from "@polywrap/core-js"; import { IWrapperCache, - LegacyRedirectsResolver, PackageToWrapperCacheResolver, RecursiveResolver, StaticResolver, @@ -28,14 +27,13 @@ export class ClientConfigBuilder extends BaseClientConfigBuilder { return { envs: this.config.envs, interfaces: this.config.interfaces, - redirects: this.config.redirects, resolver: this.resolver ?? RecursiveResolver.from( PackageToWrapperCacheResolver.from( [ - new LegacyRedirectsResolver(), StaticResolver.from([ + ...this.config.redirects, ...this.config.wrappers, ...this.config.packages, ]), diff --git a/packages/js/client/README.md b/packages/js/client/README.md index 910339bfc6..1ff5cf7bd4 100644 --- a/packages/js/client/README.md +++ b/packages/js/client/README.md @@ -76,8 +76,6 @@ const config = { // customize URI resolution resolver: new RecursiveResolver( new PackageToWrapperCacheResolver(wrapperCache, [ - new LegacyRedirectsResolver(), - new LegacyPluginsResolver(), new ExtendableUriResolver(), ]) ), @@ -119,7 +117,7 @@ constructor(config?: Partial>, options?: { * * @returns an immutable Polywrap client config */ -getConfig(): PolywrapClientConfig; +getConfig(): PolywrapCoreClientConfig; ``` ### setTracingEnabled @@ -136,37 +134,6 @@ getConfig(): PolywrapClientConfig; setTracingEnabled(tracerConfig?: Partial): void; ``` -### getRedirects -```ts -/** - * returns all uri redirects from the configuration used to instantiate the client - * - * @returns an array of uri redirects - */ -getRedirects(): readonly UriRedirect[]; -``` - -### getPlugins -```ts -/** - * returns all plugin registrations from the configuration used to instantiate the client - * - * @returns an array of plugin registrations - */ -getPlugins(): readonly PluginRegistration[]; -``` - -### getPluginByUri -```ts -/** - * 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 - */ -getPluginByUri(uri: TUri): PluginPackage | undefined; -``` - ### getInterfaces ```ts /** @@ -187,14 +154,14 @@ getInterfaces(): readonly InterfaceImplementations[]; getEnvs(): readonly Env[]; ``` -### getUriResolver +### getResolver ```ts /** * returns the URI resolver from the configuration used to instantiate the client * * @returns an object that implements the IUriResolver interface */ -getUriResolver(): IUriResolver; +getResolver(): IUriResolver; ``` ### getEnvByUri @@ -239,7 +206,7 @@ getFile(uri: TUri, options: GetFileOptions): Promise< * from the configuration used to instantiate the client * * @param uri - a wrap URI - * @param options - { applyRedirects?: boolean } + * @param options - { applyResolution?: boolean } * @returns a Result containing URI array if the request was successful */ getImplementations(uri: TUri, options?: GetImplementationsOptions): Result; diff --git a/packages/js/client/src/PolywrapClient.ts b/packages/js/client/src/PolywrapClient.ts index ed597cad91..246d7771c1 100644 --- a/packages/js/client/src/PolywrapClient.ts +++ b/packages/js/client/src/PolywrapClient.ts @@ -15,7 +15,6 @@ import { SubscribeOptions, Subscription, Uri, - IUriRedirect, createQueryDocument, getImplementations, parseQuery, @@ -107,16 +106,6 @@ export class PolywrapClient implements CoreClient { } } - /** - * returns all uri redirects from the configuration used to instantiate the client - * - * @returns an array of uri redirects - */ - @Tracer.traceMethod("PolywrapClient: getRedirects") - public getRedirects(): readonly IUriRedirect[] | undefined { - return this._config.redirects; - } - /** * returns all plugin registrations from the configuration used to instantiate the client * @@ -154,7 +143,7 @@ export class PolywrapClient implements CoreClient { * @returns an object that implements the IUriResolver interface */ @Tracer.traceMethod("PolywrapClient: getUriResolver") - public getUriResolver(): IUriResolver { + public getResolver(): IUriResolver { return this._config.resolver; } @@ -225,21 +214,22 @@ export class PolywrapClient implements CoreClient { * from the configuration used to instantiate the client * * @param uri - a wrap URI - * @param options - { applyRedirects?: boolean } + * @param options - { applyResolution?: boolean } * @returns a Result containing URI array if the request was successful */ @Tracer.traceMethod("PolywrapClient: getImplementations") - public getImplementations( + public async getImplementations( uri: TUri, options: GetImplementationsOptions = {} - ): Result { + ): Promise> { const isUriTypeString = typeof uri === "string"; - const applyRedirects = !!options.applyRedirects; + const applyResolution = !!options.applyResolution; - const getImplResult = getImplementations( + const getImplResult = await getImplementations( Uri.from(uri), this.getInterfaces() ?? [], - applyRedirects ? this.getRedirects() : undefined + applyResolution ? this : undefined, + applyResolution ? options.resolutionContext : undefined ); if (!getImplResult.ok) { @@ -606,7 +596,7 @@ export class PolywrapClient implements CoreClient { ): Promise> { const uri = Uri.from(options.uri); - const uriResolver = this.getUriResolver(); + const uriResolver = this.getResolver(); const resolutionContext = options.resolutionContext ?? new UriResolutionContext(); @@ -733,11 +723,6 @@ export class PolywrapClient implements CoreClient { config: PolywrapCoreClientConfig ): PolywrapCoreClientConfig { return { - redirects: - config?.redirects?.map((x) => ({ - from: Uri.from(x.from), - to: Uri.from(x.to), - })) ?? [], interfaces: config?.interfaces?.map((x) => ({ interface: Uri.from(x.interface), diff --git a/packages/js/client/src/__tests__/core/interface-impls.spec.ts b/packages/js/client/src/__tests__/core/interface-impls.spec.ts index 85d94bad0d..04fbd89243 100644 --- a/packages/js/client/src/__tests__/core/interface-impls.spec.ts +++ b/packages/js/client/src/__tests__/core/interface-impls.spec.ts @@ -6,7 +6,7 @@ import { mockPluginRegistration } from "../helpers/mockPluginRegistration"; jest.setTimeout(200000); describe("interface-impls", () => { - it("should register interface implementations successfully", () => { + it("should register interface implementations successfully", async () => { const interfaceUri = "wrap://ens/some-interface1.eth"; const implementation1Uri = "wrap://ens/some-implementation1.eth"; const implementation2Uri = "wrap://ens/some-implementation2.eth"; @@ -39,8 +39,8 @@ describe("interface-impls", () => { }, ]); - const implementations = client.getImplementations(interfaceUri, { - applyRedirects: false, + const implementations = await client.getImplementations(interfaceUri, { + applyResolution: false, }); if (!implementations.ok) fail(implementations.error); @@ -62,7 +62,7 @@ describe("interface-impls", () => { const client = new PolywrapClient( { - redirects: [ + resolver: UriResolver.from([ { from: interface1Uri, to: interface2Uri, @@ -75,8 +75,6 @@ describe("interface-impls", () => { from: implementation2Uri, to: implementation3Uri, }, - ], - resolver: UriResolver.from([ mockPluginRegistration(implementation4Uri), ]), interfaces: [ @@ -99,14 +97,14 @@ describe("interface-impls", () => { } ); - const implementations1 = client.getImplementations(interface1Uri, { - applyRedirects: true, + const implementations1 = await client.getImplementations(interface1Uri, { + applyResolution: true, }); - const implementations2 = client.getImplementations(interface2Uri, { - applyRedirects: true, + const implementations2 = await client.getImplementations(interface2Uri, { + applyResolution: true, }); - const implementations3 = client.getImplementations(interface3Uri, { - applyRedirects: true, + const implementations3 = await client.getImplementations(interface3Uri, { + applyResolution: true, }); if (!implementations1.ok) fail(implementations1.error); @@ -196,7 +194,7 @@ describe("interface-impls", () => { ]); }); - test("get implementations - do not return plugins that are not explicitly registered", () => { + test("get implementations - do not return plugins that are not explicitly registered", async () => { const interfaceUri = "wrap://ens/some-interface.eth"; const implementation1Uri = "wrap://ens/some-implementation1.eth"; @@ -219,9 +217,9 @@ describe("interface-impls", () => { } ); - const getImplementationsResult = client.getImplementations( + const getImplementationsResult = await client.getImplementations( new Uri(interfaceUri), - { applyRedirects: true } + { applyResolution: true } ); if (!getImplementationsResult.ok) fail(getImplementationsResult.error); @@ -230,7 +228,7 @@ describe("interface-impls", () => { ]); }); - test("get implementations - return implementations for plugins which don't have interface stated in manifest", () => { + test("get implementations - return implementations for plugins which don't have interface stated in manifest", async () => { const interfaceUri = "wrap://ens/some-interface.eth"; const implementation1Uri = "wrap://ens/some-implementation1.eth"; @@ -251,9 +249,9 @@ describe("interface-impls", () => { { noDefaults: true } ); - const getImplementationsResult = client.getImplementations( + const getImplementationsResult = await client.getImplementations( new Uri(interfaceUri), - { applyRedirects: true } + { applyResolution: true } ); if (!getImplementationsResult.ok) fail(getImplementationsResult.error); @@ -289,26 +287,26 @@ describe("interface-impls", () => { ], }); - let result = client.getImplementations(oldInterfaceUri, { - applyRedirects: false, + let result = await client.getImplementations(oldInterfaceUri, { + applyResolution: false, }); if (!result.ok) fail(result.error); expect(result.value).toEqual([implementation1Uri]); - result = client.getImplementations(oldInterfaceUri, { - applyRedirects: true, + result = await client.getImplementations(oldInterfaceUri, { + applyResolution: true, }); if (!result.ok) fail(result.error); expect(result.value).toEqual([implementation1Uri, implementation2Uri]); - let result2 = client.getImplementations(new Uri(oldInterfaceUri), { - applyRedirects: false, + let result2 = await client.getImplementations(new Uri(oldInterfaceUri), { + applyResolution: false, }); if (!result2.ok) fail(result2.error); expect(result2.value).toEqual([new Uri(implementation1Uri)]); - result2 = client.getImplementations(new Uri(oldInterfaceUri), { - applyRedirects: true, + result2 = await client.getImplementations(new Uri(oldInterfaceUri), { + applyResolution: true, }); if (!result2.ok) fail(result2.error); expect(result2.value).toEqual([ diff --git a/packages/js/client/src/__tests__/core/sanity.spec.ts b/packages/js/client/src/__tests__/core/sanity.spec.ts index fdc809288b..4220f7973b 100644 --- a/packages/js/client/src/__tests__/core/sanity.spec.ts +++ b/packages/js/client/src/__tests__/core/sanity.spec.ts @@ -1,6 +1,5 @@ import { coreInterfaceUris } from "@polywrap/core-js"; import { Uri } from "../.."; -import { defaultWrappers } from "@polywrap/client-config-builder-js"; import { PolywrapClient } from "../../PolywrapClient"; jest.setTimeout(200000); @@ -9,21 +8,6 @@ describe("sanity", () => { test("default client config", () => { const client = new PolywrapClient(); - expect(client.getRedirects()).toStrictEqual([ - { - from: new Uri("wrap://ens/sha3.polywrap.eth"), - to: new Uri(defaultWrappers.sha3), - }, - { - from: new Uri("wrap://ens/uts46.polywrap.eth"), - to: new Uri(defaultWrappers.uts46), - }, - { - from: new Uri("wrap://ens/graph-node.polywrap.eth"), - to: new Uri(defaultWrappers.graphNode), - }, - ]); - new Uri("wrap://ens/http-resolver.polywrap.eth"), expect(client.getInterfaces()).toStrictEqual([ { @@ -42,39 +26,4 @@ describe("sanity", () => { }, ]); }); - - test("redirect registration", () => { - const implementation1Uri = "wrap://ens/some-implementation1.eth"; - const implementation2Uri = "wrap://ens/some-implementation2.eth"; - - const client = new PolywrapClient({ - redirects: [ - { - from: implementation1Uri, - to: implementation2Uri, - }, - ], - }); - - const redirects = client.getRedirects(); - - expect(redirects).toEqual([ - { - from: new Uri("wrap://ens/sha3.polywrap.eth"), - to: new Uri(defaultWrappers.sha3), - }, - { - from: new Uri("wrap://ens/uts46.polywrap.eth"), - to: new Uri(defaultWrappers.uts46), - }, - { - from: new Uri("wrap://ens/graph-node.polywrap.eth"), - to: new Uri(defaultWrappers.graphNode), - }, - { - from: new Uri(implementation1Uri), - to: new Uri(implementation2Uri), - }, - ]); - }); }); diff --git a/packages/js/client/src/__tests__/core/uri-resolution/histories/can resolve redirects.json b/packages/js/client/src/__tests__/core/uri-resolution/histories/can resolve redirects.json index 19147a3ad9..b0e982583d 100644 --- a/packages/js/client/src/__tests__/core/uri-resolution/histories/can resolve redirects.json +++ b/packages/js/client/src/__tests__/core/uri-resolution/histories/can resolve redirects.json @@ -3,20 +3,14 @@ [ "wrap://ens/from.eth => UriResolverAggregator => uri (wrap://ens/to1.eth)", [ - "wrap://ens/from.eth => LegacyRedirectsResolver => uri (wrap://ens/to1.eth)", - [ - "wrap://ens/from.eth => Redirect (wrap://ens/from.eth - wrap://ens/to1.eth) => uri (wrap://ens/to1.eth)" - ] + "wrap://ens/from.eth => StaticResolver - Redirect (wrap://ens/from.eth - wrap://ens/to1.eth) => uri (wrap://ens/to1.eth)" ] ], "wrap://ens/to1.eth => PackageToWrapperCacheResolver => uri (wrap://ens/to2.eth)", [ "wrap://ens/to1.eth => UriResolverAggregator => uri (wrap://ens/to2.eth)", [ - "wrap://ens/to1.eth => LegacyRedirectsResolver => uri (wrap://ens/to2.eth)", - [ - "wrap://ens/to1.eth => Redirect (wrap://ens/to1.eth - wrap://ens/to2.eth) => uri (wrap://ens/to2.eth)" - ] + "wrap://ens/to1.eth => StaticResolver - Redirect (wrap://ens/to1.eth - wrap://ens/to2.eth) => uri (wrap://ens/to2.eth)" ] ] ] diff --git a/packages/js/client/src/__tests__/core/uri-resolution/histories/restarts URI resolution after URI resolver extension redirect.json b/packages/js/client/src/__tests__/core/uri-resolution/histories/restarts URI resolution after URI resolver extension redirect.json index 20755e281f..55dc5f9286 100644 --- a/packages/js/client/src/__tests__/core/uri-resolution/histories/restarts URI resolution after URI resolver extension redirect.json +++ b/packages/js/client/src/__tests__/core/uri-resolution/histories/restarts URI resolution after URI resolver extension redirect.json @@ -78,10 +78,7 @@ [ "wrap://simple/$root-wrapper-dir/simple/build => UriResolverAggregator => uri (wrap://ens/redirect.eth)", [ - "wrap://simple/$root-wrapper-dir/simple/build => LegacyRedirectsResolver => uri (wrap://ens/redirect.eth)", - [ - "wrap://simple/$root-wrapper-dir/simple/build => Redirect (wrap://simple/$root-wrapper-dir/simple/build - wrap://ens/redirect.eth) => uri (wrap://ens/redirect.eth)" - ] + "wrap://simple/$root-wrapper-dir/simple/build => StaticResolver - Redirect (wrap://simple/$root-wrapper-dir/simple/build - wrap://ens/redirect.eth) => uri (wrap://ens/redirect.eth)" ] ] ] \ No newline at end of file diff --git a/packages/js/client/src/__tests__/core/uri-resolution/histories/sanity.json b/packages/js/client/src/__tests__/core/uri-resolution/histories/sanity.json index c1f56ed68f..cea860ac17 100644 --- a/packages/js/client/src/__tests__/core/uri-resolution/histories/sanity.json +++ b/packages/js/client/src/__tests__/core/uri-resolution/histories/sanity.json @@ -3,12 +3,6 @@ [ "wrap://ens/uri.eth => UriResolverAggregator", [ - "wrap://ens/uri.eth => LegacyRedirectsResolver", - [ - "wrap://ens/uri.eth => Redirect (wrap://ens/sha3.polywrap.eth - wrap://ens/goerli/sha3.wrappers.eth)", - "wrap://ens/uri.eth => Redirect (wrap://ens/uts46.polywrap.eth - wrap://ens/goerli/uts46-lite.wrappers.eth)", - "wrap://ens/uri.eth => Redirect (wrap://ens/graph-node.polywrap.eth - wrap://ens/goerli/graph-node.wrappers.eth)" - ], "wrap://ens/uri.eth => StaticResolver - Miss", "wrap://ens/uri.eth => ExtendableUriResolver", [ @@ -16,12 +10,6 @@ [ "wrap://ens/ipfs-resolver.polywrap.eth => UriResolverAggregator => package (wrap://ens/ipfs-resolver.polywrap.eth)", [ - "wrap://ens/ipfs-resolver.polywrap.eth => LegacyRedirectsResolver", - [ - "wrap://ens/ipfs-resolver.polywrap.eth => Redirect (wrap://ens/sha3.polywrap.eth - wrap://ens/goerli/sha3.wrappers.eth)", - "wrap://ens/ipfs-resolver.polywrap.eth => Redirect (wrap://ens/uts46.polywrap.eth - wrap://ens/goerli/uts46-lite.wrappers.eth)", - "wrap://ens/ipfs-resolver.polywrap.eth => Redirect (wrap://ens/graph-node.polywrap.eth - wrap://ens/goerli/graph-node.wrappers.eth)" - ], "wrap://ens/ipfs-resolver.polywrap.eth => StaticResolver - Package (wrap://ens/ipfs-resolver.polywrap.eth) => package (wrap://ens/ipfs-resolver.polywrap.eth)" ] ], @@ -30,12 +18,6 @@ [ "wrap://ens/ens-resolver.polywrap.eth => UriResolverAggregator => package (wrap://ens/ens-resolver.polywrap.eth)", [ - "wrap://ens/ens-resolver.polywrap.eth => LegacyRedirectsResolver", - [ - "wrap://ens/ens-resolver.polywrap.eth => Redirect (wrap://ens/sha3.polywrap.eth - wrap://ens/goerli/sha3.wrappers.eth)", - "wrap://ens/ens-resolver.polywrap.eth => Redirect (wrap://ens/uts46.polywrap.eth - wrap://ens/goerli/uts46-lite.wrappers.eth)", - "wrap://ens/ens-resolver.polywrap.eth => Redirect (wrap://ens/graph-node.polywrap.eth - wrap://ens/goerli/graph-node.wrappers.eth)" - ], "wrap://ens/ens-resolver.polywrap.eth => StaticResolver - Package (wrap://ens/ens-resolver.polywrap.eth) => package (wrap://ens/ens-resolver.polywrap.eth)" ] ], @@ -44,12 +26,6 @@ [ "wrap://ens/fs-resolver.polywrap.eth => UriResolverAggregator => package (wrap://ens/fs-resolver.polywrap.eth)", [ - "wrap://ens/fs-resolver.polywrap.eth => LegacyRedirectsResolver", - [ - "wrap://ens/fs-resolver.polywrap.eth => Redirect (wrap://ens/sha3.polywrap.eth - wrap://ens/goerli/sha3.wrappers.eth)", - "wrap://ens/fs-resolver.polywrap.eth => Redirect (wrap://ens/uts46.polywrap.eth - wrap://ens/goerli/uts46-lite.wrappers.eth)", - "wrap://ens/fs-resolver.polywrap.eth => Redirect (wrap://ens/graph-node.polywrap.eth - wrap://ens/goerli/graph-node.wrappers.eth)" - ], "wrap://ens/fs-resolver.polywrap.eth => StaticResolver - Package (wrap://ens/fs-resolver.polywrap.eth) => package (wrap://ens/fs-resolver.polywrap.eth)" ] ], @@ -58,12 +34,6 @@ [ "wrap://ens/http-resolver.polywrap.eth => UriResolverAggregator => package (wrap://ens/http-resolver.polywrap.eth)", [ - "wrap://ens/http-resolver.polywrap.eth => LegacyRedirectsResolver", - [ - "wrap://ens/http-resolver.polywrap.eth => Redirect (wrap://ens/sha3.polywrap.eth - wrap://ens/goerli/sha3.wrappers.eth)", - "wrap://ens/http-resolver.polywrap.eth => Redirect (wrap://ens/uts46.polywrap.eth - wrap://ens/goerli/uts46-lite.wrappers.eth)", - "wrap://ens/http-resolver.polywrap.eth => Redirect (wrap://ens/graph-node.polywrap.eth - wrap://ens/goerli/graph-node.wrappers.eth)" - ], "wrap://ens/http-resolver.polywrap.eth => StaticResolver - Package (wrap://ens/http-resolver.polywrap.eth) => package (wrap://ens/http-resolver.polywrap.eth)" ] ], @@ -72,12 +42,6 @@ [ "wrap://ipfs/QmfRCVA1MSAjUbrXXjya4xA9QHkbWeiKRsT7Um1cvrR7FY => UriResolverAggregator => package (wrap://ipfs/QmfRCVA1MSAjUbrXXjya4xA9QHkbWeiKRsT7Um1cvrR7FY)", [ - "wrap://ipfs/QmfRCVA1MSAjUbrXXjya4xA9QHkbWeiKRsT7Um1cvrR7FY => LegacyRedirectsResolver", - [ - "wrap://ipfs/QmfRCVA1MSAjUbrXXjya4xA9QHkbWeiKRsT7Um1cvrR7FY => Redirect (wrap://ens/sha3.polywrap.eth - wrap://ens/goerli/sha3.wrappers.eth)", - "wrap://ipfs/QmfRCVA1MSAjUbrXXjya4xA9QHkbWeiKRsT7Um1cvrR7FY => Redirect (wrap://ens/uts46.polywrap.eth - wrap://ens/goerli/uts46-lite.wrappers.eth)", - "wrap://ipfs/QmfRCVA1MSAjUbrXXjya4xA9QHkbWeiKRsT7Um1cvrR7FY => Redirect (wrap://ens/graph-node.polywrap.eth - wrap://ens/goerli/graph-node.wrappers.eth)" - ], "wrap://ipfs/QmfRCVA1MSAjUbrXXjya4xA9QHkbWeiKRsT7Um1cvrR7FY => StaticResolver - Miss", "wrap://ipfs/QmfRCVA1MSAjUbrXXjya4xA9QHkbWeiKRsT7Um1cvrR7FY => ExtendableUriResolver => package (wrap://ipfs/QmfRCVA1MSAjUbrXXjya4xA9QHkbWeiKRsT7Um1cvrR7FY)", [ diff --git a/packages/js/client/src/__tests__/e2e/test-cases.ts b/packages/js/client/src/__tests__/e2e/test-cases.ts index 3fe4a1248c..9a0c3176ad 100644 --- a/packages/js/client/src/__tests__/e2e/test-cases.ts +++ b/packages/js/client/src/__tests__/e2e/test-cases.ts @@ -291,8 +291,8 @@ export const runImplementationsTest = async ( interfaceUri: string, implementationUri: string ) => { - const implResult = client.getImplementations(interfaceUri, { - applyRedirects: false, + const implResult = await client.getImplementations(interfaceUri, { + applyResolution: false, }); if (!implResult.ok) fail(implResult.error); expect(implResult.value).toEqual([new Uri(implementationUri).uri]); @@ -338,8 +338,8 @@ export const runGetImplementationsTest = async ( implementationUri: string ) => { let implUri = new Uri(implementationUri); - const implResult = client.getImplementations(interfaceUri, { - applyRedirects: false, + const implResult = await client.getImplementations(interfaceUri, { + applyResolution: false, }); if (!implResult.ok) fail(implResult.error); expect(implResult.value).toEqual([implUri.uri]); diff --git a/packages/js/core/src/__tests__/apply-redirects.spec.ts b/packages/js/core/src/__tests__/apply-redirects.spec.ts deleted file mode 100644 index b00dc8006f..0000000000 --- a/packages/js/core/src/__tests__/apply-redirects.spec.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { - Uri, - applyRedirects -} from "../"; - -describe("applyRedirects", () => { - - it("works with the typical use case", () => { - const uri1 = "wrap://ens/some-uri1.eth"; - const uri2 = "wrap://ens/some-uri2.eth"; - - const redirectsResult = applyRedirects(new Uri(uri1), [ - { - from: new Uri(uri1), - to: new Uri(uri2) - } - ]); - - expect (redirectsResult.ok).toBeTruthy(); - if (!redirectsResult.ok) { - throw Error("This should never happen"); - } - - const redirectedUri = redirectsResult.value; - expect(Uri.equals(redirectedUri, new Uri(uri2))).toBeTruthy(); - }); - - it("works with the redirect stack overrides", () => { - const uri1 = "wrap://ens/some-uri1.eth"; - const uri2 = "wrap://ens/some-uri2.eth"; - const uri3 = "wrap://ens/some-uri3.eth"; - - const redirectsResult = applyRedirects(new Uri(uri1), [ - { - from: new Uri(uri1), - to: new Uri(uri2) - }, - { - from: new Uri(uri1), - to: new Uri(uri3) - } - ]); - - expect (redirectsResult.ok).toBeTruthy(); - if (!redirectsResult.ok) { - throw Error("This should never happen"); - } - - const redirectedUri = redirectsResult.value; - expect(Uri.equals(redirectedUri, new Uri(uri2))).toBeTruthy(); - }); - - it("can not redirect to self", () => { - const uri = "wrap://ens/some-uri.eth"; - - const redirectsResult = applyRedirects(new Uri(uri), [ - { - from: new Uri(uri), - to: new Uri(uri) - } - ]); - - expect(redirectsResult.ok).toBeFalsy(); - if (redirectsResult.ok) { - throw Error("This should never happen"); - } - - const err = redirectsResult.error?.message; - expect(err).toContain("Infinite loop while resolving URI"); - }); -}); diff --git a/packages/js/core/src/__tests__/get-implementations.spec.ts b/packages/js/core/src/__tests__/get-implementations.spec.ts index 470f37a8d0..658c10ed25 100644 --- a/packages/js/core/src/__tests__/get-implementations.spec.ts +++ b/packages/js/core/src/__tests__/get-implementations.spec.ts @@ -1,14 +1,33 @@ import { getImplementations, Uri, - UriRedirect, + IUriRedirect, + UriPackageOrWrapper, } from "../"; -import { InterfaceImplementations } from "../types"; -import { ResultOk } from "@polywrap/result"; +import { CoreClient, InterfaceImplementations } from "../types"; +import { Result, ResultOk } from "@polywrap/result"; + +const getClient = (redirects: IUriRedirect[]): CoreClient => { + return { + tryResolveUri: async ( { uri }: { uri: Uri }): Promise> => { + while (true) { + const redirect = redirects.find((x) => uri.uri === x.from.uri); + if (redirect) { + uri = redirect.to; + } else { + return ResultOk({ + type: "uri", + uri, + }); + } + } + }, + } as CoreClient; +}; describe("getImplementations", () => { - it("works with complex redirects", () => { + it("works with complex redirects", async () => { const interface1Uri = "wrap://ens/some-interface1.eth"; const interface2Uri = "wrap://ens/some-interface2.eth"; const interface3Uri = "wrap://ens/some-interface3.eth"; @@ -17,7 +36,7 @@ describe("getImplementations", () => { const implementation2Uri = "wrap://ens/some-implementation2.eth"; const implementation3Uri = "wrap://ens/some-implementation3.eth"; - const redirects: UriRedirect[] = [ + const redirects: IUriRedirect[] = [ { from: new Uri(interface1Uri), to: new Uri(interface2Uri) @@ -54,20 +73,20 @@ describe("getImplementations", () => { } ]; - const getImplementationsResult1 = getImplementations( + const getImplementationsResult1 = await getImplementations( new Uri(interface1Uri), interfaces, - redirects + getClient(redirects) ); - const getImplementationsResult2 = getImplementations( + const getImplementationsResult2 = await getImplementations( new Uri(interface2Uri), interfaces, - redirects + getClient(redirects) ); - const getImplementationsResult3 = getImplementations( + const getImplementationsResult3 = await getImplementations( new Uri(interface3Uri), interfaces, - redirects + getClient(redirects) ); expect(getImplementationsResult1).toEqual(ResultOk([ @@ -87,13 +106,13 @@ describe("getImplementations", () => { ])); }); - it("interface implementations are not redirected", () => { + it("interface implementations are not redirected", async () => { const interface1Uri = "wrap://ens/some-interface1.eth"; const implementation1Uri = "wrap://ens/some-implementation.eth"; const implementation2Uri = "wrap://ens/some-implementation2.eth"; - const redirects: UriRedirect[] = [ + const redirects: IUriRedirect[] = [ { from: new Uri(implementation1Uri), to: new Uri(implementation2Uri) @@ -109,13 +128,13 @@ describe("getImplementations", () => { } ]; - const getImplementationsResult = getImplementations( + const result = await getImplementations( new Uri(interface1Uri), interfaces, - redirects + getClient(redirects) ); - expect(getImplementationsResult).toEqual(ResultOk([ + expect(result).toEqual(ResultOk([ new Uri(implementation1Uri) ])); }); diff --git a/packages/js/core/src/algorithms/GetImplementationsError.ts b/packages/js/core/src/algorithms/GetImplementationsError.ts new file mode 100644 index 0000000000..ef49d53cda --- /dev/null +++ b/packages/js/core/src/algorithms/GetImplementationsError.ts @@ -0,0 +1,5 @@ +export class GetImplementationsError extends Error { + constructor(public readonly internalError: TInternalError) { + super("Error occurred while getting implementations"); + } +} diff --git a/packages/js/core/src/algorithms/apply-redirects.ts b/packages/js/core/src/algorithms/apply-redirects.ts deleted file mode 100644 index 6ae68f3764..0000000000 --- a/packages/js/core/src/algorithms/apply-redirects.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Uri, IUriRedirect } from "../types"; - -import { Tracer } from "@polywrap/tracing-js"; -import { Result, ResultErr, ResultOk } from "@polywrap/result"; - -export const applyRedirects = Tracer.traceFunc( - "core: applyRedirects", - (uri: Uri, redirects: readonly IUriRedirect[]): Result => { - // Keep track of past redirects (from -> to) to find the final uri - const redirectFromToMap: Record = {}; - - const createError = (message: string) => { - const error = Error( - `${message}\nResolution Stack: ${JSON.stringify( - redirectFromToMap, - null, - 2 - )}` - ); - return ResultErr(error); - }; - - for (const redirect of redirects) { - if (!redirect.from) { - return createError( - `Redirect missing the from property.\nEncountered while resolving ${uri.uri}` - ); - } - - if (redirectFromToMap[redirect.from.uri]) { - continue; - } - - redirectFromToMap[redirect.from.uri] = redirect.to; - } - - let finalUri = uri; - - const visitedUris: Record = {}; - - while (redirectFromToMap[finalUri.uri]) { - visitedUris[finalUri.uri] = true; - - finalUri = redirectFromToMap[finalUri.uri]; - - if (visitedUris[finalUri.uri]) { - return createError(`Infinite loop while resolving URI "${uri}".`); - } - } - - return ResultOk(finalUri); - } -); diff --git a/packages/js/core/src/algorithms/applyResolution.ts b/packages/js/core/src/algorithms/applyResolution.ts new file mode 100644 index 0000000000..a86f425d94 --- /dev/null +++ b/packages/js/core/src/algorithms/applyResolution.ts @@ -0,0 +1,17 @@ +import { Uri, CoreClient, IUriResolutionContext } from ".."; + +import { Result, ResultOk } from "@polywrap/result"; + +export const applyResolution = async ( + uri: Uri, + client: CoreClient, + resolutionContext?: IUriResolutionContext +): Promise> => { + const result = await client.tryResolveUri({ uri, resolutionContext }); + + if (!result.ok) { + return result; + } + + return ResultOk(result.value.uri); +}; diff --git a/packages/js/core/src/algorithms/get-implementations.ts b/packages/js/core/src/algorithms/get-implementations.ts index 44eca08000..2865dffbe6 100644 --- a/packages/js/core/src/algorithms/get-implementations.ts +++ b/packages/js/core/src/algorithms/get-implementations.ts @@ -1,16 +1,19 @@ -import { Uri, IUriRedirect, InterfaceImplementations } from "../types"; -import { applyRedirects } from "./apply-redirects"; +import { Uri, InterfaceImplementations, CoreClient } from "../types"; +import { IUriResolutionContext } from "../uri-resolution"; +import { GetImplementationsError } from "./GetImplementationsError"; +import { applyResolution } from "./applyResolution"; import { Tracer } from "@polywrap/tracing-js"; -import { Result, ResultOk } from "@polywrap/result"; +import { Result, ResultErr, ResultOk } from "@polywrap/result"; export const getImplementations = Tracer.traceFunc( "core: getImplementations", - ( + async ( wrapperInterfaceUri: Uri, interfaces: readonly InterfaceImplementations[], - redirects?: readonly IUriRedirect[] - ): Result => { + client?: CoreClient, + resolutionContext?: IUriResolutionContext + ): Promise> => { const result: Uri[] = []; const addUniqueResult = (uri: Uri) => { @@ -20,16 +23,17 @@ export const getImplementations = Tracer.traceFunc( } }; - const addAllImplementationsFromImplementationsArray = ( + const addAllImplementationsFromImplementationsArray = async ( implementationsArray: readonly InterfaceImplementations[], wrapperInterfaceUri: Uri - ): Result => { + ): Promise> => { for (const interfaceImplementations of implementationsArray) { let fullyResolvedUri: Uri; - if (redirects) { - const redirectsResult = applyRedirects( + if (client) { + const redirectsResult = await applyResolution( interfaceImplementations.interface, - redirects + client, + resolutionContext ); if (!redirectsResult.ok) { return redirectsResult; @@ -50,19 +54,25 @@ export const getImplementations = Tracer.traceFunc( let finalUri = wrapperInterfaceUri; - if (redirects) { - const redirectsResult = applyRedirects(wrapperInterfaceUri, redirects); + if (client) { + const redirectsResult = await applyResolution( + wrapperInterfaceUri, + client, + resolutionContext + ); if (!redirectsResult.ok) { - return redirectsResult; + return ResultErr(new GetImplementationsError(redirectsResult.error)); } finalUri = redirectsResult.value; } - const addAllImp = addAllImplementationsFromImplementationsArray( + const addAllImp = await addAllImplementationsFromImplementationsArray( interfaces, finalUri ); - return addAllImp.ok ? ResultOk(result) : addAllImp; + return addAllImp.ok + ? ResultOk(result) + : ResultErr(new GetImplementationsError(addAllImp.error)); } ); diff --git a/packages/js/core/src/algorithms/index.ts b/packages/js/core/src/algorithms/index.ts index d23f3cff6f..5697df29a7 100644 --- a/packages/js/core/src/algorithms/index.ts +++ b/packages/js/core/src/algorithms/index.ts @@ -1,3 +1,4 @@ -export * from "./apply-redirects"; +export * from "./GetImplementationsError"; +export * from "./applyResolution"; export * from "./get-implementations"; export * from "./parse-query"; diff --git a/packages/js/core/src/types/CoreClient.ts b/packages/js/core/src/types/CoreClient.ts index da9e739f72..5537cd5f6d 100644 --- a/packages/js/core/src/types/CoreClient.ts +++ b/packages/js/core/src/types/CoreClient.ts @@ -2,19 +2,17 @@ import { QueryHandler, Invoker, SubscriptionHandler, - IUriRedirect, Uri, InterfaceImplementations, Env, } from "."; -import { IUriResolver } from "../uri-resolution"; +import { IUriResolutionContext, IUriResolver } from "../uri-resolution"; import { UriResolverHandler } from "./UriResolver"; import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; import { Result } from "@polywrap/result"; export interface CoreClientConfig { - readonly redirects?: Readonly[]>; readonly interfaces?: Readonly[]>; readonly envs?: Readonly[]>; readonly resolver: Readonly>; @@ -30,7 +28,8 @@ export interface GetFileOptions { } export interface GetImplementationsOptions { - applyRedirects?: boolean; + applyResolution?: boolean; + resolutionContext?: IUriResolutionContext; } export interface CoreClient @@ -40,15 +39,13 @@ export interface CoreClient UriResolverHandler { getConfig(): CoreClientConfig; - getRedirects(): readonly IUriRedirect[] | undefined; - getInterfaces(): readonly InterfaceImplementations[] | undefined; getEnvs(): readonly Env[] | undefined; getEnvByUri(uri: TUri): Env | undefined; - getUriResolver(): IUriResolver; + getResolver(): IUriResolver; getManifest( uri: TUri @@ -62,5 +59,5 @@ export interface CoreClient getImplementations( uri: TUri, options: GetImplementationsOptions - ): Result; + ): Promise>; } diff --git a/packages/js/uri-resolver-extensions/src/ExtendableUriResolver.ts b/packages/js/uri-resolver-extensions/src/ExtendableUriResolver.ts index 27e04e2e62..2c22b35843 100644 --- a/packages/js/uri-resolver-extensions/src/ExtendableUriResolver.ts +++ b/packages/js/uri-resolver-extensions/src/ExtendableUriResolver.ts @@ -4,12 +4,11 @@ import { Uri, CoreClient, IUriResolver, - getImplementations, coreInterfaceUris, IUriResolutionContext, UriPackageOrWrapper, } from "@polywrap/core-js"; -import { Result, ResultOk } from "@polywrap/result"; +import { Result, ResultErr, ResultOk } from "@polywrap/result"; import { UriResolverAggregatorBase, UriResolutionResult, @@ -31,14 +30,15 @@ export class ExtendableUriResolver extends UriResolverAggregatorBase< client: CoreClient, resolutionContext: IUriResolutionContext ): Promise[], Error>> { - const getImplementationsResult = getImplementations( + const getImplementationsResult = await client.getImplementations( coreInterfaceUris.uriResolver, - client.getInterfaces() ?? [], - client.getRedirects() ?? [] + { + resolutionContext: resolutionContext.createSubContext(), + } ); if (!getImplementationsResult.ok) { - return getImplementationsResult; + return ResultErr(getImplementationsResult.error); } const uriResolverImpls = getImplementationsResult.value; diff --git a/packages/js/uri-resolvers/src/__tests__/redirects.spec.ts b/packages/js/uri-resolvers/src/__tests__/redirects.spec.ts new file mode 100644 index 0000000000..8d89d8b7f4 --- /dev/null +++ b/packages/js/uri-resolvers/src/__tests__/redirects.spec.ts @@ -0,0 +1,166 @@ +import { + Uri, + CoreClient, + UriResolutionContext, +} from "@polywrap/core-js"; +import { InfiniteLoopError, RecursiveResolver, UriResolver } from "../helpers"; +import { StaticResolver } from "../static"; + +describe("redirects", () => { + it("sanity - UriResolver", async () => { + const uri1 = "wrap://ens/some-uri1.eth"; + const uri2 = "wrap://ens/some-uri2.eth"; + const resolver = UriResolver.from([ + { from: uri1, to: uri2 } + ]); + + const redirectsResult = await resolver.tryResolveUri(new Uri(uri1), {} as CoreClient, new UriResolutionContext()); + + if (!redirectsResult.ok) { + fail(redirectsResult.error); + } + + if (redirectsResult.value.type !== "uri") { + console.log(`Expected URI, received: `, redirectsResult.value); + fail(); + } + + expect(redirectsResult.value.uri.uri).toEqual(uri2); + }); + + it("sanity - StaticResolver", async () => { + const uri1 = "wrap://ens/some-uri1.eth"; + const uri2 = "wrap://ens/some-uri2.eth"; + const resolver = StaticResolver.from([ + { from: uri1, to: uri2 } + ]); + + const redirectsResult = await resolver.tryResolveUri(new Uri(uri1), {} as CoreClient, new UriResolutionContext()); + + if (!redirectsResult.ok) { + fail(redirectsResult.error); + } + + if (redirectsResult.value.type !== "uri") { + console.log(`Expected URI, received: `, redirectsResult.value); + fail(); + } + + expect(redirectsResult.value.uri.uri).toEqual(uri2); + }); + + it("works with the redirect stack overrides - RecursiveResolver", async () => { + const uri1 = "wrap://ens/some-uri1.eth"; + const uri2 = "wrap://ens/some-uri2.eth"; + const uri3 = "wrap://ens/some-uri3.eth"; + + const resolver = RecursiveResolver.from([ + { + from: new Uri(uri1), + to: new Uri(uri2) + }, + { + from: new Uri(uri2), + to: new Uri(uri3) + } + ]); + + const redirectsResult = await resolver.tryResolveUri(new Uri(uri1), {} as CoreClient, new UriResolutionContext()); + + if (!redirectsResult.ok) { + fail(redirectsResult.error); + } + + if (redirectsResult.value.type !== "uri") { + console.log(`Expected URI, received: `, redirectsResult.value); + fail(); + } + + expect(redirectsResult.value.uri.uri).toEqual(uri3); + }); + + it("works with the redirect stack overrides - RecursiveResolver with StaticResolver", async () => { + const uri1 = "wrap://ens/some-uri1.eth"; + const uri2 = "wrap://ens/some-uri2.eth"; + const uri3 = "wrap://ens/some-uri3.eth"; + + const resolver = RecursiveResolver.from( + StaticResolver.from([ + { + from: new Uri(uri1), + to: new Uri(uri2) + }, + { + from: new Uri(uri2), + to: new Uri(uri3) + } + ]) + ); + + const redirectsResult = await resolver.tryResolveUri(new Uri(uri1), {} as CoreClient, new UriResolutionContext()); + + if (!redirectsResult.ok) { + fail(redirectsResult.error); + } + + if (redirectsResult.value.type !== "uri") { + console.log(`Expected URI, received: `, redirectsResult.value); + fail(); + } + + expect(redirectsResult.value.uri.uri).toEqual(uri3); + }); + + it("can not redirect to self - RecursiveResolver", async () => { + const uri1 = "wrap://ens/some-uri1.eth"; + const uri2 = "wrap://ens/some-uri2.eth"; + + const resolver = RecursiveResolver.from([ + { + from: new Uri(uri1), + to: new Uri(uri2) + }, + { + from: new Uri(uri2), + to: new Uri(uri1) + }, + ]); + + const redirectsResult = await resolver.tryResolveUri(new Uri(uri1), {} as CoreClient, new UriResolutionContext()); + + if (redirectsResult.ok) { + console.log(`Expected error`, redirectsResult.value); + fail(); + } + + expect((redirectsResult.error as InfiniteLoopError).message).toContain("An infinite loop was detected while resolving the URI"); + }); + + + it("can not redirect to self - RecursiveResolver with StaticResolver", async () => { + const uri1 = "wrap://ens/some-uri1.eth"; + const uri2 = "wrap://ens/some-uri2.eth"; + + const resolver = RecursiveResolver.from( + StaticResolver.from([ + { + from: new Uri(uri1), + to: new Uri(uri2) + }, + { + from: new Uri(uri2), + to: new Uri(uri1) + }, + ] + )); + + const redirectsResult = await resolver.tryResolveUri(new Uri(uri1), {} as CoreClient, new UriResolutionContext()); + + if (redirectsResult.ok) { + console.log(`Expected error`, redirectsResult.value); + fail(); + } + + expect((redirectsResult.error as InfiniteLoopError).message).toContain("An infinite loop was detected while resolving the URI"); + }); +}); diff --git a/packages/js/uri-resolvers/src/index.ts b/packages/js/uri-resolvers/src/index.ts index 78d2434370..7087ce5ba6 100644 --- a/packages/js/uri-resolvers/src/index.ts +++ b/packages/js/uri-resolvers/src/index.ts @@ -1,6 +1,5 @@ export * from "./aggregator"; export * from "./cache"; -export * from "./legacy"; export * from "./redirects"; export * from "./packages"; export * from "./helpers"; diff --git a/packages/js/uri-resolvers/src/legacy/LegacyRedirectsResolver.ts b/packages/js/uri-resolvers/src/legacy/LegacyRedirectsResolver.ts deleted file mode 100644 index 216b1e96c3..0000000000 --- a/packages/js/uri-resolvers/src/legacy/LegacyRedirectsResolver.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { RedirectResolver } from ".."; -import { UriResolverAggregator } from ".."; - -import { Uri, CoreClient } from "@polywrap/core-js"; - -export class LegacyRedirectsResolver extends UriResolverAggregator { - constructor() { - super( - async (uri: Uri, client: CoreClient) => - client - .getRedirects() - ?.map( - (redirect) => new RedirectResolver(redirect.from, redirect.to) - ) ?? [], - "LegacyRedirectsResolver" - ); - } -} diff --git a/packages/js/uri-resolvers/src/legacy/index.ts b/packages/js/uri-resolvers/src/legacy/index.ts deleted file mode 100644 index c2822150ff..0000000000 --- a/packages/js/uri-resolvers/src/legacy/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./LegacyRedirectsResolver"; diff --git a/packages/js/wasm/src/imports.ts b/packages/js/wasm/src/imports.ts index 4cecf0ae82..583e34a6ce 100644 --- a/packages/js/wasm/src/imports.ts +++ b/packages/js/wasm/src/imports.ts @@ -173,9 +173,12 @@ export const createImports = (config: { __wrap_invoke_error: (ptr: u32, len: u32): void => { state.invoke.error = readString(memory.buffer, ptr, len); }, - __wrap_getImplementations: (uriPtr: u32, uriLen: u32): boolean => { + __wrap_getImplementations: async ( + uriPtr: u32, + uriLen: u32 + ): Promise => { const uri = readString(memory.buffer, uriPtr, uriLen); - const result = client.getImplementations(uri, {}); + const result = await client.getImplementations(uri, {}); if (!result.ok) { abort(result.error?.message as string); return false; diff --git a/packages/js/wasm/src/types.ts b/packages/js/wasm/src/types.ts index e12acfab1f..b34f25c1e6 100644 --- a/packages/js/wasm/src/types.ts +++ b/packages/js/wasm/src/types.ts @@ -38,7 +38,7 @@ export interface WrapImports extends WebAssembly.Imports { __wrap_invoke_args: (methodPtr: u32, argsPtr: u32) => void; __wrap_invoke_result: (ptr: u32, len: u32) => void; __wrap_invoke_error: (ptr: u32, len: u32) => void; - __wrap_getImplementations: (uriPtr: u32, uriLen: u32) => boolean; + __wrap_getImplementations: (uriPtr: u32, uriLen: u32) => Promise; __wrap_getImplementations_result_len: () => u32; __wrap_getImplementations_result: (ptr: u32) => void; __wrap_abort: ( diff --git a/packages/templates/wasm/assemblyscript/src/__tests__/utils.ts b/packages/templates/wasm/assemblyscript/src/__tests__/utils.ts deleted file mode 100644 index d57390c992..0000000000 --- a/packages/templates/wasm/assemblyscript/src/__tests__/utils.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { CoreClientConfig } from "@polywrap/client-js"; -import { ensResolverPlugin } from "@polywrap/ens-resolver-plugin-js"; -import { - Connection, - Connections, - ethereumPlugin, -} from "@polywrap/ethereum-plugin-js"; -import { ipfsPlugin } from "@polywrap/ipfs-plugin-js"; - -export function getPlugins( - ethereum: string, - ipfs: string, - ensAddress: string -): Partial { - return { - redirects: [], - plugins: [ - { - uri: "wrap://ens/ipfs.polywrap.eth", - plugin: ipfsPlugin({ provider: ipfs }), - }, - { - uri: "wrap://ens/ens-resolver.polywrap.eth", - plugin: ensResolverPlugin({ addresses: { testnet: ensAddress } }), - }, - { - uri: "wrap://ens/ethereum.polywrap.eth", - plugin: ethereumPlugin({ - connections: new Connections({ - networks: { - testnet: new Connection({ provider: ethereum }), - mainnet: new Connection({ provider: "http://localhost:8546" }), - }, - defaultNetwork: "testnet", - }), - }), - }, - ], - }; -} diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/assemblyscript/014-override-config/config.ts b/packages/test-cases/cases/cli/wasm/build-cmd/assemblyscript/014-override-config/config.ts index 4a08a4bd6a..f2d061717c 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/assemblyscript/014-override-config/config.ts +++ b/packages/test-cases/cases/cli/wasm/build-cmd/assemblyscript/014-override-config/config.ts @@ -1,4 +1,4 @@ -import { BaseClientConfigBuilder, getDefaultConfig, IClientConfigBuilder, CoreClientConfig, ExtendableUriResolver, LegacyRedirectsResolver, PackageToWrapperCacheResolver, RecursiveResolver, StaticResolver, Uri, WrapperCache } from "@polywrap/client-js"; +import { BaseClientConfigBuilder, getDefaultConfig, IClientConfigBuilder, CoreClientConfig, ExtendableUriResolver, PackageToWrapperCacheResolver, RecursiveResolver, StaticResolver, Uri, WrapperCache } from "@polywrap/client-js"; import { PluginModule, PluginPackage } from "@polywrap/plugin-js"; import { latestWrapManifestVersion } from "@polywrap/wrap-manifest-types-js"; @@ -11,13 +11,12 @@ export class CustomConfigBuilder extends BaseClientConfigBuilder { return { envs: this.config.envs, interfaces: this.config.interfaces, - redirects: this.config.redirects, resolver: RecursiveResolver.from( PackageToWrapperCacheResolver.from( [ - new LegacyRedirectsResolver(), StaticResolver.from([ + ...this.config.redirects, ...this.config.wrappers, ...this.config.packages, ]), diff --git a/packages/test-cases/cases/cli/wasm/codegen/007-override-config/config.ts b/packages/test-cases/cases/cli/wasm/codegen/007-override-config/config.ts index aa60c034bb..bd1193c312 100644 --- a/packages/test-cases/cases/cli/wasm/codegen/007-override-config/config.ts +++ b/packages/test-cases/cases/cli/wasm/codegen/007-override-config/config.ts @@ -1,4 +1,4 @@ -import { BaseClientConfigBuilder, getDefaultConfig, IClientConfigBuilder, CoreClientConfig, ExtendableUriResolver, LegacyRedirectsResolver, PackageToWrapperCacheResolver, RecursiveResolver, StaticResolver, Uri, WrapperCache } from "@polywrap/client-js"; +import { BaseClientConfigBuilder, getDefaultConfig, IClientConfigBuilder, CoreClientConfig, ExtendableUriResolver, PackageToWrapperCacheResolver, RecursiveResolver, StaticResolver, Uri, WrapperCache } from "@polywrap/client-js"; import { PluginModule, PluginPackage } from "@polywrap/plugin-js"; import { latestWrapManifestVersion } from "@polywrap/schema-parse"; @@ -11,13 +11,12 @@ export class CustomConfigBuilder extends BaseClientConfigBuilder { return { envs: this.config.envs, interfaces: this.config.interfaces, - redirects: this.config.redirects, resolver: RecursiveResolver.from( PackageToWrapperCacheResolver.from( [ - new LegacyRedirectsResolver(), StaticResolver.from([ + ...this.config.redirects, ...this.config.wrappers, ...this.config.packages, ]), diff --git a/yarn.lock b/yarn.lock index 2c20285bdf..5dd9b586d4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -125,9 +125,9 @@ "@babel/highlight" "^7.18.6" "@babel/compat-data@^7.17.7", "@babel/compat-data@^7.19.4", "@babel/compat-data@^7.20.0", "@babel/compat-data@^7.9.0": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.20.0.tgz#9b61938c5f688212c7b9ae363a819df7d29d4093" - integrity sha512-Gt9jszFJYq7qzXVK4slhc6NzJXnOVmRECWcVjF/T23rNXD9NtWQ0W3qxdg+p9wWIB+VQw3GYV/U2Ha9bRTfs4w== + version "7.20.1" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.20.1.tgz#f2e6ef7790d8c8dbf03d379502dcc246dcce0b30" + integrity sha512-EWZ4mE2diW3QALKvDMiXnbZpRvlj+nayZ112nK93SnhqOtpdsbVD4W+2tEoT3YNBAG9RBR0ISY758ZkOgsn6pQ== "@babel/core@7.9.0": version "7.9.0" @@ -172,10 +172,10 @@ json5 "^2.2.1" semver "^6.3.0" -"@babel/generator@^7.19.6", "@babel/generator@^7.20.0", "@babel/generator@^7.4.0", "@babel/generator@^7.9.0": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.20.0.tgz#0bfc5379e0efb05ca6092091261fcdf7ec36249d" - integrity sha512-GUPcXxWibClgmYJuIwC2Bc2Lg+8b9VjaJ+HlNdACEVt+Wlr1eoU1OPZjZRm7Hzl0gaTsUZNQfeihvZJhG7oc3w== +"@babel/generator@^7.19.6", "@babel/generator@^7.20.1", "@babel/generator@^7.4.0", "@babel/generator@^7.9.0": + version "7.20.1" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.20.1.tgz#ef32ecd426222624cbd94871a7024639cf61a9fa" + integrity sha512-u1dMdBUmA7Z0rBB97xh8pIhviK7oItYOkjbsCxTWMknyvbQRBwX7/gn4JXurRdirWMFh+ZtYARqkA6ydogVZpg== dependencies: "@babel/types" "^7.20.0" "@jridgewell/gen-mapping" "^0.3.2" @@ -374,12 +374,12 @@ "@babel/types" "^7.19.0" "@babel/helpers@^7.19.4", "@babel/helpers@^7.9.0": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.20.0.tgz#27c8ffa8cc32a2ed3762fba48886e7654dbcf77f" - integrity sha512-aGMjYraN0zosCEthoGLdqot1oRsmxVTQRHadsUPz5QM44Zej2PYRz7XiDE7GqnkZnNtLbOuxqoZw42vkU7+XEQ== + version "7.20.1" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.20.1.tgz#2ab7a0fcb0a03b5bf76629196ed63c2d7311f4c9" + integrity sha512-J77mUVaDTUJFZ5BpP6mMn6OIl3rEWymk2ZxDBQJUG3P+PbmyMcF3bYWvz0ma69Af1oobDqT/iAsvzhB58xhQUg== dependencies: "@babel/template" "^7.18.10" - "@babel/traverse" "^7.20.0" + "@babel/traverse" "^7.20.1" "@babel/types" "^7.20.0" "@babel/highlight@^7.18.6", "@babel/highlight@^7.8.3": @@ -391,10 +391,10 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.18.10", "@babel/parser@^7.19.6", "@babel/parser@^7.20.0", "@babel/parser@^7.4.3", "@babel/parser@^7.7.0", "@babel/parser@^7.9.0": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.0.tgz#b26133c888da4d79b0d3edcf42677bcadc783046" - integrity sha512-G9VgAhEaICnz8iiJeGJQyVl6J2nTjbW0xeisva0PK6XcKsga7BIaqm4ZF8Rg1Wbaqmy6znspNqhPaPkyukujzg== +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.18.10", "@babel/parser@^7.19.6", "@babel/parser@^7.20.1", "@babel/parser@^7.4.3", "@babel/parser@^7.7.0", "@babel/parser@^7.9.0": + version "7.20.1" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.1.tgz#3e045a92f7b4623cafc2425eddcb8cf2e54f9cc5" + integrity sha512-hp0AYxaZJhxULfM1zyp7Wgr+pSUKBcP3M+PHnSzWGdXOzg/kHWIgiUWARvubhUKGOEw3xqY4x+lyZ9ytBVcELw== "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.18.6": version "7.18.6" @@ -413,9 +413,9 @@ "@babel/plugin-proposal-optional-chaining" "^7.18.9" "@babel/plugin-proposal-async-generator-functions@^7.19.1", "@babel/plugin-proposal-async-generator-functions@^7.8.3": - version "7.19.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.19.1.tgz#34f6f5174b688529342288cd264f80c9ea9fb4a7" - integrity sha512-0yu8vNATgLy4ivqMNBIwb1HebCelqN7YX8SL3FDXORv/RqT0zEEWUCH4GH44JsSrvCu6GqnAdR5EBFAPeNBB4Q== + 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.19.0" @@ -908,11 +908,11 @@ "@babel/helper-replace-supers" "^7.18.6" "@babel/plugin-transform-parameters@^7.18.8", "@babel/plugin-transform-parameters@^7.8.7": - version "7.18.8" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.18.8.tgz#ee9f1a0ce6d78af58d0956a9378ea3427cccb48a" - integrity sha512-ivfbE3X2Ss+Fj8nnXvKJS6sjRG4gzwPMsP+taZC+ZzEGjAYlvENixmt1sZ5Ca6tWls+BlKSGKPJ6OOXvXCbkFg== + version "7.20.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.20.1.tgz#9a5aa370fdcce36f110455e9369db7afca0f9eeb" + integrity sha512-nDvKLrAvl+kf6BOy1UJ3MGwzzfTMgppxwiD2Jb4LO3xjYyZq30oQzDNJbCQpMdG9+j2IXHoiMrw5Cm/L6ZoxXQ== dependencies: - "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-plugin-utils" "^7.19.0" "@babel/plugin-transform-property-literals@^7.18.6", "@babel/plugin-transform-property-literals@^7.8.3": version "7.18.6" @@ -1258,9 +1258,9 @@ "@babel/plugin-transform-typescript" "^7.9.0" "@babel/runtime-corejs3@^7.10.2", "@babel/runtime-corejs3@^7.12.1": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.20.0.tgz#56ef7af3cd23d1570969809a5a8782e774e0141a" - integrity sha512-v1JH7PeAAGBEyTQM9TqojVl+b20zXtesFKCJHu50xMxZKD1fX0TKaKHPsZfFkXfs7D1M9M6Eeqg1FkJ3a0x2dA== + version "7.20.1" + resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.20.1.tgz#d0775a49bb5fba77e42cbb7276c9955c7b05af8d" + integrity sha512-CGulbEDcg/ND1Im7fUNRZdGXmX2MTWVVZacQi/6DiKE5HNwZ3aVTm5PV4lO8HHz0B2h8WQyvKKjbX5XgTtydsg== dependencies: core-js-pure "^3.25.1" regenerator-runtime "^0.13.10" @@ -1273,9 +1273,9 @@ regenerator-runtime "^0.13.4" "@babel/runtime@^7.0.0", "@babel/runtime@^7.10.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.3.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.20.0.tgz#824a9ef325ffde6f78056059db3168c08785e24a" - integrity sha512-NDYdls71fTXoU8TZHfbBWg7DiZfNzClcKui/+kyi6ppD2L1qnWW3VV6CjtaBXSUGGhiTWJ6ereOIkUvenif66Q== + version "7.20.1" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.20.1.tgz#1148bb33ab252b165a06698fde7576092a78b4a9" + integrity sha512-mrzLkl6U9YLF8qpqI7TB82PESyEGjm/0Ly91jG575eVxMMlb8fYfOXFZIJ8XfLrJZQbm7dlKry2bJmXBUEkdFg== dependencies: regenerator-runtime "^0.13.10" @@ -1288,18 +1288,18 @@ "@babel/parser" "^7.18.10" "@babel/types" "^7.18.10" -"@babel/traverse@^7.1.0", "@babel/traverse@^7.19.0", "@babel/traverse@^7.19.1", "@babel/traverse@^7.19.6", "@babel/traverse@^7.20.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.7.0", "@babel/traverse@^7.9.0": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.20.0.tgz#538c4c6ce6255f5666eba02252a7b59fc2d5ed98" - integrity sha512-5+cAXQNARgjRUK0JWu2UBwja4JLSO/rBMPJzpsKb+oBF5xlUuCfljQepS4XypBQoiigL0VQjTZy6WiONtUdScQ== +"@babel/traverse@^7.1.0", "@babel/traverse@^7.19.0", "@babel/traverse@^7.19.1", "@babel/traverse@^7.19.6", "@babel/traverse@^7.20.1", "@babel/traverse@^7.4.3", "@babel/traverse@^7.7.0", "@babel/traverse@^7.9.0": + version "7.20.1" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.20.1.tgz#9b15ccbf882f6d107eeeecf263fbcdd208777ec8" + integrity sha512-d3tN8fkVJwFLkHkBN479SOsw4DMZnz8cdbL/gvuDuzy3TS6Nfw80HuQqhw1pITbIruHyh7d1fMA47kWzmcUEGA== dependencies: "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.20.0" + "@babel/generator" "^7.20.1" "@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.0" + "@babel/parser" "^7.20.1" "@babel/types" "^7.20.0" debug "^4.1.0" globals "^11.1.0" @@ -3310,9 +3310,9 @@ integrity sha512-1P1OROm/rdubP5aFDSZQILU0vrLCJ4fvHt6EoqHEM+2D/G5MK3bIaymUKLit8Js9gbns5UyJnkP/TZROLw4tUA== "@sinonjs/commons@^1.7.0": - version "1.8.3" - resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.3.tgz#3802ddd21a50a949b6721ddd72da36e67e7f1b2d" - integrity sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ== + version "1.8.4" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.4.tgz#d1f2d80f1bd0f2520873f161588bd9b7f8567120" + integrity sha512-RpmQdHVo8hCEHDVpO39zToS9jOhR6nw+/lQAzRNq9ErrGV9IeHM71XCn68svVl/euFeVW6BWX4p35gkhbOcSIQ== dependencies: type-detect "4.0.8" @@ -3635,9 +3635,9 @@ integrity sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw== "@types/lodash@^4.14.182": - version "4.14.186" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.186.tgz#862e5514dd7bd66ada6c70ee5fce844b06c8ee97" - integrity sha512-eHcVlLXP0c2FlMPm56ITode2AgLMSa6aJ05JTTbYbI+7EMkCEE5qk2E41d5g2lCVTqRe0GnnRFurmlCsDODrPw== + version "4.14.187" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.187.tgz#122ff0a7192115b4c1a19444ab4482caa77e2c9d" + integrity sha512-MrO/xLXCaUgZy3y96C/iOsaIqZSeupyTImKClHunL5GrmaiII2VwvWmLBu2hwa0Kp0sV19CsyjtrTc/Fx8rg/A== "@types/minimatch@*": version "5.1.2" @@ -3660,9 +3660,9 @@ integrity sha512-wH6Tu9mbiOt0n5EvdoWy0VGQaJMHfLIxY/6wS0xLC7CV1taM6gESEzcYy0ZlWvxxiiljYvfDIvz4hHbUUDRlhw== "@types/node@*": - version "18.11.7" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.7.tgz#8ccef136f240770c1379d50100796a6952f01f94" - integrity sha512-LhFTglglr63mNXUSRYD8A+ZAIu5sFqNJ4Y2fPuY7UlrySJH87rRRlhtVmMHplmfk5WkoJGmDjE9oiTfyX94CpQ== + version "18.11.9" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.9.tgz#02d013de7058cea16d36168ef2fc653464cfbad4" + integrity sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg== "@types/node@12.12.26": version "12.12.26" @@ -4491,23 +4491,23 @@ array-unique@^0.3.2: integrity sha512-SleRWjh9JUud2wH1hPs9rZBZ33H6T9HOiL0uwGnGx9FpE6wKGyfWugmbkEOIs6qWrZhg0LWeLziLrEwQJhs5mQ== array.prototype.flat@^1.2.1, array.prototype.flat@^1.2.3: - version "1.3.0" - resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.3.0.tgz#0b0c1567bf57b38b56b4c97b8aa72ab45e4adc7b" - integrity sha512-12IUEkHsAhA4DY5s0FPgNXIdc8VRSqD9Zp78a5au9abH/SOBrsp082JOWFNTjkMozh8mqcdiKuaLGhPeYztxSw== + version "1.3.1" + resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz#ffc6576a7ca3efc2f46a143b9d1dda9b4b3cf5e2" + integrity sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA== dependencies: call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.2" + define-properties "^1.1.4" + es-abstract "^1.20.4" es-shim-unscopables "^1.0.0" array.prototype.reduce@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/array.prototype.reduce/-/array.prototype.reduce-1.0.4.tgz#8167e80089f78bff70a99e20bd4201d4663b0a6f" - integrity sha512-WnM+AjG/DvLRLo4DDl+r+SvCzYtD2Jd9oeBYMcEaI7t3fFrHY9M53/wdLcTvmZNQ70IU6Htj0emFkZ5TS+lrdw== + version "1.0.5" + resolved "https://registry.yarnpkg.com/array.prototype.reduce/-/array.prototype.reduce-1.0.5.tgz#6b20b0daa9d9734dd6bc7ea66b5bbce395471eac" + integrity sha512-kDdugMl7id9COE8R7MHF5jWk7Dqt/fs4Pv+JXoICnYwqpjjjbUurz6w5fT5IG6brLdJhv6/VoHB0H7oyIBXd+Q== dependencies: call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.2" + define-properties "^1.1.4" + es-abstract "^1.20.4" es-array-method-boxes-properly "^1.0.0" is-string "^1.0.7" @@ -5430,9 +5430,9 @@ call-bind@^1.0.0, call-bind@^1.0.2: get-intrinsic "^1.0.2" call-me-maybe@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b" - integrity sha512-wCyFsDQkKPwwF8BDwOiWNx/9K45L/hvggQiDbve+viMNMQnWhrlYIuBk09offfwCRtCO9P6XwUttufzU11WCVw== + version "1.0.2" + resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.2.tgz#03f964f19522ba643b1b0693acb9152fe2074baa" + integrity sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ== caller-callsite@^2.0.0: version "2.0.0" @@ -5501,9 +5501,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.30001426" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001426.tgz#58da20446ccd0cb1dfebd11d2350c907ee7c2eaa" - integrity sha512-n7cosrHLl8AWt0wwZw/PJZgUg3lV0gk9LMI7ikGJwhyhgsd2Nb65vKvmSexCqq/J7rbH3mFG6yZZiPR5dLPW5A== + version "1.0.30001430" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001430.tgz#638a8ae00b5a8a97e66ff43733b2701f81b101fa" + integrity sha512-IB1BXTZKPDVPM7cnV4iaKaHxckvdr/3xtctB3f7Hmenx3qYBhGtTZ//7EllK66aKXW98Lx0+7Yr0kxBtIt3tzg== capture-exit@^2.0.0: version "2.0.0" @@ -6665,9 +6665,9 @@ debuglog@^1.0.1: integrity sha512-syBZ+rnAK3EgMsH2aYEOLUW7mZSY9Gb+0wUMCFsZvcmiz+HigA0LOcq/HoQqVuGG+EKykunc7QG2bzrponfaSw== decamelize-keys@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9" - integrity sha512-ocLWuYzRPoS9bfiSdDd3cxvrzovVMZnRDVEzAs+hWIVXGDbHxWMECij2OBuyB/An0FFW/nLuq6Kv1i/YC5Qfzg== + version "1.1.1" + resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.1.tgz#04a2d523b2f18d80d0158a43b895d56dff8d19d8" + integrity sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg== dependencies: decamelize "^1.1.0" map-obj "^1.0.0" @@ -7252,7 +7252,7 @@ error-ex@^1.2.0, error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" -es-abstract@^1.17.2, es-abstract@^1.19.0, es-abstract@^1.19.1, es-abstract@^1.19.2, es-abstract@^1.19.5, es-abstract@^1.20.0, es-abstract@^1.20.1: +es-abstract@^1.17.2, es-abstract@^1.19.0, es-abstract@^1.19.1, es-abstract@^1.19.5, es-abstract@^1.20.1, es-abstract@^1.20.4: version "1.20.4" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.20.4.tgz#1d103f9f8d78d4cf0713edcd6d0ed1a46eed5861" integrity sha512-0UtvRN79eMe2L+UNEF1BwRe364sj/DXhQ/k5FmivgoSdpM90b8Jc0mDzKMGo7QS0BVbOP/bTwBKNnDc9rNzaPA== @@ -8764,6 +8764,13 @@ globby@^6.1.0: pify "^2.0.0" pinkie-promise "^2.0.0" +gopd@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" + integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== + dependencies: + get-intrinsic "^1.1.3" + graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.2, graceful-fs@^4.2.3, graceful-fs@^4.2.4: version "4.2.10" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" @@ -9995,15 +10002,15 @@ is-text-path@^1.0.1: dependencies: text-extensions "^1.0.0" -is-typed-array@^1.1.3, is-typed-array@^1.1.9: - version "1.1.9" - resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.9.tgz#246d77d2871e7d9f5aeb1d54b9f52c71329ece67" - integrity sha512-kfrlnTTn8pZkfpJMUgYD7YZ3qzeJgWUn8XfVYBARc4wnmNOmLbmuuaAs3q5fvB0UJOn6yHAKaGTPM7d6ezoD/A== +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== dependencies: available-typed-arrays "^1.0.5" call-bind "^1.0.2" - es-abstract "^1.20.0" for-each "^0.3.3" + gopd "^1.0.1" has-tostringtag "^1.0.0" is-typedarray@^1.0.0, is-typedarray@~1.0.0: @@ -11684,9 +11691,9 @@ long@^4.0.0: integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== long@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/long/-/long-5.2.0.tgz#2696dadf4b4da2ce3f6f6b89186085d94d52fd61" - integrity sha512-9RTUNjK60eJbx3uz+TEGF7fUr29ZDxR5QzXcyDpeSfeH28S9ycINflOgOlppit5U+4kNTe83KQnMEerw7GmE8w== + version "5.2.1" + resolved "https://registry.yarnpkg.com/long/-/long-5.2.1.tgz#e27595d0083d103d2fa2c20c7699f8e0c92b897f" + integrity sha512-GKSNGeNAtw8IryjjkhZxuKB3JzlcLTwjtiQCHKvqQet81I93kXslhDQruGI/QsddO83mcDToBVy7GqGS/zYf/A== loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0: version "1.4.0" @@ -16487,9 +16494,9 @@ table@^5.2.3: string-width "^3.0.0" table@^6.0.4, table@^6.7.1: - version "6.8.0" - resolved "https://registry.yarnpkg.com/table/-/table-6.8.0.tgz#87e28f14fa4321c3377ba286f07b79b281a3b3ca" - integrity sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA== + version "6.8.1" + resolved "https://registry.yarnpkg.com/table/-/table-6.8.1.tgz#ea2b71359fe03b017a5fbc296204471158080bdf" + integrity sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA== dependencies: ajv "^8.0.1" lodash.truncate "^4.4.2" @@ -16516,9 +16523,9 @@ tar@^4.4.12: yallist "^3.1.1" tar@^6.0.2, tar@^6.1.0: - version "6.1.11" - resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.11.tgz#6760a38f003afa1b2ffd0ffe9e9abbd0eab3d621" - integrity sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA== + version "6.1.12" + resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.12.tgz#3b742fb05669b55671fb769ab67a7791ea1a62e6" + integrity sha512-jU4TdemS31uABHd+Lt5WEYJuzn+TJTCBLljvIAHZOz6M9Os5pJ4dD+vRFLxPa/n3T0iEFzpi+0x1UfuDZYbRMw== dependencies: chownr "^2.0.0" fs-minipass "^2.0.0" @@ -16880,9 +16887,9 @@ tslib@^1.8.1, tslib@^1.9.0: integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== tslib@^2.0.3, tslib@^2.1.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" - integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== + version "2.4.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.1.tgz#0d0bfbaac2880b91e22df0768e55be9753a5b17e" + integrity sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA== tsutils@^3.17.1: version "3.21.0" @@ -17676,16 +17683,16 @@ which-module@^2.0.0: integrity sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q== which-typed-array@^1.1.2: - version "1.1.8" - resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.8.tgz#0cfd53401a6f334d90ed1125754a42ed663eb01f" - integrity sha512-Jn4e5PItbcAHyLoRDwvPj1ypu27DJbtdYXUa5zsinrUx77Uvfb0cXwwnGMTn7cjUfhhqgVQnVJCwF+7cgU7tpw== + 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== dependencies: available-typed-arrays "^1.0.5" call-bind "^1.0.2" - es-abstract "^1.20.0" for-each "^0.3.3" + gopd "^1.0.1" has-tostringtag "^1.0.0" - is-typed-array "^1.1.9" + is-typed-array "^1.1.10" which@^1.2.9, which@^1.3.0, which@^1.3.1: version "1.3.1"