@vertesia/common 1.5.0-dev.20260807.073259Z → 1.5.0-dev.20260901.005903Z

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 (451) hide show
  1. package/lib/access-control.d.ts +0 -14
  2. package/lib/access-control.d.ts.map +1 -1
  3. package/lib/access-control.js +0 -23
  4. package/lib/access-control.js.map +1 -1
  5. package/lib/account-values.d.ts +0 -10
  6. package/lib/account-values.d.ts.map +1 -1
  7. package/lib/account-values.js +0 -44
  8. package/lib/account-values.js.map +1 -1
  9. package/lib/api-contract/components.generated.json +40405 -0
  10. package/lib/api-contract/index.d.ts +186 -0
  11. package/lib/api-contract/index.d.ts.map +1 -0
  12. package/lib/api-contract/index.js +554 -0
  13. package/lib/api-contract/index.js.map +1 -0
  14. package/lib/api-schemas/agent-communication.d.ts +199 -0
  15. package/lib/api-schemas/agent-communication.d.ts.map +1 -0
  16. package/lib/api-schemas/agent-communication.js +150 -0
  17. package/lib/api-schemas/agent-communication.js.map +1 -0
  18. package/lib/api-schemas/agent-runs.d.ts +593 -0
  19. package/lib/api-schemas/agent-runs.d.ts.map +1 -1
  20. package/lib/api-schemas/agent-runs.js +44 -2
  21. package/lib/api-schemas/agent-runs.js.map +1 -1
  22. package/lib/api-schemas/app-lifecycle.d.ts +19 -0
  23. package/lib/api-schemas/app-lifecycle.d.ts.map +1 -1
  24. package/lib/api-schemas/app-lifecycle.js +34 -4
  25. package/lib/api-schemas/app-lifecycle.js.map +1 -1
  26. package/lib/api-schemas/app-runtime.d.ts +9871 -9257
  27. package/lib/api-schemas/app-runtime.d.ts.map +1 -1
  28. package/lib/api-schemas/app-runtime.js +7 -0
  29. package/lib/api-schemas/app-runtime.js.map +1 -1
  30. package/lib/api-schemas/apps.d.ts +1 -0
  31. package/lib/api-schemas/apps.d.ts.map +1 -1
  32. package/lib/api-schemas/apps.js +4 -3
  33. package/lib/api-schemas/apps.js.map +1 -1
  34. package/lib/api-schemas/content-query.d.ts +39 -0
  35. package/lib/api-schemas/content-query.d.ts.map +1 -0
  36. package/lib/api-schemas/content-query.js +30 -0
  37. package/lib/api-schemas/content-query.js.map +1 -0
  38. package/lib/api-schemas/content.d.ts +835 -29
  39. package/lib/api-schemas/content.d.ts.map +1 -1
  40. package/lib/api-schemas/content.js +82 -15
  41. package/lib/api-schemas/content.js.map +1 -1
  42. package/lib/api-schemas/dashboard.d.ts +4 -0
  43. package/lib/api-schemas/dashboard.d.ts.map +1 -1
  44. package/lib/api-schemas/dashboard.js +3 -0
  45. package/lib/api-schemas/dashboard.js.map +1 -1
  46. package/lib/api-schemas/document-processing.d.ts +333 -0
  47. package/lib/api-schemas/document-processing.d.ts.map +1 -1
  48. package/lib/api-schemas/events.d.ts +1007 -4
  49. package/lib/api-schemas/events.d.ts.map +1 -1
  50. package/lib/api-schemas/events.js +4 -1
  51. package/lib/api-schemas/events.js.map +1 -1
  52. package/lib/api-schemas/files.d.ts +17 -0
  53. package/lib/api-schemas/files.d.ts.map +1 -1
  54. package/lib/api-schemas/files.js +23 -0
  55. package/lib/api-schemas/files.js.map +1 -1
  56. package/lib/api-schemas/group.d.ts +7 -0
  57. package/lib/api-schemas/group.d.ts.map +1 -1
  58. package/lib/api-schemas/group.js +9 -0
  59. package/lib/api-schemas/group.js.map +1 -1
  60. package/lib/api-schemas/index.d.ts +4 -0
  61. package/lib/api-schemas/index.d.ts.map +1 -1
  62. package/lib/api-schemas/index.js +4 -0
  63. package/lib/api-schemas/index.js.map +1 -1
  64. package/lib/api-schemas/integrations.d.ts +19 -5
  65. package/lib/api-schemas/integrations.d.ts.map +1 -1
  66. package/lib/api-schemas/integrations.js +25 -2
  67. package/lib/api-schemas/integrations.js.map +1 -1
  68. package/lib/api-schemas/interaction.d.ts +8399 -1076
  69. package/lib/api-schemas/interaction.d.ts.map +1 -1
  70. package/lib/api-schemas/interaction.js +161 -9
  71. package/lib/api-schemas/interaction.js.map +1 -1
  72. package/lib/api-schemas/oauth-server.d.ts +131 -3
  73. package/lib/api-schemas/oauth-server.d.ts.map +1 -1
  74. package/lib/api-schemas/oauth-server.js +137 -3
  75. package/lib/api-schemas/oauth-server.js.map +1 -1
  76. package/lib/api-schemas/process.d.ts +1295 -0
  77. package/lib/api-schemas/process.d.ts.map +1 -1
  78. package/lib/api-schemas/process.js +318 -2
  79. package/lib/api-schemas/process.js.map +1 -1
  80. package/lib/api-schemas/project-configuration.d.ts +1118 -1
  81. package/lib/api-schemas/project-configuration.d.ts.map +1 -1
  82. package/lib/api-schemas/project-configuration.js +6 -2
  83. package/lib/api-schemas/project-configuration.js.map +1 -1
  84. package/lib/api-schemas/project.d.ts +1680 -6
  85. package/lib/api-schemas/project.d.ts.map +1 -1
  86. package/lib/api-schemas/registry.d.ts +87529 -69142
  87. package/lib/api-schemas/registry.d.ts.map +1 -1
  88. package/lib/api-schemas/registry.js +234 -413
  89. package/lib/api-schemas/registry.js.map +1 -1
  90. package/lib/api-schemas/schema-primitives.d.ts +4 -0
  91. package/lib/api-schemas/schema-primitives.d.ts.map +1 -1
  92. package/lib/api-schemas/schema-primitives.js +10 -0
  93. package/lib/api-schemas/schema-primitives.js.map +1 -1
  94. package/lib/api-schemas/store.d.ts +5596 -37
  95. package/lib/api-schemas/store.d.ts.map +1 -1
  96. package/lib/api-schemas/store.js +53 -8
  97. package/lib/api-schemas/store.js.map +1 -1
  98. package/lib/api-schemas/tools.d.ts +115 -0
  99. package/lib/api-schemas/tools.d.ts.map +1 -1
  100. package/lib/api-schemas/tools.js +55 -0
  101. package/lib/api-schemas/tools.js.map +1 -1
  102. package/lib/api-schemas/view-execution.d.ts +330 -854
  103. package/lib/api-schemas/view-execution.d.ts.map +1 -1
  104. package/lib/api-schemas/view-execution.js +26 -2
  105. package/lib/api-schemas/view-execution.js.map +1 -1
  106. package/lib/api-schemas/views.d.ts +452 -2562
  107. package/lib/api-schemas/views.d.ts.map +1 -1
  108. package/lib/api-schemas/views.js +119 -3
  109. package/lib/api-schemas/views.js.map +1 -1
  110. package/lib/api-schemas/workflow-runs.d.ts +344 -5
  111. package/lib/api-schemas/workflow-runs.d.ts.map +1 -1
  112. package/lib/api-schemas/workflow-runs.js +9 -7
  113. package/lib/api-schemas/workflow-runs.js.map +1 -1
  114. package/lib/apps.d.ts +8 -145
  115. package/lib/apps.d.ts.map +1 -1
  116. package/lib/apps.js +1 -54
  117. package/lib/apps.js.map +1 -1
  118. package/lib/ask-user.d.ts +2 -1
  119. package/lib/ask-user.d.ts.map +1 -1
  120. package/lib/audit-trail.d.ts +2 -2
  121. package/lib/audit-trail.d.ts.map +1 -1
  122. package/lib/audit-trail.js +2 -2
  123. package/lib/audit-trail.js.map +1 -1
  124. package/lib/browser-credentials.d.ts +2 -7
  125. package/lib/browser-credentials.d.ts.map +1 -1
  126. package/lib/common.d.ts +4 -1
  127. package/lib/common.d.ts.map +1 -1
  128. package/lib/content-query.d.ts +5 -0
  129. package/lib/content-query.d.ts.map +1 -0
  130. package/lib/content-query.js +2 -0
  131. package/lib/content-query.js.map +1 -0
  132. package/lib/data-platform.d.ts +4 -46
  133. package/lib/data-platform.d.ts.map +1 -1
  134. package/lib/data-platform.js.map +1 -1
  135. package/lib/email.d.ts +12 -18
  136. package/lib/email.d.ts.map +1 -1
  137. package/lib/email.js.map +1 -1
  138. package/lib/environment.d.ts +0 -10
  139. package/lib/environment.d.ts.map +1 -1
  140. package/lib/environment.js +1 -12
  141. package/lib/environment.js.map +1 -1
  142. package/lib/facets.d.ts +0 -4
  143. package/lib/facets.d.ts.map +1 -1
  144. package/lib/group.d.ts +2 -12
  145. package/lib/group.d.ts.map +1 -1
  146. package/lib/group.js.map +1 -1
  147. package/lib/index.d.ts +3 -10
  148. package/lib/index.d.ts.map +1 -1
  149. package/lib/index.js +2 -10
  150. package/lib/index.js.map +1 -1
  151. package/lib/integrations.d.ts +1 -27
  152. package/lib/integrations.d.ts.map +1 -1
  153. package/lib/integrations.js +0 -6
  154. package/lib/integrations.js.map +1 -1
  155. package/lib/interaction.d.ts +10 -222
  156. package/lib/interaction.d.ts.map +1 -1
  157. package/lib/interaction.js +0 -31
  158. package/lib/interaction.js.map +1 -1
  159. package/lib/meters.d.ts +5 -10
  160. package/lib/meters.d.ts.map +1 -1
  161. package/lib/meters.js +1 -9
  162. package/lib/meters.js.map +1 -1
  163. package/lib/oauth-scopes.d.ts +2 -16
  164. package/lib/oauth-scopes.d.ts.map +1 -1
  165. package/lib/oauth-scopes.js +9 -49
  166. package/lib/oauth-scopes.js.map +1 -1
  167. package/lib/oauth-server.d.ts +16 -195
  168. package/lib/oauth-server.d.ts.map +1 -1
  169. package/lib/payload.d.ts +2 -5
  170. package/lib/payload.d.ts.map +1 -1
  171. package/lib/pending-asks.d.ts +9 -41
  172. package/lib/pending-asks.d.ts.map +1 -1
  173. package/lib/platform-event.d.ts +4 -142
  174. package/lib/platform-event.d.ts.map +1 -1
  175. package/lib/platform-event.js.map +1 -1
  176. package/lib/project.d.ts +7 -46
  177. package/lib/project.d.ts.map +1 -1
  178. package/lib/project.js +2 -132
  179. package/lib/project.js.map +1 -1
  180. package/lib/prompt.d.ts +4 -7
  181. package/lib/prompt.d.ts.map +1 -1
  182. package/lib/prompt.js.map +1 -1
  183. package/lib/query.d.ts +0 -8
  184. package/lib/query.d.ts.map +1 -1
  185. package/lib/rate-limiter.d.ts +4 -3
  186. package/lib/rate-limiter.d.ts.map +1 -1
  187. package/lib/runs.d.ts +5 -1
  188. package/lib/runs.d.ts.map +1 -1
  189. package/lib/schema-for-extraction.d.ts +0 -1
  190. package/lib/schema-for-extraction.d.ts.map +1 -1
  191. package/lib/schema-for-extraction.js +1 -1
  192. package/lib/schema-for-extraction.js.map +1 -1
  193. package/lib/secrets.d.ts +2 -1
  194. package/lib/secrets.d.ts.map +1 -1
  195. package/lib/skill.d.ts +0 -13
  196. package/lib/skill.d.ts.map +1 -1
  197. package/lib/store/activity-catalog.d.ts +2 -0
  198. package/lib/store/activity-catalog.d.ts.map +1 -1
  199. package/lib/store/agent-approval.d.ts +0 -1
  200. package/lib/store/agent-approval.d.ts.map +1 -1
  201. package/lib/store/agent-approval.js +0 -3
  202. package/lib/store/agent-approval.js.map +1 -1
  203. package/lib/store/agent-run.d.ts +32 -69
  204. package/lib/store/agent-run.d.ts.map +1 -1
  205. package/lib/store/collections.d.ts +2 -6
  206. package/lib/store/collections.d.ts.map +1 -1
  207. package/lib/store/collections.js.map +1 -1
  208. package/lib/store/conversation-state.d.ts +11 -12
  209. package/lib/store/conversation-state.d.ts.map +1 -1
  210. package/lib/store/conversation-state.js +0 -18
  211. package/lib/store/conversation-state.js.map +1 -1
  212. package/lib/store/doc-analyzer.d.ts +0 -22
  213. package/lib/store/doc-analyzer.d.ts.map +1 -1
  214. package/lib/store/dsl-workflow.d.ts +22 -5
  215. package/lib/store/dsl-workflow.d.ts.map +1 -1
  216. package/lib/store/dsl-workflow.js.map +1 -1
  217. package/lib/store/grounded-extraction.d.ts +0 -14
  218. package/lib/store/grounded-extraction.d.ts.map +1 -1
  219. package/lib/store/grounded-extraction.js +1 -7
  220. package/lib/store/grounded-extraction.js.map +1 -1
  221. package/lib/store/index.d.ts +0 -5
  222. package/lib/store/index.d.ts.map +1 -1
  223. package/lib/store/index.js +0 -6
  224. package/lib/store/index.js.map +1 -1
  225. package/lib/store/intake-policy-schema.generated.d.ts.map +1 -1
  226. package/lib/store/intake-policy-schema.generated.js +279 -1
  227. package/lib/store/intake-policy-schema.generated.js.map +1 -1
  228. package/lib/store/process.d.ts +43 -1
  229. package/lib/store/process.d.ts.map +1 -1
  230. package/lib/store/process.js.map +1 -1
  231. package/lib/store/rendering.d.ts +3 -5
  232. package/lib/store/rendering.d.ts.map +1 -1
  233. package/lib/store/rendering.js +0 -4
  234. package/lib/store/rendering.js.map +1 -1
  235. package/lib/store/schedule.d.ts +0 -16
  236. package/lib/store/schedule.d.ts.map +1 -1
  237. package/lib/store/schedule.js.map +1 -1
  238. package/lib/store/signals.d.ts +12 -0
  239. package/lib/store/signals.d.ts.map +1 -1
  240. package/lib/store/store.d.ts +80 -94
  241. package/lib/store/store.d.ts.map +1 -1
  242. package/lib/store/store.js +5 -25
  243. package/lib/store/store.js.map +1 -1
  244. package/lib/store/workflow.d.ts +35 -86
  245. package/lib/store/workflow.d.ts.map +1 -1
  246. package/lib/store/workflow.js +0 -47
  247. package/lib/store/workflow.js.map +1 -1
  248. package/lib/sts-errors.d.ts +0 -1
  249. package/lib/sts-errors.d.ts.map +1 -1
  250. package/lib/sts-token-types.d.ts +2 -8
  251. package/lib/sts-token-types.d.ts.map +1 -1
  252. package/lib/sts-token-types.js +1 -19
  253. package/lib/sts-token-types.js.map +1 -1
  254. package/lib/tools.d.ts +6 -1
  255. package/lib/tools.d.ts.map +1 -1
  256. package/lib/transient-tokens.d.ts +0 -2
  257. package/lib/transient-tokens.d.ts.map +1 -1
  258. package/lib/user.d.ts +0 -17
  259. package/lib/user.d.ts.map +1 -1
  260. package/lib/user.js.map +1 -1
  261. package/lib/utils/schemas.d.ts +2 -24
  262. package/lib/utils/schemas.d.ts.map +1 -1
  263. package/lib/utils/schemas.js +0 -151
  264. package/lib/utils/schemas.js.map +1 -1
  265. package/lib/vertesia-common.js +3 -4
  266. package/lib/vertesia-common.js.map +1 -1
  267. package/lib/views.d.ts +23 -27
  268. package/lib/views.d.ts.map +1 -1
  269. package/lib/views.js +5 -26
  270. package/lib/views.js.map +1 -1
  271. package/lib/workflow-analytics.d.ts +12 -34
  272. package/lib/workflow-analytics.d.ts.map +1 -1
  273. package/package.json +12 -6
  274. package/src/access-control.ts +0 -26
  275. package/src/account-values.ts +0 -49
  276. package/src/agent-resources.test.ts +1 -12
  277. package/src/api-contract/components.contract.test.ts +99 -0
  278. package/src/api-contract/components.generated.json +40405 -0
  279. package/src/api-contract/index.ts +664 -0
  280. package/src/api-schemas/agent-communication.contract.test.ts +90 -0
  281. package/src/api-schemas/agent-communication.ts +169 -0
  282. package/src/api-schemas/agent-runs.ts +46 -1
  283. package/src/api-schemas/api-discriminators.test.ts +101 -0
  284. package/src/api-schemas/app-lifecycle.ts +39 -4
  285. package/src/api-schemas/app-runtime.ts +8 -0
  286. package/src/api-schemas/apps.ts +4 -3
  287. package/src/api-schemas/content-query.ts +31 -0
  288. package/src/api-schemas/content.ts +88 -15
  289. package/src/api-schemas/dashboard.contract.test.ts +16 -5
  290. package/src/api-schemas/dashboard.ts +3 -0
  291. package/src/api-schemas/events.ts +9 -1
  292. package/src/api-schemas/files.ts +27 -0
  293. package/src/api-schemas/group.ts +10 -0
  294. package/src/api-schemas/index.ts +4 -0
  295. package/src/api-schemas/integrations.ts +27 -2
  296. package/src/api-schemas/interaction.contract.test.ts +204 -1
  297. package/src/api-schemas/interaction.ts +176 -8
  298. package/src/api-schemas/llumiverse.contract.test.ts +33 -2
  299. package/src/api-schemas/oauth-server.ts +152 -3
  300. package/src/api-schemas/oauth.contract.test.ts +64 -1
  301. package/src/api-schemas/process.ts +352 -2
  302. package/src/api-schemas/project-configuration.ts +11 -7
  303. package/src/api-schemas/project.contract.test.ts +83 -6
  304. package/src/api-schemas/registry.ts +290 -457
  305. package/src/api-schemas/schema-primitives.ts +13 -0
  306. package/src/api-schemas/store.contract.test.ts +30 -1
  307. package/src/api-schemas/store.ts +58 -11
  308. package/src/api-schemas/tools.ts +62 -0
  309. package/src/api-schemas/view-execution.ts +28 -2
  310. package/src/api-schemas/views.contract.test.ts +119 -0
  311. package/src/api-schemas/views.ts +142 -3
  312. package/src/api-schemas/workflow-runs.ts +9 -7
  313. package/src/api-schemas/zeno-response-contracts.test.ts +344 -0
  314. package/src/apps.test.ts +2 -40
  315. package/src/apps.ts +14 -181
  316. package/src/ask-user.ts +1 -1
  317. package/src/audit-trail.ts +3 -3
  318. package/src/browser-credentials.ts +3 -7
  319. package/src/common.ts +13 -1
  320. package/src/content-query.ts +5 -0
  321. package/src/data-platform.ts +4 -51
  322. package/src/email.ts +24 -18
  323. package/src/environment.ts +1 -14
  324. package/src/facets.ts +0 -6
  325. package/src/group.ts +2 -12
  326. package/src/index.ts +3 -15
  327. package/src/integrations.ts +1 -52
  328. package/src/interaction.ts +12 -271
  329. package/src/meters.ts +10 -11
  330. package/src/oauth-scopes.test.ts +15 -0
  331. package/src/oauth-scopes.ts +10 -64
  332. package/src/oauth-server.ts +28 -215
  333. package/src/payload.ts +1 -6
  334. package/src/pending-asks.ts +17 -42
  335. package/src/platform-event.ts +3 -156
  336. package/src/project.ts +12 -160
  337. package/src/prompt.ts +9 -8
  338. package/src/query.ts +0 -9
  339. package/src/rate-limiter.ts +3 -3
  340. package/src/runs.ts +8 -0
  341. package/src/schema-for-extraction.ts +1 -1
  342. package/src/secrets.ts +3 -0
  343. package/src/skill.ts +0 -15
  344. package/src/store/activity-catalog.ts +3 -0
  345. package/src/store/agent-approval.ts +0 -4
  346. package/src/store/agent-run.ts +39 -93
  347. package/src/store/collections.ts +3 -6
  348. package/src/store/conversation-state.ts +12 -25
  349. package/src/store/doc-analyzer.ts +0 -26
  350. package/src/store/dsl-workflow.ts +28 -5
  351. package/src/store/grounded-extraction.ts +0 -18
  352. package/src/store/index.ts +0 -6
  353. package/src/store/intake-policy-schema.generated.ts +293 -1
  354. package/src/store/process.ts +84 -0
  355. package/src/store/rendering.ts +3 -8
  356. package/src/store/schedule.ts +0 -19
  357. package/src/store/signals.ts +14 -0
  358. package/src/store/store.ts +118 -127
  359. package/src/store/workflow.ts +32 -120
  360. package/src/sts-errors.ts +0 -2
  361. package/src/sts-token-types.ts +3 -28
  362. package/src/tools.ts +15 -0
  363. package/src/transient-tokens.ts +0 -2
  364. package/src/user.ts +0 -20
  365. package/src/utils/schemas.ts +2 -159
  366. package/src/views.ts +50 -47
  367. package/src/workflow-analytics.ts +12 -40
  368. package/tsconfig.dist.json +4 -1
  369. package/lib/Progress.d.ts +0 -22
  370. package/lib/Progress.d.ts.map +0 -1
  371. package/lib/Progress.js +0 -57
  372. package/lib/Progress.js.map +0 -1
  373. package/lib/agent-request-template.d.ts +0 -4
  374. package/lib/agent-request-template.d.ts.map +0 -1
  375. package/lib/agent-request-template.js +0 -46
  376. package/lib/agent-request-template.js.map +0 -1
  377. package/lib/channels.d.ts +0 -22
  378. package/lib/channels.d.ts.map +0 -1
  379. package/lib/channels.js +0 -57
  380. package/lib/channels.js.map +0 -1
  381. package/lib/host-utils.d.ts +0 -8
  382. package/lib/host-utils.d.ts.map +0 -1
  383. package/lib/host-utils.js +0 -84
  384. package/lib/host-utils.js.map +0 -1
  385. package/lib/platform-event-validation.d.ts +0 -45
  386. package/lib/platform-event-validation.d.ts.map +0 -1
  387. package/lib/platform-event-validation.js +0 -336
  388. package/lib/platform-event-validation.js.map +0 -1
  389. package/lib/store/hive-memory.d.ts +0 -117
  390. package/lib/store/hive-memory.d.ts.map +0 -1
  391. package/lib/store/hive-memory.js +0 -2
  392. package/lib/store/hive-memory.js.map +0 -1
  393. package/lib/store/object-types.d.ts +0 -24
  394. package/lib/store/object-types.d.ts.map +0 -1
  395. package/lib/store/object-types.js +0 -95
  396. package/lib/store/object-types.js.map +0 -1
  397. package/lib/store/process-schema.d.ts +0 -561
  398. package/lib/store/process-schema.d.ts.map +0 -1
  399. package/lib/store/process-schema.js +0 -561
  400. package/lib/store/process-schema.js.map +0 -1
  401. package/lib/store/process-validation.d.ts +0 -17
  402. package/lib/store/process-validation.d.ts.map +0 -1
  403. package/lib/store/process-validation.js +0 -515
  404. package/lib/store/process-validation.js.map +0 -1
  405. package/lib/store/temporalio.d.ts +0 -17
  406. package/lib/store/temporalio.d.ts.map +0 -1
  407. package/lib/store/temporalio.js +0 -41
  408. package/lib/store/temporalio.js.map +0 -1
  409. package/lib/view-configuration-validation.d.ts +0 -15
  410. package/lib/view-configuration-validation.d.ts.map +0 -1
  411. package/lib/view-configuration-validation.js +0 -63
  412. package/lib/view-configuration-validation.js.map +0 -1
  413. package/lib/view-query-validation.d.ts +0 -13
  414. package/lib/view-query-validation.d.ts.map +0 -1
  415. package/lib/view-query-validation.js +0 -266
  416. package/lib/view-query-validation.js.map +0 -1
  417. package/lib/view-validation-helpers.d.ts +0 -15
  418. package/lib/view-validation-helpers.d.ts.map +0 -1
  419. package/lib/view-validation-helpers.js +0 -25
  420. package/lib/view-validation-helpers.js.map +0 -1
  421. package/lib/views-schema.d.ts +0 -1992
  422. package/lib/views-schema.d.ts.map +0 -1
  423. package/lib/views-schema.js +0 -674
  424. package/lib/views-schema.js.map +0 -1
  425. package/lib/views-validation.d.ts +0 -21
  426. package/lib/views-validation.d.ts.map +0 -1
  427. package/lib/views-validation.js +0 -164
  428. package/lib/views-validation.js.map +0 -1
  429. package/src/Progress.ts +0 -59
  430. package/src/agent-request-template.test.ts +0 -40
  431. package/src/agent-request-template.ts +0 -45
  432. package/src/channels.ts +0 -70
  433. package/src/host-utils.test.ts +0 -61
  434. package/src/host-utils.ts +0 -93
  435. package/src/platform-event-validation.test.ts +0 -251
  436. package/src/platform-event-validation.ts +0 -372
  437. package/src/project.test.ts +0 -44
  438. package/src/store/hive-memory.ts +0 -167
  439. package/src/store/object-types.ts +0 -123
  440. package/src/store/process-schema.test.ts +0 -149
  441. package/src/store/process-schema.ts +0 -564
  442. package/src/store/process-validation.test.ts +0 -635
  443. package/src/store/process-validation.ts +0 -646
  444. package/src/store/temporalio.ts +0 -54
  445. package/src/view-configuration-validation.ts +0 -74
  446. package/src/view-query-validation.test.ts +0 -21
  447. package/src/view-query-validation.ts +0 -319
  448. package/src/view-validation-helpers.ts +0 -28
  449. package/src/views-schema.test.ts +0 -372
  450. package/src/views-schema.ts +0 -689
  451. package/src/views-validation.ts +0 -234
@@ -1,251 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import type { CreateEventSubscriptionPayload } from './platform-event.js';
3
- import {
4
- EVENT_CONDITION_JSON_LOGIC_OPERATORS,
5
- getCreateEventSubscriptionValidationResult,
6
- getUpdateEventSubscriptionValidationResult,
7
- } from './platform-event-validation.js';
8
- import { SystemRoles } from './project.js';
9
-
10
- function validCreate(overrides: Partial<CreateEventSubscriptionPayload> = {}): CreateEventSubscriptionPayload {
11
- return {
12
- name: 'My automation',
13
- filter: { event_category: ['content'], action: ['create'] },
14
- target: { type: 'agent', interaction_ref: 'sys:GeneralAgent' },
15
- run_as_role: SystemRoles.automation,
16
- ...overrides,
17
- };
18
- }
19
-
20
- describe('event subscription input validation', () => {
21
- it('accepts a valid create payload', () => {
22
- expect(getCreateEventSubscriptionValidationResult(validCreate()).valid).toBe(true);
23
- });
24
-
25
- it('requires a name', () => {
26
- const result = getCreateEventSubscriptionValidationResult(validCreate({ name: ' ' }));
27
- expect(result.valid).toBe(false);
28
- expect(result.errors).toContain('name is required');
29
- });
30
-
31
- it('requires a run_as_role on create', () => {
32
- const { run_as_role: _omitted, ...withoutRunAsRole } = validCreate();
33
- const result = getCreateEventSubscriptionValidationResult(withoutRunAsRole as CreateEventSubscriptionPayload);
34
- expect(result.valid).toBe(false);
35
- expect(result.errors).toContain('run_as_role is required');
36
- });
37
-
38
- it('does not require run_as_role on update', () => {
39
- expect(getUpdateEventSubscriptionValidationResult({ enabled: true }).valid).toBe(true);
40
- });
41
-
42
- it('rejects an unknown target type', () => {
43
- const result = getCreateEventSubscriptionValidationResult(
44
- validCreate({ target: { type: 'unsupported-target' } as never }),
45
- );
46
- expect(result.valid).toBe(false);
47
- expect(result.errors.join(' ')).toContain('target.type');
48
- });
49
-
50
- it('requires a url for webhook targets', () => {
51
- const result = getCreateEventSubscriptionValidationResult(
52
- validCreate({ target: { type: 'webhook' } as never }),
53
- );
54
- expect(result.valid).toBe(false);
55
- expect(result.errors.join(' ')).toContain('url');
56
- });
57
-
58
- it('bounds the webhook timeout', () => {
59
- const result = getCreateEventSubscriptionValidationResult(
60
- validCreate({ target: { type: 'webhook', url: 'https://example.com/hook', timeout_ms: 999_999 } }),
61
- );
62
- expect(result.valid).toBe(false);
63
- expect(result.errors.join(' ')).toContain('timeout_ms');
64
- });
65
-
66
- it('accepts a fully resolved app hook target', () => {
67
- const result = getCreateEventSubscriptionValidationResult(
68
- validCreate({
69
- target: {
70
- type: 'app',
71
- app_id: 'content-app',
72
- installation_id: 'installation-1',
73
- hook: 'content-updated',
74
- url: 'https://gateway.example/apps/content-app/api/hooks/content-updated',
75
- },
76
- }),
77
- );
78
- expect(result.valid).toBe(true);
79
- });
80
-
81
- it('requires app hook identity and URL fields', () => {
82
- const result = getCreateEventSubscriptionValidationResult(
83
- validCreate({ target: { type: 'app', app_id: '', installation_id: '', hook: '', url: '' } }),
84
- );
85
- expect(result.valid).toBe(false);
86
- expect(result.errors.join(' ')).toContain('app_id');
87
- expect(result.errors.join(' ')).toContain('installation_id');
88
- expect(result.errors.join(' ')).toContain('hook');
89
- expect(result.errors.join(' ')).toContain('url');
90
- });
91
-
92
- it('requires endpoint for workflow targets', () => {
93
- const result = getCreateEventSubscriptionValidationResult(
94
- validCreate({ target: { type: 'workflow' } as never }),
95
- );
96
- expect(result.valid).toBe(false);
97
- expect(result.errors.join(' ')).toContain('endpoint');
98
- });
99
-
100
- it('requires process_ref or process_definition for process targets', () => {
101
- const result = getCreateEventSubscriptionValidationResult(validCreate({ target: { type: 'process' } }));
102
- expect(result.valid).toBe(false);
103
- expect(result.errors.join(' ')).toContain('process_ref');
104
- });
105
-
106
- it('accepts a valid agent_signal target', () => {
107
- const result = getCreateEventSubscriptionValidationResult(
108
- validCreate({
109
- target: {
110
- type: 'agent',
111
- on_match: 'signal',
112
- message_path: 'details.payload.comment.body',
113
- client_message_id_path: 'details.payload.comment.node_id',
114
- require_command_prefixes: ['/vertesia'],
115
- on_terminal: 'skip',
116
- missing_thread: 'retry',
117
- },
118
- }),
119
- );
120
- expect(result.valid).toBe(true);
121
- });
122
-
123
- it('requires message_path for agent_signal targets', () => {
124
- const result = getCreateEventSubscriptionValidationResult(
125
- validCreate({ target: { type: 'agent', on_match: 'signal' } as never }),
126
- );
127
- expect(result.valid).toBe(false);
128
- expect(result.errors.join(' ')).toContain('message_path');
129
- });
130
-
131
- it('rejects a non-string agent_signal message_path', () => {
132
- const result = getCreateEventSubscriptionValidationResult(
133
- validCreate({ target: { type: 'agent', on_match: 'signal', message_path: 123 } as never }),
134
- );
135
- expect(result.valid).toBe(false);
136
- expect(result.errors.join(' ')).toContain('message_path');
137
- });
138
-
139
- it('rejects an invalid agent_signal missing_thread', () => {
140
- const result = getCreateEventSubscriptionValidationResult(
141
- validCreate({
142
- target: { type: 'agent', on_match: 'signal', message_path: 'm', missing_thread: 'nope' } as never,
143
- }),
144
- );
145
- expect(result.valid).toBe(false);
146
- expect(result.errors.join(' ')).toContain('missing_thread');
147
- });
148
-
149
- it('accepts agent_signal on_terminal:restart', () => {
150
- const result = getCreateEventSubscriptionValidationResult(
151
- validCreate({ target: { type: 'agent', on_match: 'signal', message_path: 'm', on_terminal: 'restart' } }),
152
- );
153
- expect(result.valid).toBe(true);
154
- });
155
-
156
- it('rejects an invalid agent_signal on_terminal value', () => {
157
- const result = getCreateEventSubscriptionValidationResult(
158
- validCreate({
159
- target: { type: 'agent', on_match: 'signal', message_path: 'm', on_terminal: 'nope' } as never,
160
- }),
161
- );
162
- expect(result.valid).toBe(false);
163
- expect(result.errors.join(' ')).toContain('on_terminal');
164
- });
165
-
166
- it('rejects an agent_signal signal_name other than UserInput', () => {
167
- const result = getCreateEventSubscriptionValidationResult(
168
- validCreate({
169
- target: { type: 'agent', on_match: 'signal', message_path: 'm', signal_name: 'Stop' } as never,
170
- }),
171
- );
172
- expect(result.valid).toBe(false);
173
- expect(result.errors.join(' ')).toContain('signal_name');
174
- });
175
-
176
- it('rejects agent_signal statuses that are not valid run statuses', () => {
177
- const result = getCreateEventSubscriptionValidationResult(
178
- validCreate({
179
- target: {
180
- type: 'agent',
181
- on_match: 'signal',
182
- message_path: 'm',
183
- statuses: ['running', 'bogus'],
184
- } as never,
185
- }),
186
- );
187
- expect(result.valid).toBe(false);
188
- expect(result.errors.join(' ')).toContain('statuses');
189
- expect(result.errors.join(' ')).toContain('bogus');
190
- });
191
-
192
- it('rejects agent_signal statuses that are terminal (not signalable)', () => {
193
- const result = getCreateEventSubscriptionValidationResult(
194
- validCreate({
195
- target: { type: 'agent', on_match: 'signal', message_path: 'm', statuses: ['completed'] } as never,
196
- }),
197
- );
198
- expect(result.valid).toBe(false);
199
- expect(result.errors.join(' ')).toContain('statuses');
200
- expect(result.errors.join(' ')).toContain('on_terminal');
201
- });
202
-
203
- it('rejects non-string agent_signal optional path fields', () => {
204
- const result = getCreateEventSubscriptionValidationResult(
205
- validCreate({
206
- target: { type: 'agent', on_match: 'signal', message_path: 'm', author_path: 123 } as never,
207
- }),
208
- );
209
- expect(result.valid).toBe(false);
210
- expect(result.errors.join(' ')).toContain('author_path');
211
- });
212
-
213
- it('accepts agent_signal with interaction_ref and valid statuses', () => {
214
- const result = getCreateEventSubscriptionValidationResult(
215
- validCreate({
216
- target: {
217
- type: 'agent',
218
- on_match: 'signal',
219
- message_path: 'details.payload.comment.body',
220
- interaction_ref: 'sys:SoftwareEngineeringAgent',
221
- statuses: ['running'],
222
- signal_name: 'UserInput',
223
- on_terminal: 'skip',
224
- },
225
- }),
226
- );
227
- expect(result.valid).toBe(true);
228
- });
229
-
230
- it('rejects unsupported event categories', () => {
231
- const result = getCreateEventSubscriptionValidationResult(
232
- validCreate({ filter: { event_category: ['nope'] as never } }),
233
- );
234
- expect(result.valid).toBe(false);
235
- expect(result.errors.join(' ')).toContain('event_category');
236
- });
237
-
238
- it('accepts a partial update', () => {
239
- expect(getUpdateEventSubscriptionValidationResult({ enabled: false }).valid).toBe(true);
240
- });
241
-
242
- it('validates a target supplied in an update', () => {
243
- const result = getUpdateEventSubscriptionValidationResult({ target: { type: 'webhook' } as never });
244
- expect(result.valid).toBe(false);
245
- expect(result.errors.join(' ')).toContain('url');
246
- });
247
-
248
- it('does not expose side-effect JSONLogic operators for event conditions', () => {
249
- expect(EVENT_CONDITION_JSON_LOGIC_OPERATORS).not.toContain('log');
250
- });
251
- });
@@ -1,372 +0,0 @@
1
- import type {
2
- CreateEventSubscriptionPayload,
3
- EventCategory,
4
- EventDeliveryTargetInput,
5
- EventPriority,
6
- EventSubscriptionFilter,
7
- UpdateEventSubscriptionPayload,
8
- } from './platform-event.js';
9
- import { SystemRoles } from './project.js';
10
- import type { AgentRunStatus } from './store/index.js';
11
-
12
- /**
13
- * Statuses an `agent_signal` target may list in `statuses` — the run statuses that can be **directly
14
- * signalled**. Only a live (`running`, possibly idle) run has an active Temporal workflow that accepts a
15
- * signal; `created` runs have no workflow bound yet, and terminal runs are handled separately by
16
- * `on_terminal` (`restart` re-activates the newest terminal run, then signals). Restricting the set keeps
17
- * config from silently trying to signal a closed workflow.
18
- */
19
- const SIGNALABLE_AGENT_RUN_STATUS_VALUES: readonly AgentRunStatus[] = ['running'];
20
-
21
- export const DEFAULT_WEBHOOK_TIMEOUT_MS = 30_000;
22
- export const MAX_WEBHOOK_TIMEOUT_MS = 50_000;
23
-
24
- export const EVENT_CATEGORIES: readonly EventCategory[] = [
25
- 'content',
26
- 'workflow',
27
- 'security',
28
- 'billing',
29
- 'system',
30
- 'external',
31
- ];
32
- export const EVENT_PRIORITIES: readonly EventPriority[] = ['high', 'normal', 'low'];
33
-
34
- /** Default agent-evaluator iteration budget for a semantic condition. */
35
- export const DEFAULT_SEMANTIC_AGENT_MAX_ITERATIONS = 10;
36
- /** Maximum agent-evaluator iteration budget a user may request. */
37
- export const MAX_SEMANTIC_AGENT_MAX_ITERATIONS = 30;
38
- /** Default content-excerpt size (chars) included in the interaction classifier prompt. */
39
- export const DEFAULT_SEMANTIC_MAX_CONTENT_CHARS = 4000;
40
- /** Maximum content-excerpt size (chars) a user may request. */
41
- export const MAX_SEMANTIC_MAX_CONTENT_CHARS = 20_000;
42
- /** Maximum length of a semantic condition instruction. */
43
- export const MAX_SEMANTIC_CONDITION_INSTRUCTION_LENGTH = 2000;
44
-
45
- /** Default action stamped on an ingested external event when none is provided/mapped. */
46
- export const DEFAULT_EXTERNAL_EVENT_ACTION = 'received';
47
- /** Default resource_type stamped on an ingested external event when none is provided/mapped. */
48
- export const DEFAULT_EXTERNAL_EVENT_RESOURCE_TYPE = 'external_event';
49
- /** Prefix combined with a channel `source` to form the event `source` (`external:<source>`). */
50
- export const EXTERNAL_EVENT_SOURCE_PREFIX = 'external:';
51
-
52
- /** Role an event subscription runs as when none is specified. */
53
- export const DEFAULT_EVENT_SUBSCRIPTION_RUN_AS_ROLE = SystemRoles.automation;
54
-
55
- /**
56
- * Roles a user may select for an event subscription's run_as_role. System subscriptions may use
57
- * additional roles (e.g. content_processor); this list gates user input in the API, agent tools,
58
- * and UI — keep all three consuming this constant.
59
- */
60
- export const EVENT_SUBSCRIPTION_RUN_AS_ROLES: readonly SystemRoles[] = [
61
- SystemRoles.automation,
62
- SystemRoles.executor,
63
- SystemRoles.reader,
64
- ];
65
-
66
- /**
67
- * JSONLogic operators accepted in event subscription filter conditions. The event-bus evaluator
68
- * rejects any operator not in this list (fail closed); the UI condition editor uses it for
69
- * completion and validation.
70
- */
71
- export const EVENT_CONDITION_JSON_LOGIC_OPERATORS: readonly string[] = [
72
- '!',
73
- '!!',
74
- '!=',
75
- '!==',
76
- '%',
77
- '*',
78
- '+',
79
- '-',
80
- '/',
81
- '<',
82
- '<=',
83
- '==',
84
- '===',
85
- '>',
86
- '>=',
87
- '?:',
88
- 'all',
89
- 'and',
90
- 'cat',
91
- 'filter',
92
- 'if',
93
- 'in',
94
- 'map',
95
- 'max',
96
- 'merge',
97
- 'min',
98
- 'missing',
99
- 'missing_some',
100
- 'none',
101
- 'or',
102
- 'reduce',
103
- 'some',
104
- 'substr',
105
- 'var',
106
- ];
107
-
108
- export interface EventSubscriptionValidationResult {
109
- valid: boolean;
110
- errors: string[];
111
- }
112
-
113
- function isRecord(value: unknown): value is Record<string, unknown> {
114
- return typeof value === 'object' && value !== null && !Array.isArray(value);
115
- }
116
-
117
- function isStringArray(value: unknown): value is string[] {
118
- return Array.isArray(value) && value.every((item) => typeof item === 'string');
119
- }
120
-
121
- function validateFilter(filter: unknown, errors: string[]): void {
122
- if (!isRecord(filter)) {
123
- errors.push('filter must be an object');
124
- return;
125
- }
126
- const f = filter as EventSubscriptionFilter;
127
- if (f.event_category !== undefined) {
128
- if (!isStringArray(f.event_category)) {
129
- errors.push('filter.event_category must be an array of strings');
130
- } else {
131
- for (const c of f.event_category) {
132
- if (c !== '*' && !EVENT_CATEGORIES.includes(c as EventCategory)) {
133
- errors.push(`filter.event_category contains unsupported value: ${c}`);
134
- }
135
- }
136
- }
137
- }
138
- if (f.exclude_event_category !== undefined) {
139
- if (!isStringArray(f.exclude_event_category)) {
140
- errors.push('filter.exclude_event_category must be an array of strings');
141
- } else {
142
- for (const c of f.exclude_event_category) {
143
- if (!EVENT_CATEGORIES.includes(c)) {
144
- errors.push(`filter.exclude_event_category contains unsupported value: ${c}`);
145
- }
146
- }
147
- }
148
- }
149
- if (f.action !== undefined && !isStringArray(f.action)) {
150
- errors.push('filter.action must be an array of strings');
151
- }
152
- if (f.resource_type !== undefined && !isStringArray(f.resource_type)) {
153
- errors.push('filter.resource_type must be an array of strings');
154
- }
155
- if (f.condition !== undefined && !isRecord(f.condition)) {
156
- errors.push('filter.condition must be a JSON Logic object');
157
- }
158
- }
159
-
160
- function validateTarget(target: unknown, errors: string[]): void {
161
- if (!isRecord(target)) {
162
- errors.push('target must be an object');
163
- return;
164
- }
165
- const type = target.type;
166
- if (type !== 'workflow' && type !== 'webhook' && type !== 'app' && type !== 'agent' && type !== 'process') {
167
- errors.push('target.type must be one of workflow, webhook, app, agent, process');
168
- return;
169
- }
170
- const t = target as EventDeliveryTargetInput;
171
- switch (t.type) {
172
- case 'workflow':
173
- if (typeof t.endpoint !== 'string' || t.endpoint.length === 0) {
174
- errors.push('workflow target requires a non-empty "endpoint"');
175
- }
176
- break;
177
- case 'webhook': {
178
- if (typeof t.url !== 'string' || t.url.length === 0) {
179
- errors.push('webhook target requires a non-empty "url"');
180
- }
181
- if (t.timeout_ms !== undefined) {
182
- if (!Number.isInteger(t.timeout_ms) || t.timeout_ms <= 0 || t.timeout_ms > MAX_WEBHOOK_TIMEOUT_MS) {
183
- errors.push(`webhook target.timeout_ms must be an integer between 1 and ${MAX_WEBHOOK_TIMEOUT_MS}`);
184
- }
185
- }
186
- if (t.signing_mode !== undefined && t.signing_mode !== 'signed' && t.signing_mode !== 'legacy_unsigned') {
187
- errors.push('webhook target.signing_mode must be "signed" or "legacy_unsigned"');
188
- }
189
- if (
190
- t.payload_mode !== undefined &&
191
- t.payload_mode !== 'event_envelope' &&
192
- t.payload_mode !== 'legacy_notify_endpoint' &&
193
- t.payload_mode !== 'workflow_notification'
194
- ) {
195
- errors.push(
196
- 'webhook target.payload_mode must be "event_envelope", "legacy_notify_endpoint" or "workflow_notification"',
197
- );
198
- }
199
- if (t.encrypted_headers === true) {
200
- errors.push('webhook target.encrypted_headers is not supported');
201
- }
202
- if (t.headers !== undefined && !isRecord(t.headers)) {
203
- errors.push('webhook target.headers must be an object of strings');
204
- }
205
- break;
206
- }
207
- case 'app': {
208
- for (const field of ['app_id', 'installation_id', 'hook', 'url'] as const) {
209
- if (typeof t[field] !== 'string' || t[field].length === 0) {
210
- errors.push(`app target requires a non-empty "${field}"`);
211
- }
212
- }
213
- if (t.timeout_ms !== undefined) {
214
- if (!Number.isInteger(t.timeout_ms) || t.timeout_ms <= 0 || t.timeout_ms > MAX_WEBHOOK_TIMEOUT_MS) {
215
- errors.push(`app target.timeout_ms must be an integer between 1 and ${MAX_WEBHOOK_TIMEOUT_MS}`);
216
- }
217
- }
218
- break;
219
- }
220
- case 'process':
221
- if ((typeof t.process_ref !== 'string' || t.process_ref.length === 0) && !isRecord(t.process_definition)) {
222
- errors.push('process target requires "process_ref" or an inline "process_definition"');
223
- }
224
- break;
225
- case 'agent': {
226
- // One target with three behaviors selected by `on_match` (default `start`): start a run,
227
- // signal an existing run, or ensure (signal-or-start). `signal`/`ensure` need `message_path`
228
- // and use the gate/signal fields; `missing_thread` is only meaningful for `signal`.
229
- const onMatch = t.on_match ?? 'start';
230
- if (onMatch !== 'start' && onMatch !== 'signal' && onMatch !== 'ensure') {
231
- errors.push('agent target.on_match must be "start", "signal", or "ensure"');
232
- }
233
- const needsMessage = onMatch === 'signal' || onMatch === 'ensure';
234
- if (needsMessage && (typeof t.message_path !== 'string' || t.message_path.length === 0)) {
235
- errors.push(`agent target.message_path is required when on_match is "${onMatch}"`);
236
- }
237
- // Only the UserInput signal is implemented (the dispatcher always sends a UserInput-shaped
238
- // payload), so reject other names rather than silently mis-deliver.
239
- if (t.signal_name !== undefined && t.signal_name !== 'UserInput') {
240
- errors.push('agent target.signal_name must be "UserInput"');
241
- }
242
- // Optional dot-path / ref fields are read dynamically at runtime — reject non-strings early.
243
- for (const field of [
244
- 'interaction_ref',
245
- 'message_path',
246
- 'client_message_id_path',
247
- 'skip_if_path_exists',
248
- 'author_path',
249
- ]) {
250
- const value = (t as unknown as Record<string, unknown>)[field];
251
- if (value !== undefined && typeof value !== 'string') {
252
- errors.push(`agent target.${field} must be a string`);
253
- }
254
- }
255
- if (t.metadata !== undefined && !isRecord(t.metadata)) {
256
- errors.push('agent target.metadata must be an object');
257
- }
258
- if (t.statuses !== undefined) {
259
- if (!isStringArray(t.statuses)) {
260
- errors.push('agent target.statuses must be an array of strings');
261
- } else {
262
- const invalid = t.statuses.filter(
263
- (s) => !SIGNALABLE_AGENT_RUN_STATUS_VALUES.includes(s as AgentRunStatus),
264
- );
265
- if (invalid.length > 0) {
266
- errors.push(
267
- `agent target.statuses may only contain signalable statuses: ${invalid.join(', ')} ` +
268
- `not allowed. Allowed: ${SIGNALABLE_AGENT_RUN_STATUS_VALUES.join(', ')} ` +
269
- `(terminal runs are handled by on_terminal).`,
270
- );
271
- }
272
- }
273
- }
274
- for (const field of ['ignore_author_patterns', 'require_command_prefixes', 'require_mentions']) {
275
- const value = (t as unknown as Record<string, unknown>)[field];
276
- if (value !== undefined && !isStringArray(value)) {
277
- errors.push(`agent target.${field} must be an array of strings`);
278
- }
279
- }
280
- if (t.missing_thread !== undefined) {
281
- if (onMatch !== 'signal') {
282
- errors.push('agent target.missing_thread is only valid when on_match is "signal"');
283
- } else if (t.missing_thread !== 'retry' && t.missing_thread !== 'skip') {
284
- errors.push('agent target.missing_thread must be "retry" or "skip"');
285
- }
286
- }
287
- if (t.on_terminal !== undefined && t.on_terminal !== 'skip' && t.on_terminal !== 'restart') {
288
- errors.push('agent target.on_terminal must be "skip" or "restart"');
289
- }
290
- break;
291
- }
292
- }
293
- }
294
-
295
- function validateCommonFields(payload: Partial<CreateEventSubscriptionPayload>, errors: string[]): void {
296
- if (payload.description !== undefined && typeof payload.description !== 'string') {
297
- errors.push('description must be a string');
298
- }
299
- if (payload.run_as_role !== undefined && !Object.values(SystemRoles).includes(payload.run_as_role)) {
300
- errors.push(`run_as_role contains unsupported value: ${payload.run_as_role}`);
301
- }
302
- if (payload.enabled !== undefined && typeof payload.enabled !== 'boolean') {
303
- errors.push('enabled must be a boolean');
304
- }
305
- if (payload.priority !== undefined && !EVENT_PRIORITIES.includes(payload.priority)) {
306
- errors.push(`priority must be one of ${EVENT_PRIORITIES.join(', ')}`);
307
- }
308
- }
309
-
310
- export function getCreateEventSubscriptionValidationResult(
311
- payload: CreateEventSubscriptionPayload,
312
- ): EventSubscriptionValidationResult {
313
- const errors: string[] = [];
314
- if (typeof payload?.name !== 'string' || payload.name.trim().length === 0) {
315
- errors.push('name is required');
316
- }
317
- if (payload?.scope !== undefined && payload.scope !== 'account' && payload.scope !== 'project') {
318
- errors.push('scope must be "account" or "project"');
319
- }
320
- if (payload?.filter === undefined) {
321
- errors.push('filter is required');
322
- } else {
323
- validateFilter(payload.filter, errors);
324
- }
325
- if (payload?.target === undefined) {
326
- errors.push('target is required');
327
- } else {
328
- validateTarget(payload.target, errors);
329
- }
330
- // run_as_role is required at creation: every subscription must declare an explicit run-as
331
- // identity so its delivery never falls back to running as the originating (possibly deleted)
332
- // user. validateCommonFields validates the value when present; this enforces presence.
333
- if (payload?.run_as_role === undefined) {
334
- errors.push('run_as_role is required');
335
- }
336
- validateCommonFields(payload ?? {}, errors);
337
- return { valid: errors.length === 0, errors };
338
- }
339
-
340
- export function getUpdateEventSubscriptionValidationResult(
341
- payload: UpdateEventSubscriptionPayload,
342
- ): EventSubscriptionValidationResult {
343
- const errors: string[] = [];
344
- if (!isRecord(payload)) {
345
- return { valid: false, errors: ['update payload must be an object'] };
346
- }
347
- if (payload.name !== undefined && (typeof payload.name !== 'string' || payload.name.trim().length === 0)) {
348
- errors.push('name must be a non-empty string');
349
- }
350
- if (payload.filter !== undefined) {
351
- validateFilter(payload.filter, errors);
352
- }
353
- if (payload.target !== undefined) {
354
- validateTarget(payload.target, errors);
355
- }
356
- validateCommonFields(payload, errors);
357
- return { valid: errors.length === 0, errors };
358
- }
359
-
360
- export function validateCreateEventSubscriptionInput(payload: CreateEventSubscriptionPayload): void {
361
- const result = getCreateEventSubscriptionValidationResult(payload);
362
- if (!result.valid) {
363
- throw new Error(result.errors.join('; '));
364
- }
365
- }
366
-
367
- export function validateUpdateEventSubscriptionInput(payload: UpdateEventSubscriptionPayload): void {
368
- const result = getUpdateEventSubscriptionValidationResult(payload);
369
- if (!result.valid) {
370
- throw new Error(result.errors.join('; '));
371
- }
372
- }
@@ -1,44 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { validateProjectSearchPropertyMappings } from './project.js';
3
-
4
- describe('validateProjectSearchPropertyMappings', () => {
5
- it('accepts supported leaf mappings on relative property paths', () => {
6
- expect(
7
- validateProjectSearchPropertyMappings({
8
- order_total: { type: 'double', ignore_malformed: true },
9
- release_date: {
10
- type: 'date',
11
- format: 'strict_date_optional_time||yyyy-MM-dd',
12
- ignore_malformed: true,
13
- },
14
- 'customer.account_number': { type: 'keyword', ignore_above: 128 },
15
- }),
16
- ).toEqual([]);
17
- });
18
-
19
- it('rejects unsupported mapping options and types', () => {
20
- const issues = validateProjectSearchPropertyMappings({
21
- order_total: { type: 'scaled_float', scaling_factor: 100 },
22
- release_date: { type: 'keyword', format: 'yyyy-MM-dd' },
23
- customer: { type: 'keyword', ignore_malformed: true },
24
- });
25
-
26
- expect(issues).toEqual(
27
- expect.arrayContaining([
28
- expect.stringContaining('unsupported option(s): scaling_factor'),
29
- expect.stringContaining('type must be one of'),
30
- expect.stringContaining('format is supported only for date mappings'),
31
- expect.stringContaining('ignore_malformed is supported only for long, double, and date mappings'),
32
- ]),
33
- );
34
- });
35
-
36
- it('allows parent and child leaf mappings for subobjects:false indexes', () => {
37
- expect(
38
- validateProjectSearchPropertyMappings({
39
- customer: { type: 'keyword' },
40
- 'customer.name': { type: 'keyword' },
41
- }),
42
- ).toEqual([]);
43
- });
44
- });