Skip to content

Commit

Permalink
Added support for workflow (de)serialization
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Baptiste Bianchi <[email protected]>
  • Loading branch information
JBBianchi committed Jul 31, 2024
1 parent 84901ef commit 2ee8b61
Show file tree
Hide file tree
Showing 108 changed files with 4,409 additions and 1,628 deletions.
343 changes: 188 additions & 155 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './serverless-workflow-sdk';
120 changes: 60 additions & 60 deletions src/lib/generated/builders/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,93 +14,93 @@
* limitations under the License.
*/

export * from './schema-builder';
export * from './external-resource-builder';
export * from './external-resource-authentication-builder';
export * from './authentication-policy-builder';
export * from './task-builder';
export * from './call-task-builder';
export * from './authentication-policy-basic-builder';
export * from './authentication-policy-bearer-builder';
export * from './authentication-policy-oauth2-builder';
export * from './authentication-policy-oauth2-client-builder';
export * from './call-async-api-builder';
export * from './flow-directive-builder';
export * from './call-async-api-with-builder';
export * from './call-async-api-with-authentication-builder';
export * from './call-function-builder';
export * from './call-function-with-builder';
export * from './call-grpc-builder';
export * from './call-grpc-with-builder';
export * from './call-grpc-with-arguments-builder';
export * from './call-grpc-with-service-builder';
export * from './call-grpc-with-service-authentication-builder';
export * from './call-http-builder';
export * from './call-http-with-builder';
export * from './call-http-with-endpoint-builder';
export * from './endpoint-authentication-builder';
export * from './call-open-api-builder';
export * from './call-open-api-with-builder';
export * from './call-open-api-with-authentication-builder';
export * from './call-function-builder';
export * from './call-open-api-with-parameters-builder';
export * from './call-task-builder';
export * from './document-builder';
export * from './document-tags-builder';
export * from './do-task-builder';
export * from './fork-task-builder';
export * from './duration-builder';
export * from './emit-task-builder';
export * from './for-task-builder';
export * from './listen-task-builder';
export * from './emit-task-emit-builder';
export * from './emit-task-emit-event-builder';
export * from './endpoint-builder';
export * from './endpoint-authentication-builder';
export * from './error-builder';
export * from './event-consumption-strategy-builder';
export * from './event-consumption-strategy-all-builder';
export * from './event-consumption-strategy-any-builder';
export * from './raise-task-builder';
export * from './run-task-builder';
export * from './run-task-run-builder';
export * from './run-task-run-script-builder';
export * from './set-task-builder';
export * from './switch-task-builder';
export * from './switch-task-switch-builder';
export * from './try-task-builder';
export * from './retry-policy-backoff-builder';
export * from './wait-task-builder';
export * from './task-list-builder';
export * from './use-extensions-builder';
export * from './workflow-builder';
export * from './document-builder';
export * from './document-tags-builder';
export * from './input-builder';
export * from './authentication-policy-basic-builder';
export * from './authentication-policy-bearer-builder';
export * from './authentication-policy-oauth2-builder';
export * from './authentication-policy-oauth2-client-builder';
export * from './oauth2-token-builder';
export * from './use-builder';
export * from './use-authentications-builder';
export * from './use-errors-builder';
export * from './error-builder';
export * from './extension-builder';
export * from './task-base-builder';
export * from './output-builder';
export * from './event-filter-builder';
export * from './event-filter-correlate-builder';
export * from './event-filter-with-builder';
export * from './export-builder';
export * from './timeout-builder';
export * from './duration-builder';
export * from './call-async-api-with-builder';
export * from './call-grpc-with-builder';
export * from './call-grpc-with-service-builder';
export * from './call-grpc-with-arguments-builder';
export * from './call-http-with-builder';
export * from './endpoint-builder';
export * from './call-open-api-with-builder';
export * from './call-open-api-with-parameters-builder';
export * from './call-function-with-builder';
export * from './extension-builder';
export * from './external-resource-builder';
export * from './external-resource-authentication-builder';
export * from './flow-directive-builder';
export * from './fork-task-builder';
export * from './fork-task-fork-builder';
export * from './emit-task-emit-builder';
export * from './emit-task-emit-event-builder';
export * from './for-task-builder';
export * from './for-task-for-builder';
export * from './input-builder';
export * from './listen-task-builder';
export * from './listen-task-listen-builder';
export * from './event-filter-builder';
export * from './event-filter-with-builder';
export * from './event-filter-correlate-builder';
export * from './oauth2-token-builder';
export * from './output-builder';
export * from './raise-task-builder';
export * from './raise-task-raise-builder';
export * from './retry-policy-builder';
export * from './retry-policy-backoff-builder';
export * from './retry-policy-jitter-builder';
export * from './retry-policy-limit-builder';
export * from './retry-policy-limit-attempt-builder';
export * from './run-task-builder';
export * from './run-task-run-builder';
export * from './run-task-run-container-builder';
export * from './run-task-run-script-builder';
export * from './run-task-run-shell-builder';
export * from './run-task-run-shell-arguments-builder';
export * from './run-task-run-shell-environment-builder';
export * from './run-task-run-workflow-builder';
export * from './run-task-run-workflow-input-builder';
export * from './schedule-builder';
export * from './schema-builder';
export * from './set-task-builder';
export * from './set-task-set-builder';
export * from './switch-task-builder';
export * from './switch-task-switch-builder';
export * from './switch-task-switch-case-builder';
export * from './task-builder';
export * from './task-base-builder';
export * from './task-list-builder';
export * from './timeout-builder';
export * from './try-task-builder';
export * from './try-task-catch-builder';
export * from './retry-policy-builder';
export * from './retry-policy-limit-builder';
export * from './retry-policy-limit-attempt-builder';
export * from './retry-policy-jitter-builder';
export * from './use-builder';
export * from './use-authentications-builder';
export * from './use-errors-builder';
export * from './use-extensions-builder';
export * from './use-functions-builder';
export * from './use-retries-builder';
export * from './schedule-builder';
export * from './wait-task-builder';
export * from './workflow-builder';
57 changes: 40 additions & 17 deletions src/lib/generated/classes/authentication-policy-basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,57 @@

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

class AuthenticationPolicyBasic extends ObjectHydrator<Specification.AuthenticationPolicyBasic> {
/**
* Represents the intersection between the AuthenticationPolicyBasic class and type
*/
export type AuthenticationPolicyBasicIntersection = AuthenticationPolicyBasic & Specification.AuthenticationPolicyBasic;

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

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

getLifecycleHook('AuthenticationPolicyBasic')?.constructor?.(this);
getLifecycleHooks('AuthenticationPolicyBasic')?.constructor?.(this);
}

/**
* Validates the current instance of the AuthenticationPolicyBasic.
* Throws if invalid.
*/
validate() {
const copy = new AuthenticationPolicyBasic(this as any) as AuthenticationPolicyBasic &
Specification.AuthenticationPolicyBasic;
getLifecycleHook('AuthenticationPolicyBasic')?.preValidation?.(copy);
validate('AuthenticationPolicyBasic', deepCopy(copy)); // deepCopy prevents potential additional properties error for constructor, validate, normalize
getLifecycleHook('AuthenticationPolicyBasic')?.postValidation?.(copy);
const copy = new AuthenticationPolicyBasic(this as any) as AuthenticationPolicyBasicIntersection;
validate('AuthenticationPolicyBasic', copy);
}

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

export const _AuthenticationPolicyBasic = AuthenticationPolicyBasic as {
new (
model?: Partial<Specification.AuthenticationPolicyBasic>,
): AuthenticationPolicyBasic & Specification.AuthenticationPolicyBasic;
};
export const _AuthenticationPolicyBasic = AuthenticationPolicyBasic as AuthenticationPolicyBasicConstructor;
58 changes: 41 additions & 17 deletions src/lib/generated/classes/authentication-policy-bearer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,58 @@

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

class AuthenticationPolicyBearer extends ObjectHydrator<Specification.AuthenticationPolicyBearer> {
/**
* Represents the intersection between the AuthenticationPolicyBearer class and type
*/
export type AuthenticationPolicyBearerIntersection = AuthenticationPolicyBearer &
Specification.AuthenticationPolicyBearer;

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

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

getLifecycleHook('AuthenticationPolicyBearer')?.constructor?.(this);
getLifecycleHooks('AuthenticationPolicyBearer')?.constructor?.(this);
}

/**
* Validates the current instance of the AuthenticationPolicyBearer.
* Throws if invalid.
*/
validate() {
const copy = new AuthenticationPolicyBearer(this as any) as AuthenticationPolicyBearer &
Specification.AuthenticationPolicyBearer;
getLifecycleHook('AuthenticationPolicyBearer')?.preValidation?.(copy);
validate('AuthenticationPolicyBearer', deepCopy(copy)); // deepCopy prevents potential additional properties error for constructor, validate, normalize
getLifecycleHook('AuthenticationPolicyBearer')?.postValidation?.(copy);
const copy = new AuthenticationPolicyBearer(this as any) as AuthenticationPolicyBearerIntersection;
validate('AuthenticationPolicyBearer', copy);
}

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

export const _AuthenticationPolicyBearer = AuthenticationPolicyBearer as {
new (
model?: Partial<Specification.AuthenticationPolicyBearer>,
): AuthenticationPolicyBearer & Specification.AuthenticationPolicyBearer;
};
export const _AuthenticationPolicyBearer = AuthenticationPolicyBearer as AuthenticationPolicyBearerConstructor;
59 changes: 42 additions & 17 deletions src/lib/generated/classes/authentication-policy-oauth2-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,59 @@

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

class AuthenticationPolicyOauth2Client extends ObjectHydrator<Specification.AuthenticationPolicyOauth2Client> {
/**
* Represents the intersection between the AuthenticationPolicyOauth2Client class and type
*/
export type AuthenticationPolicyOauth2ClientIntersection = AuthenticationPolicyOauth2Client &
Specification.AuthenticationPolicyOauth2Client;

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

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

getLifecycleHook('AuthenticationPolicyOauth2Client')?.constructor?.(this);
getLifecycleHooks('AuthenticationPolicyOauth2Client')?.constructor?.(this);
}

/**
* Validates the current instance of the AuthenticationPolicyOauth2Client.
* Throws if invalid.
*/
validate() {
const copy = new AuthenticationPolicyOauth2Client(this as any) as AuthenticationPolicyOauth2Client &
Specification.AuthenticationPolicyOauth2Client;
getLifecycleHook('AuthenticationPolicyOauth2Client')?.preValidation?.(copy);
validate('AuthenticationPolicyOauth2Client', deepCopy(copy)); // deepCopy prevents potential additional properties error for constructor, validate, normalize
getLifecycleHook('AuthenticationPolicyOauth2Client')?.postValidation?.(copy);
const copy = new AuthenticationPolicyOauth2Client(this as any) as AuthenticationPolicyOauth2ClientIntersection;
validate('AuthenticationPolicyOauth2Client', copy);
}

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

export const _AuthenticationPolicyOauth2Client = AuthenticationPolicyOauth2Client as {
new (
model?: Partial<Specification.AuthenticationPolicyOauth2Client>,
): AuthenticationPolicyOauth2Client & Specification.AuthenticationPolicyOauth2Client;
};
export const _AuthenticationPolicyOauth2Client =
AuthenticationPolicyOauth2Client as AuthenticationPolicyOauth2ClientConstructor;
Loading

0 comments on commit 2ee8b61

Please sign in to comment.