diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d4d6ac834..ae7c4d617a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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`:** @@ -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** diff --git a/package.json b/package.json index a602d13363..af08f3998a 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/cli/src/lib/workflow/JobRunner.ts b/packages/cli/src/lib/workflow/JobRunner.ts index cc1f36eff8..e16a8d1c05 100644 --- a/packages/cli/src/lib/workflow/JobRunner.ts +++ b/packages/cli/src/lib/workflow/JobRunner.ts @@ -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"; @@ -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, diff --git a/packages/cli/src/lib/workflow/types.ts b/packages/cli/src/lib/workflow/types.ts index 066e8a84c0..12c7b5c91a 100644 --- a/packages/cli/src/lib/workflow/types.ts +++ b/packages/cli/src/lib/workflow/types.ts @@ -1,7 +1,3 @@ -import { - PolywrapClientConfig, - PolywrapCoreClientConfig, -} from "@polywrap/client-js"; import { Uri } from "@polywrap/core-js"; export interface Step { @@ -10,7 +6,6 @@ export interface Step { args?: { [k: string]: unknown; }; - config?: Partial | PolywrapCoreClientConfig; } export enum Status { diff --git a/packages/js/client/README.md b/packages/js/client/README.md index 30950df81f..9d5ca0b146 100644 --- a/packages/js/client/README.md +++ b/packages/js/client/README.md @@ -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 - * | 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 { - /** set environmental variables for a wrapper */ - readonly envs: GenericEnv[]; - - /** register interface implementations */ - readonly interfaces: GenericInterfaceImplementations[]; - - /** redirect invocations from one uri to another */ - readonly redirects: IGenericUriRedirect[]; - - /** add embedded wrappers */ - readonly wrappers: IGenericUriWrapper[]; - - /** add and configure embedded packages */ - readonly packages: IGenericUriPackage[]; - - /** customize URI resolution - * - * @remarks - * A UriResolverLike can be any one of: - * IUriResolver - * | IUriRedirect - * | IUriPackage - * | IUriWrapper - * | UriResolverLike[] - * */ - readonly resolvers: GenericUriResolverLike[]; - /** 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>; -} -``` - ## PolywrapClient ### Constructor diff --git a/packages/js/client/readme/README.md b/packages/js/client/readme/README.md index f564c13b39..237221ea04 100644 --- a/packages/js/client/readme/README.md +++ b/packages/js/client/readme/README.md @@ -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 diff --git a/packages/js/client/src/PolywrapClient.ts b/packages/js/client/src/PolywrapClient.ts index 0b25a7dd5c..6c554461ca 100644 --- a/packages/js/client/src/PolywrapClient.ts +++ b/packages/js/client/src/PolywrapClient.ts @@ -1,5 +1,4 @@ import { InvokerOptions, TryResolveUriOptions } from "./types"; -import { sanitizeUri } from "./legacy"; import { PolywrapCoreClient } from "@polywrap/core-client-js"; import { @@ -79,14 +78,14 @@ export class PolywrapClient extends PolywrapCoreClient { public getEnvByUri( uri: TUri ): Env | undefined { - return super.getEnvByUri(sanitizeUri(uri)); + return super.getEnvByUri(Uri.from(uri)); } @Tracer.traceMethod("PolywrapClient: getManifest") public async getManifest( uri: TUri ): Promise> { - return super.getManifest(sanitizeUri(uri)); + return super.getManifest(Uri.from(uri)); } @Tracer.traceMethod("PolywrapClient: getFile") @@ -94,7 +93,7 @@ export class PolywrapClient extends PolywrapCoreClient { uri: TUri, options: GetFileOptions ): Promise> { - return super.getFile(sanitizeUri(uri), options); + return super.getFile(Uri.from(uri), options); } @Tracer.traceMethod("PolywrapClient: getImplementations") @@ -102,7 +101,7 @@ export class PolywrapClient extends PolywrapCoreClient { uri: TUri, options?: GetImplementationsOptions ): Promise> { - return super.getImplementations(sanitizeUri(uri), options); + return super.getImplementations(Uri.from(uri), options); } @Tracer.traceMethod("PolywrapClient: invokeWrapper") @@ -114,7 +113,7 @@ export class PolywrapClient extends PolywrapCoreClient { ): Promise> { return super.invokeWrapper({ ...options, - uri: sanitizeUri(options.uri), + uri: Uri.from(options.uri), }); } @@ -124,7 +123,7 @@ export class PolywrapClient extends PolywrapCoreClient { ): Promise> { return super.invoke({ ...options, - uri: sanitizeUri(options.uri), + uri: Uri.from(options.uri), }); } @@ -134,7 +133,7 @@ export class PolywrapClient extends PolywrapCoreClient { ): Promise> { return super.tryResolveUri({ ...options, - uri: sanitizeUri(options.uri), + uri: Uri.from(options.uri), }); } @@ -144,7 +143,7 @@ export class PolywrapClient extends PolywrapCoreClient { resolutionContext?: IUriResolutionContext, options?: DeserializeManifestOptions ): Promise> { - return super.loadWrapper(sanitizeUri(uri), resolutionContext, options); + return super.loadWrapper(Uri.from(uri), resolutionContext, options); } // $start: PolywrapCoreClient-validate diff --git a/packages/js/client/src/index.ts b/packages/js/client/src/index.ts index 3035d1805c..e4aa0a3f44 100644 --- a/packages/js/client/src/index.ts +++ b/packages/js/client/src/index.ts @@ -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"; diff --git a/packages/js/client/src/legacy/ClientConfig.ts b/packages/js/client/src/legacy/ClientConfig.ts deleted file mode 100644 index 54fd34079b..0000000000 --- a/packages/js/client/src/legacy/ClientConfig.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { - Env, - InterfaceImplementations, - IUriRedirect, - IUriPackage, - IUriWrapper, -} 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/src/legacy/PolywrapClientConfig.ts b/packages/js/client/src/legacy/PolywrapClientConfig.ts deleted file mode 100644 index cb5a61dc94..0000000000 --- a/packages/js/client/src/legacy/PolywrapClientConfig.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { - GenericEnv, - GenericInterfaceImplementations, - IGenericUriPackage, - IGenericUriRedirect, - IGenericUriWrapper, - GenericUriResolverLike, -} from "./types"; - -import { IWrapperCache } from "@polywrap/uri-resolvers-js"; -import { TracerConfig } from "@polywrap/tracing-js"; -import { Uri } from "@polywrap/core-js"; - -// $start: PolywrapClientConfig -/** - * 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 { - /** set environmental variables for a wrapper */ - readonly envs: GenericEnv[]; - - /** register interface implementations */ - readonly interfaces: GenericInterfaceImplementations[]; - - /** redirect invocations from one uri to another */ - readonly redirects: IGenericUriRedirect[]; - - /** add embedded wrappers */ - readonly wrappers: IGenericUriWrapper[]; - - /** add and configure embedded packages */ - readonly packages: IGenericUriPackage[]; - - /** customize URI resolution - * - * @remarks - * A UriResolverLike can be any one of: - * IUriResolver - * | IUriRedirect - * | IUriPackage - * | IUriWrapper - * | UriResolverLike[] - * */ - readonly resolvers: GenericUriResolverLike[]; - /** 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/src/legacy/PolywrapCoreClientConfig.ts b/packages/js/client/src/legacy/PolywrapCoreClientConfig.ts deleted file mode 100644 index f1ea57f544..0000000000 --- a/packages/js/client/src/legacy/PolywrapCoreClientConfig.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { GenericEnv, GenericInterfaceImplementations } from "./types"; - -import { IUriResolver, Uri } from "@polywrap/core-js"; -import { TracerConfig } from "@polywrap/tracing-js"; -import { IWrapperCache } from "@polywrap/uri-resolvers-js"; - -export interface PolywrapCoreClientConfig< - TUri extends Uri | string = Uri | string -> { - readonly interfaces?: Readonly[]>; - readonly envs?: Readonly[]>; - readonly resolver: Readonly>; - readonly wrapperCache?: IWrapperCache; - readonly tracerConfig?: Readonly>; -} diff --git a/packages/js/client/src/legacy/buildPolywrapCoreClientConfig.ts b/packages/js/client/src/legacy/buildPolywrapCoreClientConfig.ts deleted file mode 100644 index 3089326831..0000000000 --- a/packages/js/client/src/legacy/buildPolywrapCoreClientConfig.ts +++ /dev/null @@ -1,179 +0,0 @@ -import { - PolywrapClientConfig, - PolywrapCoreClientConfig, - ClientConfig, - sanitizeUri, -} from "."; -import { GenericUriResolverLike } from "./types"; - -import { - CoreClientConfig, - Env, - InterfaceImplementations, - Uri, -} from "@polywrap/core-js"; -import { - IWrapperCache, - UriResolverLike as SanitizedUriResolverLike, -} from "@polywrap/uri-resolvers-js"; -import { - BuilderConfig, - ClientConfigBuilder, -} from "@polywrap/client-config-builder-js"; - -export function sanitizeConfig( - config: Partial> | Partial -): BuilderConfig { - const builderConfig: BuilderConfig = { - envs: {}, - interfaces: {}, - redirects: {}, - wrappers: {}, - packages: {}, - resolvers: [], - }; - - if (config.envs) { - for (const env of config.envs) { - builderConfig.envs[sanitizeUri(env.uri).uri] = env.env; - } - } - if (config.interfaces) { - for (const interfaceImplementation of config.interfaces) { - const impls: Set = - builderConfig.interfaces[ - sanitizeUri(interfaceImplementation.interface).uri - ] || new Set(); - for (const implementation of interfaceImplementation.implementations) { - impls.add(sanitizeUri(implementation).uri); - } - builderConfig.interfaces[ - sanitizeUri(interfaceImplementation.interface).uri - ] = impls; - } - } - if ("redirects" in config && config.redirects) { - for (const redirect of config.redirects) { - builderConfig.redirects[ - sanitizeUri(redirect.from).uri - ] = sanitizeUri(redirect.to).uri; - } - } - if ("wrappers" in config && config.wrappers) { - for (const wrapper of config.wrappers) { - builderConfig.wrappers[sanitizeUri(wrapper.uri).uri] = - wrapper.wrapper; - } - } - if ("packages" in config && config.packages) { - for (const pkg of config.packages) { - builderConfig.packages[sanitizeUri(pkg.uri).uri] = - pkg.package; - } - } - if ("resolvers" in config && config.resolvers) { - for (const resolver of config.resolvers) { - builderConfig.resolvers.push(sanitizeResolverLike(resolver)); - } - } - - return builderConfig; -} - -export function sanitizeResolverLike( - resolverLike: GenericUriResolverLike | SanitizedUriResolverLike -): SanitizedUriResolverLike { - if (Array.isArray(resolverLike)) { - const sanitizedResolvers: SanitizedUriResolverLike[] = []; - for (const resolver of resolverLike) { - sanitizedResolvers.push(sanitizeResolverLike(resolver)); - } - return sanitizedResolvers; - } else if ("tryResolveUri" in resolverLike) { - return resolverLike; - } else if ("uri" in resolverLike) { - return { - ...resolverLike, - uri: sanitizeUri(resolverLike.uri), - }; - } else if ("from" in resolverLike) { - return { - from: sanitizeUri(resolverLike.from), - to: sanitizeUri(resolverLike.to), - }; - } else { - throw new Error( - `Invalid resolverLike: ${JSON.stringify(resolverLike, null, 2)}` - ); - } -} - -export function sanitizePolywrapCoreConfig( - config: PolywrapCoreClientConfig | CoreClientConfig -): CoreClientConfig { - const sanitizedEnvs: Env[] = []; - const sanitizedInterfaces: InterfaceImplementations[] = []; - - if (config.envs) { - for (const env of config.envs) { - sanitizedEnvs.push({ - uri: sanitizeUri(env.uri), - env: env.env, - }); - } - } - if (config.interfaces) { - for (const interfaceImpl of config.interfaces) { - const sanitizedImpls: Uri[] = []; - for (const impl of interfaceImpl.implementations) { - sanitizedImpls.push(sanitizeUri(impl)); - } - - sanitizedInterfaces.push({ - interface: sanitizeUri(interfaceImpl.interface), - implementations: sanitizedImpls, - }); - } - } - - return { - envs: sanitizedEnvs, - interfaces: sanitizedInterfaces, - resolver: config.resolver, - }; -} - -export function buildPolywrapCoreClientConfig< - TUri extends Uri | string = string ->( - config?: - | Partial> - | PolywrapCoreClientConfig - | Partial - | CoreClientConfig - | undefined, - builder: ClientConfigBuilder | undefined = undefined, - noDefaults = false -): CoreClientConfig { - if (!builder) { - builder = new ClientConfigBuilder(); - } - - if (!noDefaults) { - builder.addDefaults(); - } - - if (config && "resolver" in config) { - return sanitizePolywrapCoreConfig(config); - } else if (config) { - builder.add(sanitizeConfig(config)); - } - - if (config && "wrapperCache" in config) { - return builder.build({ - wrapperCache: config.wrapperCache as IWrapperCache, - }); - } - - return builder.build(); -} diff --git a/packages/js/client/src/legacy/index.ts b/packages/js/client/src/legacy/index.ts deleted file mode 100644 index 800a33e7e8..0000000000 --- a/packages/js/client/src/legacy/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from "./types"; -export * from "./ClientConfig"; -export * from "./PolywrapClientConfig"; -export * from "./PolywrapCoreClientConfig"; -export * from "./buildPolywrapCoreClientConfig"; -export * from "./sanitizeUri"; diff --git a/packages/js/client/src/legacy/sanitizeUri.ts b/packages/js/client/src/legacy/sanitizeUri.ts deleted file mode 100644 index b6551102c7..0000000000 --- a/packages/js/client/src/legacy/sanitizeUri.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Uri } from "@polywrap/core-js"; - -export function sanitizeUri( - uri: TUri -): Uri { - return typeof uri === "string" ? new Uri(uri) : (uri as Uri); -} diff --git a/packages/js/client/src/legacy/types/GenericEnv.ts b/packages/js/client/src/legacy/types/GenericEnv.ts deleted file mode 100644 index 8492707a04..0000000000 --- a/packages/js/client/src/legacy/types/GenericEnv.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Uri } from "@polywrap/core-js"; - -export interface GenericEnv { - /** Uri of wrapper */ - uri: TUri; - - /** Env variables used by the module */ - env: Record; -} diff --git a/packages/js/client/src/legacy/types/GenericIUriPackage.ts b/packages/js/client/src/legacy/types/GenericIUriPackage.ts deleted file mode 100644 index 3596bce298..0000000000 --- a/packages/js/client/src/legacy/types/GenericIUriPackage.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { Uri, IWrapPackage } from "@polywrap/core-js"; - -export interface IGenericUriPackage { - uri: TUri; - package: IWrapPackage; -} diff --git a/packages/js/client/src/legacy/types/GenericIUriRedirect.ts b/packages/js/client/src/legacy/types/GenericIUriRedirect.ts deleted file mode 100644 index 637fe4d627..0000000000 --- a/packages/js/client/src/legacy/types/GenericIUriRedirect.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { Uri } from "@polywrap/core-js"; - -export interface IGenericUriRedirect { - from: TUri; - to: TUri; -} diff --git a/packages/js/client/src/legacy/types/GenericIUriWrapper.ts b/packages/js/client/src/legacy/types/GenericIUriWrapper.ts deleted file mode 100644 index f59eb9d0a5..0000000000 --- a/packages/js/client/src/legacy/types/GenericIUriWrapper.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { Uri, Wrapper } from "@polywrap/core-js"; - -export interface IGenericUriWrapper { - uri: TUri; - wrapper: Wrapper; -} diff --git a/packages/js/client/src/legacy/types/GenericInterfaceImplementations.ts b/packages/js/client/src/legacy/types/GenericInterfaceImplementations.ts deleted file mode 100644 index 339ca1a3bd..0000000000 --- a/packages/js/client/src/legacy/types/GenericInterfaceImplementations.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Uri } from "@polywrap/core-js"; - -export interface GenericInterfaceImplementations< - TUri extends Uri | string = string -> { - interface: TUri; - implementations: TUri[]; -} diff --git a/packages/js/client/src/legacy/types/GenericUriResolverLike.ts b/packages/js/client/src/legacy/types/GenericUriResolverLike.ts deleted file mode 100644 index eaf4f1d64d..0000000000 --- a/packages/js/client/src/legacy/types/GenericUriResolverLike.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { IGenericUriPackage } from "./GenericIUriPackage"; -import { IGenericUriRedirect } from "./GenericIUriRedirect"; -import { IGenericUriWrapper } from "./GenericIUriWrapper"; - -import { IUriResolver, Uri } from "@polywrap/core-js"; - -export type GenericUriResolverLike = - | IUriResolver - | IGenericUriRedirect - | IGenericUriPackage - | IGenericUriWrapper - | GenericUriResolverLike[]; diff --git a/packages/js/client/src/legacy/types/index.ts b/packages/js/client/src/legacy/types/index.ts deleted file mode 100644 index 4b551dc3bb..0000000000 --- a/packages/js/client/src/legacy/types/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from "./GenericInterfaceImplementations"; -export * from "./GenericEnv"; -export * from "./GenericIUriWrapper"; -export * from "./GenericIUriRedirect"; -export * from "./GenericIUriPackage"; -export * from "./GenericUriResolverLike"; diff --git a/packages/js/manifests/polywrap/scripts/templates/index-ts.mustache b/packages/js/manifests/polywrap/scripts/templates/index-ts.mustache index 563e8cad35..b6eac4535c 100644 --- a/packages/js/manifests/polywrap/scripts/templates/index-ts.mustache +++ b/packages/js/manifests/polywrap/scripts/templates/index-ts.mustache @@ -44,13 +44,12 @@ export type Any{{#latest}}{{type}}{{/latest}} = | {{type}}_{{tsVersion}} {{/formats}} - -{{#formats}} -{{#isWorkflow}} +{{#latest.isWorkflow}} export type WorkflowJobs = +{{#formats}} | WorkflowJobs_{{tsVersion}} -{{/isWorkflow}} {{/formats}} +{{/latest.isWorkflow}} export type {{#latest}}{{type}}{{/latest}} = {{#latest}}{{type}}_{{tsVersion}}{{/latest}}; diff --git a/packages/js/manifests/polywrap/src/__tests__/PolywrapWorkflow.spec.ts b/packages/js/manifests/polywrap/src/__tests__/PolywrapWorkflow.spec.ts index 629087cb22..bceb2094ef 100644 --- a/packages/js/manifests/polywrap/src/__tests__/PolywrapWorkflow.spec.ts +++ b/packages/js/manifests/polywrap/src/__tests__/PolywrapWorkflow.spec.ts @@ -4,24 +4,24 @@ import fs from "fs"; describe("Polywrap Workflow Validation", () => { it("Should throw incorrect version format error", async () => { - const workflowPath = __dirname + "/manifest/workflow/incorrect-version-format/polywrap.test.yaml"; + const workflowPath = __dirname + "/manifest/test/incorrect-version-format/polywrap.test.yaml"; const workflow = fs.readFileSync(workflowPath, "utf-8"); expect(() => deserializePolywrapWorkflow(workflow)).toThrowError(/Unrecognized PolywrapWorkflow schema format/); }); it("Should throw not accepted field error", async () => { - const workflowPath = __dirname + "/manifest/workflow/not-accepted-field/polywrap.test.yaml"; + const workflowPath = __dirname + "/manifest/test/not-accepted-field/polywrap.test.yaml"; const workflow = fs.readFileSync(workflowPath, "utf-8"); expect(() => deserializePolywrapWorkflow(workflow)).toThrowError(/not allowed to have the additional property "not_accepted_field"/); }); it("Should throw required field missing error", async () => { - const workflowPath = __dirname + "/manifest/workflow/required-field-missing/polywrap.test.yaml"; + const workflowPath = __dirname + "/manifest/test/required-field-missing/polywrap.test.yaml"; const workflow = fs.readFileSync(workflowPath, "utf-8"); expect(() => deserializePolywrapWorkflow(workflow)).toThrowError(/instance requires property "name"/); }); it("Should throw wrong type error", async () => { - const workflowPath = __dirname + "/manifest/workflow/wrong-type/polywrap.test.yaml"; + const workflowPath = __dirname + "/manifest/test/wrong-type/polywrap.test.yaml"; const workflow = fs.readFileSync(workflowPath, "utf-8"); expect(() => deserializePolywrapWorkflow(workflow)).toThrowError(/instance.format is not of a type\(s\) string/); diff --git a/packages/js/manifests/polywrap/src/__tests__/manifest/workflow/incorrect-version-format/polywrap.test.yaml b/packages/js/manifests/polywrap/src/__tests__/manifest/test/incorrect-version-format/polywrap.test.yaml similarity index 100% rename from packages/js/manifests/polywrap/src/__tests__/manifest/workflow/incorrect-version-format/polywrap.test.yaml rename to packages/js/manifests/polywrap/src/__tests__/manifest/test/incorrect-version-format/polywrap.test.yaml diff --git a/packages/js/manifests/polywrap/src/__tests__/manifest/workflow/main.ts b/packages/js/manifests/polywrap/src/__tests__/manifest/test/main.ts similarity index 100% rename from packages/js/manifests/polywrap/src/__tests__/manifest/workflow/main.ts rename to packages/js/manifests/polywrap/src/__tests__/manifest/test/main.ts diff --git a/packages/js/manifests/polywrap/src/__tests__/manifest/test/migrations/polywrap.test-0.1.0-config.yaml b/packages/js/manifests/polywrap/src/__tests__/manifest/test/migrations/polywrap.test-0.1.0-config.yaml new file mode 100644 index 0000000000..7bd485ec23 --- /dev/null +++ b/packages/js/manifests/polywrap/src/__tests__/manifest/test/migrations/polywrap.test-0.1.0-config.yaml @@ -0,0 +1,12 @@ +name: test-workflow +format: 0.1.0 +jobs: + sampleMethod: + steps: + - uri: fs/build + method: sampleMethod + args: + arg: "polywrap" + config: + foo: bar + baz: bam diff --git a/packages/js/manifests/polywrap/src/__tests__/manifest/test/migrations/polywrap.test-0.1.0.yaml b/packages/js/manifests/polywrap/src/__tests__/manifest/test/migrations/polywrap.test-0.1.0.yaml new file mode 100644 index 0000000000..1e9524c116 --- /dev/null +++ b/packages/js/manifests/polywrap/src/__tests__/manifest/test/migrations/polywrap.test-0.1.0.yaml @@ -0,0 +1,9 @@ +name: test-workflow +format: 0.1.0 +jobs: + sampleMethod: + steps: + - uri: fs/build + method: sampleMethod + args: + arg: "polywrap" diff --git a/packages/js/manifests/polywrap/src/__tests__/manifest/test/migrations/polywrap.test-0.2.0.yaml b/packages/js/manifests/polywrap/src/__tests__/manifest/test/migrations/polywrap.test-0.2.0.yaml new file mode 100644 index 0000000000..9cd3c365d4 --- /dev/null +++ b/packages/js/manifests/polywrap/src/__tests__/manifest/test/migrations/polywrap.test-0.2.0.yaml @@ -0,0 +1,9 @@ +name: test-workflow +format: 0.2.0 +jobs: + sampleMethod: + steps: + - uri: fs/build + method: sampleMethod + args: + arg: "polywrap" diff --git a/packages/js/manifests/polywrap/src/__tests__/manifest/workflow/not-accepted-field/polywrap.test.yaml b/packages/js/manifests/polywrap/src/__tests__/manifest/test/not-accepted-field/polywrap.test.yaml similarity index 100% rename from packages/js/manifests/polywrap/src/__tests__/manifest/workflow/not-accepted-field/polywrap.test.yaml rename to packages/js/manifests/polywrap/src/__tests__/manifest/test/not-accepted-field/polywrap.test.yaml diff --git a/packages/js/manifests/polywrap/src/__tests__/manifest/workflow/required-field-missing/polywrap.test.yaml b/packages/js/manifests/polywrap/src/__tests__/manifest/test/required-field-missing/polywrap.test.yaml similarity index 100% rename from packages/js/manifests/polywrap/src/__tests__/manifest/workflow/required-field-missing/polywrap.test.yaml rename to packages/js/manifests/polywrap/src/__tests__/manifest/test/required-field-missing/polywrap.test.yaml diff --git a/packages/js/manifests/polywrap/src/__tests__/manifest/workflow/schema.graphql b/packages/js/manifests/polywrap/src/__tests__/manifest/test/schema.graphql similarity index 100% rename from packages/js/manifests/polywrap/src/__tests__/manifest/workflow/schema.graphql rename to packages/js/manifests/polywrap/src/__tests__/manifest/test/schema.graphql diff --git a/packages/js/manifests/polywrap/src/__tests__/manifest/workflow/wrong-type/polywrap.test.yaml b/packages/js/manifests/polywrap/src/__tests__/manifest/test/wrong-type/polywrap.test.yaml similarity index 100% rename from packages/js/manifests/polywrap/src/__tests__/manifest/workflow/wrong-type/polywrap.test.yaml rename to packages/js/manifests/polywrap/src/__tests__/manifest/test/wrong-type/polywrap.test.yaml diff --git a/packages/js/manifests/polywrap/src/__tests__/migrations.spec.ts b/packages/js/manifests/polywrap/src/__tests__/migrations.spec.ts index 4b9a8f0b1d..022231c9e6 100644 --- a/packages/js/manifests/polywrap/src/__tests__/migrations.spec.ts +++ b/packages/js/manifests/polywrap/src/__tests__/migrations.spec.ts @@ -1,7 +1,44 @@ -import { deserializeDeployManifest, deserializePolywrapManifest } from "../"; +import { + deserializeDeployManifest, + deserializePolywrapManifest, + deserializePolywrapWorkflow, +} from "../"; import fs from "fs"; import { findShortestMigrationPath, Migrator } from "../migrations"; +import { ILogger } from "@polywrap/logging-js"; + +function getMockLogger(): { + logger: ILogger; + debug: jest.Mock; + warn: jest.Mock; + info: jest.Mock; + error: jest.Mock; + log: jest.Mock; +} { + const warn = jest.fn(); + const debug = jest.fn(); + const error = jest.fn(); + const info = jest.fn(); + const log = jest.fn(); + + const logger: ILogger = { + warn, + debug, + error, + info, + log, + }; + + return { + logger, + warn, + debug, + error, + info, + log, + }; +} describe("Manifest migration pathfinding", () => { const migrators: Migrator[] = [ @@ -92,3 +129,48 @@ describe("Polywrap Deploy Manifest Migrations", () => { expect(manifest).toEqual(expectedManifest); }); }); + +describe("Polywrap Test Manifest Migrations", () => { + const stepConfigWarning_0_1_0 = + "One or more of the steps in your test manifest have a config property. This is no longer supported, and will be removed."; + + it("Should succesfully migrate from 0.1.0 to 0.2.0 - no steps with config", async () => { + const { logger, warn } = getMockLogger(); + + const manifestPath = + __dirname + "/manifest/test/migrations/polywrap.test-0.1.0.yaml"; + const expectedManifestPath = + __dirname + "/manifest/test/migrations/polywrap.test-0.2.0.yaml"; + + const manifestFile = fs.readFileSync(manifestPath, "utf-8"); + const expectedManifestFile = fs.readFileSync(expectedManifestPath, "utf-8"); + + const manifest = deserializePolywrapWorkflow(manifestFile, { + logger: logger, + }); + const expectedManifest = deserializePolywrapWorkflow(expectedManifestFile); + + expect(manifest).toEqual(expectedManifest); + expect(warn).not.toHaveBeenCalledWith(stepConfigWarning_0_1_0); + }); + + it("Should succesfully migrate from 0.1.0 to 0.2.0 - steps with config", async () => { + const { logger, warn } = getMockLogger(); + + const manifestPath = + __dirname + "/manifest/test/migrations/polywrap.test-0.1.0-config.yaml"; + const expectedManifestPath = + __dirname + "/manifest/test/migrations/polywrap.test-0.2.0.yaml"; + + const manifestFile = fs.readFileSync(manifestPath, "utf-8"); + const expectedManifestFile = fs.readFileSync(expectedManifestPath, "utf-8"); + + const manifest = deserializePolywrapWorkflow(manifestFile, { + logger: logger, + }); + const expectedManifest = deserializePolywrapWorkflow(expectedManifestFile); + + expect(manifest).toEqual(expectedManifest); + expect(warn).toHaveBeenCalledWith(stepConfigWarning_0_1_0); + }); +}); diff --git a/packages/js/manifests/polywrap/src/formats/polywrap.app/index.ts b/packages/js/manifests/polywrap/src/formats/polywrap.app/index.ts index ae289deac0..913db8c0c1 100644 --- a/packages/js/manifests/polywrap/src/formats/polywrap.app/index.ts +++ b/packages/js/manifests/polywrap/src/formats/polywrap.app/index.ts @@ -43,7 +43,6 @@ export type AnyAppManifest = | AppManifest_0_3_0 - export type AppManifest = AppManifest_0_3_0; export const latestAppManifestFormat = AppManifestFormats["v0.3.0"] diff --git a/packages/js/manifests/polywrap/src/formats/polywrap.build/index.ts b/packages/js/manifests/polywrap/src/formats/polywrap.build/index.ts index b4a26a8ef2..31e87f2f0c 100644 --- a/packages/js/manifests/polywrap/src/formats/polywrap.build/index.ts +++ b/packages/js/manifests/polywrap/src/formats/polywrap.build/index.ts @@ -43,7 +43,6 @@ export type AnyBuildManifest = | BuildManifest_0_3_0 - export type BuildManifest = BuildManifest_0_3_0; export const latestBuildManifestFormat = BuildManifestFormats["v0.3.0"] diff --git a/packages/js/manifests/polywrap/src/formats/polywrap.deploy/index.ts b/packages/js/manifests/polywrap/src/formats/polywrap.deploy/index.ts index 23357f9a64..923554cb67 100644 --- a/packages/js/manifests/polywrap/src/formats/polywrap.deploy/index.ts +++ b/packages/js/manifests/polywrap/src/formats/polywrap.deploy/index.ts @@ -36,7 +36,6 @@ export type AnyDeployManifest = | DeployManifest_0_2_0 - export type DeployManifest = DeployManifest_0_2_0; export const latestDeployManifestFormat = DeployManifestFormats["v0.2.0"] diff --git a/packages/js/manifests/polywrap/src/formats/polywrap.infra/index.ts b/packages/js/manifests/polywrap/src/formats/polywrap.infra/index.ts index 5819449dda..2498a820a3 100644 --- a/packages/js/manifests/polywrap/src/formats/polywrap.infra/index.ts +++ b/packages/js/manifests/polywrap/src/formats/polywrap.infra/index.ts @@ -29,7 +29,6 @@ export type AnyInfraManifest = | InfraManifest_0_1_0 - export type InfraManifest = InfraManifest_0_1_0; export const latestInfraManifestFormat = InfraManifestFormats["v0.1.0"] diff --git a/packages/js/manifests/polywrap/src/formats/polywrap.plugin/index.ts b/packages/js/manifests/polywrap/src/formats/polywrap.plugin/index.ts index 9d7eeb4e96..2a66aa6fdb 100644 --- a/packages/js/manifests/polywrap/src/formats/polywrap.plugin/index.ts +++ b/packages/js/manifests/polywrap/src/formats/polywrap.plugin/index.ts @@ -43,7 +43,6 @@ export type AnyPluginManifest = | PluginManifest_0_3_0 - export type PluginManifest = PluginManifest_0_3_0; export const latestPluginManifestFormat = PluginManifestFormats["v0.3.0"] diff --git a/packages/js/manifests/polywrap/src/formats/polywrap.test/0.2.0.ts b/packages/js/manifests/polywrap/src/formats/polywrap.test/0.2.0.ts new file mode 100644 index 0000000000..ddbb28c4a1 --- /dev/null +++ b/packages/js/manifests/polywrap/src/formats/polywrap.test/0.2.0.ts @@ -0,0 +1,59 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +/* tslint:disable */ +/** + * This file was automatically generated by json-schema-to-typescript. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run json-schema-to-typescript to regenerate this file. + */ + +export interface PolywrapWorkflow { + /** + * Workflow format version + */ + format: "0.2.0"; + /** + * Workflow name + */ + name: string; + /** + * Path to validation script + */ + validation?: string; + jobs: Jobs; + __type: "PolywrapWorkflow"; +} +/** + * Map of workflow jobs + */ +export interface Jobs { + [k: string]: JobInfo; +} +/** + * Sequences of actions inside the job + * + * This interface was referenced by `Jobs`'s JSON-Schema definition + * via the `patternProperty` "^.*$". + */ +export interface JobInfo { + /** + * Array of calls to wrappers + */ + steps?: Step[]; + jobs?: Jobs; +} +export interface Step { + /** + * Wrapper URI + */ + uri: any; + /** + * Wrapper method name + */ + method: string; + /** + * Wrapper method arguments + */ + args?: { + [k: string]: unknown; + }; +} diff --git a/packages/js/manifests/polywrap/src/formats/polywrap.test/index.ts b/packages/js/manifests/polywrap/src/formats/polywrap.test/index.ts index 3f2d4dea88..976672248c 100644 --- a/packages/js/manifests/polywrap/src/formats/polywrap.test/index.ts +++ b/packages/js/manifests/polywrap/src/formats/polywrap.test/index.ts @@ -9,34 +9,43 @@ import { PolywrapWorkflow as PolywrapWorkflow_0_1_0, Jobs as WorkflowJobs_0_1_0, } from "./0.1.0"; +import { + PolywrapWorkflow as PolywrapWorkflow_0_2_0, + Jobs as WorkflowJobs_0_2_0, +} from "./0.2.0"; export { PolywrapWorkflow_0_1_0, WorkflowJobs_0_1_0, + PolywrapWorkflow_0_2_0, + WorkflowJobs_0_2_0, }; export enum PolywrapWorkflowFormats { // NOTE: Patch fix for backwards compatability "v0.1" = "0.1", "v0.1.0" = "0.1.0", + "v0.2.0" = "0.2.0", } export const PolywrapWorkflowSchemaFiles: Record = { // NOTE: Patch fix for backwards compatability "0.1": "formats/polywrap.test/0.1.0.json", "0.1.0": "formats/polywrap.test/0.1.0.json", + "0.2.0": "formats/polywrap.test/0.2.0.json", } export type AnyPolywrapWorkflow = | PolywrapWorkflow_0_1_0 - + | PolywrapWorkflow_0_2_0 export type WorkflowJobs = | WorkflowJobs_0_1_0 + | WorkflowJobs_0_2_0 -export type PolywrapWorkflow = PolywrapWorkflow_0_1_0; +export type PolywrapWorkflow = PolywrapWorkflow_0_2_0; -export const latestPolywrapWorkflowFormat = PolywrapWorkflowFormats["v0.1.0"] +export const latestPolywrapWorkflowFormat = PolywrapWorkflowFormats["v0.2.0"] export { migratePolywrapWorkflow } from "./migrate"; diff --git a/packages/js/manifests/polywrap/src/formats/polywrap.test/migrators/0.1.0_to_0.2.0.ts b/packages/js/manifests/polywrap/src/formats/polywrap.test/migrators/0.1.0_to_0.2.0.ts new file mode 100644 index 0000000000..84d1a12cc1 --- /dev/null +++ b/packages/js/manifests/polywrap/src/formats/polywrap.test/migrators/0.1.0_to_0.2.0.ts @@ -0,0 +1,67 @@ +import { ILogger } from "@polywrap/logging-js"; +import { Jobs as OldJobs, PolywrapWorkflow as OldManifest } from "../0.1.0"; +import { Jobs as NewJobs, PolywrapWorkflow as NewManifest } from "../0.2.0"; + +export function migrate(manifest: OldManifest, logger?: ILogger): NewManifest { + const [jobsSanitized, jobsHaveStepsWithConfig] = sanitizeJobsSteps( + manifest.jobs + ); + + if (jobsHaveStepsWithConfig) { + logger?.warn( + "One or more of the steps in your test manifest have a config property. This is no longer supported, and will be removed." + ); + } + + return { + format: "0.2.0", + name: manifest.name, + jobs: jobsSanitized as NewJobs, + validation: manifest.validation, + + // eslint-disable-next-line @typescript-eslint/naming-convention + __type: "PolywrapWorkflow", + }; +} + +function sanitizeJobsSteps( + jobs: OldJobs | undefined +): [NewJobs | undefined, boolean] { + if (jobs === undefined) { + return [undefined, false]; + } + + const oldJobs = JSON.parse(JSON.stringify(jobs)) as OldJobs; + const newJobs: NewJobs = {}; + let jobHasStepsWithConfig = false; + + for (const job in oldJobs) { + const jobInfo = oldJobs[job]; + + if (jobInfo.steps) { + newJobs[job] = {}; + newJobs[job].steps = jobInfo.steps.map((x) => { + if (x.config) { + jobHasStepsWithConfig = true; + } + + return { + method: x.method, + uri: x.uri, + args: x.args, + }; + }); + } + + let innerJobsHaveStepsWithConfig = false; + + [newJobs[job].jobs, innerJobsHaveStepsWithConfig] = sanitizeJobsSteps( + jobInfo.jobs + ); + + jobHasStepsWithConfig = + jobHasStepsWithConfig || innerJobsHaveStepsWithConfig; + } + + return [newJobs, jobHasStepsWithConfig]; +} diff --git a/packages/js/manifests/polywrap/src/formats/polywrap.test/migrators/index.ts b/packages/js/manifests/polywrap/src/formats/polywrap.test/migrators/index.ts index 6fa0ce38a3..570a38125d 100644 --- a/packages/js/manifests/polywrap/src/formats/polywrap.test/migrators/index.ts +++ b/packages/js/manifests/polywrap/src/formats/polywrap.test/migrators/index.ts @@ -1,3 +1,15 @@ import { Migrator } from "../../../migrations"; +import { migrate as migrate_0_1_0_to_0_2_0 } from "./0.1.0_to_0.2.0"; -export const migrators: Migrator[] = []; +export const migrators: Migrator[] = [ + { + from: "0.1", + to: "0.2.0", + migrate: migrate_0_1_0_to_0_2_0, + }, + { + from: "0.1.0", + to: "0.2.0", + migrate: migrate_0_1_0_to_0_2_0, + }, +]; diff --git a/packages/js/manifests/polywrap/src/formats/polywrap.test/validate.ts b/packages/js/manifests/polywrap/src/formats/polywrap.test/validate.ts index 58320ca228..4680d15bd9 100644 --- a/packages/js/manifests/polywrap/src/formats/polywrap.test/validate.ts +++ b/packages/js/manifests/polywrap/src/formats/polywrap.test/validate.ts @@ -10,6 +10,7 @@ import { } from "."; import PolywrapWorkflowSchema_0_1_0 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.test/0.1.0.json"; +import PolywrapWorkflowSchema_0_2_0 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.test/0.2.0.json"; import { Schema, @@ -26,6 +27,7 @@ const schemas: PolywrapWorkflowSchemas = { // NOTE: Patch fix for backwards compatability "0.1": PolywrapWorkflowSchema_0_1_0, "0.1.0": PolywrapWorkflowSchema_0_1_0, + "0.2.0": PolywrapWorkflowSchema_0_2_0, }; const validator = new Validator(); diff --git a/packages/js/manifests/polywrap/src/formats/polywrap/index.ts b/packages/js/manifests/polywrap/src/formats/polywrap/index.ts index f2f3db1d33..36e537d551 100644 --- a/packages/js/manifests/polywrap/src/formats/polywrap/index.ts +++ b/packages/js/manifests/polywrap/src/formats/polywrap/index.ts @@ -43,7 +43,6 @@ export type AnyPolywrapManifest = | PolywrapManifest_0_3_0 - export type PolywrapManifest = PolywrapManifest_0_3_0; export const latestPolywrapManifestFormat = PolywrapManifestFormats["v0.3.0"] diff --git a/packages/manifests/polywrap/formats/polywrap.test/0.2.0.json b/packages/manifests/polywrap/formats/polywrap.test/0.2.0.json new file mode 100644 index 0000000000..5e7040b5f6 --- /dev/null +++ b/packages/manifests/polywrap/formats/polywrap.test/0.2.0.json @@ -0,0 +1,75 @@ +{ + "id": "PolywrapWorkflow", + "type": "object", + "additionalProperties": false, + "required": ["format", "name", "jobs"], + "properties": { + "format": { + "description": "Workflow format version", + "type": "string", + "enum": ["0.2.0"] + }, + "name": { + "description": "Workflow name", + "type": "string", + "pattern": "^[a-zA-Z0-9\\-\\_]+$" + }, + "validation": { + "description": "Path to validation script", + "type": "string" + }, + "jobs": { + "$ref": "#/definitions/jobs" + } + }, + "definitions": { + "step": { + "type": "object", + "additionalProperties": false, + "required": ["uri", "method"], + "properties": { + "uri": { + "description": "Wrapper URI", + "type": "string", + "tsType": "any" + }, + "method": { + "description": "Wrapper method name", + "type": "string", + "pattern": "^[a-zA-Z0-9\\-\\_]+$" + }, + "args": { + "description": "Wrapper method arguments", + "type": "object", + "additionalProperties": true + } + } + }, + "jobInfo": { + "description": "Sequences of actions inside the job", + "type": "object", + "additionalProperties": false, + "properties": { + "steps": { + "description": "Array of calls to wrappers", + "type": "array", + "items": { + "$ref": "#/definitions/step" + } + }, + "jobs": { + "$ref": "#/definitions/jobs" + } + } + }, + "jobs": { + "description": "Map of workflow jobs", + "type": "object", + "patternProperties": { + "^.*$": { + "$ref": "#/definitions/jobInfo" + } + } + } + } +} diff --git a/packages/test-cases/cases/cli/test/001-yaml-workflow/polywrap.test.yaml b/packages/test-cases/cases/cli/test/001-yaml-workflow/polywrap.test.yaml index 40b784b1af..6bd8e638c8 100644 --- a/packages/test-cases/cases/cli/test/001-yaml-workflow/polywrap.test.yaml +++ b/packages/test-cases/cases/cli/test/001-yaml-workflow/polywrap.test.yaml @@ -1,5 +1,5 @@ name: run-test-wrapper -format: 0.1.0 +format: 0.2.0 jobs: cases: steps: diff --git a/packages/test-cases/cases/cli/test/002-json-workflow/polywrap.test.json b/packages/test-cases/cases/cli/test/002-json-workflow/polywrap.test.json index 6ebc3412d9..2846f02da7 100644 --- a/packages/test-cases/cases/cli/test/002-json-workflow/polywrap.test.json +++ b/packages/test-cases/cases/cli/test/002-json-workflow/polywrap.test.json @@ -1,6 +1,6 @@ { "name": "run-test-wrapper", - "format": "0.1.0", + "format": "0.2.0", "jobs": { "cases": { "steps": [ diff --git a/packages/test-cases/cases/cli/test/003-json-output/polywrap.test.yaml b/packages/test-cases/cases/cli/test/003-json-output/polywrap.test.yaml index 1b1bc8437e..107b90fd08 100644 --- a/packages/test-cases/cases/cli/test/003-json-output/polywrap.test.yaml +++ b/packages/test-cases/cases/cli/test/003-json-output/polywrap.test.yaml @@ -1,5 +1,5 @@ name: run-test-wrapper -format: 0.1.0 +format: 0.2.0 jobs: cases: steps: diff --git a/packages/test-cases/cases/cli/test/004-yaml-output/polywrap.test.yaml b/packages/test-cases/cases/cli/test/004-yaml-output/polywrap.test.yaml index 40b784b1af..6bd8e638c8 100644 --- a/packages/test-cases/cases/cli/test/004-yaml-output/polywrap.test.yaml +++ b/packages/test-cases/cases/cli/test/004-yaml-output/polywrap.test.yaml @@ -1,5 +1,5 @@ name: run-test-wrapper -format: 0.1.0 +format: 0.2.0 jobs: cases: steps: diff --git a/packages/test-cases/cases/cli/test/005-validate/polywrap.test.yaml b/packages/test-cases/cases/cli/test/005-validate/polywrap.test.yaml index 33dbc789bb..7620144f49 100644 --- a/packages/test-cases/cases/cli/test/005-validate/polywrap.test.yaml +++ b/packages/test-cases/cases/cli/test/005-validate/polywrap.test.yaml @@ -1,5 +1,5 @@ name: run-test-wrapper -format: 0.1.0 +format: 0.2.0 validation: "./validator.cue" jobs: cases: diff --git a/packages/test-cases/cases/cli/test/006-validation-fail/polywrap.test.yaml b/packages/test-cases/cases/cli/test/006-validation-fail/polywrap.test.yaml index bd82f14f66..945f9cb7a2 100644 --- a/packages/test-cases/cases/cli/test/006-validation-fail/polywrap.test.yaml +++ b/packages/test-cases/cases/cli/test/006-validation-fail/polywrap.test.yaml @@ -1,5 +1,5 @@ name: run-test-wrapper -format: 0.1.0 +format: 0.2.0 validation: "./validator.cue" jobs: cases: diff --git a/packages/test-cases/cases/cli/test/007-invalid-manifest/polywrap.test.yaml b/packages/test-cases/cases/cli/test/007-invalid-manifest/polywrap.test.yaml index 61150e955a..263140f510 100644 --- a/packages/test-cases/cases/cli/test/007-invalid-manifest/polywrap.test.yaml +++ b/packages/test-cases/cases/cli/test/007-invalid-manifest/polywrap.test.yaml @@ -1,5 +1,5 @@ name-invalid: run-test-wrapper -format: 0.1.0 +format: 0.2.0 jobs: cases: steps: diff --git a/packages/test-cases/cases/cli/test/008-custom-config/polywrap.test.yaml b/packages/test-cases/cases/cli/test/008-custom-config/polywrap.test.yaml index 1a11b85f8b..46fd33bfc6 100644 --- a/packages/test-cases/cases/cli/test/008-custom-config/polywrap.test.yaml +++ b/packages/test-cases/cases/cli/test/008-custom-config/polywrap.test.yaml @@ -1,5 +1,5 @@ name: run-test-wrapper -format: 0.1.0 +format: 0.2.0 validation: "./validator.cue" jobs: cases: diff --git a/packages/test-cases/cases/cli/test/009-nested-props/polywrap.test.yaml b/packages/test-cases/cases/cli/test/009-nested-props/polywrap.test.yaml index e98f5b2f3c..4b0d745b20 100644 --- a/packages/test-cases/cases/cli/test/009-nested-props/polywrap.test.yaml +++ b/packages/test-cases/cases/cli/test/009-nested-props/polywrap.test.yaml @@ -1,5 +1,5 @@ name: run-test-wrapper -format: 0.1.0 +format: 0.2.0 validation: "./validator.cue" jobs: cases: diff --git a/packages/test-cases/cases/cli/test/010-reserved-job-names/polywrap.test.yaml b/packages/test-cases/cases/cli/test/010-reserved-job-names/polywrap.test.yaml index 253b7158fe..034f3aeb3a 100644 --- a/packages/test-cases/cases/cli/test/010-reserved-job-names/polywrap.test.yaml +++ b/packages/test-cases/cases/cli/test/010-reserved-job-names/polywrap.test.yaml @@ -1,5 +1,5 @@ name: run-test-wrapper -format: 0.1.0 +format: 0.2.0 jobs: case1: steps: diff --git a/packages/test-cases/cases/cli/test/011-id-subset/polywrap.test.yaml b/packages/test-cases/cases/cli/test/011-id-subset/polywrap.test.yaml index 3017b10e10..06f8fc32e7 100644 --- a/packages/test-cases/cases/cli/test/011-id-subset/polywrap.test.yaml +++ b/packages/test-cases/cases/cli/test/011-id-subset/polywrap.test.yaml @@ -1,5 +1,5 @@ name: run-test-wrapper -format: 0.1.0 +format: 0.2.0 validation: "./validator.cue" jobs: case1: diff --git a/packages/test-cases/cases/cli/test/012-validation-error-expected/polywrap.test.yaml b/packages/test-cases/cases/cli/test/012-validation-error-expected/polywrap.test.yaml index 9bb04086c3..3648587c75 100644 --- a/packages/test-cases/cases/cli/test/012-validation-error-expected/polywrap.test.yaml +++ b/packages/test-cases/cases/cli/test/012-validation-error-expected/polywrap.test.yaml @@ -1,5 +1,5 @@ name: run-test-wrapper -format: 0.1.0 +format: 0.2.0 validation: "./validator.cue" jobs: cases: