@transai/connector-runner-api 0.8.1 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,26 @@
1
+ export interface ValueMapper {
2
+ selector: string;
3
+ type: 'string' | 'number' | 'boolean';
4
+ required?: boolean;
5
+ }
6
+ export interface ArrayMapper {
7
+ selector: string;
8
+ type: 'array';
9
+ required?: boolean;
10
+ items: MessageMapper;
11
+ }
12
+ export type MessageMapper = {
13
+ [key: string]: ValueMapper | ArrayMapper;
14
+ };
15
+ export interface ConditionMapper {
16
+ selector: string;
17
+ [key: string]: string | {
18
+ id: string;
19
+ value: string;
20
+ };
21
+ }
22
+ export interface ValidationMapper {
23
+ selector: string;
24
+ custom_failure_message?: string;
25
+ }
26
+ export type NodeMapper = MessageMapper | ConditionMapper | ValidationMapper | {};
@@ -1,47 +1,45 @@
1
- import { TriggerType } from './trigger-types.interface';
2
- import { NodeTypes, WorkflowDrawing } from './workflow.drawing';
3
- export interface ValueMapper {
4
- selector: string;
5
- type: 'string' | 'number' | 'boolean';
6
- required?: boolean;
7
- }
8
- export interface ArrayMapper {
9
- selector: string;
10
- type: 'array';
11
- required?: boolean;
12
- items: MessageMapper;
13
- }
14
- export type MessageMapper = {
15
- [key: string]: ValueMapper | ArrayMapper;
16
- };
17
- export interface ConditionMapper {
18
- selector: string;
19
- [key: string]: string | {
20
- id: string;
21
- value: string;
22
- };
1
+ import { NodeTypes, TriggerType } from './enums';
2
+ import { ConditionMapper, MessageMapper, NodeMapper, ValidationMapper } from './parameter-mapper.interface';
3
+ import { WorkflowDrawing } from './workflow-drawing.interface';
4
+ export interface StoredInterface {
5
+ id: string;
6
+ createdAt: Date;
7
+ updatedAt: Date;
23
8
  }
24
- export type NodeMapper = MessageMapper | ConditionMapper;
25
9
  export interface TriggerInterface {
26
10
  name: string;
27
11
  type: TriggerType;
28
12
  identifier: string;
29
13
  expression?: string;
30
14
  }
31
- export interface CreateWorkflowDefinitionStep {
15
+ export interface WorkflowDefinitionStepBase {
32
16
  name: string;
33
17
  identifier: string;
34
18
  requires: Array<string>;
35
- type: NodeTypes;
36
19
  operationIdentifier: string;
37
20
  operationVersion?: string;
21
+ type: NodeTypes;
38
22
  with: NodeMapper;
39
23
  }
40
- export interface WorkflowDefinitionStep extends CreateWorkflowDefinitionStep {
41
- id: string;
42
- createdAt: Date;
43
- updatedAt: Date;
24
+ export type BaseWorkflowDefinitionStep = WorkflowDefinitionStepBase & StoredInterface;
25
+ export interface ActionStep extends WorkflowDefinitionStepBase {
26
+ type: NodeTypes.ACTION;
27
+ with: MessageMapper;
28
+ operationVersion: string;
29
+ }
30
+ export interface ConditionalStep extends WorkflowDefinitionStepBase {
31
+ type: NodeTypes.CONDITIONAL;
32
+ with: ConditionMapper;
33
+ }
34
+ export interface ValidationStep extends WorkflowDefinitionStepBase {
35
+ type: NodeTypes.VALIDATION;
36
+ with: ValidationMapper;
37
+ }
38
+ export interface PlaceholderStep extends WorkflowDefinitionStepBase {
39
+ type: NodeTypes.PLACEHOLDER;
40
+ with: {};
44
41
  }
42
+ export type WorkflowDefinitionStep = ActionStep | ConditionalStep | ValidationStep | PlaceholderStep;
45
43
  export interface CreateWorkflowDefinition {
46
44
  identifier: string;
47
45
  name: string;
@@ -50,15 +48,19 @@ export interface CreateWorkflowDefinition {
50
48
  triggerType: TriggerType;
51
49
  triggerIdentifier: string;
52
50
  semanticIdentifier: string;
53
- steps: Array<CreateWorkflowDefinitionStep>;
51
+ steps: Array<WorkflowDefinitionStepBase>;
54
52
  enabled: boolean;
55
53
  workflowDrawing?: WorkflowDrawing;
56
54
  trigger?: TriggerInterface;
57
55
  }
58
- export interface WorkflowDefinition extends CreateWorkflowDefinition {
59
- steps: Array<WorkflowDefinitionStep>;
60
- id: string;
61
- createdAt: Date;
62
- updatedAt: Date;
56
+ export interface WorkflowDefinition extends CreateWorkflowDefinition, StoredInterface {
57
+ steps: Array<WorkflowDefinitionStepBase>;
63
58
  tenantIdentifier: string;
64
59
  }
60
+ /**
61
+ * TODO: set this later as WorkflowDefinition
62
+ * However if i do that right now, compilation fails
63
+ */
64
+ export interface BetterWorkflowDefinition extends WorkflowDefinition {
65
+ steps: Array<WorkflowDefinitionStep & StoredInterface>;
66
+ }
@@ -1,19 +1,5 @@
1
- import { TriggerType } from './trigger-types.interface';
2
- import { ConditionMapper, MessageMapper } from './workflow-definition.interface';
3
- export declare enum NodeTypes {
4
- TRIGGER = "TRIGGER",
5
- ACTION = "ACTION",
6
- CONDITIONAL = "CONDITIONAL",
7
- VALIDATION = "VALIDATION",
8
- ANNOTATION = "ANNOTATION",
9
- PLACEHOLDER = "PLACEHOLDER",
10
- INVISIBLE = "INVISIBLE",
11
- END = "END"
12
- }
13
- export declare enum ConditionalTypes {
14
- TRUE_FALSE = "TRUE_FALSE",
15
- CASE = "CASE"
16
- }
1
+ import { ConditionalTypes, NodeTypes, TriggerType } from './enums';
2
+ import { ConditionMapper, MessageMapper, ValidationMapper } from './parameter-mapper.interface';
17
3
  export interface Conditional {
18
4
  type: ConditionalTypes;
19
5
  }
@@ -50,7 +36,7 @@ export interface ConditionalNode extends Node {
50
36
  }
51
37
  export interface ValidationNode extends Node {
52
38
  type: NodeTypes.VALIDATION;
53
- with: ConditionMapper;
39
+ with: ValidationMapper;
54
40
  }
55
41
  export interface AnnotationNode extends Node {
56
42
  type: NodeTypes.ANNOTATION;
@@ -60,6 +46,7 @@ export interface EndNode extends Node {
60
46
  }
61
47
  export interface PlaceholderNode extends Node {
62
48
  type: NodeTypes.PLACEHOLDER;
49
+ with: {};
63
50
  }
64
51
  export interface InvisibleNode extends Node {
65
52
  type: NodeTypes.INVISIBLE;
@@ -1,37 +1,9 @@
1
1
  import { EventInterface } from '../event-origin.interface';
2
- import { ConditionMapper, MessageMapper, NodeMapper, WorkflowDefinition, WorkflowDefinitionStep } from './workflow-definition.interface';
3
- import { NodeTypes, WorkflowDrawing } from './workflow.drawing';
4
- export declare enum WorkflowRunStatusStatus {
5
- PENDING = "PENDING",
6
- RUNNING = "RUNNING",
7
- SUCCESS = "SUCCESS",
8
- FAILED = "FAILED"
9
- }
10
- export declare enum WorkflowJobStatusStatus {
11
- PENDING = "PENDING",
12
- RUNNING = "RUNNING",
13
- SUCCESS = "SUCCESS",
14
- SKIPPED = "SKIPPED",
15
- BAD_REQUEST = "BAD_REQUEST",// input validation errors
16
- INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR",
17
- ABORTED = "ABORTED"
18
- }
19
- export interface WorkflowRunInterface {
20
- id: string;
21
- tenantIdentifier: string;
22
- semanticIdentifier: string;
23
- status: WorkflowRunStatusStatus;
24
- ttl: number;
25
- workflow: WorkflowDefinition;
26
- drawing?: WorkflowDrawing;
27
- trigger: EventInterface;
28
- jobs: Array<ActionJob | ConditionalJob | ValidationJob>;
29
- createdAt: Date;
30
- updatedAt: Date;
31
- testRun?: boolean;
32
- restartOf?: string;
33
- }
34
- export interface WorkflowJobInterface {
2
+ import { WorkflowDefinition, WorkflowDefinitionStep } from './workflow-definition.interface';
3
+ import { WorkflowDrawing } from './workflow-drawing.interface';
4
+ import { ConditionMapper, MessageMapper, NodeMapper, ValidationMapper } from './parameter-mapper.interface';
5
+ import { WorkflowRunStatusStatus, WorkflowJobStatusStatus, NodeTypes } from './enums';
6
+ export interface BaseWorkflowJobInterface {
35
7
  id: string;
36
8
  identifier: string;
37
9
  run: WorkflowRunInterface;
@@ -41,26 +13,45 @@ export interface WorkflowJobInterface {
41
13
  payload?: Record<string, unknown> | undefined;
42
14
  log?: string;
43
15
  result?: unknown;
44
- type: NodeTypes;
45
- with: NodeMapper;
46
16
  requires: Array<string>;
47
17
  step: WorkflowDefinitionStep;
48
18
  testRun?: boolean;
49
19
  createdAt: Date;
50
20
  updatedAt: Date;
21
+ type: NodeTypes;
22
+ with: NodeMapper;
51
23
  }
52
- export interface ActionJob extends WorkflowJobInterface {
24
+ export interface ActionJob extends BaseWorkflowJobInterface {
53
25
  type: NodeTypes.ACTION;
54
26
  with: MessageMapper;
27
+ operationIdentifier: string;
28
+ operationVersion: string;
55
29
  }
56
- export interface ConditionalJob extends WorkflowJobInterface {
30
+ export interface ConditionalJob extends BaseWorkflowJobInterface {
57
31
  type: NodeTypes.CONDITIONAL;
58
32
  with: ConditionMapper;
59
33
  }
60
- export interface ValidationJob extends WorkflowJobInterface {
34
+ export interface ValidationJob extends BaseWorkflowJobInterface {
61
35
  type: NodeTypes.VALIDATION;
62
- with: ConditionMapper;
36
+ with: ValidationMapper;
63
37
  }
64
- export interface PlaceholderJob extends WorkflowJobInterface {
38
+ export interface PlaceholderJob extends BaseWorkflowJobInterface {
65
39
  type: NodeTypes.PLACEHOLDER;
40
+ with: {};
41
+ }
42
+ export type WorkflowJobInterface = ActionJob | ConditionalJob | ValidationJob | PlaceholderJob;
43
+ export interface WorkflowRunInterface {
44
+ id: string;
45
+ tenantIdentifier: string;
46
+ semanticIdentifier: string;
47
+ status: WorkflowRunStatusStatus;
48
+ ttl: number;
49
+ workflow: WorkflowDefinition;
50
+ drawing?: WorkflowDrawing;
51
+ trigger: EventInterface;
52
+ jobs: Array<WorkflowJobInterface>;
53
+ createdAt: Date;
54
+ updatedAt: Date;
55
+ testRun?: boolean;
56
+ restartOf?: string;
66
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transai/connector-runner-api",
3
- "version": "0.8.1",
3
+ "version": "0.9.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -11,6 +11,6 @@
11
11
  "url": "https://transai.com"
12
12
  },
13
13
  "type": "commonjs",
14
- "main": "./index.js",
14
+ "main": "./index.cjs",
15
15
  "typings": "./index.d.ts"
16
16
  }