Skip to content

Commit 3c9501c

Browse files
committed
Updated for v1.0.0-alpha5
Signed-off-by: Jean-Baptiste Bianchi <[email protected]>
1 parent 0727bde commit 3c9501c

15 files changed

+726
-225
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@serverlessworkflow/sdk",
3-
"version": "1.0.0-alpha3.0",
4-
"schemaVersion": "1.0.0-alpha3",
3+
"version": "1.0.0-alpha5.0",
4+
"schemaVersion": "1.0.0-alpha5",
55
"description": "Typescript SDK for Serverless Workflow Specification",
66
"main": "umd/index.umd.min.js",
77
"browser": "umd/index.umd.min.js",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright 2021-Present The Serverless Workflow Specification Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/*****************************************************************************************
18+
*
19+
* /!\ This file is computer generated. Any manual modification can and will be lost. /!\
20+
*
21+
*****************************************************************************************/
22+
23+
import { builder, Builder, BuildOptions } from '../../builder';
24+
import { Classes } from '../classes';
25+
import { Specification } from '../definitions';
26+
27+
/**
28+
* The internal function used by the builder proxy to validate and return its underlying object
29+
* @param {Specification.Catalog} model The proxied object
30+
* @param {BuildOptions} options The build options to use
31+
* @returns {Specification.Catalog} The built object
32+
*/
33+
function buildingFn(model: Specification.Catalog, options: BuildOptions): Specification.Catalog {
34+
const instance = new Classes.Catalog(model);
35+
if (options.validate) instance.validate();
36+
return (options.normalize ? instance.normalize() : instance) as Specification.Catalog;
37+
}
38+
39+
/**
40+
* A factory to create a builder proxy for the type `Specification.Catalog`
41+
* @returns {Builder<Specification.Catalog>} A builder for `Specification.Catalog`
42+
*/
43+
export const catalogBuilder = (model?: Partial<Specification.Catalog>): Builder<Specification.Catalog> =>
44+
builder<Specification.Catalog>(model, buildingFn);

src/lib/generated/builders/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export * from './call-grpc-builder';
3333
export * from './call-http-builder';
3434
export * from './call-open-api-builder';
3535
export * from './call-task-builder';
36+
export * from './catalog-builder';
3637
export * from './catch-errors-builder';
3738
export * from './constant-backoff-builder';
3839
export * from './container-builder';
@@ -145,8 +146,10 @@ export * from './timeout-builder';
145146
export * from './try-task-builder';
146147
export * from './try-task-catch-builder';
147148
export * from './try-task-catch-retry-builder';
149+
export * from './uri-template-builder';
148150
export * from './use-builder';
149151
export * from './use-authentications-builder';
152+
export * from './use-catalogs-builder';
150153
export * from './use-errors-builder';
151154
export * from './use-extensions-builder';
152155
export * from './use-functions-builder';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright 2021-Present The Serverless Workflow Specification Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/*****************************************************************************************
18+
*
19+
* /!\ This file is computer generated. Any manual modification can and will be lost. /!\
20+
*
21+
*****************************************************************************************/
22+
23+
import { builder, Builder, BuildOptions } from '../../builder';
24+
import { Classes } from '../classes';
25+
import { Specification } from '../definitions';
26+
27+
/**
28+
* The internal function used by the builder proxy to validate and return its underlying object
29+
* @param {Specification.UriTemplate} model The proxied object
30+
* @param {BuildOptions} options The build options to use
31+
* @returns {Specification.UriTemplate} The built object
32+
*/
33+
function buildingFn(model: Specification.UriTemplate, options: BuildOptions): Specification.UriTemplate {
34+
const instance = new Classes.UriTemplate(model);
35+
if (options.validate) instance.validate();
36+
return (options.normalize ? instance.normalize() : instance) as Specification.UriTemplate;
37+
}
38+
39+
/**
40+
* A factory to create a builder proxy for the type `Specification.UriTemplate`
41+
* @returns {Builder<Specification.UriTemplate>} A builder for `Specification.UriTemplate`
42+
*/
43+
export const uriTemplateBuilder = (model?: Partial<Specification.UriTemplate>): Builder<Specification.UriTemplate> =>
44+
builder<Specification.UriTemplate>(model, buildingFn);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright 2021-Present The Serverless Workflow Specification Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/*****************************************************************************************
18+
*
19+
* /!\ This file is computer generated. Any manual modification can and will be lost. /!\
20+
*
21+
*****************************************************************************************/
22+
23+
import { builder, Builder, BuildOptions } from '../../builder';
24+
import { Classes } from '../classes';
25+
import { Specification } from '../definitions';
26+
27+
/**
28+
* The internal function used by the builder proxy to validate and return its underlying object
29+
* @param {Specification.UseCatalogs} model The proxied object
30+
* @param {BuildOptions} options The build options to use
31+
* @returns {Specification.UseCatalogs} The built object
32+
*/
33+
function buildingFn(model: Specification.UseCatalogs, options: BuildOptions): Specification.UseCatalogs {
34+
const instance = new Classes.UseCatalogs(model);
35+
if (options.validate) instance.validate();
36+
return (options.normalize ? instance.normalize() : instance) as Specification.UseCatalogs;
37+
}
38+
39+
/**
40+
* A factory to create a builder proxy for the type `Specification.UseCatalogs`
41+
* @returns {Builder<Specification.UseCatalogs>} A builder for `Specification.UseCatalogs`
42+
*/
43+
export const useCatalogsBuilder = (model?: Partial<Specification.UseCatalogs>): Builder<Specification.UseCatalogs> =>
44+
builder<Specification.UseCatalogs>(model, buildingFn);

src/lib/generated/classes/catalog.ts

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
* Copyright 2021-Present The Serverless Workflow Specification Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/*****************************************************************************************
18+
*
19+
* /!\ This file is computer generated. Any manual modification can and will be lost. /!\
20+
*
21+
*****************************************************************************************/
22+
23+
import { _Endpoint } from './endpoint';
24+
import { ObjectHydrator } from '../../hydrator';
25+
import { Specification } from '../definitions';
26+
import { getLifecycleHooks } from '../../lifecycle-hooks';
27+
import { validate } from '../../validation';
28+
import { isObject } from '../../utils';
29+
30+
/**
31+
* Represents the intersection between the Catalog class and type
32+
*/
33+
export type CatalogIntersection = Catalog & Specification.Catalog;
34+
35+
/**
36+
* Represents a constructor for the intersection of the Catalog class and type
37+
*/
38+
export interface CatalogConstructor {
39+
new (model?: Partial<Specification.Catalog>): CatalogIntersection;
40+
}
41+
42+
/**
43+
* Represents a Catalog with methods for validation and normalization.
44+
* Inherits from ObjectHydrator which provides functionality for hydrating the state based on a model.
45+
*/
46+
export class Catalog extends ObjectHydrator<Specification.Catalog> {
47+
/**
48+
* Instanciates a new instance of the Catalog class.
49+
* Initializes properties based on the provided model if it is an object.
50+
*
51+
* @param model - Optional partial model object to initialize the Catalog.
52+
*/
53+
constructor(model?: Partial<Specification.Catalog>) {
54+
super(model);
55+
const self = this as unknown as Specification.Catalog & object;
56+
if (isObject(model)) {
57+
if (typeof model.endpoint === 'object') self.endpoint = new _Endpoint(model.endpoint);
58+
}
59+
getLifecycleHooks('Catalog')?.constructor?.(this);
60+
}
61+
62+
/**
63+
* Validates the current instance of the Catalog.
64+
* Throws if invalid.
65+
*/
66+
validate(workflow?: Partial<Specification.Workflow>) {
67+
const copy = new Catalog(this as any) as CatalogIntersection;
68+
validate('Catalog', copy, workflow);
69+
}
70+
71+
/**
72+
* Normalizes the current instance of the Catalog.
73+
* Creates a copy of the Catalog, invokes normalization hooks if available, and returns the normalized copy.
74+
*
75+
* @returns A normalized version of the Catalog instance.
76+
*/
77+
normalize(): Catalog & Specification.Catalog {
78+
const copy = new Catalog(this as any) as CatalogIntersection;
79+
return getLifecycleHooks('Catalog')?.normalize?.(copy) || copy;
80+
}
81+
}
82+
83+
export const _Catalog = Catalog as CatalogConstructor;

src/lib/generated/classes/index.ts

+6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import { _CallGRPC } from './call-grpc';
3333
import { _CallHTTP } from './call-http';
3434
import { _CallOpenAPI } from './call-open-api';
3535
import { _CallTask } from './call-task';
36+
import { _Catalog } from './catalog';
3637
import { _CatchErrors } from './catch-errors';
3738
import { _ConstantBackoff } from './constant-backoff';
3839
import { _Container } from './container';
@@ -145,8 +146,10 @@ import { _Timeout } from './timeout';
145146
import { _TryTask } from './try-task';
146147
import { _TryTaskCatch } from './try-task-catch';
147148
import { _TryTaskCatchRetry } from './try-task-catch-retry';
149+
import { _UriTemplate } from './uri-template';
148150
import { _Use } from './use';
149151
import { _UseAuthentications } from './use-authentications';
152+
import { _UseCatalogs } from './use-catalogs';
150153
import { _UseErrors } from './use-errors';
151154
import { _UseExtensions } from './use-extensions';
152155
import { _UseFunctions } from './use-functions';
@@ -187,6 +190,7 @@ export const Classes = {
187190
CallHTTP: _CallHTTP,
188191
CallOpenAPI: _CallOpenAPI,
189192
CallTask: _CallTask,
193+
Catalog: _Catalog,
190194
CatchErrors: _CatchErrors,
191195
ConstantBackoff: _ConstantBackoff,
192196
Container: _Container,
@@ -299,8 +303,10 @@ export const Classes = {
299303
TryTask: _TryTask,
300304
TryTaskCatch: _TryTaskCatch,
301305
TryTaskCatchRetry: _TryTaskCatchRetry,
306+
UriTemplate: _UriTemplate,
302307
Use: _Use,
303308
UseAuthentications: _UseAuthentications,
309+
UseCatalogs: _UseCatalogs,
304310
UseErrors: _UseErrors,
305311
UseExtensions: _UseExtensions,
306312
UseFunctions: _UseFunctions,
+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
* Copyright 2021-Present The Serverless Workflow Specification Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/*****************************************************************************************
18+
*
19+
* /!\ This file is computer generated. Any manual modification can and will be lost. /!\
20+
*
21+
*****************************************************************************************/
22+
23+
import { ObjectHydrator } from '../../hydrator';
24+
import { Specification } from '../definitions';
25+
import { getLifecycleHooks } from '../../lifecycle-hooks';
26+
import { validate } from '../../validation';
27+
28+
/**
29+
* Represents the intersection between the UriTemplate class and type
30+
*/
31+
export type UriTemplateIntersection = UriTemplate & Specification.UriTemplate;
32+
33+
/**
34+
* Represents a constructor for the intersection of the UriTemplate class and type
35+
*/
36+
export interface UriTemplateConstructor {
37+
new (model?: Partial<Specification.UriTemplate>): UriTemplateIntersection;
38+
}
39+
40+
/**
41+
* Represents a UriTemplate with methods for validation and normalization.
42+
* Inherits from ObjectHydrator which provides functionality for hydrating the state based on a model.
43+
*/
44+
export class UriTemplate extends ObjectHydrator<Specification.UriTemplate> {
45+
/**
46+
* Instanciates a new instance of the UriTemplate class.
47+
* Initializes properties based on the provided model if it is an object.
48+
*
49+
* @param model - Optional partial model object to initialize the UriTemplate.
50+
*/
51+
constructor(model?: Partial<Specification.UriTemplate>) {
52+
super(model);
53+
54+
getLifecycleHooks('UriTemplate')?.constructor?.(this);
55+
}
56+
57+
/**
58+
* Validates the current instance of the UriTemplate.
59+
* Throws if invalid.
60+
*/
61+
validate(workflow?: Partial<Specification.Workflow>) {
62+
const copy = new UriTemplate(this as any) as UriTemplateIntersection;
63+
validate('UriTemplate', copy, workflow);
64+
}
65+
66+
/**
67+
* Normalizes the current instance of the UriTemplate.
68+
* Creates a copy of the UriTemplate, invokes normalization hooks if available, and returns the normalized copy.
69+
*
70+
* @returns A normalized version of the UriTemplate instance.
71+
*/
72+
normalize(): UriTemplate & Specification.UriTemplate {
73+
const copy = new UriTemplate(this as any) as UriTemplateIntersection;
74+
return getLifecycleHooks('UriTemplate')?.normalize?.(copy) || copy;
75+
}
76+
}
77+
78+
export const _UriTemplate = UriTemplate as UriTemplateConstructor;

0 commit comments

Comments
 (0)