@vertesia/common 0.52.0 → 0.55.0
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/lib/cjs/apikey.js +1 -1
- package/lib/cjs/apikey.js.map +1 -1
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interaction.js.map +1 -1
- package/lib/cjs/plugin.js +3 -0
- package/lib/cjs/plugin.js.map +1 -0
- package/lib/cjs/project.js.map +1 -1
- package/lib/cjs/store/store.js.map +1 -1
- package/lib/cjs/store/workflow.js +8 -0
- package/lib/cjs/store/workflow.js.map +1 -1
- package/lib/esm/apikey.js +1 -1
- package/lib/esm/apikey.js.map +1 -1
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interaction.js.map +1 -1
- package/lib/esm/plugin.js +2 -0
- package/lib/esm/plugin.js.map +1 -0
- package/lib/esm/project.js.map +1 -1
- package/lib/esm/store/store.js.map +1 -1
- package/lib/esm/store/workflow.js +7 -0
- package/lib/esm/store/workflow.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/apikey.d.ts +1 -1
- package/lib/types/apikey.d.ts.map +1 -1
- package/lib/types/common.d.ts +2 -0
- package/lib/types/common.d.ts.map +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/integrations.d.ts +1 -1
- package/lib/types/integrations.d.ts.map +1 -1
- package/lib/types/interaction.d.ts +20 -5
- package/lib/types/interaction.d.ts.map +1 -1
- package/lib/types/payload.d.ts +5 -2
- package/lib/types/payload.d.ts.map +1 -1
- package/lib/types/plugin.d.ts +12 -0
- package/lib/types/plugin.d.ts.map +1 -0
- package/lib/types/project.d.ts +1 -0
- package/lib/types/project.d.ts.map +1 -1
- package/lib/types/query.d.ts +5 -3
- package/lib/types/query.d.ts.map +1 -1
- package/lib/types/runs.d.ts +2 -2
- package/lib/types/store/agent.d.ts +1 -1
- package/lib/types/store/collections.d.ts +6 -1
- package/lib/types/store/collections.d.ts.map +1 -1
- package/lib/types/store/common.d.ts +12 -0
- package/lib/types/store/common.d.ts.map +1 -1
- package/lib/types/store/doc-analyzer.d.ts +2 -2
- package/lib/types/store/doc-analyzer.d.ts.map +1 -1
- package/lib/types/store/dsl-workflow.d.ts +9 -9
- package/lib/types/store/signals.d.ts +1 -0
- package/lib/types/store/signals.d.ts.map +1 -1
- package/lib/types/store/store.d.ts +68 -21
- package/lib/types/store/store.d.ts.map +1 -1
- package/lib/types/store/workflow.d.ts +56 -3
- package/lib/types/store/workflow.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/apikey.ts +1 -1
- package/src/common.ts +2 -0
- package/src/index.ts +1 -1
- package/src/integrations.ts +1 -1
- package/src/interaction.ts +23 -5
- package/src/payload.ts +15 -3
- package/src/plugin.ts +12 -0
- package/src/project.ts +1 -0
- package/src/prompt.ts +1 -1
- package/src/query.ts +5 -3
- package/src/runs.ts +2 -2
- package/src/store/activity-catalog.ts +1 -1
- package/src/store/agent.ts +1 -1
- package/src/store/collections.ts +9 -3
- package/src/store/common.ts +21 -1
- package/src/store/doc-analyzer.ts +2 -2
- package/src/store/dsl-workflow.ts +9 -9
- package/src/store/signals.ts +1 -0
- package/src/store/store.ts +111 -53
- package/src/store/workflow.ts +81 -3
package/src/store/store.ts
CHANGED
@@ -1,18 +1,17 @@
|
|
1
|
-
import { SearchPayload } from
|
2
|
-
import { SupportedEmbeddingTypes } from
|
3
|
-
import { ComplexSearchQuery } from
|
4
|
-
import { BaseObject } from
|
5
|
-
import { RenditionProperties } from
|
1
|
+
import { SearchPayload } from "../payload.js";
|
2
|
+
import { SupportedEmbeddingTypes } from "../project.js";
|
3
|
+
import { ComplexSearchQuery } from "../query.js";
|
4
|
+
import { BaseObject } from "./common.js";
|
5
|
+
import { RenditionProperties } from "./index.js";
|
6
6
|
|
7
7
|
export enum ContentObjectStatus {
|
8
|
-
created =
|
9
|
-
processing =
|
10
|
-
completed =
|
11
|
-
failed =
|
12
|
-
archived =
|
8
|
+
created = "created",
|
9
|
+
processing = "processing", // the was created and still processing
|
10
|
+
completed = "completed",
|
11
|
+
failed = "failed",
|
12
|
+
archived = "archived",
|
13
13
|
}
|
14
14
|
|
15
|
-
|
16
15
|
export interface Embedding {
|
17
16
|
model: string; //the model used to generate this embedding
|
18
17
|
values: number[];
|
@@ -28,8 +27,7 @@ export interface ContentObject<T = any> extends ContentObjectItem<T> {
|
|
28
27
|
transcript?: Transcript;
|
29
28
|
}
|
30
29
|
|
31
|
-
|
32
|
-
export type ContentNature = 'video' | 'image' | 'audio' | 'document' | 'code' | 'other';
|
30
|
+
export type ContentNature = "video" | "image" | "audio" | "document" | "code" | "other";
|
33
31
|
|
34
32
|
export interface Dimensions {
|
35
33
|
width: number;
|
@@ -48,12 +46,10 @@ export interface GenerationRunMetadata {
|
|
48
46
|
target?: string;
|
49
47
|
}
|
50
48
|
|
51
|
-
|
52
|
-
|
53
49
|
export interface ContentMetadata {
|
54
50
|
// Common fields for all media types
|
55
51
|
type?: ContentNature;
|
56
|
-
size?: number;
|
52
|
+
size?: number; // in bytes
|
57
53
|
languages?: string[];
|
58
54
|
location?: Location;
|
59
55
|
generation_runs: GenerationRunMetadata[];
|
@@ -63,25 +59,25 @@ export interface ContentMetadata {
|
|
63
59
|
// Example of type-specific metadata interfaces (optional, for better type safety)
|
64
60
|
export interface TemporalMediaMetadata extends ContentMetadata {
|
65
61
|
duration?: number; // in seconds
|
66
|
-
transcript?: Transcript
|
62
|
+
transcript?: Transcript;
|
67
63
|
}
|
68
64
|
|
69
65
|
export interface ImageMetadata extends ContentMetadata {
|
70
|
-
type:
|
66
|
+
type: "image";
|
71
67
|
dimensions?: Dimensions;
|
72
68
|
}
|
73
69
|
|
74
70
|
export interface AudioMetadata extends TemporalMediaMetadata {
|
75
|
-
type:
|
71
|
+
type: "audio";
|
76
72
|
}
|
77
73
|
|
78
74
|
export interface VideoMetadata extends TemporalMediaMetadata {
|
79
|
-
type:
|
75
|
+
type: "video";
|
80
76
|
dimensions?: Dimensions;
|
81
77
|
}
|
82
78
|
|
83
79
|
export interface DocumentMetadata extends ContentMetadata {
|
84
|
-
type:
|
80
|
+
type: "document";
|
85
81
|
page_count?: number;
|
86
82
|
content_processor?: {
|
87
83
|
type?: string;
|
@@ -91,7 +87,7 @@ export interface DocumentMetadata extends ContentMetadata {
|
|
91
87
|
image_count: number;
|
92
88
|
zone_count: number;
|
93
89
|
needs_ocr_count?: number;
|
94
|
-
}
|
90
|
+
};
|
95
91
|
}
|
96
92
|
|
97
93
|
export interface Transcript {
|
@@ -101,12 +97,12 @@ export interface Transcript {
|
|
101
97
|
}
|
102
98
|
|
103
99
|
export interface TranscriptSegment {
|
104
|
-
start: number
|
105
|
-
text: string
|
106
|
-
speaker?: number
|
107
|
-
end?: number
|
108
|
-
confidence?: number
|
109
|
-
language?: string
|
100
|
+
start: number;
|
101
|
+
text: string;
|
102
|
+
speaker?: number;
|
103
|
+
end?: number;
|
104
|
+
confidence?: number;
|
105
|
+
language?: string;
|
110
106
|
}
|
111
107
|
|
112
108
|
export interface ContentSource {
|
@@ -120,34 +116,99 @@ export interface ContentSource {
|
|
120
116
|
etag?: string;
|
121
117
|
}
|
122
118
|
|
119
|
+
/**
|
120
|
+
*
|
121
|
+
*/
|
122
|
+
export interface RevisionInfo {
|
123
|
+
/** Direct parent revision id (omit on the first revision) */
|
124
|
+
parent?: string;
|
125
|
+
|
126
|
+
/** The root revision id (omit on the first revision) */
|
127
|
+
root: string;
|
128
|
+
|
129
|
+
/** True if this revision is the head revision */
|
130
|
+
head: boolean;
|
131
|
+
|
132
|
+
/** Human‑friendly tag or state ("v1.2", "approved") */
|
133
|
+
label?: string;
|
134
|
+
|
135
|
+
/** Extra parents when two branches are merged (leave undefined until needed) */
|
136
|
+
//merge_parents?: string[]; //maybe later
|
137
|
+
|
138
|
+
/** Pointer to a diff / patch blob if you store deltas instead of full content */
|
139
|
+
//delta_ref?: string;
|
140
|
+
}
|
141
|
+
|
123
142
|
/**
|
124
143
|
* The content object item is a simplified version of the ContentObject that is returned by the store API when listing objects.
|
125
144
|
*/
|
126
|
-
export interface ContentObjectItem<T = any
|
127
|
-
root?: string; // the ID of the root parent object. The root object doesn't have the root field set.
|
145
|
+
export interface ContentObjectItem<T = Record<string, any>> extends BaseObject {
|
128
146
|
parent: string; // the id of the direct parent object. The root object doesn't have the parent field set.
|
147
|
+
|
148
|
+
/** An optional path based location for the object */
|
129
149
|
location: string; // the path of the parent object
|
150
|
+
|
151
|
+
/**
|
152
|
+
* Object status.
|
153
|
+
* - created: the object was created and is being processed
|
154
|
+
* - processing: the object is being processed
|
155
|
+
* - completed: the object was processed and is ready to use
|
156
|
+
* - failed: the object processing failed
|
157
|
+
* - archived: the object was archived and is no longer available
|
158
|
+
*/
|
130
159
|
status: ContentObjectStatus;
|
131
|
-
|
160
|
+
|
161
|
+
/**
|
162
|
+
* Object type id.
|
163
|
+
*/
|
132
164
|
type?: ContentObjectTypeRef;
|
133
|
-
|
165
|
+
|
166
|
+
/**
|
167
|
+
* Content source information, typically a link to an object store
|
168
|
+
*/
|
134
169
|
content: ContentSource;
|
170
|
+
|
171
|
+
/**
|
172
|
+
* External identifier for integration with other systems
|
173
|
+
*/
|
135
174
|
external_id?: string;
|
136
|
-
|
175
|
+
|
176
|
+
/** The object properties. This is a JSON object that describes the object, matching the object type schema */
|
177
|
+
properties: T; // a JSON object that describes the object
|
178
|
+
|
179
|
+
/** Technical metadata of the object */
|
137
180
|
metadata?: VideoMetadata | AudioMetadata | ImageMetadata | DocumentMetadata | ContentMetadata;
|
181
|
+
|
182
|
+
/** Token information */
|
138
183
|
tokens?: {
|
139
184
|
count: number; // the number of tokens in the text
|
140
185
|
encoding: string; // the encoding used to calculate the tokens
|
141
186
|
etag: string; //the etag of the text used for the token count
|
142
187
|
};
|
188
|
+
|
189
|
+
/**
|
190
|
+
* Revision information. This is used to track the history of the object.
|
191
|
+
*/
|
192
|
+
revision: RevisionInfo; // the revision info of the object
|
193
|
+
|
194
|
+
/**
|
195
|
+
* Soft delete flag. When true, the object should be considered deleted
|
196
|
+
* but is still retained in the database for historical purposes.
|
197
|
+
*/
|
198
|
+
is_deleted?: boolean;
|
199
|
+
|
200
|
+
/**
|
201
|
+
* Soft lock flag. When true, the object should be considered read-only
|
202
|
+
* and modification attempts should be rejected.
|
203
|
+
*/
|
204
|
+
is_locked?: boolean;
|
143
205
|
}
|
144
206
|
|
145
207
|
/**
|
146
|
-
* When creating from an uploaded file the content
|
208
|
+
* When creating from an uploaded file the content should be an URL to the uploaded file
|
147
209
|
*/
|
148
|
-
export interface CreateContentObjectPayload<T = any>
|
149
|
-
|
150
|
-
| 'owner'>> {
|
210
|
+
export interface CreateContentObjectPayload<T = any>
|
211
|
+
extends Partial<Omit<ContentObject<T>, "id" | "root" | "created_at" | "updated_at" | "type" | "owner">> {
|
151
212
|
id?: string; // An optional existing object ID to be replaced by the new one
|
152
213
|
type?: string; // the object type ID
|
153
214
|
generation_run_info?: GenerationRunMetadata;
|
@@ -158,7 +219,7 @@ export interface ContentObjectTypeRef {
|
|
158
219
|
name: string;
|
159
220
|
}
|
160
221
|
|
161
|
-
export interface ComplexSearchPayload extends Omit<SearchPayload,
|
222
|
+
export interface ComplexSearchPayload extends Omit<SearchPayload, "query"> {
|
162
223
|
query?: ComplexSearchQuery;
|
163
224
|
}
|
164
225
|
|
@@ -185,29 +246,28 @@ export interface ColumnLayout {
|
|
185
246
|
*/
|
186
247
|
default?: any;
|
187
248
|
}
|
188
|
-
export interface ContentObjectType extends ContentObjectTypeItem {
|
189
|
-
}
|
249
|
+
export interface ContentObjectType extends ContentObjectTypeItem {}
|
190
250
|
export interface ContentObjectTypeItem extends BaseObject {
|
191
251
|
is_chunkable?: boolean;
|
192
252
|
/**
|
193
|
-
* This is only included in ContentObjectTypeItem if
|
253
|
+
* This is only included in ContentObjectTypeItem if explicitly requested
|
194
254
|
* It is always included in ContentObjectType
|
195
255
|
*/
|
196
256
|
table_layout?: ColumnLayout[];
|
197
257
|
/**
|
198
|
-
* this is only included in ContentObjectTypeItem if
|
258
|
+
* this is only included in ContentObjectTypeItem if explicitly requested
|
199
259
|
* It is always included in ContentObjectType
|
200
260
|
*/
|
201
261
|
object_schema?: Record<string, any>; // an optional JSON schema for the object properties.
|
202
262
|
}
|
203
263
|
|
204
|
-
export interface CreateContentObjectTypePayload
|
205
|
-
}
|
264
|
+
export interface CreateContentObjectTypePayload
|
265
|
+
extends Omit<ContentObjectType, "id" | "created_at" | "updated_at" | "created_by" | "updated_by"> {}
|
206
266
|
|
207
267
|
export enum WorkflowRuleInputType {
|
208
|
-
single =
|
209
|
-
multiple =
|
210
|
-
none =
|
268
|
+
single = "single",
|
269
|
+
multiple = "multiple",
|
270
|
+
none = "none",
|
211
271
|
}
|
212
272
|
export interface WorkflowRuleItem extends BaseObject {
|
213
273
|
// the name of the workflow function
|
@@ -237,18 +297,16 @@ export interface WorkflowRule extends WorkflowRuleItem {
|
|
237
297
|
customer_override?: boolean;
|
238
298
|
}
|
239
299
|
|
240
|
-
|
241
300
|
export interface CreateWorkflowRulePayload extends UploadWorkflowRulePayload {
|
242
301
|
name: string; // required
|
243
302
|
endpoint: string; // required
|
244
303
|
}
|
245
|
-
export interface UploadWorkflowRulePayload
|
246
|
-
}
|
304
|
+
export interface UploadWorkflowRulePayload
|
305
|
+
extends Partial<Omit<WorkflowRule, "id" | "created_at" | "updated_at" | "owner">> {}
|
247
306
|
|
248
307
|
export interface GetRenditionResponse {
|
249
|
-
|
250
|
-
|
251
|
-
rendition?: ContentObject<RenditionProperties> //TODO add <Rendition>
|
308
|
+
status: "found" | "generating" | "failed";
|
309
|
+
rendition?: ContentObject<RenditionProperties>; //TODO add <Rendition>
|
252
310
|
workflow_run_id?: string;
|
253
311
|
}
|
254
312
|
|
package/src/store/workflow.ts
CHANGED
@@ -2,6 +2,7 @@ export enum ContentEventName {
|
|
2
2
|
create = "create",
|
3
3
|
change_type = "change_type",
|
4
4
|
update = "update",
|
5
|
+
revision_created = "revision_created",
|
5
6
|
delete = "delete",
|
6
7
|
workflow_finished = "workflow_finished",
|
7
8
|
workflow_execution_request = "workflow_execution_request",
|
@@ -16,7 +17,7 @@ export interface WorkflowExecutionBaseParams<T = Record<string, any>> {
|
|
16
17
|
|
17
18
|
/**
|
18
19
|
* The account ID of the user who created the activity.
|
19
|
-
* This is
|
20
|
+
* This is useful to select the right database to work on.
|
20
21
|
*/
|
21
22
|
account_id: string;
|
22
23
|
|
@@ -32,7 +33,7 @@ export interface WorkflowExecutionBaseParams<T = Record<string, any>> {
|
|
32
33
|
*
|
33
34
|
* In the case of workflows started by events (e.g. using a a workflow rule) the user input vars will be initialized with the workflow rule configuration field.
|
34
35
|
*
|
35
|
-
* In case of dsl workflows the
|
36
|
+
* In case of dsl workflows the workflow execution payload vars will be applied over the default vars values stored in the DSL vars field.
|
36
37
|
*/
|
37
38
|
vars: T;
|
38
39
|
|
@@ -53,9 +54,10 @@ export interface WorkflowExecutionBaseParams<T = Record<string, any>> {
|
|
53
54
|
|
54
55
|
/**
|
55
56
|
* The list of endpoints to notify when the workflow finishes.
|
56
|
-
* It is handled by a
|
57
|
+
* It is handled by a sub-workflow execution, so the main workflow will not wait for the notification to be sent.
|
57
58
|
*/
|
58
59
|
notify_endpoints?: string[];
|
60
|
+
|
59
61
|
}
|
60
62
|
|
61
63
|
export interface WorkflowExecutionPayload<T = Record<string, any>> extends WorkflowExecutionBaseParams<T> {
|
@@ -81,23 +83,96 @@ export interface WorkflowExecutionPayload<T = Record<string, any>> extends Workf
|
|
81
83
|
auth_token: string;
|
82
84
|
}
|
83
85
|
|
86
|
+
export function getDocumentIds(payload: WorkflowExecutionPayload): string[] {
|
87
|
+
if ("objectIds" in payload) {
|
88
|
+
return payload.objectIds;
|
89
|
+
}
|
90
|
+
return [];
|
91
|
+
}
|
92
|
+
|
84
93
|
export interface ExecuteWorkflowPayload {
|
94
|
+
|
95
|
+
/**
|
96
|
+
* The task queue to assign the workflow to. Deprecated, queues are choosend server side
|
97
|
+
*/
|
98
|
+
//@deprecated
|
85
99
|
task_queue?: string;
|
100
|
+
|
101
|
+
/**
|
102
|
+
* Docuument IDs pon which the workflow will be executed, deprecated, replaced params in vars
|
103
|
+
*/
|
104
|
+
//@deprecated
|
86
105
|
objectIds?: string[];
|
106
|
+
|
107
|
+
/**
|
108
|
+
* Parameters to pass to the workflow
|
109
|
+
*/
|
87
110
|
vars?: Record<string, any>;
|
111
|
+
|
112
|
+
/**
|
113
|
+
* Make the workflow ID unique by always adding a random token to the ID.
|
114
|
+
*/
|
88
115
|
unique?: boolean;
|
116
|
+
|
117
|
+
/**
|
118
|
+
* A custom ID to use for the workflow execution id instead of the generated one.
|
119
|
+
*/
|
120
|
+
custom_id?: string;
|
121
|
+
|
122
|
+
/**
|
123
|
+
* Timeout for the workflow execution to complete, in seconds.
|
124
|
+
*/
|
89
125
|
timeout?: number; //timeout in seconds
|
90
126
|
}
|
91
127
|
|
92
128
|
export interface ListWorkflowRunsPayload {
|
129
|
+
|
130
|
+
/**
|
131
|
+
* The document ID passed to a workflow run.
|
132
|
+
*/
|
133
|
+
|
93
134
|
document_id?: string;
|
135
|
+
|
136
|
+
/**
|
137
|
+
* The event name that triggered the workflow.
|
138
|
+
*/
|
94
139
|
event_name?: string;
|
140
|
+
|
141
|
+
/**
|
142
|
+
* The workflow rule ID that triggered the workflow.
|
143
|
+
*/
|
95
144
|
rule_id?: string;
|
145
|
+
|
146
|
+
/**
|
147
|
+
* The start time for filtering workflow runs.
|
148
|
+
*/
|
96
149
|
start?: string;
|
150
|
+
|
151
|
+
/**
|
152
|
+
* The end time for filtering workflow runs.
|
153
|
+
*/
|
97
154
|
end?: string;
|
155
|
+
|
156
|
+
/**
|
157
|
+
* The status of the workflow run.
|
158
|
+
*/
|
98
159
|
status?: string;
|
160
|
+
|
161
|
+
/**
|
162
|
+
* search term to filter on workflow id and run id
|
163
|
+
*/
|
99
164
|
search_term?: string;
|
165
|
+
|
166
|
+
/**
|
167
|
+
* The user or service account that initiated the workflow run.
|
168
|
+
*/
|
100
169
|
initiated_by?: string;
|
170
|
+
|
171
|
+
/**
|
172
|
+
* Lucene query string to search for the workflow runs.
|
173
|
+
* This is a full text search on the workflow run history.
|
174
|
+
*/
|
175
|
+
query?: string;
|
101
176
|
}
|
102
177
|
|
103
178
|
interface WorkflowRunEvent {
|
@@ -138,6 +213,9 @@ export interface WorkflowRun {
|
|
138
213
|
|
139
214
|
export interface WorkflowRunWithDetails extends WorkflowRun {
|
140
215
|
history?: WorkflowRunEvent[];
|
216
|
+
memo?: {
|
217
|
+
[key: string]: any;
|
218
|
+
} | null;
|
141
219
|
}
|
142
220
|
export interface ListWorkflowRunsResponse {
|
143
221
|
runs: WorkflowRun[];
|