@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.
Files changed (77) hide show
  1. package/lib/cjs/apikey.js +1 -1
  2. package/lib/cjs/apikey.js.map +1 -1
  3. package/lib/cjs/index.js +1 -0
  4. package/lib/cjs/index.js.map +1 -1
  5. package/lib/cjs/interaction.js.map +1 -1
  6. package/lib/cjs/plugin.js +3 -0
  7. package/lib/cjs/plugin.js.map +1 -0
  8. package/lib/cjs/project.js.map +1 -1
  9. package/lib/cjs/store/store.js.map +1 -1
  10. package/lib/cjs/store/workflow.js +8 -0
  11. package/lib/cjs/store/workflow.js.map +1 -1
  12. package/lib/esm/apikey.js +1 -1
  13. package/lib/esm/apikey.js.map +1 -1
  14. package/lib/esm/index.js +1 -0
  15. package/lib/esm/index.js.map +1 -1
  16. package/lib/esm/interaction.js.map +1 -1
  17. package/lib/esm/plugin.js +2 -0
  18. package/lib/esm/plugin.js.map +1 -0
  19. package/lib/esm/project.js.map +1 -1
  20. package/lib/esm/store/store.js.map +1 -1
  21. package/lib/esm/store/workflow.js +7 -0
  22. package/lib/esm/store/workflow.js.map +1 -1
  23. package/lib/tsconfig.tsbuildinfo +1 -1
  24. package/lib/types/apikey.d.ts +1 -1
  25. package/lib/types/apikey.d.ts.map +1 -1
  26. package/lib/types/common.d.ts +2 -0
  27. package/lib/types/common.d.ts.map +1 -1
  28. package/lib/types/index.d.ts +1 -0
  29. package/lib/types/index.d.ts.map +1 -1
  30. package/lib/types/integrations.d.ts +1 -1
  31. package/lib/types/integrations.d.ts.map +1 -1
  32. package/lib/types/interaction.d.ts +20 -5
  33. package/lib/types/interaction.d.ts.map +1 -1
  34. package/lib/types/payload.d.ts +5 -2
  35. package/lib/types/payload.d.ts.map +1 -1
  36. package/lib/types/plugin.d.ts +12 -0
  37. package/lib/types/plugin.d.ts.map +1 -0
  38. package/lib/types/project.d.ts +1 -0
  39. package/lib/types/project.d.ts.map +1 -1
  40. package/lib/types/query.d.ts +5 -3
  41. package/lib/types/query.d.ts.map +1 -1
  42. package/lib/types/runs.d.ts +2 -2
  43. package/lib/types/store/agent.d.ts +1 -1
  44. package/lib/types/store/collections.d.ts +6 -1
  45. package/lib/types/store/collections.d.ts.map +1 -1
  46. package/lib/types/store/common.d.ts +12 -0
  47. package/lib/types/store/common.d.ts.map +1 -1
  48. package/lib/types/store/doc-analyzer.d.ts +2 -2
  49. package/lib/types/store/doc-analyzer.d.ts.map +1 -1
  50. package/lib/types/store/dsl-workflow.d.ts +9 -9
  51. package/lib/types/store/signals.d.ts +1 -0
  52. package/lib/types/store/signals.d.ts.map +1 -1
  53. package/lib/types/store/store.d.ts +68 -21
  54. package/lib/types/store/store.d.ts.map +1 -1
  55. package/lib/types/store/workflow.d.ts +56 -3
  56. package/lib/types/store/workflow.d.ts.map +1 -1
  57. package/package.json +1 -1
  58. package/src/apikey.ts +1 -1
  59. package/src/common.ts +2 -0
  60. package/src/index.ts +1 -1
  61. package/src/integrations.ts +1 -1
  62. package/src/interaction.ts +23 -5
  63. package/src/payload.ts +15 -3
  64. package/src/plugin.ts +12 -0
  65. package/src/project.ts +1 -0
  66. package/src/prompt.ts +1 -1
  67. package/src/query.ts +5 -3
  68. package/src/runs.ts +2 -2
  69. package/src/store/activity-catalog.ts +1 -1
  70. package/src/store/agent.ts +1 -1
  71. package/src/store/collections.ts +9 -3
  72. package/src/store/common.ts +21 -1
  73. package/src/store/doc-analyzer.ts +2 -2
  74. package/src/store/dsl-workflow.ts +9 -9
  75. package/src/store/signals.ts +1 -0
  76. package/src/store/store.ts +111 -53
  77. package/src/store/workflow.ts +81 -3
@@ -1,18 +1,17 @@
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';
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 = 'created',
9
- processing = 'processing', // the was created and still processing
10
- completed = 'completed',
11
- failed = 'failed',
12
- archived = '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; // in bytes
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: 'image';
66
+ type: "image";
71
67
  dimensions?: Dimensions;
72
68
  }
73
69
 
74
70
  export interface AudioMetadata extends TemporalMediaMetadata {
75
- type: 'audio';
71
+ type: "audio";
76
72
  }
77
73
 
78
74
  export interface VideoMetadata extends TemporalMediaMetadata {
79
- type: 'video';
75
+ type: "video";
80
76
  dimensions?: Dimensions;
81
77
  }
82
78
 
83
79
  export interface DocumentMetadata extends ContentMetadata {
84
- type: 'document';
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> extends BaseObject {
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
- // A ref to the object type
160
+
161
+ /**
162
+ * Object type id.
163
+ */
132
164
  type?: ContentObjectTypeRef;
133
- // the content source URL and type
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
- properties: T | Record<string, any>; // a JSON object that describes the object
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 shouild be an URL to the uploaded file
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> extends Partial<Omit<ContentObject<T>,
149
- 'id' | 'root' | 'created_at' | 'updated_at' | 'type'
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, 'query'> {
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 explicitely requested
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 explicitely requested
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 extends Omit<ContentObjectType, 'id' | 'created_at' | 'updated_at' | 'created_by' | 'updated_by'> {
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 = 'single',
209
- multiple = 'multiple',
210
- none = '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 extends Partial<Omit<WorkflowRule, 'id' | 'created_at' | 'updated_at' | 'owner'>> {
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
- status: 'found' | 'generating' | 'failed';
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
 
@@ -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 usefull to select the right database to work on.
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 worflow execution payload vars will be applied over the default vars values stored in the DSL vars field.
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 subworkflow execution, so the main workflow will not wait for the notification to be sent.
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[];