@vertesia/common 0.24.0-dev.202601221707

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 (388) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +53 -0
  3. package/lib/cjs/Progress.js +61 -0
  4. package/lib/cjs/Progress.js.map +1 -0
  5. package/lib/cjs/access-control.js +56 -0
  6. package/lib/cjs/access-control.js.map +1 -0
  7. package/lib/cjs/analytics.js +3 -0
  8. package/lib/cjs/analytics.js.map +1 -0
  9. package/lib/cjs/apikey.js +16 -0
  10. package/lib/cjs/apikey.js.map +1 -0
  11. package/lib/cjs/apps.js +35 -0
  12. package/lib/cjs/apps.js.map +1 -0
  13. package/lib/cjs/ask-user.js +8 -0
  14. package/lib/cjs/ask-user.js.map +1 -0
  15. package/lib/cjs/channels.js +63 -0
  16. package/lib/cjs/channels.js.map +1 -0
  17. package/lib/cjs/common.js +3 -0
  18. package/lib/cjs/common.js.map +1 -0
  19. package/lib/cjs/data-platform.js +127 -0
  20. package/lib/cjs/data-platform.js.map +1 -0
  21. package/lib/cjs/email.js +20 -0
  22. package/lib/cjs/email.js.map +1 -0
  23. package/lib/cjs/environment.js +44 -0
  24. package/lib/cjs/environment.js.map +1 -0
  25. package/lib/cjs/facets.js +3 -0
  26. package/lib/cjs/facets.js.map +1 -0
  27. package/lib/cjs/group.js +5 -0
  28. package/lib/cjs/group.js.map +1 -0
  29. package/lib/cjs/index.js +55 -0
  30. package/lib/cjs/index.js.map +1 -0
  31. package/lib/cjs/integrations.js +14 -0
  32. package/lib/cjs/integrations.js.map +1 -0
  33. package/lib/cjs/interaction.js +97 -0
  34. package/lib/cjs/interaction.js.map +1 -0
  35. package/lib/cjs/json-schema.js +3 -0
  36. package/lib/cjs/json-schema.js.map +1 -0
  37. package/lib/cjs/json.js +3 -0
  38. package/lib/cjs/json.js.map +1 -0
  39. package/lib/cjs/meters.js +13 -0
  40. package/lib/cjs/meters.js.map +1 -0
  41. package/lib/cjs/model_utility.js +6 -0
  42. package/lib/cjs/model_utility.js.map +1 -0
  43. package/lib/cjs/package.json +3 -0
  44. package/lib/cjs/payload.js +3 -0
  45. package/lib/cjs/payload.js.map +1 -0
  46. package/lib/cjs/pending-asks.js +7 -0
  47. package/lib/cjs/pending-asks.js.map +1 -0
  48. package/lib/cjs/project.js +107 -0
  49. package/lib/cjs/project.js.map +1 -0
  50. package/lib/cjs/prompt.js +21 -0
  51. package/lib/cjs/prompt.js.map +1 -0
  52. package/lib/cjs/query.js +3 -0
  53. package/lib/cjs/query.js.map +1 -0
  54. package/lib/cjs/rate-limiter.js +6 -0
  55. package/lib/cjs/rate-limiter.js.map +1 -0
  56. package/lib/cjs/refs.js +14 -0
  57. package/lib/cjs/refs.js.map +1 -0
  58. package/lib/cjs/runs.js +3 -0
  59. package/lib/cjs/runs.js.map +1 -0
  60. package/lib/cjs/skill.js +14 -0
  61. package/lib/cjs/skill.js.map +1 -0
  62. package/lib/cjs/store/activity-catalog.js +3 -0
  63. package/lib/cjs/store/activity-catalog.js.map +1 -0
  64. package/lib/cjs/store/collections.js +9 -0
  65. package/lib/cjs/store/collections.js.map +1 -0
  66. package/lib/cjs/store/common.js +3 -0
  67. package/lib/cjs/store/common.js.map +1 -0
  68. package/lib/cjs/store/conversation-state.js +3 -0
  69. package/lib/cjs/store/conversation-state.js.map +1 -0
  70. package/lib/cjs/store/doc-analyzer.js +3 -0
  71. package/lib/cjs/store/doc-analyzer.js.map +1 -0
  72. package/lib/cjs/store/dsl-workflow.js +5 -0
  73. package/lib/cjs/store/dsl-workflow.js.map +1 -0
  74. package/lib/cjs/store/index.js +30 -0
  75. package/lib/cjs/store/index.js.map +1 -0
  76. package/lib/cjs/store/object-types.js +98 -0
  77. package/lib/cjs/store/object-types.js.map +1 -0
  78. package/lib/cjs/store/schedule.js +32 -0
  79. package/lib/cjs/store/schedule.js.map +1 -0
  80. package/lib/cjs/store/signals.js +3 -0
  81. package/lib/cjs/store/signals.js.map +1 -0
  82. package/lib/cjs/store/store.js +166 -0
  83. package/lib/cjs/store/store.js.map +1 -0
  84. package/lib/cjs/store/temporalio.js +44 -0
  85. package/lib/cjs/store/temporalio.js.map +1 -0
  86. package/lib/cjs/store/worker.js +3 -0
  87. package/lib/cjs/store/worker.js.map +1 -0
  88. package/lib/cjs/store/workflow.js +241 -0
  89. package/lib/cjs/store/workflow.js.map +1 -0
  90. package/lib/cjs/sts-token-types.js +32 -0
  91. package/lib/cjs/sts-token-types.js.map +1 -0
  92. package/lib/cjs/tenant.js +3 -0
  93. package/lib/cjs/tenant.js.map +1 -0
  94. package/lib/cjs/tool-execution.js +6 -0
  95. package/lib/cjs/tool-execution.js.map +1 -0
  96. package/lib/cjs/training.js +14 -0
  97. package/lib/cjs/training.js.map +1 -0
  98. package/lib/cjs/transient-tokens.js +9 -0
  99. package/lib/cjs/transient-tokens.js.map +1 -0
  100. package/lib/cjs/user.js +25 -0
  101. package/lib/cjs/user.js.map +1 -0
  102. package/lib/cjs/utils/auth.js +15 -0
  103. package/lib/cjs/utils/auth.js.map +1 -0
  104. package/lib/cjs/utils/schemas.js +114 -0
  105. package/lib/cjs/utils/schemas.js.map +1 -0
  106. package/lib/cjs/utils/type-helpers.js +3 -0
  107. package/lib/cjs/utils/type-helpers.js.map +1 -0
  108. package/lib/cjs/versions.js +8 -0
  109. package/lib/cjs/versions.js.map +1 -0
  110. package/lib/cjs/workflow-analytics.js +52 -0
  111. package/lib/cjs/workflow-analytics.js.map +1 -0
  112. package/lib/esm/Progress.js +57 -0
  113. package/lib/esm/Progress.js.map +1 -0
  114. package/lib/esm/access-control.js +53 -0
  115. package/lib/esm/access-control.js.map +1 -0
  116. package/lib/esm/analytics.js +2 -0
  117. package/lib/esm/analytics.js.map +1 -0
  118. package/lib/esm/apikey.js +13 -0
  119. package/lib/esm/apikey.js.map +1 -0
  120. package/lib/esm/apps.js +32 -0
  121. package/lib/esm/apps.js.map +1 -0
  122. package/lib/esm/ask-user.js +7 -0
  123. package/lib/esm/ask-user.js.map +1 -0
  124. package/lib/esm/channels.js +57 -0
  125. package/lib/esm/channels.js.map +1 -0
  126. package/lib/esm/common.js +2 -0
  127. package/lib/esm/common.js.map +1 -0
  128. package/lib/esm/data-platform.js +124 -0
  129. package/lib/esm/data-platform.js.map +1 -0
  130. package/lib/esm/email.js +16 -0
  131. package/lib/esm/email.js.map +1 -0
  132. package/lib/esm/environment.js +41 -0
  133. package/lib/esm/environment.js.map +1 -0
  134. package/lib/esm/facets.js +2 -0
  135. package/lib/esm/facets.js.map +1 -0
  136. package/lib/esm/group.js +2 -0
  137. package/lib/esm/group.js.map +1 -0
  138. package/lib/esm/index.js +39 -0
  139. package/lib/esm/index.js.map +1 -0
  140. package/lib/esm/integrations.js +11 -0
  141. package/lib/esm/integrations.js.map +1 -0
  142. package/lib/esm/interaction.js +92 -0
  143. package/lib/esm/interaction.js.map +1 -0
  144. package/lib/esm/json-schema.js +2 -0
  145. package/lib/esm/json-schema.js.map +1 -0
  146. package/lib/esm/json.js +2 -0
  147. package/lib/esm/json.js.map +1 -0
  148. package/lib/esm/meters.js +10 -0
  149. package/lib/esm/meters.js.map +1 -0
  150. package/lib/esm/model_utility.js +2 -0
  151. package/lib/esm/model_utility.js.map +1 -0
  152. package/lib/esm/payload.js +2 -0
  153. package/lib/esm/payload.js.map +1 -0
  154. package/lib/esm/pending-asks.js +6 -0
  155. package/lib/esm/pending-asks.js.map +1 -0
  156. package/lib/esm/project.js +102 -0
  157. package/lib/esm/project.js.map +1 -0
  158. package/lib/esm/prompt.js +18 -0
  159. package/lib/esm/prompt.js.map +1 -0
  160. package/lib/esm/query.js +2 -0
  161. package/lib/esm/query.js.map +1 -0
  162. package/lib/esm/rate-limiter.js +5 -0
  163. package/lib/esm/rate-limiter.js.map +1 -0
  164. package/lib/esm/refs.js +11 -0
  165. package/lib/esm/refs.js.map +1 -0
  166. package/lib/esm/runs.js +2 -0
  167. package/lib/esm/runs.js.map +1 -0
  168. package/lib/esm/skill.js +13 -0
  169. package/lib/esm/skill.js.map +1 -0
  170. package/lib/esm/store/activity-catalog.js +2 -0
  171. package/lib/esm/store/activity-catalog.js.map +1 -0
  172. package/lib/esm/store/collections.js +6 -0
  173. package/lib/esm/store/collections.js.map +1 -0
  174. package/lib/esm/store/common.js +2 -0
  175. package/lib/esm/store/common.js.map +1 -0
  176. package/lib/esm/store/conversation-state.js +2 -0
  177. package/lib/esm/store/conversation-state.js.map +1 -0
  178. package/lib/esm/store/doc-analyzer.js +2 -0
  179. package/lib/esm/store/doc-analyzer.js.map +1 -0
  180. package/lib/esm/store/dsl-workflow.js +2 -0
  181. package/lib/esm/store/dsl-workflow.js.map +1 -0
  182. package/lib/esm/store/index.js +14 -0
  183. package/lib/esm/store/index.js.map +1 -0
  184. package/lib/esm/store/object-types.js +95 -0
  185. package/lib/esm/store/object-types.js.map +1 -0
  186. package/lib/esm/store/schedule.js +29 -0
  187. package/lib/esm/store/schedule.js.map +1 -0
  188. package/lib/esm/store/signals.js +2 -0
  189. package/lib/esm/store/signals.js.map +1 -0
  190. package/lib/esm/store/store.js +160 -0
  191. package/lib/esm/store/store.js.map +1 -0
  192. package/lib/esm/store/temporalio.js +41 -0
  193. package/lib/esm/store/temporalio.js.map +1 -0
  194. package/lib/esm/store/worker.js +2 -0
  195. package/lib/esm/store/worker.js.map +1 -0
  196. package/lib/esm/store/workflow.js +228 -0
  197. package/lib/esm/store/workflow.js.map +1 -0
  198. package/lib/esm/sts-token-types.js +24 -0
  199. package/lib/esm/sts-token-types.js.map +1 -0
  200. package/lib/esm/tenant.js +2 -0
  201. package/lib/esm/tenant.js.map +1 -0
  202. package/lib/esm/tool-execution.js +5 -0
  203. package/lib/esm/tool-execution.js.map +1 -0
  204. package/lib/esm/training.js +11 -0
  205. package/lib/esm/training.js.map +1 -0
  206. package/lib/esm/transient-tokens.js +6 -0
  207. package/lib/esm/transient-tokens.js.map +1 -0
  208. package/lib/esm/user.js +22 -0
  209. package/lib/esm/user.js.map +1 -0
  210. package/lib/esm/utils/auth.js +11 -0
  211. package/lib/esm/utils/auth.js.map +1 -0
  212. package/lib/esm/utils/schemas.js +107 -0
  213. package/lib/esm/utils/schemas.js.map +1 -0
  214. package/lib/esm/utils/type-helpers.js +2 -0
  215. package/lib/esm/utils/type-helpers.js.map +1 -0
  216. package/lib/esm/versions.js +5 -0
  217. package/lib/esm/versions.js.map +1 -0
  218. package/lib/esm/workflow-analytics.js +49 -0
  219. package/lib/esm/workflow-analytics.js.map +1 -0
  220. package/lib/tsconfig.tsbuildinfo +1 -0
  221. package/lib/types/Progress.d.ts +21 -0
  222. package/lib/types/Progress.d.ts.map +1 -0
  223. package/lib/types/access-control.d.ts +73 -0
  224. package/lib/types/access-control.d.ts.map +1 -0
  225. package/lib/types/analytics.d.ts +87 -0
  226. package/lib/types/analytics.d.ts.map +1 -0
  227. package/lib/types/apikey.d.ts +98 -0
  228. package/lib/types/apikey.d.ts.map +1 -0
  229. package/lib/types/apps.d.ts +236 -0
  230. package/lib/types/apps.d.ts.map +1 -0
  231. package/lib/types/ask-user.d.ts +32 -0
  232. package/lib/types/ask-user.d.ts.map +1 -0
  233. package/lib/types/channels.d.ts +21 -0
  234. package/lib/types/channels.d.ts.map +1 -0
  235. package/lib/types/common.d.ts +31 -0
  236. package/lib/types/common.d.ts.map +1 -0
  237. package/lib/types/data-platform.d.ts +860 -0
  238. package/lib/types/data-platform.d.ts.map +1 -0
  239. package/lib/types/email.d.ts +66 -0
  240. package/lib/types/email.d.ts.map +1 -0
  241. package/lib/types/environment.d.ts +106 -0
  242. package/lib/types/environment.d.ts.map +1 -0
  243. package/lib/types/facets.d.ts +34 -0
  244. package/lib/types/facets.d.ts.map +1 -0
  245. package/lib/types/group.d.ts +21 -0
  246. package/lib/types/group.d.ts.map +1 -0
  247. package/lib/types/index.d.ts +39 -0
  248. package/lib/types/index.d.ts.map +1 -0
  249. package/lib/types/integrations.d.ts +60 -0
  250. package/lib/types/integrations.d.ts.map +1 -0
  251. package/lib/types/interaction.d.ts +958 -0
  252. package/lib/types/interaction.d.ts.map +1 -0
  253. package/lib/types/json-schema.d.ts +1 -0
  254. package/lib/types/json-schema.d.ts.map +1 -0
  255. package/lib/types/json.d.ts +1 -0
  256. package/lib/types/json.d.ts.map +1 -0
  257. package/lib/types/meters.d.ts +23 -0
  258. package/lib/types/meters.d.ts.map +1 -0
  259. package/lib/types/model_utility.d.ts +1 -0
  260. package/lib/types/model_utility.d.ts.map +1 -0
  261. package/lib/types/payload.d.ts +60 -0
  262. package/lib/types/payload.d.ts.map +1 -0
  263. package/lib/types/pending-asks.d.ts +93 -0
  264. package/lib/types/pending-asks.d.ts.map +1 -0
  265. package/lib/types/project.d.ts +179 -0
  266. package/lib/types/project.d.ts.map +1 -0
  267. package/lib/types/prompt.d.ts +78 -0
  268. package/lib/types/prompt.d.ts.map +1 -0
  269. package/lib/types/query.d.ts +118 -0
  270. package/lib/types/query.d.ts.map +1 -0
  271. package/lib/types/rate-limiter.d.ts +28 -0
  272. package/lib/types/rate-limiter.d.ts.map +1 -0
  273. package/lib/types/refs.d.ts +22 -0
  274. package/lib/types/refs.d.ts.map +1 -0
  275. package/lib/types/runs.d.ts +32 -0
  276. package/lib/types/runs.d.ts.map +1 -0
  277. package/lib/types/skill.d.ts +78 -0
  278. package/lib/types/skill.d.ts.map +1 -0
  279. package/lib/types/store/activity-catalog.d.ts +26 -0
  280. package/lib/types/store/activity-catalog.d.ts.map +1 -0
  281. package/lib/types/store/collections.d.ts +78 -0
  282. package/lib/types/store/collections.d.ts.map +1 -0
  283. package/lib/types/store/common.d.ts +22 -0
  284. package/lib/types/store/common.d.ts.map +1 -0
  285. package/lib/types/store/conversation-state.d.ts +120 -0
  286. package/lib/types/store/conversation-state.d.ts.map +1 -0
  287. package/lib/types/store/doc-analyzer.d.ts +140 -0
  288. package/lib/types/store/doc-analyzer.d.ts.map +1 -0
  289. package/lib/types/store/dsl-workflow.d.ts +244 -0
  290. package/lib/types/store/dsl-workflow.d.ts.map +1 -0
  291. package/lib/types/store/index.d.ts +13 -0
  292. package/lib/types/store/index.d.ts.map +1 -0
  293. package/lib/types/store/object-types.d.ts +23 -0
  294. package/lib/types/store/object-types.d.ts.map +1 -0
  295. package/lib/types/store/schedule.d.ts +182 -0
  296. package/lib/types/store/schedule.d.ts.map +1 -0
  297. package/lib/types/store/signals.d.ts +24 -0
  298. package/lib/types/store/signals.d.ts.map +1 -0
  299. package/lib/types/store/store.d.ts +407 -0
  300. package/lib/types/store/store.d.ts.map +1 -0
  301. package/lib/types/store/temporalio.d.ts +16 -0
  302. package/lib/types/store/temporalio.d.ts.map +1 -0
  303. package/lib/types/store/worker.d.ts +18 -0
  304. package/lib/types/store/worker.d.ts.map +1 -0
  305. package/lib/types/store/workflow.d.ts +730 -0
  306. package/lib/types/store/workflow.d.ts.map +1 -0
  307. package/lib/types/sts-token-types.d.ts +72 -0
  308. package/lib/types/sts-token-types.d.ts.map +1 -0
  309. package/lib/types/tenant.d.ts +10 -0
  310. package/lib/types/tenant.d.ts.map +1 -0
  311. package/lib/types/tool-execution.d.ts +45 -0
  312. package/lib/types/tool-execution.d.ts.map +1 -0
  313. package/lib/types/training.d.ts +38 -0
  314. package/lib/types/training.d.ts.map +1 -0
  315. package/lib/types/transient-tokens.d.ts +24 -0
  316. package/lib/types/transient-tokens.d.ts.map +1 -0
  317. package/lib/types/user.d.ts +116 -0
  318. package/lib/types/user.d.ts.map +1 -0
  319. package/lib/types/utils/auth.d.ts +3 -0
  320. package/lib/types/utils/auth.d.ts.map +1 -0
  321. package/lib/types/utils/schemas.d.ts +9 -0
  322. package/lib/types/utils/schemas.d.ts.map +1 -0
  323. package/lib/types/utils/type-helpers.d.ts +3 -0
  324. package/lib/types/utils/type-helpers.d.ts.map +1 -0
  325. package/lib/types/versions.d.ts +3 -0
  326. package/lib/types/versions.d.ts.map +1 -0
  327. package/lib/types/workflow-analytics.d.ts +777 -0
  328. package/lib/types/workflow-analytics.d.ts.map +1 -0
  329. package/lib/vertesia-common.js +2 -0
  330. package/lib/vertesia-common.js.map +1 -0
  331. package/package.json +54 -0
  332. package/src/Progress.ts +57 -0
  333. package/src/access-control.ts +98 -0
  334. package/src/analytics.ts +106 -0
  335. package/src/apikey.ts +116 -0
  336. package/src/apps.ts +296 -0
  337. package/src/ask-user.ts +35 -0
  338. package/src/channels.ts +70 -0
  339. package/src/common.ts +37 -0
  340. package/src/data-platform.ts +976 -0
  341. package/src/email.ts +80 -0
  342. package/src/environment.ts +137 -0
  343. package/src/facets.ts +44 -0
  344. package/src/group.ts +26 -0
  345. package/src/index.ts +40 -0
  346. package/src/integrations.ts +72 -0
  347. package/src/interaction.ts +1182 -0
  348. package/src/json-schema.ts +7 -0
  349. package/src/json.ts +4 -0
  350. package/src/meters.ts +30 -0
  351. package/src/model_utility.ts +1 -0
  352. package/src/payload.ts +83 -0
  353. package/src/pending-asks.ts +106 -0
  354. package/src/project.ts +263 -0
  355. package/src/prompt.ts +103 -0
  356. package/src/query.ts +137 -0
  357. package/src/rate-limiter.ts +34 -0
  358. package/src/refs.ts +30 -0
  359. package/src/runs.ts +36 -0
  360. package/src/skill.ts +90 -0
  361. package/src/store/activity-catalog.ts +44 -0
  362. package/src/store/collections.ts +87 -0
  363. package/src/store/common.ts +30 -0
  364. package/src/store/conversation-state.ts +146 -0
  365. package/src/store/doc-analyzer.ts +161 -0
  366. package/src/store/dsl-workflow.ts +288 -0
  367. package/src/store/index.ts +14 -0
  368. package/src/store/ms.d.ts +11 -0
  369. package/src/store/object-types.ts +127 -0
  370. package/src/store/schedule.ts +238 -0
  371. package/src/store/signals.ts +25 -0
  372. package/src/store/store.ts +579 -0
  373. package/src/store/temporalio.ts +54 -0
  374. package/src/store/worker.ts +19 -0
  375. package/src/store/workflow.test.ts +578 -0
  376. package/src/store/workflow.ts +973 -0
  377. package/src/sts-token-types.ts +117 -0
  378. package/src/tenant.ts +10 -0
  379. package/src/tool-execution.ts +47 -0
  380. package/src/training.ts +44 -0
  381. package/src/transient-tokens.ts +30 -0
  382. package/src/user.ts +153 -0
  383. package/src/utils/auth.ts +12 -0
  384. package/src/utils/schemas.ts +108 -0
  385. package/src/utils/type-helpers.ts +6 -0
  386. package/src/versions.ts +3 -0
  387. package/src/workflow-analytics.ts +925 -0
  388. package/tsconfig.dist.json +20 -0
@@ -0,0 +1,579 @@
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
+
6
+ export enum ContentObjectApiHeaders {
7
+ COLLECTION_ID = 'x-collection-id',
8
+ PROCESSING_PRIORITY = 'x-processing-priority',
9
+ CREATE_REVISION = 'x-create-revision',
10
+ REVISION_LABEL = 'x-revision-label',
11
+ /** When set to 'true', prevents this update from triggering workflow rules */
12
+ SUPPRESS_WORKFLOWS = 'x-suppress-workflows',
13
+ }
14
+
15
+ /**
16
+ * Headers for Data Store API calls.
17
+ * Used for Cloud Run session affinity to route requests to the same instance.
18
+ */
19
+ export enum DataStoreApiHeaders {
20
+ /** Data store ID for session affinity - routes requests for same store to same instance */
21
+ DATA_STORE_ID = 'x-data-store-id',
22
+ }
23
+
24
+ export enum ContentObjectStatus {
25
+ created = "created",
26
+ processing = "processing", // the was created and still processing
27
+ ready = "ready", // the object is rendered and ready to be used
28
+ completed = "completed",
29
+ failed = "failed",
30
+ archived = "archived",
31
+ }
32
+
33
+ export interface Embedding {
34
+ model: string; //the model used to generate this embedding
35
+ values: number[];
36
+ etag?: string; // the etag of the text used for the embedding
37
+ }
38
+
39
+ /**
40
+ * Metadata about a single inherited property.
41
+ */
42
+ export interface InheritedPropertyMetadata {
43
+ /** The property name that was inherited */
44
+ name: string;
45
+ /** The collection ID that provided this property */
46
+ collection: string;
47
+ }
48
+ export interface ContentObject<T = any> extends ContentObjectItem<T> {
49
+ text?: string; // the text representation of the object
50
+ text_etag?: string;
51
+ embeddings: Partial<Record<SupportedEmbeddingTypes, Embedding>>;
52
+ parts?: string[]; // the list of objectId of the parts of the object
53
+ parts_etag?: string; // the etag of the text used for the parts list
54
+ transcript?: Transcript;
55
+ security?: Record<string, string[]>; // Security field for granular permissions
56
+
57
+ /**
58
+ * Inherited properties metadata - tracks which properties were inherited from parent collections.
59
+ * Used to display readonly inherited properties in the UI and enable incremental sync optimization.
60
+ */
61
+ inherited_properties?: InheritedPropertyMetadata[];
62
+ }
63
+
64
+ export enum ContentNature {
65
+ Video = "video",
66
+ Image = "image",
67
+ Audio = "audio",
68
+ Document = "document",
69
+ Code = "code",
70
+ Other = "other"
71
+ }
72
+
73
+ export interface Dimensions {
74
+ width: number;
75
+ height: number;
76
+ }
77
+
78
+ export interface Location {
79
+ latitude: number;
80
+ longitude: number;
81
+ }
82
+
83
+ export interface GenerationRunMetadata {
84
+ id: string;
85
+ date: string;
86
+ model: string;
87
+ target?: string;
88
+ }
89
+
90
+ // Base rendition interface for document and audio
91
+ export interface Rendition {
92
+ name: string;
93
+ content: ContentSource;
94
+ }
95
+
96
+ // Rendition with dimensions for video and image
97
+ export interface RenditionWithDimensions extends Rendition {
98
+ dimensions: Dimensions;
99
+ }
100
+
101
+ /**
102
+ * @deprecated Use RenditionWithDimensions instead
103
+ */
104
+ export type VideoRendition = RenditionWithDimensions;
105
+
106
+ export const POSTER_RENDITION_NAME = "Poster";
107
+ export const AUDIO_RENDITION_NAME = "Audio";
108
+ export const WEB_VIDEO_RENDITION_NAME = "Web";
109
+ export const PDF_RENDITION_NAME = "PDF";
110
+
111
+ export interface ContentMetadata {
112
+ // Common fields for all media types
113
+ type?: ContentNature;
114
+ size?: number; // in bytes
115
+ languages?: string[];
116
+ location?: Location;
117
+ generation_runs: GenerationRunMetadata[];
118
+ etag?: string;
119
+ renditions?: Rendition[];
120
+ }
121
+
122
+ // Type-specific metadata interfaces
123
+ export interface TemporalMediaMetadata extends ContentMetadata {
124
+ duration?: number; // in seconds
125
+ transcript?: Transcript;
126
+ }
127
+
128
+ export interface ImageMetadata extends ContentMetadata {
129
+ type: ContentNature.Image;
130
+ dimensions?: Dimensions;
131
+ renditions?: RenditionWithDimensions[];
132
+ }
133
+
134
+ export interface AudioMetadata extends TemporalMediaMetadata {
135
+ type: ContentNature.Audio;
136
+ }
137
+
138
+ export interface VideoMetadata extends TemporalMediaMetadata {
139
+ type: ContentNature.Video;
140
+ dimensions?: Dimensions;
141
+ renditions?: RenditionWithDimensions[];
142
+ hasAudio?: boolean;
143
+ }
144
+
145
+ export interface TextSection {
146
+ description: string; // the description of the section
147
+ first_line_index: number;
148
+ last_line_index: number;
149
+ }
150
+
151
+ export interface DocumentMetadata extends ContentMetadata {
152
+ type: ContentNature.Document;
153
+ page_count?: number;
154
+ content_processor?: {
155
+ type?: string;
156
+ features_requested?: string[];
157
+ zones_requested?: string[];
158
+ table_count?: number;
159
+ image_count: number;
160
+ zone_count: number;
161
+ needs_ocr_count?: number;
162
+ };
163
+ sections?: TextSection[]; // List of sections with descriptions and line indexes
164
+ }
165
+
166
+ export interface Transcript {
167
+ text?: string;
168
+ segments?: TranscriptSegment[];
169
+ etag?: string;
170
+ }
171
+
172
+ export interface TranscriptSegment {
173
+ start: number;
174
+ text: string;
175
+ speaker?: number;
176
+ end?: number;
177
+ confidence?: number;
178
+ language?: string;
179
+ }
180
+
181
+ export interface ContentSource {
182
+ // the URI of the content source. Usually an URL to the uploaded file inside a cloud file storage like s3.
183
+ source?: string;
184
+ // the mime type of the content source.
185
+ type?: string;
186
+ // the original name of the input file if any
187
+ name?: string;
188
+ // the etag of the content source if any
189
+ etag?: string;
190
+ }
191
+
192
+ /**
193
+ *
194
+ */
195
+ export interface RevisionInfo {
196
+ /** Direct parent revision id (omit on the first revision) */
197
+ parent?: string;
198
+
199
+ /** The root revision id (omit on the first revision) */
200
+ root: string;
201
+
202
+ /** True if this revision is the head revision */
203
+ head: boolean;
204
+
205
+ /** Human‑friendly tag or state ("v1.2", "approved") */
206
+ label?: string;
207
+
208
+ /** Extra parents when two branches are merged (leave undefined until needed) */
209
+ //merge_parents?: string[]; //maybe later
210
+
211
+ /** Pointer to a diff / patch blob if you store deltas instead of full content */
212
+ //delta_ref?: string;
213
+ }
214
+
215
+ /**
216
+ * The content object item is a simplified version of the ContentObject that is returned by the store API when listing objects.
217
+ */
218
+ export interface ContentObjectItem<T = Record<string, any>> extends BaseObject {
219
+ parent: string; // the id of the direct parent object. The root object doesn't have the parent field set.
220
+
221
+ /** An optional path based location for the object */
222
+ location: string; // the path of the parent object
223
+
224
+ /**
225
+ * Object status.
226
+ * - created: the object was created and is being processed
227
+ * - processing: the object is being processed
228
+ * - completed: the object was processed and is ready to use
229
+ * - failed: the object processing failed
230
+ * - archived: the object was archived and is no longer available
231
+ */
232
+ status: ContentObjectStatus;
233
+
234
+ /**
235
+ * Object type id.
236
+ */
237
+ type?: ContentObjectTypeRef;
238
+
239
+ /**
240
+ * Content source information, typically a link to an object store
241
+ */
242
+ content: ContentSource;
243
+
244
+ /**
245
+ * External identifier for integration with other systems
246
+ */
247
+ external_id?: string;
248
+
249
+ /** The object properties. This is a JSON object that describes the object, matching the object type schema */
250
+ properties: T; // a JSON object that describes the object
251
+
252
+ /** Technical metadata of the object */
253
+ metadata?:
254
+ | VideoMetadata
255
+ | AudioMetadata
256
+ | ImageMetadata
257
+ | DocumentMetadata
258
+ | ContentMetadata;
259
+
260
+ /** Token information */
261
+ tokens?: {
262
+ count: number; // the number of tokens in the text
263
+ encoding: string; // the encoding used to calculate the tokens
264
+ etag: string; //the etag of the text used for the token count
265
+ };
266
+
267
+ /**
268
+ * Revision information. This is used to track the history of the object.
269
+ */
270
+ revision: RevisionInfo; // the revision info of the object
271
+
272
+ /**
273
+ * Soft delete flag. When true, the object should be considered deleted
274
+ * but is still retained in the database for historical purposes.
275
+ */
276
+ is_deleted?: boolean;
277
+
278
+ /**
279
+ * Soft lock flag. When true, the object should be considered read-only
280
+ * and modification attempts should be rejected.
281
+ */
282
+ is_locked?: boolean;
283
+
284
+ /**
285
+ * The document score, used for ranking and sorting.
286
+ */
287
+ score?: number;
288
+ }
289
+
290
+ /**
291
+ * When creating from an uploaded file the content should be an URL to the uploaded file
292
+ */
293
+ export interface CreateContentObjectPayload<T = any>
294
+ extends Partial<
295
+ Omit<
296
+ ContentObject<T>,
297
+ "id" | "root" | "created_at" | "updated_at" | "type" | "owner"
298
+ >
299
+ > {
300
+ id?: string; // An optional existing object ID to be replaced by the new one
301
+ type?: string; // the object type ID
302
+ generation_run_info?: GenerationRunMetadata;
303
+ }
304
+
305
+ export interface ContentObjectTypeRef {
306
+ id: string;
307
+ name: string;
308
+ }
309
+
310
+ export interface ComplexSearchPayload extends Omit<SearchPayload, "query"> {
311
+ query?: ComplexSearchQuery;
312
+ }
313
+
314
+ export interface ColumnLayout {
315
+ /**
316
+ * The path of the field to use (e.g. "properties.title")
317
+ */
318
+ field: string;
319
+ /**
320
+ * The name to display in the table column
321
+ */
322
+ name: string;
323
+ /**
324
+ * The type of the field specifies how the rendering will be done. If not specified the string type will be used.
325
+ * The type may contain additional parameters prepended using a web-like query string syntax: date?LLL
326
+ */
327
+ type?: string;
328
+ /*
329
+ * a fallback field to use if the field is not present in the object
330
+ */
331
+ fallback?: string;
332
+ /**
333
+ * A default value to be used if the field is not present in the object
334
+ */
335
+ default?: any;
336
+ }
337
+ export interface ContentObjectType extends ContentObjectTypeItem { }
338
+ export interface ContentObjectTypeItem extends BaseObject {
339
+ is_chunkable?: boolean;
340
+ /**
341
+ * This is only included in ContentObjectTypeItem if explicitly requested
342
+ * It is always included in ContentObjectType
343
+ */
344
+ table_layout?: ColumnLayout[];
345
+ /**
346
+ * this is only included in ContentObjectTypeItem if explicitly requested
347
+ * It is always included in ContentObjectType
348
+ */
349
+ object_schema?: Record<string, any>; // an optional JSON schema for the object properties.
350
+
351
+ /**
352
+ * Determines if the content will be validated against the object schema a generation time and save/update time.
353
+ */
354
+ strict_mode?: boolean;
355
+ }
356
+
357
+ export interface CreateContentObjectTypePayload
358
+ extends Omit<
359
+ ContentObjectType,
360
+ "id" | "created_at" | "updated_at" | "created_by" | "updated_by"
361
+ > { }
362
+
363
+ export enum WorkflowRuleInputType {
364
+ single = "single",
365
+ multiple = "multiple",
366
+ none = "none",
367
+ }
368
+ export interface WorkflowRuleItem extends BaseObject {
369
+ // the name of the workflow function
370
+ endpoint: string;
371
+ input_type: WorkflowRuleInputType;
372
+ }
373
+ export interface WorkflowRule extends WorkflowRuleItem {
374
+ /*
375
+ * mongo matching rules for a content event
376
+ */
377
+ match?: Record<string, any>;
378
+ /**
379
+ * Activities configuration if any.
380
+ */
381
+ config?: Record<string, any>;
382
+
383
+ /**
384
+ * Debug mode for the rule
385
+ * @default false
386
+ */
387
+ debug?: boolean;
388
+
389
+ /**
390
+ * Customer override for the rule
391
+ * When set to true the rule will not be updated by the system
392
+ */
393
+ customer_override?: boolean;
394
+
395
+ /**
396
+ * Optional task queue name to use when starting workflows for this rule
397
+ */
398
+ task_queue?: string;
399
+ }
400
+
401
+ export interface CreateWorkflowRulePayload extends UploadWorkflowRulePayload {
402
+ name: string; // required
403
+ endpoint: string; // required
404
+ }
405
+ export interface UploadWorkflowRulePayload
406
+ extends Partial<
407
+ Omit<WorkflowRule, "id" | "created_at" | "updated_at" | "owner">
408
+ > { }
409
+
410
+ export enum ImageRenditionFormat {
411
+ jpeg = "jpeg",
412
+ png = "png",
413
+ webp = "webp",
414
+ }
415
+
416
+ export enum MarkdownRenditionFormat {
417
+ docx = "docx",
418
+ pdf = "pdf",
419
+ }
420
+
421
+ export interface GetRenditionParams {
422
+ format: ImageRenditionFormat | MarkdownRenditionFormat;
423
+ max_hw?: number;
424
+ generate_if_missing?: boolean;
425
+ sign_url?: boolean;
426
+ block_on_generation?: boolean;
427
+ }
428
+
429
+ export interface GetRenditionResponse {
430
+ status: "found" | "generating" | "failed";
431
+ renditions?: string[]; //file paths for the renditions
432
+ workflow_run_id?: string;
433
+ }
434
+
435
+ // ============================================================================
436
+ // Rendition Format Compatibility Utilities
437
+ // ============================================================================
438
+
439
+ export type RenditionFormat = ImageRenditionFormat | MarkdownRenditionFormat;
440
+
441
+ /**
442
+ * Matrix of supported content type → format conversions.
443
+ * This is the authoritative source of truth for what renditions can be generated.
444
+ *
445
+ * Key patterns:
446
+ * - Exact MIME types (e.g., 'application/pdf')
447
+ * - Wildcard patterns (e.g., 'image/*', 'video/*')
448
+ */
449
+ const RENDITION_COMPATIBILITY: Record<string, RenditionFormat[]> = {
450
+ // Image formats can generate: jpeg, png, webp
451
+ 'image/*': [ImageRenditionFormat.jpeg, ImageRenditionFormat.png, ImageRenditionFormat.webp],
452
+ // Video formats can generate: jpeg, png (thumbnails)
453
+ 'video/*': [ImageRenditionFormat.jpeg, ImageRenditionFormat.png],
454
+ // PDF can generate: jpeg, png, webp (page images)
455
+ 'application/pdf': [ImageRenditionFormat.jpeg, ImageRenditionFormat.png, ImageRenditionFormat.webp],
456
+ // Markdown can generate: pdf, docx (NOT jpeg/png)
457
+ 'text/markdown': [MarkdownRenditionFormat.pdf, MarkdownRenditionFormat.docx],
458
+ // Plain text can generate: docx
459
+ 'text/plain': [MarkdownRenditionFormat.docx],
460
+ // Office documents can generate: pdf
461
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': [MarkdownRenditionFormat.pdf],
462
+ 'application/msword': [MarkdownRenditionFormat.pdf],
463
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation': [MarkdownRenditionFormat.pdf],
464
+ 'application/vnd.ms-powerpoint': [MarkdownRenditionFormat.pdf],
465
+ };
466
+
467
+ /**
468
+ * Check if a specific rendition format can be generated from a content type.
469
+ *
470
+ * @param contentType - The MIME type of the source content (e.g., 'image/png', 'text/markdown')
471
+ * @param format - The desired rendition format (e.g., ImageRenditionFormat.jpeg)
472
+ * @returns true if the format can be generated from the content type
473
+ *
474
+ * @example
475
+ * canGenerateRendition('image/png', ImageRenditionFormat.jpeg) // true
476
+ * canGenerateRendition('text/markdown', ImageRenditionFormat.jpeg) // false
477
+ * canGenerateRendition('text/markdown', MarkdownRenditionFormat.pdf) // true
478
+ */
479
+ export function canGenerateRendition(contentType: string | undefined, format: RenditionFormat | string): boolean {
480
+ if (!contentType) return false;
481
+
482
+ const formatStr = typeof format === 'string' ? format : format;
483
+
484
+ // Check exact match first
485
+ const exactMatch = RENDITION_COMPATIBILITY[contentType];
486
+ if (exactMatch && exactMatch.some(f => f === formatStr)) {
487
+ return true;
488
+ }
489
+
490
+ // Check wildcard patterns (e.g., 'image/*', 'video/*')
491
+ const [category] = contentType.split('/');
492
+ const wildcardKey = `${category}/*`;
493
+ const wildcardMatch = RENDITION_COMPATIBILITY[wildcardKey];
494
+ if (wildcardMatch && wildcardMatch.some(f => f === formatStr)) {
495
+ return true;
496
+ }
497
+
498
+ return false;
499
+ }
500
+
501
+ /**
502
+ * Get the list of rendition formats supported for a given content type.
503
+ *
504
+ * @param contentType - The MIME type of the source content
505
+ * @returns Array of supported rendition formats, or empty array if none
506
+ *
507
+ * @example
508
+ * getSupportedRenditionFormats('image/png') // [jpeg, png, webp]
509
+ * getSupportedRenditionFormats('text/markdown') // [pdf, docx]
510
+ * getSupportedRenditionFormats('text/html') // []
511
+ */
512
+ export function getSupportedRenditionFormats(contentType: string | undefined): RenditionFormat[] {
513
+ if (!contentType) return [];
514
+
515
+ // Check exact match first
516
+ if (RENDITION_COMPATIBILITY[contentType]) {
517
+ return [...RENDITION_COMPATIBILITY[contentType]];
518
+ }
519
+
520
+ // Check wildcard patterns
521
+ const [category] = contentType.split('/');
522
+ const wildcardKey = `${category}/*`;
523
+ const wildcardMatch = RENDITION_COMPATIBILITY[wildcardKey];
524
+ if (wildcardMatch) {
525
+ return [...wildcardMatch];
526
+ }
527
+
528
+ return [];
529
+ }
530
+
531
+ /**
532
+ * Check if a content type supports visual (image) renditions.
533
+ * This is useful for determining if a document can have thumbnails/previews.
534
+ *
535
+ * @param contentType - The MIME type of the source content
536
+ * @returns true if the content type can generate JPEG renditions
537
+ *
538
+ * @example
539
+ * supportsVisualRendition('image/png') // true
540
+ * supportsVisualRendition('application/pdf') // true
541
+ * supportsVisualRendition('text/markdown') // false
542
+ */
543
+ export function supportsVisualRendition(contentType: string | undefined): boolean {
544
+ return canGenerateRendition(contentType, ImageRenditionFormat.jpeg);
545
+ }
546
+
547
+ export interface GetUploadUrlPayload {
548
+ name: string;
549
+ id?: string;
550
+ mime_type?: string;
551
+ ttl?: number;
552
+ }
553
+
554
+ export interface GetFileUrlPayload {
555
+ file: string;
556
+ // Optional filename to use in Content-Disposition for downloads
557
+ name?: string;
558
+ // Optional disposition for downloads (default: attachment)
559
+ disposition?: "inline" | "attachment";
560
+ }
561
+
562
+ export interface GetFileUrlResponse {
563
+ url: string;
564
+ id: string;
565
+ mime_type: string;
566
+ path: string;
567
+ }
568
+
569
+ export interface SetFileMetadataPayload {
570
+ /** The file path (relative to bucket) or full URI */
571
+ file: string;
572
+ /** Custom metadata key-value pairs to set on the file */
573
+ metadata: Record<string, string>;
574
+ }
575
+
576
+ export enum ContentObjectProcessingPriority {
577
+ normal = "normal",
578
+ low = "low",
579
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Copied from temporalio
3
+ * The temporalio ParentClosePolicy
4
+ */
5
+ export type ParentClosePolicyType = "TERMINATE" | "ABANDON" | "REQUEST_CANCEL" | undefined;
6
+ interface ParentClosePolicyI {
7
+ TERMINATE: "TERMINATE",
8
+ ABANDON: "ABANDON",
9
+ REQUEST_CANCEL: "REQUEST_CANCEL",
10
+ PARENT_CLOSE_POLICY_UNSPECIFIED: undefined,
11
+ PARENT_CLOSE_POLICY_TERMINATE: "TERMINATE",
12
+ PARENT_CLOSE_POLICY_ABANDON: "ABANDON",
13
+ PARENT_CLOSE_POLICY_REQUEST_CANCEL: "REQUEST_CANCEL"
14
+ }
15
+ export const ParentClosePolicy = {
16
+ /**
17
+ * When the Parent is Closed, the Child is Terminated.
18
+ *
19
+ * @default
20
+ */
21
+ TERMINATE: "TERMINATE",
22
+ /**
23
+ * When the Parent is Closed, nothing is done to the Child.
24
+ */
25
+ ABANDON: "ABANDON",
26
+ /**
27
+ * When the Parent is Closed, the Child is Cancelled.
28
+ */
29
+ REQUEST_CANCEL: "REQUEST_CANCEL",
30
+ /**
31
+ * If a `ParentClosePolicy` is set to this, or is not set at all, the server default value will be used.
32
+ *
33
+ * @deprecated Either leave property `undefined`, or set an explicit policy instead.
34
+ */
35
+ PARENT_CLOSE_POLICY_UNSPECIFIED: undefined,
36
+ /**
37
+ * When the Parent is Closed, the Child is Terminated.
38
+ *
39
+ * @deprecated Use {@link ParentClosePolicy.TERMINATE} instead.
40
+ */
41
+ PARENT_CLOSE_POLICY_TERMINATE: "TERMINATE",
42
+ /**
43
+ * When the Parent is Closed, nothing is done to the Child.
44
+ *
45
+ * @deprecated Use {@link ParentClosePolicy.ABANDON} instead.
46
+ */
47
+ PARENT_CLOSE_POLICY_ABANDON: "ABANDON",
48
+ /**
49
+ * When the Parent is Closed, the Child is Cancelled.
50
+ *
51
+ * @deprecated Use {@link ParentClosePolicy.REQUEST_CANCEL} instead.
52
+ */
53
+ PARENT_CLOSE_POLICY_REQUEST_CANCEL: "REQUEST_CANCEL"
54
+ } as ParentClosePolicyI;
@@ -0,0 +1,19 @@
1
+ export interface CreateWorkerDeploymentRequest {
2
+ /**
3
+ * The worker ID is composed from the worker organization and the worker name, separated by a slash.
4
+ * Example: vertesia/docgen-worker
5
+ */
6
+ workerId: string;
7
+ /**
8
+ * The environment to deploy the worker to. This should be one of the following values:
9
+ * - `production`
10
+ * - `preview`
11
+ * - `staging`
12
+ */
13
+ environment: 'production' | 'preview' | 'staging';
14
+
15
+ /**
16
+ * The worker docker image version. A major.minor.patch[-modifier] string.
17
+ */
18
+ version: string;
19
+ }