Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
* See example [config.ts](https://github.com/polywrap/toolchain/blob/1096f2f4dfb35fdcc29e9b66057f91ade8b82c67/packages/test-cases/cases/cli/test/008-custom-config/config.ts).
* [PR-1348](https://github.com/polywrap/toolchain/pull/1348) **Rename `run` to `test`**
* Rename the `run` command to `test`, which uses the `test` project extension, as defined in the `polywrap.test.yaml` manifest file.
* [PR-1545](https://github.com/polywrap/toolchain/pull/1545) **Remove `config` section from test manifest
* The Polywrap Test manifest (`polywrap.test.yaml`) has been upgraded to version `0.2.0` with the following change:
* The `config` section inside `step` has been removed, and manifest migrations will warn the user regarding this change.

### JS Client
**`@polywrap/client-js`:**
Expand All @@ -22,6 +25,9 @@
* The Polywrap Client with `noDefaults: true`, no longer accepts a `plugins` field. It is expected that devs using this option will manually configure their own resolver.
* removed `getPlugins` and `getPluginByUri`. Will add `getWrapper`, `getWrapperByUri`, `getPackage`, `getPackageByUri`, in a follow up PR.
* `createPolywrapClient` function has been deprecated.
* [PR-1534](https://github.com/polywrap/toolchain/pull/1534) **Remove legacy config types from PolywrapClient**
* The `PolywrapClient`'s constructor now accepts only an optional `CoreClientConfig` type as its configuration object.
* It is now advised to use the `ClientConfigBuilder` found in `@polywrap/client-config-builder-js` and exported by `@polywrap/client-js` in order to set up their client configurations.

**`@polywrap/client-config-builder-js`:**
* [PR-1480](https://github.com/polywrap/toolchain/pull/1480) **ClientConfigBuilder-specific `BuilderConfig` Object**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"dependencies:install": "cd dependencies && yarn",
"test-wrappers:install": "lerna run generate:wrappers --scope @polywrap/test-cases",
"preinstall": "yarn dependencies:install",
"build": "yarn build:core && yarn build:interfaces && yarn link:schema && yarn build:resolver:plugins && yarn build:config && yarn build:core:client && yarn build:client && yarn build:test-env && yarn build:cli && yarn test-wrappers:install",
"build": "yarn build:core && yarn build:interfaces && yarn link:interface:deps && yarn build:resolver:plugins && yarn build:config && yarn build:core:client && yarn build:client && yarn build:test-env && yarn build:cli && yarn test-wrappers:install",
"build:core": "lerna run build --no-private --ignore @polywrap/*-plugin-js --ignore @polywrap/client-config-builder-js --ignore polywrap --ignore @polywrap/core-client-js --ignore @polywrap/client-js --ignore @polywrap/test-env-js --ignore @polywrap/*-interface --ignore @polywrap/cli-js",
"build:interfaces": "lerna run build --scope @polywrap/*-interface",
"build:resolver:plugins": "lerna run build --scope @polywrap/*-resolver-plugin-js",
Expand Down
15 changes: 2 additions & 13 deletions packages/cli/src/lib/workflow/JobRunner.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { JobResult, Status, Step } from "./types";

import {
IClientConfigBuilder,
PolywrapClient,
buildPolywrapCoreClientConfig,
} from "@polywrap/client-js";
import { IClientConfigBuilder, PolywrapClient } from "@polywrap/client-js";
import { CoreClient, MaybeAsync, Uri } from "@polywrap/core-js";
import { WorkflowJobs } from "@polywrap/polywrap-manifest-types-js";

Expand Down Expand Up @@ -182,14 +178,7 @@ export class JobRunner {
}
}

let finalClient = this._client;

if (step.config) {
const finalConfig = buildPolywrapCoreClientConfig(step.config);
finalClient = new PolywrapClient(finalConfig);
}

const invokeResult = await finalClient.invoke({
const invokeResult = await this._client.invoke({
uri: Uri.from(step.uri),
method: step.method,
args: args,
Expand Down
5 changes: 0 additions & 5 deletions packages/cli/src/lib/workflow/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import {
PolywrapClientConfig,
PolywrapCoreClientConfig,
} from "@polywrap/client-js";
import { Uri } from "@polywrap/core-js";

export interface Step {
Expand All @@ -10,7 +6,6 @@ export interface Step {
args?: {
[k: string]: unknown;
};
config?: Partial<PolywrapClientConfig> | PolywrapCoreClientConfig;
}

export enum Status {
Expand Down
82 changes: 0 additions & 82 deletions packages/js/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,88 +59,6 @@ Invoke a wrapper.

Below you will find a reference of object definitions which can be used to configure the Polywrap client. Please note that the intended way of configuring the client is to use the `ClientConfigBuilder`, as explained above.

### ClientConfig
```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<unknown>
* | IUriRedirect
* | IUriPackage
* | IUriWrapper
* | UriResolverLike[]
* */
readonly resolvers: UriResolverLike[];
}
```

### PolywrapClientConfig
```ts
/**
* Client configuration that can be passed to the PolywrapClient.
*
* @remarks
* Extends ClientConfig from @polywrap/client-js.
* The PolywrapClient converts the PolywrapClientConfig to a CoreClientConfig.
*/
export interface PolywrapClientConfig<TUri extends Uri | string = string> {
/** set environmental variables for a wrapper */
readonly envs: GenericEnv<TUri>[];

/** register interface implementations */
readonly interfaces: GenericInterfaceImplementations<TUri>[];

/** redirect invocations from one uri to another */
readonly redirects: IGenericUriRedirect<TUri>[];

/** add embedded wrappers */
readonly wrappers: IGenericUriWrapper<TUri>[];

/** add and configure embedded packages */
readonly packages: IGenericUriPackage<TUri>[];

/** customize URI resolution
*
* @remarks
* A UriResolverLike can be any one of:
* IUriResolver<unknown>
* | IUriRedirect
* | IUriPackage
* | IUriWrapper
* | UriResolverLike<TUri>[]
* */
readonly resolvers: GenericUriResolverLike<TUri>[];
/** 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<Partial<TracerConfig>>;
}
```

## PolywrapClient

### Constructor
Expand Down
10 changes: 0 additions & 10 deletions packages/js/client/readme/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,6 @@ $snippet: quickstart-invoke

Below you will find a reference of object definitions which can be used to configure the Polywrap client. Please note that the intended way of configuring the client is to use the `ClientConfigBuilder`, as explained above.

### ClientConfig
```ts
$snippet: ClientConfig
```

### PolywrapClientConfig
```ts
$snippet: PolywrapClientConfig
```

## PolywrapClient

### Constructor
Expand Down
17 changes: 8 additions & 9 deletions packages/js/client/src/PolywrapClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { InvokerOptions, TryResolveUriOptions } from "./types";
import { sanitizeUri } from "./legacy";

import { PolywrapCoreClient } from "@polywrap/core-client-js";
import {
Expand Down Expand Up @@ -79,30 +78,30 @@ export class PolywrapClient extends PolywrapCoreClient {
public getEnvByUri<TUri extends Uri | string = string>(
uri: TUri
): Env | undefined {
return super.getEnvByUri(sanitizeUri(uri));
return super.getEnvByUri(Uri.from(uri));
}

@Tracer.traceMethod("PolywrapClient: getManifest")
public async getManifest<TUri extends Uri | string = string>(
uri: TUri
): Promise<Result<WrapManifest, WrapError>> {
return super.getManifest(sanitizeUri(uri));
return super.getManifest(Uri.from(uri));
}

@Tracer.traceMethod("PolywrapClient: getFile")
public async getFile<TUri extends Uri | string = string>(
uri: TUri,
options: GetFileOptions
): Promise<Result<string | Uint8Array, WrapError>> {
return super.getFile(sanitizeUri(uri), options);
return super.getFile(Uri.from(uri), options);
}

@Tracer.traceMethod("PolywrapClient: getImplementations")
public async getImplementations<TUri extends Uri | string = string>(
uri: TUri,
options?: GetImplementationsOptions
): Promise<Result<Uri[], WrapError>> {
return super.getImplementations(sanitizeUri(uri), options);
return super.getImplementations(Uri.from(uri), options);
}

@Tracer.traceMethod("PolywrapClient: invokeWrapper")
Expand All @@ -114,7 +113,7 @@ export class PolywrapClient extends PolywrapCoreClient {
): Promise<InvokeResult<TData>> {
return super.invokeWrapper({
...options,
uri: sanitizeUri(options.uri),
uri: Uri.from(options.uri),
});
}

Expand All @@ -124,7 +123,7 @@ export class PolywrapClient extends PolywrapCoreClient {
): Promise<InvokeResult<TData>> {
return super.invoke({
...options,
uri: sanitizeUri(options.uri),
uri: Uri.from(options.uri),
});
}

Expand All @@ -134,7 +133,7 @@ export class PolywrapClient extends PolywrapCoreClient {
): Promise<Result<UriPackageOrWrapper, unknown>> {
return super.tryResolveUri({
...options,
uri: sanitizeUri(options.uri),
uri: Uri.from(options.uri),
});
}

Expand All @@ -144,7 +143,7 @@ export class PolywrapClient extends PolywrapCoreClient {
resolutionContext?: IUriResolutionContext,
options?: DeserializeManifestOptions
): Promise<Result<Wrapper, WrapError>> {
return super.loadWrapper(sanitizeUri(uri), resolutionContext, options);
return super.loadWrapper(Uri.from(uri), resolutionContext, options);
}

// $start: PolywrapCoreClient-validate
Expand Down
1 change: 0 additions & 1 deletion packages/js/client/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from "./PolywrapClient";
export * from "./legacy";
export * from "@polywrap/core-js";
export * from "@polywrap/core-client-js";
export * from "@polywrap/uri-resolvers-js";
Expand Down
45 changes: 0 additions & 45 deletions packages/js/client/src/legacy/ClientConfig.ts

This file was deleted.

55 changes: 0 additions & 55 deletions packages/js/client/src/legacy/PolywrapClientConfig.ts

This file was deleted.

15 changes: 0 additions & 15 deletions packages/js/client/src/legacy/PolywrapCoreClientConfig.ts

This file was deleted.

Loading