@vertesia/client 0.81.1 → 1.0.0-dev.20260203.130115Z

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 (266) hide show
  1. package/package.json +7 -7
  2. package/src/InteractionsApi.ts +21 -1
  3. package/src/MCPOAuthApi.ts +67 -0
  4. package/src/ProjectsApi.ts +23 -2
  5. package/src/client.ts +19 -5
  6. package/src/index.ts +2 -2
  7. package/src/store/CollectionsApi.ts +4 -4
  8. package/src/store/DashboardApi.ts +216 -0
  9. package/src/store/DataApi.ts +516 -0
  10. package/src/store/EmailApi.ts +211 -0
  11. package/src/store/FilesApi.ts +13 -0
  12. package/src/store/HiveMemoryApi.ts +231 -0
  13. package/src/store/IndexingAdminApi.ts +336 -0
  14. package/src/store/IndexingApi.ts +62 -0
  15. package/src/store/ObjectsApi.ts +40 -0
  16. package/src/store/PendingAsksApi.ts +98 -0
  17. package/src/store/QueryApi.ts +110 -0
  18. package/src/store/SchedulesApi.ts +114 -0
  19. package/src/store/ToolsApi.ts +19 -0
  20. package/src/store/WorkflowsApi.ts +310 -48
  21. package/src/store/client.ts +18 -0
  22. package/src/store/index.ts +9 -0
  23. package/lib/cjs/AccountApi.js +0 -85
  24. package/lib/cjs/AccountApi.js.map +0 -1
  25. package/lib/cjs/AccountsApi.js +0 -16
  26. package/lib/cjs/AccountsApi.js.map +0 -1
  27. package/lib/cjs/AnalyticsApi.js +0 -41
  28. package/lib/cjs/AnalyticsApi.js.map +0 -1
  29. package/lib/cjs/ApiKeysApi.js +0 -63
  30. package/lib/cjs/ApiKeysApi.js.map +0 -1
  31. package/lib/cjs/AppsApi.js +0 -119
  32. package/lib/cjs/AppsApi.js.map +0 -1
  33. package/lib/cjs/CommandsApi.js +0 -19
  34. package/lib/cjs/CommandsApi.js.map +0 -1
  35. package/lib/cjs/EnvironmentsApi.js +0 -72
  36. package/lib/cjs/EnvironmentsApi.js.map +0 -1
  37. package/lib/cjs/GroupsApi.js +0 -78
  38. package/lib/cjs/GroupsApi.js.map +0 -1
  39. package/lib/cjs/IamApi.js +0 -53
  40. package/lib/cjs/IamApi.js.map +0 -1
  41. package/lib/cjs/InteractionBase.js +0 -44
  42. package/lib/cjs/InteractionBase.js.map +0 -1
  43. package/lib/cjs/InteractionCatalogApi.js +0 -64
  44. package/lib/cjs/InteractionCatalogApi.js.map +0 -1
  45. package/lib/cjs/InteractionOutput.js +0 -300
  46. package/lib/cjs/InteractionOutput.js.map +0 -1
  47. package/lib/cjs/InteractionResult.example.js +0 -57
  48. package/lib/cjs/InteractionResult.example.js.map +0 -1
  49. package/lib/cjs/InteractionsApi.js +0 -243
  50. package/lib/cjs/InteractionsApi.js.map +0 -1
  51. package/lib/cjs/ProjectsApi.js +0 -53
  52. package/lib/cjs/ProjectsApi.js.map +0 -1
  53. package/lib/cjs/PromptsApi.js +0 -133
  54. package/lib/cjs/PromptsApi.js.map +0 -1
  55. package/lib/cjs/RefsApi.js +0 -14
  56. package/lib/cjs/RefsApi.js.map +0 -1
  57. package/lib/cjs/RunsApi.js +0 -113
  58. package/lib/cjs/RunsApi.js.map +0 -1
  59. package/lib/cjs/SkillsApi.js +0 -39
  60. package/lib/cjs/SkillsApi.js.map +0 -1
  61. package/lib/cjs/StreamSource.js +0 -17
  62. package/lib/cjs/StreamSource.js.map +0 -1
  63. package/lib/cjs/TrainingApi.js +0 -54
  64. package/lib/cjs/TrainingApi.js.map +0 -1
  65. package/lib/cjs/UsersApi.js +0 -13
  66. package/lib/cjs/UsersApi.js.map +0 -1
  67. package/lib/cjs/client.js +0 -351
  68. package/lib/cjs/client.js.map +0 -1
  69. package/lib/cjs/execute.js +0 -158
  70. package/lib/cjs/execute.js.map +0 -1
  71. package/lib/cjs/index.js +0 -22
  72. package/lib/cjs/index.js.map +0 -1
  73. package/lib/cjs/nodejs/NodeStreamSource.js +0 -45
  74. package/lib/cjs/nodejs/NodeStreamSource.js.map +0 -1
  75. package/lib/cjs/nodejs/index.js +0 -18
  76. package/lib/cjs/nodejs/index.js.map +0 -1
  77. package/lib/cjs/package.json +0 -3
  78. package/lib/cjs/store/AnalyzeDocApi.js +0 -56
  79. package/lib/cjs/store/AnalyzeDocApi.js.map +0 -1
  80. package/lib/cjs/store/CollectionsApi.js +0 -131
  81. package/lib/cjs/store/CollectionsApi.js.map +0 -1
  82. package/lib/cjs/store/CommandsApi.js +0 -17
  83. package/lib/cjs/store/CommandsApi.js.map +0 -1
  84. package/lib/cjs/store/EmbeddingsApi.js +0 -29
  85. package/lib/cjs/store/EmbeddingsApi.js.map +0 -1
  86. package/lib/cjs/store/FilesApi.js +0 -225
  87. package/lib/cjs/store/FilesApi.js.map +0 -1
  88. package/lib/cjs/store/ObjectsApi.js +0 -283
  89. package/lib/cjs/store/ObjectsApi.js.map +0 -1
  90. package/lib/cjs/store/TypesApi.js +0 -57
  91. package/lib/cjs/store/TypesApi.js.map +0 -1
  92. package/lib/cjs/store/WorkersApi.js +0 -16
  93. package/lib/cjs/store/WorkersApi.js.map +0 -1
  94. package/lib/cjs/store/WorkflowsApi.js +0 -425
  95. package/lib/cjs/store/WorkflowsApi.js.map +0 -1
  96. package/lib/cjs/store/client.js +0 -71
  97. package/lib/cjs/store/client.js.map +0 -1
  98. package/lib/cjs/store/errors.js +0 -11
  99. package/lib/cjs/store/errors.js.map +0 -1
  100. package/lib/cjs/store/index.js +0 -23
  101. package/lib/cjs/store/index.js.map +0 -1
  102. package/lib/cjs/store/version.js +0 -6
  103. package/lib/cjs/store/version.js.map +0 -1
  104. package/lib/esm/AccountApi.js +0 -82
  105. package/lib/esm/AccountApi.js.map +0 -1
  106. package/lib/esm/AccountsApi.js +0 -13
  107. package/lib/esm/AccountsApi.js.map +0 -1
  108. package/lib/esm/AnalyticsApi.js +0 -38
  109. package/lib/esm/AnalyticsApi.js.map +0 -1
  110. package/lib/esm/ApiKeysApi.js +0 -59
  111. package/lib/esm/ApiKeysApi.js.map +0 -1
  112. package/lib/esm/AppsApi.js +0 -116
  113. package/lib/esm/AppsApi.js.map +0 -1
  114. package/lib/esm/CommandsApi.js +0 -16
  115. package/lib/esm/CommandsApi.js.map +0 -1
  116. package/lib/esm/EnvironmentsApi.js +0 -69
  117. package/lib/esm/EnvironmentsApi.js.map +0 -1
  118. package/lib/esm/GroupsApi.js +0 -74
  119. package/lib/esm/GroupsApi.js.map +0 -1
  120. package/lib/esm/IamApi.js +0 -47
  121. package/lib/esm/IamApi.js.map +0 -1
  122. package/lib/esm/InteractionBase.js +0 -40
  123. package/lib/esm/InteractionBase.js.map +0 -1
  124. package/lib/esm/InteractionCatalogApi.js +0 -60
  125. package/lib/esm/InteractionCatalogApi.js.map +0 -1
  126. package/lib/esm/InteractionOutput.js +0 -293
  127. package/lib/esm/InteractionOutput.js.map +0 -1
  128. package/lib/esm/InteractionResult.example.js +0 -55
  129. package/lib/esm/InteractionResult.example.js.map +0 -1
  130. package/lib/esm/InteractionsApi.js +0 -240
  131. package/lib/esm/InteractionsApi.js.map +0 -1
  132. package/lib/esm/ProjectsApi.js +0 -50
  133. package/lib/esm/ProjectsApi.js.map +0 -1
  134. package/lib/esm/PromptsApi.js +0 -130
  135. package/lib/esm/PromptsApi.js.map +0 -1
  136. package/lib/esm/RefsApi.js +0 -10
  137. package/lib/esm/RefsApi.js.map +0 -1
  138. package/lib/esm/RunsApi.js +0 -109
  139. package/lib/esm/RunsApi.js.map +0 -1
  140. package/lib/esm/SkillsApi.js +0 -36
  141. package/lib/esm/SkillsApi.js.map +0 -1
  142. package/lib/esm/StreamSource.js +0 -13
  143. package/lib/esm/StreamSource.js.map +0 -1
  144. package/lib/esm/TrainingApi.js +0 -51
  145. package/lib/esm/TrainingApi.js.map +0 -1
  146. package/lib/esm/UsersApi.js +0 -10
  147. package/lib/esm/UsersApi.js.map +0 -1
  148. package/lib/esm/client.js +0 -342
  149. package/lib/esm/client.js.map +0 -1
  150. package/lib/esm/execute.js +0 -118
  151. package/lib/esm/execute.js.map +0 -1
  152. package/lib/esm/index.js +0 -6
  153. package/lib/esm/index.js.map +0 -1
  154. package/lib/esm/nodejs/NodeStreamSource.js +0 -41
  155. package/lib/esm/nodejs/NodeStreamSource.js.map +0 -1
  156. package/lib/esm/nodejs/index.js +0 -2
  157. package/lib/esm/nodejs/index.js.map +0 -1
  158. package/lib/esm/store/AnalyzeDocApi.js +0 -52
  159. package/lib/esm/store/AnalyzeDocApi.js.map +0 -1
  160. package/lib/esm/store/CollectionsApi.js +0 -127
  161. package/lib/esm/store/CollectionsApi.js.map +0 -1
  162. package/lib/esm/store/CommandsApi.js +0 -13
  163. package/lib/esm/store/CommandsApi.js.map +0 -1
  164. package/lib/esm/store/EmbeddingsApi.js +0 -25
  165. package/lib/esm/store/EmbeddingsApi.js.map +0 -1
  166. package/lib/esm/store/FilesApi.js +0 -219
  167. package/lib/esm/store/FilesApi.js.map +0 -1
  168. package/lib/esm/store/ObjectsApi.js +0 -279
  169. package/lib/esm/store/ObjectsApi.js.map +0 -1
  170. package/lib/esm/store/TypesApi.js +0 -53
  171. package/lib/esm/store/TypesApi.js.map +0 -1
  172. package/lib/esm/store/WorkersApi.js +0 -12
  173. package/lib/esm/store/WorkersApi.js.map +0 -1
  174. package/lib/esm/store/WorkflowsApi.js +0 -419
  175. package/lib/esm/store/WorkflowsApi.js.map +0 -1
  176. package/lib/esm/store/client.js +0 -67
  177. package/lib/esm/store/client.js.map +0 -1
  178. package/lib/esm/store/errors.js +0 -7
  179. package/lib/esm/store/errors.js.map +0 -1
  180. package/lib/esm/store/index.js +0 -7
  181. package/lib/esm/store/index.js.map +0 -1
  182. package/lib/esm/store/version.js +0 -3
  183. package/lib/esm/store/version.js.map +0 -1
  184. package/lib/tsconfig.tsbuildinfo +0 -1
  185. package/lib/types/AccountApi.d.ts +0 -59
  186. package/lib/types/AccountApi.d.ts.map +0 -1
  187. package/lib/types/AccountsApi.d.ts +0 -7
  188. package/lib/types/AccountsApi.d.ts.map +0 -1
  189. package/lib/types/AnalyticsApi.d.ts +0 -11
  190. package/lib/types/AnalyticsApi.d.ts.map +0 -1
  191. package/lib/types/ApiKeysApi.d.ts +0 -42
  192. package/lib/types/ApiKeysApi.d.ts.map +0 -1
  193. package/lib/types/AppsApi.d.ts +0 -65
  194. package/lib/types/AppsApi.d.ts.map +0 -1
  195. package/lib/types/CommandsApi.d.ts +0 -10
  196. package/lib/types/CommandsApi.d.ts.map +0 -1
  197. package/lib/types/EnvironmentsApi.d.ts +0 -40
  198. package/lib/types/EnvironmentsApi.d.ts.map +0 -1
  199. package/lib/types/GroupsApi.d.ts +0 -65
  200. package/lib/types/GroupsApi.d.ts.map +0 -1
  201. package/lib/types/IamApi.d.ts +0 -41
  202. package/lib/types/IamApi.d.ts.map +0 -1
  203. package/lib/types/InteractionBase.d.ts +0 -22
  204. package/lib/types/InteractionBase.d.ts.map +0 -1
  205. package/lib/types/InteractionCatalogApi.d.ts +0 -36
  206. package/lib/types/InteractionCatalogApi.d.ts.map +0 -1
  207. package/lib/types/InteractionOutput.d.ts +0 -174
  208. package/lib/types/InteractionOutput.d.ts.map +0 -1
  209. package/lib/types/InteractionResult.example.d.ts +0 -6
  210. package/lib/types/InteractionResult.example.d.ts.map +0 -1
  211. package/lib/types/InteractionsApi.d.ts +0 -165
  212. package/lib/types/InteractionsApi.d.ts.map +0 -1
  213. package/lib/types/ProjectsApi.d.ts +0 -18
  214. package/lib/types/ProjectsApi.d.ts.map +0 -1
  215. package/lib/types/PromptsApi.d.ts +0 -106
  216. package/lib/types/PromptsApi.d.ts.map +0 -1
  217. package/lib/types/RefsApi.d.ts +0 -6
  218. package/lib/types/RefsApi.d.ts.map +0 -1
  219. package/lib/types/RunsApi.d.ts +0 -79
  220. package/lib/types/RunsApi.d.ts.map +0 -1
  221. package/lib/types/SkillsApi.d.ts +0 -26
  222. package/lib/types/SkillsApi.d.ts.map +0 -1
  223. package/lib/types/StreamSource.d.ts +0 -7
  224. package/lib/types/StreamSource.d.ts.map +0 -1
  225. package/lib/types/TrainingApi.d.ts +0 -27
  226. package/lib/types/TrainingApi.d.ts.map +0 -1
  227. package/lib/types/UsersApi.d.ts +0 -6
  228. package/lib/types/UsersApi.d.ts.map +0 -1
  229. package/lib/types/client.d.ts +0 -125
  230. package/lib/types/client.d.ts.map +0 -1
  231. package/lib/types/execute.d.ts +0 -37
  232. package/lib/types/execute.d.ts.map +0 -1
  233. package/lib/types/index.d.ts +0 -10
  234. package/lib/types/index.d.ts.map +0 -1
  235. package/lib/types/nodejs/NodeStreamSource.d.ts +0 -9
  236. package/lib/types/nodejs/NodeStreamSource.d.ts.map +0 -1
  237. package/lib/types/nodejs/index.d.ts +0 -1
  238. package/lib/types/nodejs/index.d.ts.map +0 -1
  239. package/lib/types/store/AnalyzeDocApi.d.ts +0 -17
  240. package/lib/types/store/AnalyzeDocApi.d.ts.map +0 -1
  241. package/lib/types/store/CollectionsApi.d.ts +0 -82
  242. package/lib/types/store/CollectionsApi.d.ts.map +0 -1
  243. package/lib/types/store/CommandsApi.d.ts +0 -10
  244. package/lib/types/store/CommandsApi.d.ts.map +0 -1
  245. package/lib/types/store/EmbeddingsApi.d.ts +0 -12
  246. package/lib/types/store/EmbeddingsApi.d.ts.map +0 -1
  247. package/lib/types/store/FilesApi.d.ts +0 -103
  248. package/lib/types/store/FilesApi.d.ts.map +0 -1
  249. package/lib/types/store/ObjectsApi.d.ts +0 -117
  250. package/lib/types/store/ObjectsApi.d.ts.map +0 -1
  251. package/lib/types/store/TypesApi.d.ts +0 -23
  252. package/lib/types/store/TypesApi.d.ts.map +0 -1
  253. package/lib/types/store/WorkersApi.d.ts +0 -6
  254. package/lib/types/store/WorkersApi.d.ts.map +0 -1
  255. package/lib/types/store/WorkflowsApi.d.ts +0 -71
  256. package/lib/types/store/WorkflowsApi.d.ts.map +0 -1
  257. package/lib/types/store/client.d.ts +0 -35
  258. package/lib/types/store/client.d.ts.map +0 -1
  259. package/lib/types/store/errors.d.ts +0 -4
  260. package/lib/types/store/errors.d.ts.map +0 -1
  261. package/lib/types/store/index.d.ts +0 -6
  262. package/lib/types/store/index.d.ts.map +0 -1
  263. package/lib/types/store/version.d.ts +0 -2
  264. package/lib/types/store/version.d.ts.map +0 -1
  265. package/lib/vertesia-client.js +0 -2
  266. package/lib/vertesia-client.js.map +0 -1
@@ -0,0 +1,336 @@
1
+ import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
2
+
3
+ /**
4
+ * Document data structure for Elasticsearch indexing
5
+ */
6
+ export interface ElasticsearchDocumentData {
7
+ name?: string;
8
+ text?: string;
9
+ properties?: Record<string, unknown>;
10
+ status?: string;
11
+ type?: {
12
+ id?: string;
13
+ name?: string;
14
+ };
15
+ security?: {
16
+ 'content:read'?: string[];
17
+ 'content:write'?: string[];
18
+ 'content:delete'?: string[];
19
+ };
20
+ revision?: {
21
+ head?: boolean;
22
+ root?: string;
23
+ };
24
+ embeddings_text?: number[];
25
+ embeddings_image?: number[];
26
+ embeddings_properties?: number[];
27
+ created_at?: Date | string;
28
+ updated_at?: Date | string;
29
+ }
30
+
31
+ /**
32
+ * Result from bulk indexing
33
+ */
34
+ export interface BulkIndexResult {
35
+ successful: number;
36
+ failed: number;
37
+ }
38
+
39
+ /**
40
+ * Result from creating a reindex target
41
+ */
42
+ export interface CreateReindexTargetResult {
43
+ created: boolean;
44
+ indexName: string;
45
+ aliasName: string;
46
+ version: number;
47
+ }
48
+
49
+ /**
50
+ * Result from getting reindex range
51
+ */
52
+ export interface ReindexRangeResult {
53
+ first: string | null;
54
+ last: string | null;
55
+ count: number;
56
+ }
57
+
58
+ /**
59
+ * Result from fetching a batch
60
+ */
61
+ export interface FetchBatchResult {
62
+ documents: Array<{
63
+ id: string;
64
+ document: ElasticsearchDocumentData;
65
+ }>;
66
+ nextCursor: string | null;
67
+ done: boolean;
68
+ }
69
+
70
+ /**
71
+ * Result from indexing a batch
72
+ */
73
+ export interface IndexBatchResult {
74
+ successful: number;
75
+ failed: number;
76
+ processed: number;
77
+ nextCursor: string | null;
78
+ done: boolean;
79
+ }
80
+
81
+ /**
82
+ * Result from triggering a reindex
83
+ */
84
+ export interface TriggerReindexResult {
85
+ status: string;
86
+ workflow?: string;
87
+ workflowId?: string;
88
+ runId?: string;
89
+ objectCount?: number;
90
+ reason?: string;
91
+ enabled?: boolean;
92
+ }
93
+
94
+ /**
95
+ * Elasticsearch index statistics
96
+ */
97
+ export interface ElasticsearchIndexStats {
98
+ enabled: boolean;
99
+ exists?: boolean;
100
+ documentCount?: number;
101
+ sizeInBytes?: number;
102
+ indexName?: string;
103
+ aliasName?: string;
104
+ }
105
+
106
+ /**
107
+ * Embedding configuration for a single type
108
+ */
109
+ export interface EmbeddingTypeConfig {
110
+ environment?: string;
111
+ dimensions?: number;
112
+ model?: string;
113
+ provider?: string;
114
+ enabled?: boolean;
115
+ }
116
+
117
+ /**
118
+ * Detailed index configuration
119
+ */
120
+ export interface IndexConfiguration {
121
+ enabled: boolean;
122
+ exists?: boolean;
123
+ indexName?: string;
124
+ aliasName?: string;
125
+ version?: number;
126
+ documentCount?: number;
127
+ sizeInBytes?: number;
128
+ embeddingDimensions?: {
129
+ text?: number;
130
+ image?: number;
131
+ properties?: number;
132
+ };
133
+ fieldMappings?: Record<string, unknown>;
134
+ projectEmbeddingsConfig?: {
135
+ text?: EmbeddingTypeConfig;
136
+ image?: EmbeddingTypeConfig;
137
+ properties?: EmbeddingTypeConfig;
138
+ };
139
+ createdAt?: Date | null;
140
+ }
141
+
142
+ /**
143
+ * Result from fetching documents by IDs
144
+ */
145
+ export interface FetchDocumentsByIdsResult {
146
+ documents: Array<{
147
+ id: string;
148
+ document: ElasticsearchDocumentData;
149
+ }>;
150
+ notFound: string[];
151
+ }
152
+
153
+ /**
154
+ * Result from bulk delete
155
+ */
156
+ export interface BulkDeleteResult {
157
+ successful: number;
158
+ failed: number;
159
+ }
160
+
161
+ /**
162
+ * Admin API for Elasticsearch operations
163
+ *
164
+ * These methods are called by Temporal workflow activities to perform
165
+ * Elasticsearch operations. They require content admin permissions.
166
+ */
167
+ export class IndexingAdminApi extends ApiTopic {
168
+
169
+ constructor(parent: ClientBase, basePath: string = "/admin/elasticsearch") {
170
+ super(parent, basePath);
171
+ }
172
+
173
+ /**
174
+ * Index a single document to Elasticsearch
175
+ */
176
+ index(objectId: string, document: ElasticsearchDocumentData): Promise<{ status: string; objectId: string }> {
177
+ return this.post("/index", {
178
+ payload: { objectId, document },
179
+ });
180
+ }
181
+
182
+ /**
183
+ * Delete a document from Elasticsearch
184
+ */
185
+ delete(objectId: string): Promise<{ status: string; objectId: string }> {
186
+ return this.post("/delete", {
187
+ payload: { objectId },
188
+ });
189
+ }
190
+
191
+ /**
192
+ * Bulk index multiple documents to Elasticsearch
193
+ *
194
+ * @param documents Array of documents to index
195
+ * @param targetIndex Optional explicit index name for zero-downtime reindexing
196
+ */
197
+ bulkIndex(
198
+ documents: Array<{ id: string; document: ElasticsearchDocumentData }>,
199
+ targetIndex?: string
200
+ ): Promise<BulkIndexResult> {
201
+ return this.post("/bulk-index", {
202
+ payload: { documents, targetIndex },
203
+ });
204
+ }
205
+
206
+ /**
207
+ * Ensure Elasticsearch index exists for the project
208
+ *
209
+ * @param recreate If true, drops and recreates the index
210
+ */
211
+ ensureIndex(recreate?: boolean): Promise<{ created: boolean; recreated?: boolean; existed?: boolean }> {
212
+ return this.post("/ensure-index", {
213
+ payload: { recreate },
214
+ });
215
+ }
216
+
217
+ /**
218
+ * Create a new versioned index for reindexing (without alias)
219
+ * The alias will be swapped after reindexing completes via swapAlias
220
+ */
221
+ createReindexTarget(): Promise<CreateReindexTargetResult> {
222
+ return this.post("/create-reindex-target", {
223
+ payload: {},
224
+ });
225
+ }
226
+
227
+ /**
228
+ * Atomically swap the alias from old index to new index
229
+ *
230
+ * @param newIndexName The new index to point the alias to
231
+ * @param deleteOld If true, deletes the old index after swapping
232
+ */
233
+ swapAlias(newIndexName: string, deleteOld?: boolean): Promise<{ swapped: boolean; aliasName?: string; newIndexName?: string }> {
234
+ return this.post("/swap-alias", {
235
+ payload: { newIndexName, deleteOld },
236
+ });
237
+ }
238
+
239
+ /**
240
+ * Get Elasticsearch index statistics for the project
241
+ */
242
+ getStats(): Promise<ElasticsearchIndexStats> {
243
+ return this.post("/stats", {
244
+ payload: {},
245
+ });
246
+ }
247
+
248
+ /**
249
+ * Get the _id range for reindexing (first, last, count)
250
+ * Used by workflow to set up cursor-based pagination
251
+ */
252
+ getReindexRange(): Promise<ReindexRangeResult> {
253
+ return this.post("/reindex-range", {
254
+ payload: {},
255
+ });
256
+ }
257
+
258
+ /**
259
+ * Fetch a batch of documents from MongoDB (without indexing)
260
+ * Used by pipeline approach: fetch next batch while indexing current
261
+ *
262
+ * @param cursor Cursor from previous batch (null for first batch)
263
+ * @param limit Maximum documents to fetch (default: 500)
264
+ */
265
+ fetchBatch(cursor?: string | null, limit?: number): Promise<FetchBatchResult> {
266
+ return this.post("/fetch-batch", {
267
+ payload: { cursor, limit },
268
+ });
269
+ }
270
+
271
+ /**
272
+ * Fetch and index a batch of documents (server-side)
273
+ * Uses cursor-based pagination for reliability
274
+ *
275
+ * @param cursor Cursor from previous batch (null for first batch)
276
+ * @param limit Maximum documents to process (default: 500)
277
+ * @param targetIndex Optional explicit index name for zero-downtime reindexing
278
+ */
279
+ indexBatch(cursor?: string | null, limit?: number, targetIndex?: string): Promise<IndexBatchResult> {
280
+ return this.post("/index-batch", {
281
+ payload: { cursor, limit, targetIndex },
282
+ });
283
+ }
284
+
285
+ /**
286
+ * Trigger a reindex operation via Temporal workflow
287
+ *
288
+ * @param fullReindex If true, reindexes all documents in the project
289
+ * @param objectIds Specific object IDs to reindex (if not fullReindex)
290
+ * @param recreateIndex If true, recreates the index before reindexing
291
+ */
292
+ triggerReindex(options?: {
293
+ fullReindex?: boolean;
294
+ objectIds?: string[];
295
+ recreateIndex?: boolean;
296
+ }): Promise<TriggerReindexResult> {
297
+ return this.post("/reindex", {
298
+ payload: options ?? {},
299
+ });
300
+ }
301
+
302
+ /**
303
+ * Fetch documents by their IDs from MongoDB (for retry workflow)
304
+ * Returns documents ready for bulk indexing
305
+ *
306
+ * @param objectIds Array of object IDs to fetch
307
+ */
308
+ fetchDocumentsByIds(objectIds: string[]): Promise<FetchDocumentsByIdsResult> {
309
+ return this.post("/fetch-by-ids", {
310
+ payload: { objectIds },
311
+ });
312
+ }
313
+
314
+ /**
315
+ * Bulk delete documents from Elasticsearch
316
+ *
317
+ * @param objectIds Array of object IDs to delete
318
+ */
319
+ bulkDelete(objectIds: string[]): Promise<BulkDeleteResult> {
320
+ return this.post("/bulk-delete", {
321
+ payload: { objectIds },
322
+ });
323
+ }
324
+
325
+ /**
326
+ * Get detailed index configuration for the project
327
+ *
328
+ * Returns comprehensive information about the Elasticsearch index including
329
+ * status, embedding dimensions, field mappings, and project configuration.
330
+ */
331
+ getConfiguration(): Promise<IndexConfiguration> {
332
+ return this.post("/configuration", {
333
+ payload: {},
334
+ });
335
+ }
336
+ }
@@ -0,0 +1,62 @@
1
+ import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
2
+ import {
3
+ IndexingStatusResponse,
4
+ GenericCommandResponse,
5
+ } from "@vertesia/common";
6
+
7
+ /**
8
+ * API for indexing operations on content objects.
9
+ * Provides status, reindex, and configuration management.
10
+ */
11
+ export class IndexingApi extends ApiTopic {
12
+
13
+ constructor(parent: ClientBase, basePath: string = "/api/v1/indexing") {
14
+ super(parent, basePath);
15
+ }
16
+
17
+ /**
18
+ * Get Elasticsearch status for the current project
19
+ */
20
+ async status(): Promise<IndexingStatusResponse> {
21
+ return this.get("/status");
22
+ }
23
+
24
+ /**
25
+ * Trigger a full reindex of all documents
26
+ * @param recreateIndex If true, drops and recreates the index before reindexing
27
+ */
28
+ async reindex(recreateIndex?: boolean): Promise<GenericCommandResponse> {
29
+ return this.post("/reindex", { payload: { recreateIndex } });
30
+ }
31
+
32
+ /**
33
+ * Enable indexing for this project
34
+ */
35
+ async enableIndexing(): Promise<GenericCommandResponse> {
36
+ return this.post("/enable-indexing");
37
+ }
38
+
39
+ /**
40
+ * Disable indexing for this project
41
+ */
42
+ async disableIndexing(): Promise<GenericCommandResponse> {
43
+ return this.post("/disable-indexing");
44
+ }
45
+
46
+ /**
47
+ * Enable index-based queries for this project
48
+ * (routes searches to index instead of Atlas Search)
49
+ */
50
+ async enableQueries(): Promise<GenericCommandResponse> {
51
+ return this.post("/enable-queries");
52
+ }
53
+
54
+ /**
55
+ * Disable index-based queries for this project
56
+ * (routes searches back to Atlas Search)
57
+ */
58
+ async disableQueries(): Promise<GenericCommandResponse> {
59
+ return this.post("/disable-queries");
60
+ }
61
+
62
+ }
@@ -1,5 +1,6 @@
1
1
  import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
2
2
  import {
3
+ canGenerateRendition,
3
4
  ContentObjectApiHeaders,
4
5
  ComplexSearchPayload,
5
6
  ComputeObjectFacetPayload,
@@ -16,13 +17,18 @@ import {
16
17
  GetFileUrlResponse,
17
18
  GetRenditionParams,
18
19
  GetRenditionResponse,
20
+ getSupportedRenditionFormats,
19
21
  GetUploadUrlPayload,
20
22
  ListWorkflowRunsResponse,
21
23
  ObjectSearchPayload,
22
24
  ObjectSearchQuery,
23
25
  SupportedEmbeddingTypes,
26
+ supportsVisualRendition,
24
27
  } from "@vertesia/common";
25
28
 
29
+ // Re-export rendition utilities for consumers
30
+ export { canGenerateRendition, getSupportedRenditionFormats, supportsVisualRendition };
31
+
26
32
  import { StreamSource } from "../StreamSource.js";
27
33
  import { AnalyzeDocApi } from "./AnalyzeDocApi.js";
28
34
  import { ZenoClient } from "./client.js";
@@ -284,6 +290,7 @@ export class ObjectsApi extends ApiTopic {
284
290
  * @param options Additional options
285
291
  * @param options.createRevision Whether to create a new revision instead of updating in place
286
292
  * @param options.revisionLabel Optional label for the revision (e.g., "v1.2")
293
+ * @param options.suppressWorkflows When true, prevents this update from triggering workflow rules
287
294
  * @returns The updated object or newly created revision
288
295
  */
289
296
  async update(
@@ -293,6 +300,7 @@ export class ObjectsApi extends ApiTopic {
293
300
  createRevision?: boolean;
294
301
  revisionLabel?: string;
295
302
  processing_priority?: ContentObjectProcessingPriority;
303
+ suppressWorkflows?: boolean;
296
304
  },
297
305
  ): Promise<ContentObject> {
298
306
  const updatePayload: Partial<CreateContentObjectPayload> = {
@@ -317,6 +325,9 @@ export class ObjectsApi extends ApiTopic {
317
325
  headers[ContentObjectApiHeaders.REVISION_LABEL] = options.revisionLabel;
318
326
  }
319
327
  }
328
+ if (options?.suppressWorkflows) {
329
+ headers[ContentObjectApiHeaders.SUPPRESS_WORKFLOWS] = "true";
330
+ }
320
331
 
321
332
  return this.put(`/${id}`, {
322
333
  payload: updatePayload,
@@ -372,6 +383,35 @@ export class ObjectsApi extends ApiTopic {
372
383
  });
373
384
  }
374
385
 
386
+ /**
387
+ * Get rendition with pre-validation of content type compatibility.
388
+ * Returns null instead of throwing if the format is not supported for the content type.
389
+ *
390
+ * @param documentId - The document ID
391
+ * @param contentType - The content type of the document (e.g., 'image/png', 'text/markdown')
392
+ * @param options - Rendition options including format
393
+ * @returns The rendition response, or null if format is not supported for the content type
394
+ *
395
+ * @example
396
+ * const rendition = await client.objects.getRenditionSafe(docId, doc.content?.type, {
397
+ * format: ImageRenditionFormat.jpeg,
398
+ * generate_if_missing: true
399
+ * });
400
+ * if (!rendition) {
401
+ * console.log('Document does not support JPEG renditions');
402
+ * }
403
+ */
404
+ getRenditionSafe(
405
+ documentId: string,
406
+ contentType: string | undefined,
407
+ options: GetRenditionParams,
408
+ ): Promise<GetRenditionResponse | null> {
409
+ if (!canGenerateRendition(contentType, options.format)) {
410
+ return Promise.resolve(null);
411
+ }
412
+ return this.getRendition(documentId, options);
413
+ }
414
+
375
415
  exportProperties(
376
416
  payload: ExportPropertiesPayload,
377
417
  ): Promise<ExportPropertiesResponse> {
@@ -0,0 +1,98 @@
1
+ import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
2
+ import { ListPendingAsksResponse, PendingAskData, UserChannel } from "@vertesia/common";
3
+
4
+ /**
5
+ * Request to register a pending ask.
6
+ */
7
+ export interface RegisterPendingAskRequest {
8
+ /** Temporal workflow run ID */
9
+ runId: string;
10
+ /** Temporal workflow ID */
11
+ workflowId: string;
12
+ /** Name of the agent/interaction */
13
+ agentName: string;
14
+ /** Questions asked by the agent */
15
+ questions: string[];
16
+ /** Timeout in hours (default 48) */
17
+ timeoutHours?: number;
18
+ /** User communication channels */
19
+ userChannels: UserChannel[];
20
+ }
21
+
22
+ /**
23
+ * Response from registering a pending ask.
24
+ */
25
+ export interface RegisterPendingAskResponse {
26
+ /** Whether registration succeeded */
27
+ success: boolean;
28
+ /** Generated ask ID */
29
+ askId?: string;
30
+ /** Whether webhook was sent */
31
+ webhookSent?: boolean;
32
+ /** Error message if failed */
33
+ error?: string;
34
+ }
35
+
36
+ /**
37
+ * Request to resolve a pending ask.
38
+ */
39
+ export interface ResolvePendingAskRequest {
40
+ /** User's response */
41
+ response: string;
42
+ }
43
+
44
+ /**
45
+ * Response from resolving a pending ask.
46
+ */
47
+ export interface ResolvePendingAskResponse {
48
+ /** Whether resolution succeeded */
49
+ success: boolean;
50
+ /** Whether webhook was sent */
51
+ webhookSent?: boolean;
52
+ /** How long the user took to respond (ms) */
53
+ waitDurationMs?: number;
54
+ /** Error message if failed */
55
+ error?: string;
56
+ }
57
+
58
+ /**
59
+ * Pending Asks API for tracking ask_user requests.
60
+ * Handles registration, resolution, and listing of pending asks.
61
+ */
62
+ export class PendingAsksApi extends ApiTopic {
63
+ constructor(parent: ClientBase) {
64
+ super(parent, "/api/v1/pending-asks");
65
+ }
66
+
67
+ /**
68
+ * Register a new pending ask.
69
+ * Called when an agent calls ask_user.
70
+ * Stores in Redis and sends webhook if configured.
71
+ */
72
+ register(request: RegisterPendingAskRequest): Promise<RegisterPendingAskResponse> {
73
+ return this.post("/", { payload: request });
74
+ }
75
+
76
+ /**
77
+ * Resolve a pending ask with the user's response.
78
+ * Called when a user responds to an ask.
79
+ * Updates Redis and sends webhook if configured.
80
+ */
81
+ resolve(askId: string, request: ResolvePendingAskRequest): Promise<ResolvePendingAskResponse> {
82
+ return this.post(`/${askId}/resolve`, { payload: request });
83
+ }
84
+
85
+ /**
86
+ * List all pending asks for the current project.
87
+ */
88
+ list(): Promise<ListPendingAsksResponse> {
89
+ return this.get("/");
90
+ }
91
+
92
+ /**
93
+ * Get a specific pending ask by ID.
94
+ */
95
+ retrieve(askId: string): Promise<PendingAskData> {
96
+ return this.get(`/${askId}`);
97
+ }
98
+ }
@@ -0,0 +1,110 @@
1
+ import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
2
+
3
+ /**
4
+ * Query payload for agent data access
5
+ */
6
+ export interface QueryPayload {
7
+ /** SQL query (uses ES SQL API) */
8
+ sql?: string;
9
+ /** ES|QL query (Elastic's piped query language) */
10
+ esql?: string;
11
+ /** Raw DSL query for full control */
12
+ dsl?: {
13
+ query?: Record<string, unknown>;
14
+ aggs?: Record<string, unknown>;
15
+ size?: number;
16
+ from?: number;
17
+ sort?: Array<Record<string, unknown>>;
18
+ };
19
+ /** Output format */
20
+ format?: 'json' | 'csv' | 'table';
21
+ }
22
+
23
+ /**
24
+ * Query result
25
+ */
26
+ export interface QueryResult {
27
+ /** Result type */
28
+ type: 'sql' | 'esql' | 'dsl';
29
+ /** Column definitions */
30
+ columns?: Array<{ name: string; type: string }>;
31
+ /** Rows for SQL/ES|QL */
32
+ rows?: unknown[][];
33
+ /** Hits for DSL */
34
+ hits?: Array<{ id: string; score: number; source: unknown }>;
35
+ /** Total count */
36
+ total?: number;
37
+ /** Aggregations for DSL */
38
+ aggregations?: Record<string, unknown>;
39
+ /** Cursor for pagination (SQL) */
40
+ cursor?: string;
41
+ /** Query execution time in ms */
42
+ took?: number;
43
+ }
44
+
45
+ /**
46
+ * API for querying documents using SQL, ES|QL, or raw Elasticsearch DSL.
47
+ * All queries are automatically filtered based on the authenticated user's permissions.
48
+ */
49
+ export class QueryApi extends ApiTopic {
50
+
51
+ constructor(parent: ClientBase, basePath: string = "/api/v1/query") {
52
+ super(parent, basePath);
53
+ }
54
+
55
+ /**
56
+ * Execute a query against the project's document index
57
+ *
58
+ * @param payload - Query payload with sql, esql, or dsl
59
+ * @returns Query result with columns/rows or hits/aggregations
60
+ *
61
+ * @example SQL query
62
+ * ```typescript
63
+ * const result = await client.query.execute({
64
+ * sql: "SELECT name, status FROM content WHERE status = 'published' LIMIT 10"
65
+ * });
66
+ * ```
67
+ *
68
+ * @example ES|QL query
69
+ * ```typescript
70
+ * const result = await client.query.execute({
71
+ * esql: "FROM content | WHERE status == 'published' | STATS count = COUNT(*) BY type.name"
72
+ * });
73
+ * ```
74
+ *
75
+ * @example DSL query with aggregations
76
+ * ```typescript
77
+ * const result = await client.query.execute({
78
+ * dsl: {
79
+ * query: { match: { text: "machine learning" } },
80
+ * aggs: { by_type: { terms: { field: "type.name" } } },
81
+ * size: 10
82
+ * }
83
+ * });
84
+ * ```
85
+ */
86
+ async execute(payload: QueryPayload): Promise<QueryResult> {
87
+ return this.post("/", { payload });
88
+ }
89
+
90
+ /**
91
+ * Execute a SQL query
92
+ */
93
+ async sql(query: string): Promise<QueryResult> {
94
+ return this.execute({ sql: query });
95
+ }
96
+
97
+ /**
98
+ * Execute an ES|QL query
99
+ */
100
+ async esql(query: string): Promise<QueryResult> {
101
+ return this.execute({ esql: query });
102
+ }
103
+
104
+ /**
105
+ * Execute a DSL query
106
+ */
107
+ async dsl(query: QueryPayload['dsl']): Promise<QueryResult> {
108
+ return this.execute({ dsl: query });
109
+ }
110
+ }