@vertesia/common 0.42.2
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.
- package/LICENSE +13 -0
- package/lib/cjs/access-control.js +39 -0
- package/lib/cjs/access-control.js.map +1 -0
- package/lib/cjs/analytics.js +3 -0
- package/lib/cjs/analytics.js.map +1 -0
- package/lib/cjs/apikey.js +15 -0
- package/lib/cjs/apikey.js.map +1 -0
- package/lib/cjs/common.js +3 -0
- package/lib/cjs/common.js.map +1 -0
- package/lib/cjs/environment.js +116 -0
- package/lib/cjs/environment.js.map +1 -0
- package/lib/cjs/facets.js +3 -0
- package/lib/cjs/facets.js.map +1 -0
- package/lib/cjs/index.js +37 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/integrations.js +10 -0
- package/lib/cjs/integrations.js.map +1 -0
- package/lib/cjs/interaction.js +63 -0
- package/lib/cjs/interaction.js.map +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/payload.js +3 -0
- package/lib/cjs/payload.js.map +1 -0
- package/lib/cjs/project.js +50 -0
- package/lib/cjs/project.js.map +1 -0
- package/lib/cjs/prompt.js +21 -0
- package/lib/cjs/prompt.js.map +1 -0
- package/lib/cjs/query.js +3 -0
- package/lib/cjs/query.js.map +1 -0
- package/lib/cjs/refs.js +12 -0
- package/lib/cjs/refs.js.map +1 -0
- package/lib/cjs/runs.js +3 -0
- package/lib/cjs/runs.js.map +1 -0
- package/lib/cjs/store/activity-catalog.js +3 -0
- package/lib/cjs/store/activity-catalog.js.map +1 -0
- package/lib/cjs/store/common.js +3 -0
- package/lib/cjs/store/common.js.map +1 -0
- package/lib/cjs/store/dsl-workflow.js +5 -0
- package/lib/cjs/store/dsl-workflow.js.map +1 -0
- package/lib/cjs/store/index.js +24 -0
- package/lib/cjs/store/index.js.map +1 -0
- package/lib/cjs/store/object-types.js +98 -0
- package/lib/cjs/store/object-types.js.map +1 -0
- package/lib/cjs/store/store.js +18 -0
- package/lib/cjs/store/store.js.map +1 -0
- package/lib/cjs/store/temporalio.js +44 -0
- package/lib/cjs/store/temporalio.js.map +1 -0
- package/lib/cjs/store/workflow.js +24 -0
- package/lib/cjs/store/workflow.js.map +1 -0
- package/lib/cjs/training.js +14 -0
- package/lib/cjs/training.js.map +1 -0
- package/lib/cjs/transient-tokens.js +9 -0
- package/lib/cjs/transient-tokens.js.map +1 -0
- package/lib/cjs/user.js +12 -0
- package/lib/cjs/user.js.map +1 -0
- package/lib/cjs/utils/auth.js +15 -0
- package/lib/cjs/utils/auth.js.map +1 -0
- package/lib/cjs/utils/schemas.js +48 -0
- package/lib/cjs/utils/schemas.js.map +1 -0
- package/lib/esm/access-control.js +36 -0
- package/lib/esm/access-control.js.map +1 -0
- package/lib/esm/analytics.js +2 -0
- package/lib/esm/analytics.js.map +1 -0
- package/lib/esm/apikey.js +12 -0
- package/lib/esm/apikey.js.map +1 -0
- package/lib/esm/common.js +2 -0
- package/lib/esm/common.js.map +1 -0
- package/lib/esm/environment.js +113 -0
- package/lib/esm/environment.js.map +1 -0
- package/lib/esm/facets.js +2 -0
- package/lib/esm/facets.js.map +1 -0
- package/lib/esm/index.js +21 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/integrations.js +7 -0
- package/lib/esm/integrations.js.map +1 -0
- package/lib/esm/interaction.js +60 -0
- package/lib/esm/interaction.js.map +1 -0
- package/lib/esm/payload.js +2 -0
- package/lib/esm/payload.js.map +1 -0
- package/lib/esm/project.js +46 -0
- package/lib/esm/project.js.map +1 -0
- package/lib/esm/prompt.js +18 -0
- package/lib/esm/prompt.js.map +1 -0
- package/lib/esm/query.js +2 -0
- package/lib/esm/query.js.map +1 -0
- package/lib/esm/refs.js +9 -0
- package/lib/esm/refs.js.map +1 -0
- package/lib/esm/runs.js +2 -0
- package/lib/esm/runs.js.map +1 -0
- package/lib/esm/store/activity-catalog.js +2 -0
- package/lib/esm/store/activity-catalog.js.map +1 -0
- package/lib/esm/store/common.js +2 -0
- package/lib/esm/store/common.js.map +1 -0
- package/lib/esm/store/dsl-workflow.js +2 -0
- package/lib/esm/store/dsl-workflow.js.map +1 -0
- package/lib/esm/store/index.js +8 -0
- package/lib/esm/store/index.js.map +1 -0
- package/lib/esm/store/object-types.js +95 -0
- package/lib/esm/store/object-types.js.map +1 -0
- package/lib/esm/store/store.js +15 -0
- package/lib/esm/store/store.js.map +1 -0
- package/lib/esm/store/temporalio.js +41 -0
- package/lib/esm/store/temporalio.js.map +1 -0
- package/lib/esm/store/workflow.js +21 -0
- package/lib/esm/store/workflow.js.map +1 -0
- package/lib/esm/training.js +11 -0
- package/lib/esm/training.js.map +1 -0
- package/lib/esm/transient-tokens.js +6 -0
- package/lib/esm/transient-tokens.js.map +1 -0
- package/lib/esm/user.js +9 -0
- package/lib/esm/user.js.map +1 -0
- package/lib/esm/utils/auth.js +11 -0
- package/lib/esm/utils/auth.js.map +1 -0
- package/lib/esm/utils/schemas.js +44 -0
- package/lib/esm/utils/schemas.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/types/access-control.d.ts +56 -0
- package/lib/types/access-control.d.ts.map +1 -0
- package/lib/types/analytics.d.ts +36 -0
- package/lib/types/analytics.d.ts.map +1 -0
- package/lib/types/apikey.d.ts +54 -0
- package/lib/types/apikey.d.ts.map +1 -0
- package/lib/types/common.d.ts +28 -0
- package/lib/types/common.d.ts.map +1 -0
- package/lib/types/environment.d.ts +79 -0
- package/lib/types/environment.d.ts.map +1 -0
- package/lib/types/facets.d.ts +34 -0
- package/lib/types/facets.d.ts.map +1 -0
- package/lib/types/index.d.ts +20 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/integrations.d.ts +18 -0
- package/lib/types/integrations.d.ts.map +1 -0
- package/lib/types/interaction.d.ts +233 -0
- package/lib/types/interaction.d.ts.map +1 -0
- package/lib/types/payload.d.ts +49 -0
- package/lib/types/payload.d.ts.map +1 -0
- package/lib/types/project.d.ts +95 -0
- package/lib/types/project.d.ts.map +1 -0
- package/lib/types/prompt.d.ts +70 -0
- package/lib/types/prompt.d.ts.map +1 -0
- package/lib/types/query.d.ts +74 -0
- package/lib/types/query.d.ts.map +1 -0
- package/lib/types/refs.d.ts +19 -0
- package/lib/types/refs.d.ts.map +1 -0
- package/lib/types/runs.d.ts +24 -0
- package/lib/types/runs.d.ts.map +1 -0
- package/lib/types/store/activity-catalog.d.ts +24 -0
- package/lib/types/store/activity-catalog.d.ts.map +1 -0
- package/lib/types/store/common.d.ts +10 -0
- package/lib/types/store/common.d.ts.map +1 -0
- package/lib/types/store/dsl-workflow.d.ts +244 -0
- package/lib/types/store/dsl-workflow.d.ts.map +1 -0
- package/lib/types/store/index.d.ts +7 -0
- package/lib/types/store/index.d.ts.map +1 -0
- package/lib/types/store/object-types.d.ts +23 -0
- package/lib/types/store/object-types.d.ts.map +1 -0
- package/lib/types/store/store.d.ts +211 -0
- package/lib/types/store/store.d.ts.map +1 -0
- package/lib/types/store/temporalio.d.ts +16 -0
- package/lib/types/store/temporalio.d.ts.map +1 -0
- package/lib/types/store/workflow.d.ts +129 -0
- package/lib/types/store/workflow.d.ts.map +1 -0
- package/lib/types/training.d.ts +38 -0
- package/lib/types/training.d.ts.map +1 -0
- package/lib/types/transient-tokens.d.ts +27 -0
- package/lib/types/transient-tokens.d.ts.map +1 -0
- package/lib/types/user.d.ts +105 -0
- package/lib/types/user.d.ts.map +1 -0
- package/lib/types/utils/auth.d.ts +3 -0
- package/lib/types/utils/auth.d.ts.map +1 -0
- package/lib/types/utils/schemas.d.ts +5 -0
- package/lib/types/utils/schemas.d.ts.map +1 -0
- package/package.json +34 -0
- package/src/access-control.ts +77 -0
- package/src/analytics.ts +49 -0
- package/src/apikey.ts +68 -0
- package/src/common.ts +34 -0
- package/src/environment.ts +193 -0
- package/src/facets.ts +44 -0
- package/src/index.ts +20 -0
- package/src/integrations.ts +25 -0
- package/src/interaction.ts +300 -0
- package/src/payload.ts +62 -0
- package/src/project.ts +136 -0
- package/src/prompt.ts +95 -0
- package/src/query.ts +85 -0
- package/src/refs.ts +27 -0
- package/src/runs.ts +27 -0
- package/src/store/activity-catalog.ts +39 -0
- package/src/store/common.ts +10 -0
- package/src/store/dsl-workflow.ts +289 -0
- package/src/store/index.ts +7 -0
- package/src/store/ms.d.ts +11 -0
- package/src/store/object-types.ts +128 -0
- package/src/store/store.ts +262 -0
- package/src/store/temporalio.ts +54 -0
- package/src/store/workflow.ts +156 -0
- package/src/training.ts +44 -0
- package/src/transient-tokens.ts +30 -0
- package/src/user.ts +124 -0
- package/src/utils/auth.ts +12 -0
- package/src/utils/schemas.ts +44 -0
package/src/runs.ts
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
import { FacetResult } from './facets.js';
|
2
|
+
import { NamedInteractionExecutionPayload } from './interaction.js';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Interaction execution payload for creating a new run
|
6
|
+
* It uses interaction field (from NamedInteractionExecutionPayload) to pass the intercation ID to run
|
7
|
+
*/
|
8
|
+
export interface RunCreatePayload extends NamedInteractionExecutionPayload {
|
9
|
+
}
|
10
|
+
|
11
|
+
/**
|
12
|
+
* To be used as a value for a numeric or date filters
|
13
|
+
*/
|
14
|
+
export interface RangeValue {
|
15
|
+
gt?: number | string,
|
16
|
+
gte?: number | string,
|
17
|
+
lt?: number | string,
|
18
|
+
lte?: number | string,
|
19
|
+
}
|
20
|
+
|
21
|
+
export interface RunSearchMetaRepsonse {
|
22
|
+
count: {
|
23
|
+
lower_bound?: number,
|
24
|
+
total?: number,
|
25
|
+
},
|
26
|
+
facet: Record<string, FacetResult>
|
27
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
export type TsPropType = "string" | "number" | "boolean" | "record" | "object" | "array" | "enum" | "literal" | "union" | "promise" | "any";
|
2
|
+
|
3
|
+
// generic types are replaced by "any"
|
4
|
+
export interface ActivityTypeDefinition {
|
5
|
+
name: TsPropType;
|
6
|
+
// in case of primitives will be the type name: string, boolean number.
|
7
|
+
// in case of objects or enums will be the object name
|
8
|
+
// in case of arrays will be String(itemType.value)+"[]"
|
9
|
+
// in case of primitive literals will be the value
|
10
|
+
// or nested objects / arrays will be "object" or "array"
|
11
|
+
// for record this is Record<type,type>
|
12
|
+
value: string | boolean | number;
|
13
|
+
// in case of objects
|
14
|
+
members?: ActivityPropertyDefinition[];
|
15
|
+
// in case of arrays or promises will be innertype (i.e. the element type for arrays)
|
16
|
+
innerType?: ActivityTypeDefinition;
|
17
|
+
// in case of enums the enum values will be here
|
18
|
+
enum?: string[] | number[] | undefined;
|
19
|
+
// in case of unions
|
20
|
+
union?: ActivityTypeDefinition[];
|
21
|
+
}
|
22
|
+
|
23
|
+
export interface ActivityPropertyDefinition {
|
24
|
+
name: string;
|
25
|
+
type: ActivityTypeDefinition;
|
26
|
+
optional: boolean;
|
27
|
+
}
|
28
|
+
|
29
|
+
export interface ActivityDefinition {
|
30
|
+
name: string;
|
31
|
+
description?: string;
|
32
|
+
paramsType: string;
|
33
|
+
params: ActivityPropertyDefinition[];
|
34
|
+
returnType?: ActivityTypeDefinition | undefined;
|
35
|
+
}
|
36
|
+
|
37
|
+
export interface ActivityCatalog {
|
38
|
+
activities: ActivityDefinition[];
|
39
|
+
}
|
@@ -0,0 +1,289 @@
|
|
1
|
+
import { StringValue } from "ms";
|
2
|
+
import { BaseObject } from "./common.js";
|
3
|
+
import { WorkflowExecutionPayload } from "./index.js";
|
4
|
+
import { ParentClosePolicyType } from "./temporalio.js";
|
5
|
+
|
6
|
+
/**
|
7
|
+
* The interface of a function that can be used as a DSL workflow activity.
|
8
|
+
*/
|
9
|
+
export interface DSLActivityFn {
|
10
|
+
(payload: DSLActivityExecutionPayload): Promise<any>;
|
11
|
+
}
|
12
|
+
|
13
|
+
|
14
|
+
/**
|
15
|
+
* The payload sent when starting a workflow from the temporal client to the workflow instance.
|
16
|
+
*/
|
17
|
+
export interface DSLWorkflowExecutionPayload extends WorkflowExecutionPayload {
|
18
|
+
/**
|
19
|
+
* The workflow definition to be used by the DSL workflow.
|
20
|
+
* If a dsl workflow is executed and no definition is provided the workflow will fail.
|
21
|
+
*/
|
22
|
+
workflow: DSLWorkflowSpec;
|
23
|
+
}
|
24
|
+
|
25
|
+
/**
|
26
|
+
* The payload for a DSL acitivty options.
|
27
|
+
*
|
28
|
+
* @see ActivityOptions in @temporalio/common
|
29
|
+
*/
|
30
|
+
export interface DSLActivityOptions {
|
31
|
+
startToCloseTimeout?: StringValue | number;
|
32
|
+
scheduleToStartTimeout?: StringValue | number;
|
33
|
+
scheduleToCloseTimeout?: StringValue | number;
|
34
|
+
retry?: DSLRetryPolicy;
|
35
|
+
}
|
36
|
+
|
37
|
+
/**
|
38
|
+
* The payload for a DSL retry policy.
|
39
|
+
*
|
40
|
+
* @see RetryPolicy in @temporalio/common
|
41
|
+
*/
|
42
|
+
export interface DSLRetryPolicy {
|
43
|
+
backoffCoefficient?: number;
|
44
|
+
initialInterval?: StringValue | number;
|
45
|
+
maximumAttempts?: number;
|
46
|
+
maximumInterval?: StringValue | number;
|
47
|
+
nonRetryableErrorTypes?: string[];
|
48
|
+
}
|
49
|
+
|
50
|
+
/**
|
51
|
+
* The payload for a DSL activity execution.
|
52
|
+
*/
|
53
|
+
export interface DSLActivityExecutionPayload extends WorkflowExecutionPayload {
|
54
|
+
activity: DSLActivitySpec;
|
55
|
+
params: Record<string, any>;
|
56
|
+
workflow_name: string;
|
57
|
+
debug_mode?: boolean;
|
58
|
+
}
|
59
|
+
|
60
|
+
|
61
|
+
export type ImportSpec = (string | Record<string, string>)[];
|
62
|
+
export interface ActivityFetchSpec {
|
63
|
+
/**
|
64
|
+
* The data provider name
|
65
|
+
*/
|
66
|
+
type: "document" | "document_type" | "interaction_run";
|
67
|
+
/**
|
68
|
+
* An optinal URI to the data source.
|
69
|
+
*/
|
70
|
+
source?: string;
|
71
|
+
/**
|
72
|
+
* The query to be executed by the data provider
|
73
|
+
*/
|
74
|
+
query: Record<string, any>;
|
75
|
+
/**
|
76
|
+
* a string of space separated field names.
|
77
|
+
* Prefix a field name with "-" to exclude it from the result.
|
78
|
+
*/
|
79
|
+
select?: string;
|
80
|
+
|
81
|
+
/**
|
82
|
+
* The number of results to return. If the result is limitedto 1 the result will be a single object
|
83
|
+
*/
|
84
|
+
limit?: number;
|
85
|
+
|
86
|
+
/**
|
87
|
+
* How to handle not found objects.
|
88
|
+
* 1. ignore - Ignore and return an empty array for multi objects query (or undefined for single object query) or empty array for multiple objectthrow an error.
|
89
|
+
* 2. throw - Throw an error if the object or no objects are found.
|
90
|
+
*/
|
91
|
+
on_not_found?: "ignore" | "throw";
|
92
|
+
}
|
93
|
+
|
94
|
+
export interface DSLWorkflowStepBase {
|
95
|
+
/**
|
96
|
+
* The type fo the step.
|
97
|
+
* If not set defaults to "activity"
|
98
|
+
*/
|
99
|
+
type: "activity" | "workflow";
|
100
|
+
}
|
101
|
+
|
102
|
+
export interface DSLActivitySpec<PARAMS extends Record<string, any> = Record<string, any>> {
|
103
|
+
/**
|
104
|
+
* The name of the activity function
|
105
|
+
*/
|
106
|
+
name: string;
|
107
|
+
/**
|
108
|
+
* Title of the activity to be displayed in the UI workflow builder
|
109
|
+
*/
|
110
|
+
title?: string;
|
111
|
+
/**
|
112
|
+
* The description of the activity to e displayed in the UI workflow builder
|
113
|
+
*/
|
114
|
+
description?: string;
|
115
|
+
/**
|
116
|
+
* Activities parameters. These parameters can be either literals
|
117
|
+
* (hardcoded strings, numbers, booleans, obejcts, arrays etc.), either
|
118
|
+
* references to the workflow variables.
|
119
|
+
* The workflow variables are built from the workflow params (e.g. the workflow configuration)
|
120
|
+
* and from the result of the previous activities.
|
121
|
+
*/
|
122
|
+
params?: PARAMS;
|
123
|
+
/**
|
124
|
+
* The name of the workflow variable that will store the result of the activity
|
125
|
+
* If not specified the result will not be stored
|
126
|
+
* The parameters describe how the actual parameters will be obtained from the worlkfow execution vars.
|
127
|
+
* since it may contain references to workflow execution vars.
|
128
|
+
*/
|
129
|
+
output?: string;
|
130
|
+
|
131
|
+
/**
|
132
|
+
* A JSON expression which evaluate to true or false similar to mongo matches.
|
133
|
+
* We support fow now basic expreion like: $true, $false, $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $regexp
|
134
|
+
* {$eq: {name: value}},
|
135
|
+
* Ex: {$eq: {wfVarName: value}}
|
136
|
+
*/
|
137
|
+
condition?: Record<string, any>;
|
138
|
+
|
139
|
+
/**
|
140
|
+
* The import spec is used to import data from workflow variables.
|
141
|
+
* The import spec is a list of variable names to import from the workflow context.
|
142
|
+
* You can also use objects to rename the imported variables, or to reference an expression.
|
143
|
+
* Example:
|
144
|
+
* ["runId", {"typeId": "docType.id"}]
|
145
|
+
*/
|
146
|
+
import?: ImportSpec;
|
147
|
+
|
148
|
+
/**
|
149
|
+
* The fetch phase is used to fetch data from external sources.
|
150
|
+
*/
|
151
|
+
fetch?: Record<string, ActivityFetchSpec>;
|
152
|
+
|
153
|
+
/**
|
154
|
+
* Projection to apply to the result. Not all activities support this.
|
155
|
+
*/
|
156
|
+
projection?: never | Record<string, any>;
|
157
|
+
|
158
|
+
// ---------- Optional features not implemented in a first step ------------
|
159
|
+
/**
|
160
|
+
* If true the activity will be executed in parallel with the other activities.
|
161
|
+
* (i.e. the workflow will not wait for the activity to finish before starting the next one)
|
162
|
+
*/
|
163
|
+
parallel?: boolean;
|
164
|
+
|
165
|
+
/**
|
166
|
+
* Await for a parallel activity execution to return.
|
167
|
+
*/
|
168
|
+
await?: string; //the activity name to await
|
169
|
+
|
170
|
+
/**
|
171
|
+
* Activity options for configuring the activity execution, which overrides the activity options
|
172
|
+
* defined at workflow level.
|
173
|
+
*/
|
174
|
+
options?: DSLActivityOptions;
|
175
|
+
}
|
176
|
+
|
177
|
+
export interface DSLActivityStep<PARAMS extends Record<string, any> = Record<string, any>> extends DSLActivitySpec<PARAMS>, DSLWorkflowStepBase {
|
178
|
+
type: "activity";
|
179
|
+
}
|
180
|
+
|
181
|
+
export interface DSLChildWorkflowStep extends DSLWorkflowStepBase {
|
182
|
+
type: "workflow";
|
183
|
+
// the workflow endpoint to run
|
184
|
+
name: string;
|
185
|
+
/**
|
186
|
+
* The parameters to pass to the child workflow.
|
187
|
+
* These parameters will be merged over the parent workflow vars and passed altogether to the child workflow.
|
188
|
+
*/
|
189
|
+
vars?: Record<string, any>;
|
190
|
+
// whether or not to wait for the workflow to finish.
|
191
|
+
// default is false. (the parent workflow will await for the workflow to finish)
|
192
|
+
async?: boolean;
|
193
|
+
/**
|
194
|
+
* The name of the workflow variable that will store the result of the child workflow (if async the workflow id is stored)
|
195
|
+
* If not specified the result will not be stored
|
196
|
+
* The parameters describe how the actual parameters will be obtained from the worlkfow execution vars.
|
197
|
+
* since it may contain references to workflow execution vars.
|
198
|
+
*/
|
199
|
+
output?: string;
|
200
|
+
/**
|
201
|
+
* In case the dslWorkflow is used as a child workflow the spec is used to define the child workflow.
|
202
|
+
* If spec is defined then the name must be "dslWorkflow"
|
203
|
+
*/
|
204
|
+
spec?: DSLWorkflowSpec;
|
205
|
+
options?: {
|
206
|
+
memo?: Record<string, any>;
|
207
|
+
retry?: DSLRetryPolicy;
|
208
|
+
searchAttributes?: Record<string, string[] | number[] | boolean[] | Date[]>;
|
209
|
+
taskQueue?: string;
|
210
|
+
workflowExecutionTimeout?: StringValue | number;
|
211
|
+
workflowRunTimeout?: StringValue | number;
|
212
|
+
workflowTaskTimeout?: StringValue | number;
|
213
|
+
workflowId?: string;
|
214
|
+
cronSchedule?: string;
|
215
|
+
parentClosePolicy?: ParentClosePolicyType;
|
216
|
+
//TODO
|
217
|
+
//cancellationType
|
218
|
+
//versioningIntent
|
219
|
+
//workflowIdReusePolicy
|
220
|
+
}
|
221
|
+
}
|
222
|
+
|
223
|
+
export type DSLWorkflowStep = DSLActivityStep | DSLChildWorkflowStep;
|
224
|
+
|
225
|
+
export interface DSLWorkflowSpecBase {
|
226
|
+
name: string;
|
227
|
+
description?: string;
|
228
|
+
tags?: string[];
|
229
|
+
|
230
|
+
steps?: DSLWorkflowStep[] | never;
|
231
|
+
/**
|
232
|
+
* @deprecated use steps instead
|
233
|
+
*/
|
234
|
+
activities?: DSLActivitySpec[] | never;
|
235
|
+
|
236
|
+
// a dictionary of vars to initialize the workflow execution vars
|
237
|
+
// Initial vars cannot contains references to other vars
|
238
|
+
vars: Record<string, any>;
|
239
|
+
// activity options that apply to all activities within the workflow
|
240
|
+
options?: DSLActivityOptions;
|
241
|
+
// the name of the variable that will hold the workflow result
|
242
|
+
// if not specified "result" will be assumed
|
243
|
+
result?: string;
|
244
|
+
debug_mode?: boolean;
|
245
|
+
}
|
246
|
+
|
247
|
+
export interface DSLWorkflowSpecWithSteps extends DSLWorkflowSpecBase {
|
248
|
+
steps: DSLWorkflowStep[];
|
249
|
+
/**
|
250
|
+
* @deprecated use steps instead
|
251
|
+
*/
|
252
|
+
activities?: never;
|
253
|
+
}
|
254
|
+
|
255
|
+
/**
|
256
|
+
* @deprecated use steps instead
|
257
|
+
*/
|
258
|
+
export interface DSLWorkflowSpecWithActivities extends DSLWorkflowSpecBase {
|
259
|
+
steps?: never;
|
260
|
+
/**
|
261
|
+
* @deprecated use steps instead
|
262
|
+
*/
|
263
|
+
activities: DSLActivitySpec[];
|
264
|
+
}
|
265
|
+
|
266
|
+
/**
|
267
|
+
* activities and steps fields are mutally exclusive
|
268
|
+
* steps was added after activities and may contain a mix of activities and other tasks like exec child workflows.
|
269
|
+
* For backward compatibility we keep the activities field as a fallback but one should use one or the other not both.
|
270
|
+
*/
|
271
|
+
export type DSLWorkflowSpec = DSLWorkflowSpecWithSteps | DSLWorkflowSpecWithActivities;
|
272
|
+
|
273
|
+
export interface DSLWorkflowDefinition extends BaseObject, DSLWorkflowSpecBase {
|
274
|
+
// an optional JSON schema to describe the input vars of the workflow.
|
275
|
+
input_schema?: Record<string, any>;
|
276
|
+
activities?: DSLActivitySpec[];
|
277
|
+
steps?: DSLWorkflowStep[];
|
278
|
+
}
|
279
|
+
|
280
|
+
export interface WorkflowDefinitionRef {
|
281
|
+
id: string;
|
282
|
+
name: string;
|
283
|
+
description?: string;
|
284
|
+
tags?: string[];
|
285
|
+
created_at: Date;
|
286
|
+
updated_at: Date;
|
287
|
+
}
|
288
|
+
|
289
|
+
export const WorkflowDefinitionRefPopulate = "id name description tags created_at updated_at"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* Types for the `ms` package (version 3.0.0-canary.1)
|
3
|
+
*/
|
4
|
+
declare module "ms" {
|
5
|
+
declare type Unit = 'Years' | 'Year' | 'Yrs' | 'Yr' | 'Y' | 'Weeks' | 'Week' | 'W' | 'Days' | 'Day' | 'D' | 'Hours' | 'Hour' | 'Hrs' | 'Hr' | 'H' | 'Minutes' | 'Minute' | 'Mins' | 'Min' | 'M' | 'Seconds' | 'Second' | 'Secs' | 'Sec' | 's' | 'Milliseconds' | 'Millisecond' | 'Msecs' | 'Msec' | 'Ms';
|
6
|
+
declare type UnitAnyCase = Unit | Uppercase<Unit> | Lowercase<Unit>;
|
7
|
+
export declare type StringValue = `${number}` | `${number}${UnitAnyCase}` | `${number} ${UnitAnyCase}`;
|
8
|
+
declare function ms(value: StringValue, options?: Options): number;
|
9
|
+
declare function ms(value: number, options?: Options): string;
|
10
|
+
export default ms;
|
11
|
+
}
|
@@ -0,0 +1,128 @@
|
|
1
|
+
import { JSONSchemaType } from "ajv"
|
2
|
+
|
3
|
+
/*Default JSON Schema type for rendition*/
|
4
|
+
|
5
|
+
export interface RenditionProperties {
|
6
|
+
mime_type: string,
|
7
|
+
source_etag?: string,
|
8
|
+
height?: number,
|
9
|
+
width?: number,
|
10
|
+
multipart?: boolean,
|
11
|
+
total_parts?: number,
|
12
|
+
}
|
13
|
+
|
14
|
+
export const RenditionSchema: JSONSchemaType<RenditionProperties> = {
|
15
|
+
|
16
|
+
type: "object",
|
17
|
+
description: "Represent a rendition of a file stored in an object. It will be stored as a separate object in the database.",
|
18
|
+
properties: {
|
19
|
+
mime_type: {
|
20
|
+
type: "string",
|
21
|
+
description: "The format of the rendition. This is a MIME type."
|
22
|
+
},
|
23
|
+
source_etag: {
|
24
|
+
type: "string",
|
25
|
+
description: "The ETag of the file used for the rendition.",
|
26
|
+
nullable: true
|
27
|
+
},
|
28
|
+
height: {
|
29
|
+
type: "integer",
|
30
|
+
description: "The height of the rendition",
|
31
|
+
nullable: true
|
32
|
+
},
|
33
|
+
width: {
|
34
|
+
type: "integer",
|
35
|
+
description: "The width of the rendition",
|
36
|
+
nullable: true
|
37
|
+
},
|
38
|
+
multipart: {
|
39
|
+
type: "boolean",
|
40
|
+
description: "If the rendition is a multi-part rendition",
|
41
|
+
nullable: true,
|
42
|
+
default: false
|
43
|
+
},
|
44
|
+
total_parts: {
|
45
|
+
type: "integer",
|
46
|
+
description: "The total number of parts in the rendition",
|
47
|
+
nullable: true
|
48
|
+
}
|
49
|
+
},
|
50
|
+
required: ["mime_type"],
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
export interface DocumentPartProperties {
|
56
|
+
|
57
|
+
source_etag?: string,
|
58
|
+
part_number: number,
|
59
|
+
title?: string,
|
60
|
+
source_line_start?: number,
|
61
|
+
source_line_end?: number,
|
62
|
+
type?: 'text' | 'image' | 'table' | 'chart' | 'diagram' | 'code' | 'other',
|
63
|
+
page_number?: number,
|
64
|
+
description?: string,
|
65
|
+
height?: number,
|
66
|
+
width?: number,
|
67
|
+
|
68
|
+
}
|
69
|
+
|
70
|
+
|
71
|
+
export const DocumentPartSchema: JSONSchemaType<DocumentPartProperties> = {
|
72
|
+
type: "object",
|
73
|
+
description: "Represent a semantic chunk of a document",
|
74
|
+
properties: {
|
75
|
+
source_etag: {
|
76
|
+
type: "string",
|
77
|
+
description: "The ETag of the file used for the rendition.",
|
78
|
+
nullable: true
|
79
|
+
},
|
80
|
+
part_number: {
|
81
|
+
type: "integer",
|
82
|
+
description: "The part number of the chunk",
|
83
|
+
},
|
84
|
+
title: {
|
85
|
+
type: "string",
|
86
|
+
description: "The title of the chunk",
|
87
|
+
nullable: true
|
88
|
+
},
|
89
|
+
source_line_start: {
|
90
|
+
type: "integer",
|
91
|
+
description: "The line number where the chunk starts",
|
92
|
+
nullable: true
|
93
|
+
},
|
94
|
+
source_line_end: {
|
95
|
+
type: "integer",
|
96
|
+
description: "The line number where the chunk ends",
|
97
|
+
nullable: true
|
98
|
+
},
|
99
|
+
type: {
|
100
|
+
type: "string",
|
101
|
+
description: "The type of the chunk",
|
102
|
+
enum: ['text', 'image', 'table', 'chart', 'diagram', 'code', 'other'],
|
103
|
+
nullable: true
|
104
|
+
},
|
105
|
+
page_number: {
|
106
|
+
type: "integer",
|
107
|
+
description: "The page number of the document part",
|
108
|
+
nullable: true
|
109
|
+
},
|
110
|
+
description: {
|
111
|
+
type: "string",
|
112
|
+
description: "The description of the document part, if it's an image, the exhaustive description of the image",
|
113
|
+
nullable: true
|
114
|
+
},
|
115
|
+
height: {
|
116
|
+
type: "integer",
|
117
|
+
description: "The height of the rendition",
|
118
|
+
nullable: true
|
119
|
+
},
|
120
|
+
width: {
|
121
|
+
type: "integer",
|
122
|
+
description: "The width of the rendition",
|
123
|
+
nullable: true
|
124
|
+
}
|
125
|
+
},
|
126
|
+
required: ["part_number"],
|
127
|
+
}
|
128
|
+
|