Skip to content

Commit

Permalink
Updated for v1.0.0-alpha5
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Baptiste Bianchi <[email protected]>
  • Loading branch information
JBBianchi committed Dec 18, 2024
1 parent 0727bde commit 3c9501c
Show file tree
Hide file tree
Showing 15 changed files with 726 additions and 225 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@serverlessworkflow/sdk",
"version": "1.0.0-alpha3.0",
"schemaVersion": "1.0.0-alpha3",
"version": "1.0.0-alpha5.0",
"schemaVersion": "1.0.0-alpha5",
"description": "Typescript SDK for Serverless Workflow Specification",
"main": "umd/index.umd.min.js",
"browser": "umd/index.umd.min.js",
Expand Down
44 changes: 44 additions & 0 deletions src/lib/generated/builders/catalog-builder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2021-Present The Serverless Workflow Specification Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*****************************************************************************************
*
* /!\ This file is computer generated. Any manual modification can and will be lost. /!\
*
*****************************************************************************************/

import { builder, Builder, BuildOptions } from '../../builder';
import { Classes } from '../classes';
import { Specification } from '../definitions';

/**
* The internal function used by the builder proxy to validate and return its underlying object
* @param {Specification.Catalog} model The proxied object
* @param {BuildOptions} options The build options to use
* @returns {Specification.Catalog} The built object
*/
function buildingFn(model: Specification.Catalog, options: BuildOptions): Specification.Catalog {
const instance = new Classes.Catalog(model);
if (options.validate) instance.validate();
return (options.normalize ? instance.normalize() : instance) as Specification.Catalog;
}

/**
* A factory to create a builder proxy for the type `Specification.Catalog`
* @returns {Builder<Specification.Catalog>} A builder for `Specification.Catalog`
*/
export const catalogBuilder = (model?: Partial<Specification.Catalog>): Builder<Specification.Catalog> =>
builder<Specification.Catalog>(model, buildingFn);
3 changes: 3 additions & 0 deletions src/lib/generated/builders/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export * from './call-grpc-builder';
export * from './call-http-builder';
export * from './call-open-api-builder';
export * from './call-task-builder';
export * from './catalog-builder';
export * from './catch-errors-builder';
export * from './constant-backoff-builder';
export * from './container-builder';
Expand Down Expand Up @@ -145,8 +146,10 @@ export * from './timeout-builder';
export * from './try-task-builder';
export * from './try-task-catch-builder';
export * from './try-task-catch-retry-builder';
export * from './uri-template-builder';
export * from './use-builder';
export * from './use-authentications-builder';
export * from './use-catalogs-builder';
export * from './use-errors-builder';
export * from './use-extensions-builder';
export * from './use-functions-builder';
Expand Down
44 changes: 44 additions & 0 deletions src/lib/generated/builders/uri-template-builder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2021-Present The Serverless Workflow Specification Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*****************************************************************************************
*
* /!\ This file is computer generated. Any manual modification can and will be lost. /!\
*
*****************************************************************************************/

import { builder, Builder, BuildOptions } from '../../builder';
import { Classes } from '../classes';
import { Specification } from '../definitions';

/**
* The internal function used by the builder proxy to validate and return its underlying object
* @param {Specification.UriTemplate} model The proxied object
* @param {BuildOptions} options The build options to use
* @returns {Specification.UriTemplate} The built object
*/
function buildingFn(model: Specification.UriTemplate, options: BuildOptions): Specification.UriTemplate {
const instance = new Classes.UriTemplate(model);
if (options.validate) instance.validate();
return (options.normalize ? instance.normalize() : instance) as Specification.UriTemplate;
}

/**
* A factory to create a builder proxy for the type `Specification.UriTemplate`
* @returns {Builder<Specification.UriTemplate>} A builder for `Specification.UriTemplate`
*/
export const uriTemplateBuilder = (model?: Partial<Specification.UriTemplate>): Builder<Specification.UriTemplate> =>
builder<Specification.UriTemplate>(model, buildingFn);
44 changes: 44 additions & 0 deletions src/lib/generated/builders/use-catalogs-builder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2021-Present The Serverless Workflow Specification Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*****************************************************************************************
*
* /!\ This file is computer generated. Any manual modification can and will be lost. /!\
*
*****************************************************************************************/

import { builder, Builder, BuildOptions } from '../../builder';
import { Classes } from '../classes';
import { Specification } from '../definitions';

/**
* The internal function used by the builder proxy to validate and return its underlying object
* @param {Specification.UseCatalogs} model The proxied object
* @param {BuildOptions} options The build options to use
* @returns {Specification.UseCatalogs} The built object
*/
function buildingFn(model: Specification.UseCatalogs, options: BuildOptions): Specification.UseCatalogs {
const instance = new Classes.UseCatalogs(model);
if (options.validate) instance.validate();
return (options.normalize ? instance.normalize() : instance) as Specification.UseCatalogs;
}

/**
* A factory to create a builder proxy for the type `Specification.UseCatalogs`
* @returns {Builder<Specification.UseCatalogs>} A builder for `Specification.UseCatalogs`
*/
export const useCatalogsBuilder = (model?: Partial<Specification.UseCatalogs>): Builder<Specification.UseCatalogs> =>
builder<Specification.UseCatalogs>(model, buildingFn);
83 changes: 83 additions & 0 deletions src/lib/generated/classes/catalog.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* Copyright 2021-Present The Serverless Workflow Specification Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*****************************************************************************************
*
* /!\ This file is computer generated. Any manual modification can and will be lost. /!\
*
*****************************************************************************************/

import { _Endpoint } from './endpoint';
import { ObjectHydrator } from '../../hydrator';
import { Specification } from '../definitions';
import { getLifecycleHooks } from '../../lifecycle-hooks';
import { validate } from '../../validation';
import { isObject } from '../../utils';

/**
* Represents the intersection between the Catalog class and type
*/
export type CatalogIntersection = Catalog & Specification.Catalog;

/**
* Represents a constructor for the intersection of the Catalog class and type
*/
export interface CatalogConstructor {
new (model?: Partial<Specification.Catalog>): CatalogIntersection;
}

/**
* Represents a Catalog with methods for validation and normalization.
* Inherits from ObjectHydrator which provides functionality for hydrating the state based on a model.
*/
export class Catalog extends ObjectHydrator<Specification.Catalog> {
/**
* Instanciates a new instance of the Catalog class.
* Initializes properties based on the provided model if it is an object.
*
* @param model - Optional partial model object to initialize the Catalog.
*/
constructor(model?: Partial<Specification.Catalog>) {
super(model);
const self = this as unknown as Specification.Catalog & object;
if (isObject(model)) {
if (typeof model.endpoint === 'object') self.endpoint = new _Endpoint(model.endpoint);
}
getLifecycleHooks('Catalog')?.constructor?.(this);
}

/**
* Validates the current instance of the Catalog.
* Throws if invalid.
*/
validate(workflow?: Partial<Specification.Workflow>) {
const copy = new Catalog(this as any) as CatalogIntersection;
validate('Catalog', copy, workflow);
}

/**
* Normalizes the current instance of the Catalog.
* Creates a copy of the Catalog, invokes normalization hooks if available, and returns the normalized copy.
*
* @returns A normalized version of the Catalog instance.
*/
normalize(): Catalog & Specification.Catalog {
const copy = new Catalog(this as any) as CatalogIntersection;
return getLifecycleHooks('Catalog')?.normalize?.(copy) || copy;
}
}

export const _Catalog = Catalog as CatalogConstructor;
6 changes: 6 additions & 0 deletions src/lib/generated/classes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { _CallGRPC } from './call-grpc';
import { _CallHTTP } from './call-http';
import { _CallOpenAPI } from './call-open-api';
import { _CallTask } from './call-task';
import { _Catalog } from './catalog';
import { _CatchErrors } from './catch-errors';
import { _ConstantBackoff } from './constant-backoff';
import { _Container } from './container';
Expand Down Expand Up @@ -145,8 +146,10 @@ import { _Timeout } from './timeout';
import { _TryTask } from './try-task';
import { _TryTaskCatch } from './try-task-catch';
import { _TryTaskCatchRetry } from './try-task-catch-retry';
import { _UriTemplate } from './uri-template';
import { _Use } from './use';
import { _UseAuthentications } from './use-authentications';
import { _UseCatalogs } from './use-catalogs';
import { _UseErrors } from './use-errors';
import { _UseExtensions } from './use-extensions';
import { _UseFunctions } from './use-functions';
Expand Down Expand Up @@ -187,6 +190,7 @@ export const Classes = {
CallHTTP: _CallHTTP,
CallOpenAPI: _CallOpenAPI,
CallTask: _CallTask,
Catalog: _Catalog,
CatchErrors: _CatchErrors,
ConstantBackoff: _ConstantBackoff,
Container: _Container,
Expand Down Expand Up @@ -299,8 +303,10 @@ export const Classes = {
TryTask: _TryTask,
TryTaskCatch: _TryTaskCatch,
TryTaskCatchRetry: _TryTaskCatchRetry,
UriTemplate: _UriTemplate,
Use: _Use,
UseAuthentications: _UseAuthentications,
UseCatalogs: _UseCatalogs,
UseErrors: _UseErrors,
UseExtensions: _UseExtensions,
UseFunctions: _UseFunctions,
Expand Down
78 changes: 78 additions & 0 deletions src/lib/generated/classes/uri-template.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Copyright 2021-Present The Serverless Workflow Specification Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*****************************************************************************************
*
* /!\ This file is computer generated. Any manual modification can and will be lost. /!\
*
*****************************************************************************************/

import { ObjectHydrator } from '../../hydrator';
import { Specification } from '../definitions';
import { getLifecycleHooks } from '../../lifecycle-hooks';
import { validate } from '../../validation';

/**
* Represents the intersection between the UriTemplate class and type
*/
export type UriTemplateIntersection = UriTemplate & Specification.UriTemplate;

/**
* Represents a constructor for the intersection of the UriTemplate class and type
*/
export interface UriTemplateConstructor {
new (model?: Partial<Specification.UriTemplate>): UriTemplateIntersection;
}

/**
* Represents a UriTemplate with methods for validation and normalization.
* Inherits from ObjectHydrator which provides functionality for hydrating the state based on a model.
*/
export class UriTemplate extends ObjectHydrator<Specification.UriTemplate> {
/**
* Instanciates a new instance of the UriTemplate class.
* Initializes properties based on the provided model if it is an object.
*
* @param model - Optional partial model object to initialize the UriTemplate.
*/
constructor(model?: Partial<Specification.UriTemplate>) {
super(model);

getLifecycleHooks('UriTemplate')?.constructor?.(this);
}

/**
* Validates the current instance of the UriTemplate.
* Throws if invalid.
*/
validate(workflow?: Partial<Specification.Workflow>) {
const copy = new UriTemplate(this as any) as UriTemplateIntersection;
validate('UriTemplate', copy, workflow);
}

/**
* Normalizes the current instance of the UriTemplate.
* Creates a copy of the UriTemplate, invokes normalization hooks if available, and returns the normalized copy.
*
* @returns A normalized version of the UriTemplate instance.
*/
normalize(): UriTemplate & Specification.UriTemplate {
const copy = new UriTemplate(this as any) as UriTemplateIntersection;
return getLifecycleHooks('UriTemplate')?.normalize?.(copy) || copy;
}
}

export const _UriTemplate = UriTemplate as UriTemplateConstructor;
Loading

0 comments on commit 3c9501c

Please sign in to comment.