@vertesia/common 1.4.0 → 1.5.0-dev.20260713.113008Z

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 (90) hide show
  1. package/lib/access-control.d.ts +31 -6
  2. package/lib/access-control.d.ts.map +1 -1
  3. package/lib/access-control.js +12 -2
  4. package/lib/access-control.js.map +1 -1
  5. package/lib/apikey.d.ts +29 -5
  6. package/lib/apikey.d.ts.map +1 -1
  7. package/lib/apikey.js.map +1 -1
  8. package/lib/apps.d.ts +78 -4
  9. package/lib/apps.d.ts.map +1 -1
  10. package/lib/apps.js +2 -0
  11. package/lib/apps.js.map +1 -1
  12. package/lib/audit-trail.d.ts +15 -2
  13. package/lib/audit-trail.d.ts.map +1 -1
  14. package/lib/audit-trail.js +20 -0
  15. package/lib/audit-trail.js.map +1 -1
  16. package/lib/environment.d.ts +7 -0
  17. package/lib/environment.d.ts.map +1 -1
  18. package/lib/index.d.ts +3 -0
  19. package/lib/index.d.ts.map +1 -1
  20. package/lib/index.js +2 -0
  21. package/lib/index.js.map +1 -1
  22. package/lib/integrations.d.ts +13 -1
  23. package/lib/integrations.d.ts.map +1 -1
  24. package/lib/integrations.js.map +1 -1
  25. package/lib/platform-event-validation.d.ts +45 -0
  26. package/lib/platform-event-validation.d.ts.map +1 -0
  27. package/lib/platform-event-validation.js +323 -0
  28. package/lib/platform-event-validation.js.map +1 -0
  29. package/lib/platform-event.d.ts +665 -0
  30. package/lib/platform-event.d.ts.map +1 -0
  31. package/lib/platform-event.js +2 -0
  32. package/lib/platform-event.js.map +1 -0
  33. package/lib/project.d.ts +32 -0
  34. package/lib/project.d.ts.map +1 -1
  35. package/lib/project.js.map +1 -1
  36. package/lib/prompt.d.ts +1 -0
  37. package/lib/prompt.d.ts.map +1 -1
  38. package/lib/prompt.js.map +1 -1
  39. package/lib/query.d.ts +1 -0
  40. package/lib/query.d.ts.map +1 -1
  41. package/lib/rate-limiter.d.ts +72 -0
  42. package/lib/rate-limiter.d.ts.map +1 -1
  43. package/lib/roles/types.d.ts +1 -1
  44. package/lib/roles/types.js +1 -1
  45. package/lib/secrets.d.ts +59 -0
  46. package/lib/secrets.d.ts.map +1 -1
  47. package/lib/store/agent-run.d.ts +17 -1
  48. package/lib/store/agent-run.d.ts.map +1 -1
  49. package/lib/store/process-validation.js +19 -0
  50. package/lib/store/process-validation.js.map +1 -1
  51. package/lib/store/store.d.ts +234 -10
  52. package/lib/store/store.d.ts.map +1 -1
  53. package/lib/store/store.js +3 -1
  54. package/lib/store/store.js.map +1 -1
  55. package/lib/store/workflow.d.ts +6 -5
  56. package/lib/store/workflow.d.ts.map +1 -1
  57. package/lib/store/workflow.js.map +1 -1
  58. package/lib/sts-token-types.d.ts +1 -0
  59. package/lib/sts-token-types.d.ts.map +1 -1
  60. package/lib/sts-token-types.js.map +1 -1
  61. package/lib/user.d.ts +36 -1
  62. package/lib/user.d.ts.map +1 -1
  63. package/lib/user.js +39 -0
  64. package/lib/user.js.map +1 -1
  65. package/lib/vertesia-common.js +3 -2
  66. package/lib/vertesia-common.js.map +1 -1
  67. package/package.json +4 -7
  68. package/src/access-control.ts +31 -6
  69. package/src/apikey.ts +29 -5
  70. package/src/apps.ts +87 -4
  71. package/src/audit-trail.ts +34 -18
  72. package/src/environment.ts +7 -0
  73. package/src/index.ts +25 -0
  74. package/src/integrations.ts +14 -1
  75. package/src/platform-event-validation.test.ts +225 -0
  76. package/src/platform-event-validation.ts +359 -0
  77. package/src/platform-event.ts +771 -0
  78. package/src/project.ts +38 -0
  79. package/src/prompt.ts +1 -0
  80. package/src/query.ts +1 -0
  81. package/src/rate-limiter.ts +78 -0
  82. package/src/roles/types.ts +1 -1
  83. package/src/secrets.ts +69 -0
  84. package/src/store/agent-run.ts +22 -1
  85. package/src/store/process-validation.test.ts +62 -0
  86. package/src/store/process-validation.ts +18 -0
  87. package/src/store/store.ts +263 -10
  88. package/src/store/workflow.ts +7 -5
  89. package/src/sts-token-types.ts +1 -0
  90. package/src/user.ts +49 -1
@@ -10,7 +10,9 @@ export enum ContentObjectApiHeaders {
10
10
  PROCESSING_PRIORITY = 'x-processing-priority',
11
11
  CREATE_REVISION = 'x-create-revision',
12
12
  REVISION_LABEL = 'x-revision-label',
13
- /** When set to 'true', prevents this update from triggering workflow rules */
13
+ /**
14
+ * @deprecated Events are now always emitted. This suppresses the Temporal-backed delivery targets (workflow, agent, and process) — webhook deliveries still fire.
15
+ */
14
16
  SUPPRESS_WORKFLOWS = 'x-suppress-workflows',
15
17
  }
16
18
 
@@ -35,6 +37,9 @@ export interface UpdateContentObjectHeaders {
35
37
  'x-create-revision'?: boolean;
36
38
  'x-revision-label'?: string;
37
39
  'x-processing-priority'?: ContentObjectProcessingPriority;
40
+ /**
41
+ * @deprecated Events are now always emitted. This suppresses the Temporal-backed delivery targets (workflow, agent, and process) — webhook deliveries still fire.
42
+ */
38
43
  'x-suppress-workflows'?: boolean;
39
44
  }
40
45
 
@@ -69,6 +74,238 @@ export interface Embedding {
69
74
  etag?: string; // the etag of the text used for the embedding
70
75
  }
71
76
 
77
+ /**
78
+ * Optional object context to include in content object export rows.
79
+ */
80
+ export interface ExportContentObjectsIncludeOptions {
81
+ /**
82
+ * Include stored embeddings. Disabled by default for generic object exports.
83
+ */
84
+ embeddings?: boolean;
85
+ /**
86
+ * Include content source metadata. Enabled by default.
87
+ */
88
+ content?: boolean;
89
+ /**
90
+ * Include object lifecycle status. Enabled by default.
91
+ */
92
+ status?: boolean;
93
+ /**
94
+ * Include object properties. Enabled by default.
95
+ */
96
+ properties?: boolean;
97
+ /**
98
+ * Include technical object metadata. Disabled by default because metadata may be large.
99
+ */
100
+ metadata?: boolean;
101
+ /**
102
+ * Include object revision details. Enabled by default.
103
+ */
104
+ revision?: boolean;
105
+ }
106
+
107
+ /**
108
+ * Bounded filters supported by the bulk content object export API.
109
+ */
110
+ export interface ExportContentObjectsFilter {
111
+ types?: string[];
112
+ created_from?: string;
113
+ created_to?: string;
114
+ updated_from?: string;
115
+ updated_to?: string;
116
+ }
117
+
118
+ /**
119
+ * Exported object identity and context for a single content object row.
120
+ */
121
+ export interface ExportedContentObjectRecord {
122
+ id: string;
123
+ name: string;
124
+ location: string;
125
+ external_id?: string;
126
+ type?: {
127
+ ref_type?: 'stored' | 'incode' | 'untyped';
128
+ id?: string;
129
+ code?: string;
130
+ name?: string;
131
+ };
132
+ status?: ContentObjectStatus;
133
+ content?: {
134
+ source?: string;
135
+ type?: string;
136
+ name?: string;
137
+ etag?: string;
138
+ };
139
+ created_at: string;
140
+ updated_at: string;
141
+ revision?: RevisionInfo;
142
+ properties?: Record<string, unknown>;
143
+ metadata?: Record<string, unknown>;
144
+ embeddings?: Partial<Record<SupportedEmbeddingTypes, Embedding>>;
145
+ }
146
+
147
+ export interface StartContentObjectExportRequest {
148
+ /**
149
+ * Embedding types to export when include.embeddings is true. Defaults to all supported embedding types.
150
+ */
151
+ embedding_types?: SupportedEmbeddingTypes[];
152
+ /**
153
+ * Explicit export filters. This intentionally does not accept the search API's full Mongo/search DSL.
154
+ */
155
+ filter?: ExportContentObjectsFilter;
156
+ /**
157
+ * Include all revisions. Defaults to false, exporting only head revisions.
158
+ */
159
+ all_revisions?: boolean;
160
+ /**
161
+ * Optional object context selectors.
162
+ */
163
+ include?: ExportContentObjectsIncludeOptions;
164
+ /**
165
+ * Compress the export with gzip. Defaults to true.
166
+ */
167
+ compression?: boolean;
168
+ }
169
+
170
+ export interface StartContentObjectExportResponse {
171
+ workflow_id: string;
172
+ run_id: string;
173
+ export_id: string;
174
+ }
175
+
176
+ export interface ZenoBulkContentObjectExportRequest extends Omit<StartContentObjectExportRequest, 'compression'> {
177
+ tenant_id: string;
178
+ project_id: string;
179
+ export_id: string;
180
+ output_path: string;
181
+ filename: string;
182
+ manifest_path: string;
183
+ manifest_filename: string;
184
+ compression: boolean;
185
+ }
186
+
187
+ export interface ZenoBulkContentObjectExportShardRange {
188
+ min_id?: string;
189
+ max_id?: string;
190
+ }
191
+
192
+ export interface ZenoBulkContentObjectExportPlanRequest extends ZenoBulkContentObjectExportRequest {
193
+ target_shard_records?: number;
194
+ max_shards?: number;
195
+ }
196
+
197
+ export interface ZenoBulkContentObjectExportPlanResponse {
198
+ shards: ZenoBulkContentObjectExportShardRange[];
199
+ }
200
+
201
+ export interface ZenoBulkContentObjectExportShardRequest extends ZenoBulkContentObjectExportRequest {
202
+ shard_index: number;
203
+ shard_count: number;
204
+ shard: ZenoBulkContentObjectExportShardRange;
205
+ }
206
+
207
+ export interface ZenoBulkContentObjectExportSplitShardRequest extends ZenoBulkContentObjectExportRequest {
208
+ shard: ZenoBulkContentObjectExportShardRange;
209
+ min_split_records?: number;
210
+ }
211
+
212
+ export interface ZenoBulkContentObjectExportSplitShardResponse {
213
+ shards: ZenoBulkContentObjectExportShardRange[];
214
+ splittable: boolean;
215
+ records: number;
216
+ }
217
+
218
+ export interface ZenoBulkContentObjectExportShardResult {
219
+ status: 'completed';
220
+ shard_index: number;
221
+ shard_count: number;
222
+ path: string;
223
+ filename: string;
224
+ content_type: string;
225
+ records: number;
226
+ bytes: number;
227
+ started_at: string;
228
+ completed_at: string;
229
+ duration_ms: number;
230
+ }
231
+
232
+ export interface ZenoBulkContentObjectExportComposeRequest extends ZenoBulkContentObjectExportRequest {
233
+ parts: string[];
234
+ records?: number;
235
+ /**
236
+ * Export workflow start timestamp. Used to report end-to-end duration after final compose.
237
+ */
238
+ started_at?: string;
239
+ }
240
+
241
+ export interface ContentObjectExportResult {
242
+ status: 'completed';
243
+ path: string;
244
+ filename: string;
245
+ content_type: string;
246
+ manifest_path?: string;
247
+ manifest_filename?: string;
248
+ manifest_content_type?: string;
249
+ manifest_bytes?: number;
250
+ records: number;
251
+ bytes: number;
252
+ started_at: string;
253
+ completed_at: string;
254
+ duration_ms: number;
255
+ }
256
+
257
+ export interface ContentObjectExportProgress {
258
+ status: 'queued' | 'planning' | 'exporting' | 'composing' | 'completed' | 'failed';
259
+ records: number;
260
+ bytes: number;
261
+ path?: string;
262
+ filename?: string;
263
+ completed_shards?: number;
264
+ total_shards?: number;
265
+ started_at?: string;
266
+ completed_at?: string;
267
+ error?: string;
268
+ }
269
+
270
+ export interface ContentObjectExportStatusResponse {
271
+ workflow_id: string;
272
+ run_id: string;
273
+ status: 'queued' | 'running' | 'completed' | 'failed' | 'canceled' | 'terminated' | 'timed_out' | 'unknown';
274
+ done: boolean;
275
+ progress?: ContentObjectExportProgress;
276
+ result?: ContentObjectExportResult;
277
+ error?: string;
278
+ }
279
+
280
+ export interface ContentObjectExportArtifact {
281
+ export_id: string;
282
+ path: string;
283
+ filename: string;
284
+ content_type: string;
285
+ bytes: number;
286
+ created_at?: string;
287
+ files?: ContentObjectExportArtifactFile[];
288
+ }
289
+
290
+ export interface ContentObjectExportArtifactFile {
291
+ role: 'data' | 'manifest';
292
+ path: string;
293
+ filename: string;
294
+ content_type: string;
295
+ bytes: number;
296
+ }
297
+
298
+ export interface ListContentObjectExportsResponse {
299
+ items: ContentObjectExportArtifact[];
300
+ limit: number;
301
+ }
302
+
303
+ export interface DeleteContentObjectExportResponse {
304
+ success: boolean;
305
+ export_id: string;
306
+ path: string;
307
+ }
308
+
72
309
  /**
73
310
  * Metadata about a single inherited property.
74
311
  */
@@ -116,12 +353,12 @@ export interface ContentObjectItemApiResponse extends BaseObject {
116
353
  type?: ContentObjectApiTypeRef;
117
354
  content?: ContentSource;
118
355
  external_id?: string;
119
- properties: Record<string, unknown>;
356
+ properties: JSONObject;
120
357
  metadata?: Record<string, unknown>;
121
358
  tokens?: {
122
- count: number;
123
- encoding: string;
124
- etag: string;
359
+ count?: number;
360
+ encoding?: string;
361
+ etag?: string;
125
362
  };
126
363
  revision: ContentObjectApiRevision;
127
364
  is_deleted?: boolean;
@@ -356,13 +593,19 @@ export interface ContentObjectItem<T = JSONObject> extends BaseObject {
356
593
  properties: T; // a JSON object that describes the object
357
594
 
358
595
  /** Technical metadata of the object */
359
- metadata?: VideoMetadata | AudioMetadata | ImageMetadata | DocumentMetadata | ContentMetadata;
596
+ metadata?:
597
+ | VideoMetadata
598
+ | AudioMetadata
599
+ | ImageMetadata
600
+ | DocumentMetadata
601
+ | ContentMetadata
602
+ | Record<string, unknown>;
360
603
 
361
604
  /** Token information */
362
605
  tokens?: {
363
- count: number; // the number of tokens in the text
364
- encoding: string; // the encoding used to calculate the tokens
365
- etag: string; //the etag of the text used for the token count
606
+ count?: number; // the number of tokens in the text
607
+ encoding?: string; // the encoding used to calculate the tokens
608
+ etag?: string; //the etag of the text used for the token count
366
609
  };
367
610
 
368
611
  /**
@@ -562,6 +805,16 @@ export interface WorkflowRule extends WorkflowRuleItem {
562
805
  * Optional task queue name to use when starting workflows for this rule
563
806
  */
564
807
  task_queue?: string;
808
+
809
+ /**
810
+ * Event subscription migration status for legacy workflow-rule cutover.
811
+ */
812
+ event_subscription_migration_status?: 'migrated' | 'unsupported_match' | 'failed';
813
+
814
+ /**
815
+ * Migration failure or unsupported-match reason, when applicable.
816
+ */
817
+ event_subscription_migration_error?: string;
565
818
  }
566
819
 
567
820
  export interface CreateWorkflowRulePayload extends UploadWorkflowRulePayload {
@@ -597,7 +850,7 @@ export interface GetRenditionResponse {
597
850
  }
598
851
 
599
852
  export interface ObjectSearchResponse {
600
- results: ContentObjectItem[];
853
+ results: ContentObjectItemApiResponse[];
601
854
  facets: ComputedFacetResponse;
602
855
  aggregations?: Record<string, unknown>;
603
856
  }
@@ -59,7 +59,8 @@ export interface WorkflowExecutionBaseParams<T = Record<string, unknown>> {
59
59
  * The user input ar custom user options that can be used to configure the workflow.
60
60
  * You can see the user input as the arguments for a command line app.
61
61
  *
62
- * 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.
62
+ * In the case of workflows started by event subscriptions, the user input vars
63
+ * are initialized from the subscription target configuration.
63
64
  *
64
65
  * In case of dsl workflows the workflow execution payload vars will be applied over the default vars values stored in the DSL vars field.
65
66
  */
@@ -138,11 +139,12 @@ export interface WebHookSpec {
138
139
  result_path?: string;
139
140
  }
140
141
 
141
- export interface WorkflowExecutionPayload<T = Record<string, unknown>> extends WorkflowExecutionBaseParams<T> {
142
+ export interface WorkflowExecutionPayload<T = Record<string, unknown>, EventName extends string = string>
143
+ extends WorkflowExecutionBaseParams<T> {
142
144
  /**
143
145
  * The event which started the workflow who created the activity.
144
146
  */
145
- event: ContentEventName;
147
+ event: EventName;
146
148
 
147
149
  /*
148
150
  * The Workflow Rule ID if any. If the workflow was started by a rule this field will contain the rule ID
@@ -242,7 +244,7 @@ export interface ListWorkflowRunsPayload {
242
244
  event_name?: string;
243
245
 
244
246
  /**
245
- * The workflow rule ID that triggered the workflow.
247
+ * Legacy workflow rule ID filter, when applicable.
246
248
  */
247
249
  rule_id?: string;
248
250
 
@@ -1356,7 +1358,7 @@ export interface AgentIntakeWorkflowParams {
1356
1358
  http_timeout?: HttpTimeoutOptions;
1357
1359
 
1358
1360
  /**
1359
- * LLM execution config. Prefer this for workflow-rule-driven execution settings.
1361
+ * LLM execution config. Prefer this for event-subscription-driven execution settings.
1360
1362
  */
1361
1363
  config?: InteractionExecutionConfiguration;
1362
1364
 
@@ -83,6 +83,7 @@ export interface ServiceAccountTokenRequest extends BaseTokenRequest {
83
83
  project_id: string; // Will verify it belongs to account
84
84
  roles?: SystemRoles[]; // Optional - roles for the service account token
85
85
  name?: string;
86
+ email?: string;
86
87
  }
87
88
 
88
89
  /**
package/src/user.ts CHANGED
@@ -7,7 +7,7 @@ export interface UserWithAccounts extends User {
7
7
 
8
8
  export interface User {
9
9
  id: string;
10
- externalId: string;
10
+ externalId?: string;
11
11
  email: string;
12
12
  name: string;
13
13
  username?: string;
@@ -24,6 +24,8 @@ export interface User {
24
24
  clearance?: number;
25
25
  /** Compartments the user belongs to — restricts access to documents in matching compartments */
26
26
  compartments?: string[];
27
+ /** Free-form user metadata - restricted to internal use */
28
+ annotations?: string[];
27
29
  }
28
30
 
29
31
  export interface UpdateUserPayload {
@@ -47,6 +49,20 @@ export interface UserRef {
47
49
 
48
50
  export const UserRefPopulate = 'id name email picture';
49
51
 
52
+ /**
53
+ * Annotation marker (stored in {@link User.annotations}) that grants a user access to
54
+ * non-production environments (`preview`, `preprod`). See
55
+ * `docs/restrict-access-to-non-production-envs.md`.
56
+ */
57
+ export const EARLY_ACCESS_ANNOTATION = 'early-access';
58
+
59
+ /**
60
+ * Business error code returned by the STS (token server) when a user is denied access to a
61
+ * restricted (`preview`/`preprod`) environment because they lack the {@link EARLY_ACCESS_ANNOTATION}
62
+ * annotation. The UI keys its dedicated rejection screen off this code.
63
+ */
64
+ export const RESTRICTED_ENVIRONMENT_ERROR_CODE = 'restricted_environment';
65
+
50
66
  export enum Datacenters {
51
67
  aws = 'aws',
52
68
  gcp = 'gcp',
@@ -72,6 +88,34 @@ export interface AccountBilling {
72
88
  stripe_customer_id?: string;
73
89
  }
74
90
 
91
+ /**
92
+ * Quota/rate-limit tier assigned to an account. Code-defined tiers live in `@dglabs/quota`
93
+ * (`QUOTA_TIERS`); these names must match its keys.
94
+ * - `standard` — protective baseline limits (the default for most accounts).
95
+ * - `enterprise` — high limits for contracted customers / internal / partners.
96
+ *
97
+ * An account with no explicit `quota_tier` derives its tier from its `account_type`.
98
+ */
99
+ export enum QuotaTier {
100
+ standard = 'standard',
101
+ enterprise = 'enterprise',
102
+ }
103
+
104
+ /**
105
+ * Default tier for an account that has no explicit `quota_tier`, derived from its `account_type`:
106
+ * contracted customers and internal Vertesia accounts get `enterprise`; everyone else (partner,
107
+ * free, prospect, unknown) gets the protective `standard` baseline.
108
+ */
109
+ export function quotaTierForAccountType(accountType: AccountType | undefined | null): QuotaTier {
110
+ switch (accountType) {
111
+ case AccountType.customer:
112
+ case AccountType.vertesia:
113
+ return QuotaTier.enterprise;
114
+ default:
115
+ return QuotaTier.standard;
116
+ }
117
+ }
118
+
75
119
  export interface Account {
76
120
  id: string;
77
121
  name: string;
@@ -89,6 +133,9 @@ export interface Account {
89
133
 
90
134
  billing: AccountBilling;
91
135
 
136
+ /** Quota/rate-limit tier. Unset → the deployment default tier (env `QUOTA_BASE_TIER`). */
137
+ quota_tier?: QuotaTier;
138
+
92
139
  created_by: string;
93
140
  updated_by: string;
94
141
  created_at: string;
@@ -99,6 +146,7 @@ export interface UpdateAccountPayload {
99
146
  name?: string;
100
147
  email_domains?: string[];
101
148
  billing?: AccountBilling;
149
+ quota_tier?: QuotaTier;
102
150
  }
103
151
 
104
152
  export interface AccountRef {