hazo_collab_forms 3.1.7 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (284) hide show
  1. package/CHANGE_LOG.md +201 -0
  2. package/README.md +3 -0
  3. package/dist/components/clarification/clarification_item_body.d.ts +19 -1
  4. package/dist/components/clarification/clarification_item_body.d.ts.map +1 -1
  5. package/dist/components/clarification/clarification_item_body.js +114 -6
  6. package/dist/components/clarification/clarification_item_body.js.map +1 -1
  7. package/dist/components/clarification/clarification_thread.js +1 -1
  8. package/dist/components/clarification/clarification_thread.js.map +1 -1
  9. package/dist/components/clarification/index.d.ts +2 -0
  10. package/dist/components/clarification/index.d.ts.map +1 -1
  11. package/dist/components/clarification/index.js +1 -0
  12. package/dist/components/clarification/index.js.map +1 -1
  13. package/dist/components/clarification/resolution_status_strip.d.ts +18 -0
  14. package/dist/components/clarification/resolution_status_strip.d.ts.map +1 -0
  15. package/dist/components/clarification/resolution_status_strip.js +20 -0
  16. package/dist/components/clarification/resolution_status_strip.js.map +1 -0
  17. package/dist/components/hazo_fb_form/context.d.ts +1 -1
  18. package/dist/components/hazo_fb_form/context.d.ts.map +1 -1
  19. package/dist/components/hazo_fb_form/hazo_fb_form.d.ts.map +1 -1
  20. package/dist/components/hazo_fb_form/hazo_fb_form.js +330 -113
  21. package/dist/components/hazo_fb_form/hazo_fb_form.js.map +1 -1
  22. package/dist/components/hazo_fb_form/hooks/use_fb_form_state.d.ts +3 -3
  23. package/dist/components/hazo_fb_form/hooks/use_fb_form_state.d.ts.map +1 -1
  24. package/dist/components/hazo_fb_form/hooks/use_fb_form_state.js +339 -46
  25. package/dist/components/hazo_fb_form/hooks/use_fb_form_state.js.map +1 -1
  26. package/dist/components/hazo_fb_form/hooks/use_llm_run.d.ts +3 -1
  27. package/dist/components/hazo_fb_form/hooks/use_llm_run.d.ts.map +1 -1
  28. package/dist/components/hazo_fb_form/hooks/use_llm_run.js +89 -11
  29. package/dist/components/hazo_fb_form/hooks/use_llm_run.js.map +1 -1
  30. package/dist/components/hazo_fb_form/shared/agent_stepper.js +1 -1
  31. package/dist/components/hazo_fb_form/shared/agent_stepper.js.map +1 -1
  32. package/dist/components/hazo_fb_form/shared/file_status_accordion.d.ts +9 -0
  33. package/dist/components/hazo_fb_form/shared/file_status_accordion.d.ts.map +1 -0
  34. package/dist/components/hazo_fb_form/shared/file_status_accordion.js +39 -0
  35. package/dist/components/hazo_fb_form/shared/file_status_accordion.js.map +1 -0
  36. package/dist/components/hazo_fb_form/shared/format.d.ts.map +1 -1
  37. package/dist/components/hazo_fb_form/shared/format.js +8 -3
  38. package/dist/components/hazo_fb_form/shared/format.js.map +1 -1
  39. package/dist/components/hazo_fb_form/shared/send_back_item_card.d.ts +7 -1
  40. package/dist/components/hazo_fb_form/shared/send_back_item_card.d.ts.map +1 -1
  41. package/dist/components/hazo_fb_form/shared/send_back_item_card.js +6 -3
  42. package/dist/components/hazo_fb_form/shared/send_back_item_card.js.map +1 -1
  43. package/dist/components/hazo_fb_form/types.d.ts +3 -1
  44. package/dist/components/hazo_fb_form/types.d.ts.map +1 -1
  45. package/dist/components/hazo_fb_form/views/back_office_view.js +1 -1
  46. package/dist/components/hazo_fb_form/views/back_office_view.js.map +1 -1
  47. package/dist/components/hazo_fb_form/views/clarifications_view.js +2 -2
  48. package/dist/components/hazo_fb_form/views/clarifications_view.js.map +1 -1
  49. package/dist/components/hazo_fb_form/views/front_office_view.d.ts.map +1 -1
  50. package/dist/components/hazo_fb_form/views/front_office_view.js +62 -41
  51. package/dist/components/hazo_fb_form/views/front_office_view.js.map +1 -1
  52. package/dist/components/hazo_fb_form/views/interim_view.js +3 -3
  53. package/dist/components/hazo_fb_form/views/interim_view.js.map +1 -1
  54. package/dist/components/hazo_fb_form/views/review_queue_view.d.ts.map +1 -1
  55. package/dist/components/hazo_fb_form/views/review_queue_view.js +22 -9
  56. package/dist/components/hazo_fb_form/views/review_queue_view.js.map +1 -1
  57. package/dist/components/hazo_validation_rule_editor/components/rule_editor.d.ts.map +1 -1
  58. package/dist/components/hazo_validation_rule_editor/components/rule_editor.js +32 -3
  59. package/dist/components/hazo_validation_rule_editor/components/rule_editor.js.map +1 -1
  60. package/dist/components/hazo_validation_rule_editor/components/variable_chain_input.d.ts +20 -0
  61. package/dist/components/hazo_validation_rule_editor/components/variable_chain_input.d.ts.map +1 -0
  62. package/dist/components/hazo_validation_rule_editor/components/variable_chain_input.js +34 -0
  63. package/dist/components/hazo_validation_rule_editor/components/variable_chain_input.js.map +1 -0
  64. package/dist/components/hazo_validation_rule_editor/context.d.ts +3 -2
  65. package/dist/components/hazo_validation_rule_editor/context.d.ts.map +1 -1
  66. package/dist/components/hazo_validation_rule_editor/context.js +15 -3
  67. package/dist/components/hazo_validation_rule_editor/context.js.map +1 -1
  68. package/dist/components/hazo_validation_rule_editor/types.d.ts +7 -1
  69. package/dist/components/hazo_validation_rule_editor/types.d.ts.map +1 -1
  70. package/dist/components/hazo_validation_rule_editor/validation_rule_editor.d.ts +1 -1
  71. package/dist/components/hazo_validation_rule_editor/validation_rule_editor.d.ts.map +1 -1
  72. package/dist/components/hazo_validation_rule_editor/validation_rule_editor.js +2 -2
  73. package/dist/components/hazo_validation_rule_editor/validation_rule_editor.js.map +1 -1
  74. package/dist/components/index.d.ts +2 -0
  75. package/dist/components/index.d.ts.map +1 -1
  76. package/dist/components/index.js +2 -0
  77. package/dist/components/index.js.map +1 -1
  78. package/dist/components/shared/document_type_editor.d.ts +31 -0
  79. package/dist/components/shared/document_type_editor.d.ts.map +1 -0
  80. package/dist/components/shared/document_type_editor.js +60 -0
  81. package/dist/components/shared/document_type_editor.js.map +1 -0
  82. package/dist/components/shared/file_bar/file_bar.d.ts +7 -1
  83. package/dist/components/shared/file_bar/file_bar.d.ts.map +1 -1
  84. package/dist/components/shared/file_bar/file_bar.js +5 -3
  85. package/dist/components/shared/file_bar/file_bar.js.map +1 -1
  86. package/dist/components/shared/file_bar/file_bar_validation_dialog.js +4 -4
  87. package/dist/components/shared/file_bar/file_bar_validation_dialog.js.map +1 -1
  88. package/dist/components/shared/file_status_icon.d.ts +23 -0
  89. package/dist/components/shared/file_status_icon.d.ts.map +1 -0
  90. package/dist/components/shared/file_status_icon.js +38 -0
  91. package/dist/components/shared/file_status_icon.js.map +1 -0
  92. package/dist/components/shared/json_data_panel/json_data_panel.d.ts +1 -1
  93. package/dist/components/shared/json_data_panel/json_data_panel.d.ts.map +1 -1
  94. package/dist/components/shared/json_data_panel/json_data_panel.js +27 -2
  95. package/dist/components/shared/json_data_panel/json_data_panel.js.map +1 -1
  96. package/dist/components/shared/rule_result_card.d.ts.map +1 -1
  97. package/dist/components/shared/rule_result_card.js +5 -4
  98. package/dist/components/shared/rule_result_card.js.map +1 -1
  99. package/dist/components/thread_form/components/add_question_dialog.d.ts +12 -0
  100. package/dist/components/thread_form/components/add_question_dialog.d.ts.map +1 -0
  101. package/dist/components/thread_form/components/add_question_dialog.js +36 -0
  102. package/dist/components/thread_form/components/add_question_dialog.js.map +1 -0
  103. package/dist/components/thread_form/components/agent_compose_dialog.d.ts +30 -0
  104. package/dist/components/thread_form/components/agent_compose_dialog.d.ts.map +1 -0
  105. package/dist/components/thread_form/components/agent_compose_dialog.js +45 -0
  106. package/dist/components/thread_form/components/agent_compose_dialog.js.map +1 -0
  107. package/dist/components/thread_form/components/clarification.d.ts +14 -0
  108. package/dist/components/thread_form/components/clarification.d.ts.map +1 -0
  109. package/dist/components/thread_form/components/clarification.js +12 -0
  110. package/dist/components/thread_form/components/clarification.js.map +1 -0
  111. package/dist/components/thread_form/components/collected_data_view.d.ts +15 -0
  112. package/dist/components/thread_form/components/collected_data_view.d.ts.map +1 -0
  113. package/dist/components/thread_form/components/collected_data_view.js +121 -0
  114. package/dist/components/thread_form/components/collected_data_view.js.map +1 -0
  115. package/dist/components/thread_form/components/coverage_card.d.ts +11 -0
  116. package/dist/components/thread_form/components/coverage_card.d.ts.map +1 -0
  117. package/dist/components/thread_form/components/coverage_card.js +60 -0
  118. package/dist/components/thread_form/components/coverage_card.js.map +1 -0
  119. package/dist/components/thread_form/components/file_bar.d.ts +93 -0
  120. package/dist/components/thread_form/components/file_bar.d.ts.map +1 -0
  121. package/dist/components/thread_form/components/file_bar.js +251 -0
  122. package/dist/components/thread_form/components/file_bar.js.map +1 -0
  123. package/dist/components/thread_form/components/file_info_dialog.d.ts +15 -0
  124. package/dist/components/thread_form/components/file_info_dialog.d.ts.map +1 -0
  125. package/dist/components/thread_form/components/file_info_dialog.js +64 -0
  126. package/dist/components/thread_form/components/file_info_dialog.js.map +1 -0
  127. package/dist/components/thread_form/components/issue_group_tree.d.ts +20 -0
  128. package/dist/components/thread_form/components/issue_group_tree.d.ts.map +1 -0
  129. package/dist/components/thread_form/components/issue_group_tree.js +164 -0
  130. package/dist/components/thread_form/components/issue_group_tree.js.map +1 -0
  131. package/dist/components/thread_form/components/pdf_side_panel.d.ts +20 -0
  132. package/dist/components/thread_form/components/pdf_side_panel.d.ts.map +1 -0
  133. package/dist/components/thread_form/components/pdf_side_panel.js +63 -0
  134. package/dist/components/thread_form/components/pdf_side_panel.js.map +1 -0
  135. package/dist/components/thread_form/components/rule_decision_row.d.ts +31 -0
  136. package/dist/components/thread_form/components/rule_decision_row.d.ts.map +1 -0
  137. package/dist/components/thread_form/components/rule_decision_row.js +20 -0
  138. package/dist/components/thread_form/components/rule_decision_row.js.map +1 -0
  139. package/dist/components/thread_form/components/send_back_message.d.ts +32 -0
  140. package/dist/components/thread_form/components/send_back_message.d.ts.map +1 -0
  141. package/dist/components/thread_form/components/send_back_message.js +82 -0
  142. package/dist/components/thread_form/components/send_back_message.js.map +1 -0
  143. package/dist/components/thread_form/components/shared.d.ts +54 -0
  144. package/dist/components/thread_form/components/shared.d.ts.map +1 -0
  145. package/dist/components/thread_form/components/shared.js +136 -0
  146. package/dist/components/thread_form/components/shared.js.map +1 -0
  147. package/dist/components/thread_form/components/task_card.d.ts +90 -0
  148. package/dist/components/thread_form/components/task_card.d.ts.map +1 -0
  149. package/dist/components/thread_form/components/task_card.js +63 -0
  150. package/dist/components/thread_form/components/task_card.js.map +1 -0
  151. package/dist/components/thread_form/components/text_doc_check.d.ts +15 -0
  152. package/dist/components/thread_form/components/text_doc_check.d.ts.map +1 -0
  153. package/dist/components/thread_form/components/text_doc_check.js +16 -0
  154. package/dist/components/thread_form/components/text_doc_check.js.map +1 -0
  155. package/dist/components/thread_form/components/text_extraction.d.ts +14 -0
  156. package/dist/components/thread_form/components/text_extraction.d.ts.map +1 -0
  157. package/dist/components/thread_form/components/text_extraction.js +16 -0
  158. package/dist/components/thread_form/components/text_extraction.js.map +1 -0
  159. package/dist/components/thread_form/components/thread_composer.d.ts +15 -0
  160. package/dist/components/thread_form/components/thread_composer.d.ts.map +1 -0
  161. package/dist/components/thread_form/components/thread_composer.js +93 -0
  162. package/dist/components/thread_form/components/thread_composer.js.map +1 -0
  163. package/dist/components/thread_form/components/thread_timeline.d.ts +65 -0
  164. package/dist/components/thread_form/components/thread_timeline.d.ts.map +1 -0
  165. package/dist/components/thread_form/components/thread_timeline.js +225 -0
  166. package/dist/components/thread_form/components/thread_timeline.js.map +1 -0
  167. package/dist/components/thread_form/hooks/use_file_pipeline.d.ts +126 -0
  168. package/dist/components/thread_form/hooks/use_file_pipeline.d.ts.map +1 -0
  169. package/dist/components/thread_form/hooks/use_file_pipeline.js +760 -0
  170. package/dist/components/thread_form/hooks/use_file_pipeline.js.map +1 -0
  171. package/dist/components/thread_form/hooks/use_thread_form.d.ts +36 -0
  172. package/dist/components/thread_form/hooks/use_thread_form.d.ts.map +1 -0
  173. package/dist/components/thread_form/hooks/use_thread_form.js +126 -0
  174. package/dist/components/thread_form/hooks/use_thread_form.js.map +1 -0
  175. package/dist/components/thread_form/index.d.ts +33 -0
  176. package/dist/components/thread_form/index.d.ts.map +1 -0
  177. package/dist/components/thread_form/index.js +30 -0
  178. package/dist/components/thread_form/index.js.map +1 -0
  179. package/dist/components/thread_form/sample_data.d.ts +8 -0
  180. package/dist/components/thread_form/sample_data.d.ts.map +1 -0
  181. package/dist/components/thread_form/sample_data.js +658 -0
  182. package/dist/components/thread_form/sample_data.js.map +1 -0
  183. package/dist/components/thread_form/thread_form.d.ts +7 -0
  184. package/dist/components/thread_form/thread_form.d.ts.map +1 -0
  185. package/dist/components/thread_form/thread_form.js +1385 -0
  186. package/dist/components/thread_form/thread_form.js.map +1 -0
  187. package/dist/components/thread_form/types.d.ts +402 -0
  188. package/dist/components/thread_form/types.d.ts.map +1 -0
  189. package/dist/components/thread_form/types.js +23 -0
  190. package/dist/components/thread_form/types.js.map +1 -0
  191. package/dist/components/thread_form/utils/file_decision_state.d.ts +22 -0
  192. package/dist/components/thread_form/utils/file_decision_state.d.ts.map +1 -0
  193. package/dist/components/thread_form/utils/file_decision_state.js +37 -0
  194. package/dist/components/thread_form/utils/file_decision_state.js.map +1 -0
  195. package/dist/components/thread_form/utils/merge_send_back.d.ts +13 -0
  196. package/dist/components/thread_form/utils/merge_send_back.d.ts.map +1 -0
  197. package/dist/components/thread_form/utils/merge_send_back.js +23 -0
  198. package/dist/components/thread_form/utils/merge_send_back.js.map +1 -0
  199. package/dist/lib/autofill_handler.d.ts.map +1 -1
  200. package/dist/lib/autofill_handler.js +5 -44
  201. package/dist/lib/autofill_handler.js.map +1 -1
  202. package/dist/lib/classification_handler.d.ts +105 -0
  203. package/dist/lib/classification_handler.d.ts.map +1 -0
  204. package/dist/lib/classification_handler.js +342 -0
  205. package/dist/lib/classification_handler.js.map +1 -0
  206. package/dist/lib/content_gate_handler.d.ts +37 -0
  207. package/dist/lib/content_gate_handler.d.ts.map +1 -0
  208. package/dist/lib/content_gate_handler.js +126 -0
  209. package/dist/lib/content_gate_handler.js.map +1 -0
  210. package/dist/lib/index.d.ts +10 -0
  211. package/dist/lib/index.d.ts.map +1 -1
  212. package/dist/lib/index.js +5 -0
  213. package/dist/lib/index.js.map +1 -1
  214. package/dist/lib/periodic_coverage_runner.d.ts +24 -0
  215. package/dist/lib/periodic_coverage_runner.d.ts.map +1 -0
  216. package/dist/lib/periodic_coverage_runner.js +121 -0
  217. package/dist/lib/periodic_coverage_runner.js.map +1 -0
  218. package/dist/lib/resolution_handler.d.ts +150 -0
  219. package/dist/lib/resolution_handler.d.ts.map +1 -0
  220. package/dist/lib/resolution_handler.js +597 -0
  221. package/dist/lib/resolution_handler.js.map +1 -0
  222. package/dist/lib/resolve_variable.d.ts +25 -0
  223. package/dist/lib/resolve_variable.d.ts.map +1 -0
  224. package/dist/lib/resolve_variable.js +77 -0
  225. package/dist/lib/resolve_variable.js.map +1 -0
  226. package/dist/lib/validation_handler.d.ts +27 -3
  227. package/dist/lib/validation_handler.d.ts.map +1 -1
  228. package/dist/lib/validation_handler.js +338 -288
  229. package/dist/lib/validation_handler.js.map +1 -1
  230. package/dist/types/clarification.d.ts +54 -0
  231. package/dist/types/clarification.d.ts.map +1 -1
  232. package/dist/types/fb_form_data.d.ts +273 -123
  233. package/dist/types/fb_form_data.d.ts.map +1 -1
  234. package/dist/types/fb_form_data.js +44 -58
  235. package/dist/types/fb_form_data.js.map +1 -1
  236. package/dist/types/fb_form_data_v1.d.ts +250 -0
  237. package/dist/types/fb_form_data_v1.d.ts.map +1 -0
  238. package/dist/types/fb_form_data_v1.js +117 -0
  239. package/dist/types/fb_form_data_v1.js.map +1 -0
  240. package/dist/types/fb_form_instance.d.ts +1 -1
  241. package/dist/types/fb_form_instance.d.ts.map +1 -1
  242. package/dist/types/index.d.ts +5 -3
  243. package/dist/types/index.d.ts.map +1 -1
  244. package/dist/types/index.js +2 -1
  245. package/dist/types/index.js.map +1 -1
  246. package/dist/types/validation.d.ts +134 -12
  247. package/dist/types/validation.d.ts.map +1 -1
  248. package/dist/utils/expectation_extractor.d.ts +31 -0
  249. package/dist/utils/expectation_extractor.d.ts.map +1 -0
  250. package/dist/utils/expectation_extractor.js +142 -0
  251. package/dist/utils/expectation_extractor.js.map +1 -0
  252. package/dist/utils/fb_data_adapter.d.ts +7 -2
  253. package/dist/utils/fb_data_adapter.d.ts.map +1 -1
  254. package/dist/utils/fb_data_adapter.js +58 -7
  255. package/dist/utils/fb_data_adapter.js.map +1 -1
  256. package/dist/utils/fb_data_adapter_v2.d.ts +17 -0
  257. package/dist/utils/fb_data_adapter_v2.d.ts.map +1 -0
  258. package/dist/utils/fb_data_adapter_v2.js +483 -0
  259. package/dist/utils/fb_data_adapter_v2.js.map +1 -0
  260. package/dist/utils/fb_data_helpers.d.ts +1 -1
  261. package/dist/utils/fb_data_helpers.d.ts.map +1 -1
  262. package/dist/utils/fb_data_mutations.d.ts +1 -1
  263. package/dist/utils/fb_data_mutations.d.ts.map +1 -1
  264. package/dist/utils/fb_data_mutations_v2.d.ts +46 -0
  265. package/dist/utils/fb_data_mutations_v2.d.ts.map +1 -0
  266. package/dist/utils/fb_data_mutations_v2.js +341 -0
  267. package/dist/utils/fb_data_mutations_v2.js.map +1 -0
  268. package/dist/utils/fb_data_queries.d.ts +81 -0
  269. package/dist/utils/fb_data_queries.d.ts.map +1 -0
  270. package/dist/utils/fb_data_queries.js +354 -0
  271. package/dist/utils/fb_data_queries.js.map +1 -0
  272. package/dist/utils/index.d.ts +4 -0
  273. package/dist/utils/index.d.ts.map +1 -1
  274. package/dist/utils/index.js +6 -0
  275. package/dist/utils/index.js.map +1 -1
  276. package/dist/utils/issue_bucketing.d.ts +36 -0
  277. package/dist/utils/issue_bucketing.d.ts.map +1 -0
  278. package/dist/utils/issue_bucketing.js +107 -0
  279. package/dist/utils/issue_bucketing.js.map +1 -0
  280. package/dist/utils/validation_result.d.ts +32 -0
  281. package/dist/utils/validation_result.d.ts.map +1 -0
  282. package/dist/utils/validation_result.js +55 -0
  283. package/dist/utils/validation_result.js.map +1 -0
  284. package/package.json +16 -4
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Resolve variable references (e.g. `@tenant_start_date`, `@Beginning_Of_Tax_Year`)
3
+ * against the active form data and session-level constants.
4
+ *
5
+ * Variable syntax: `@<name>`. Resolution order:
6
+ * 1. Session vars (by key name) — tax-year boundaries, client name, etc.
7
+ * 2. Form-field values — looked up by `question_field_id` in `FbFormData.data[]`.
8
+ *
9
+ * Empty-string and whitespace-only values are treated as null so a chain like
10
+ * ['@tenant_start_date', '@Beginning_Of_Tax_Year']
11
+ * falls through to the fallback when the user has not yet entered a tenant date.
12
+ */
13
+ /** Resolve a single variable reference. Returns the value or null if unresolved/empty. */
14
+ export function resolve_variable(ref, ctx) {
15
+ if (!ref.startsWith('@'))
16
+ return null;
17
+ const name = ref.slice(1);
18
+ // Session-level constants take precedence by name (e.g. Beginning_Of_Tax_Year).
19
+ if (Object.prototype.hasOwnProperty.call(ctx.session, name)) {
20
+ return non_empty(ctx.session[name]);
21
+ }
22
+ // Otherwise, treat as form-field reference.
23
+ if (ctx.form_data) {
24
+ return non_empty(lookup_form_field(ctx.form_data, name));
25
+ }
26
+ return null;
27
+ }
28
+ /** Walk the chain. Return the first non-empty resolved value, or null if none resolve. */
29
+ export function resolve_variable_chain(chain, ctx) {
30
+ for (const ref of chain) {
31
+ const v = resolve_variable(ref, ctx);
32
+ if (v !== null)
33
+ return v;
34
+ }
35
+ return null;
36
+ }
37
+ function non_empty(v) {
38
+ if (v === null || v === undefined)
39
+ return null;
40
+ const s = String(v).trim();
41
+ return s.length === 0 ? null : s;
42
+ }
43
+ /**
44
+ * Look up a form-field value by question id within FbFormData.
45
+ *
46
+ * The v2 hierarchical model stores user input under
47
+ * data[].client_data[].client_input.{data_text|data_option}
48
+ * keyed against a question identified by `question.question_field_id`.
49
+ *
50
+ * We return the first non-empty `data_text` we find for the matching question;
51
+ * if no text input exists we fall back to `data_option`. Returns null when the
52
+ * question is absent or no input has been provided.
53
+ */
54
+ function lookup_form_field(form_data, field_id) {
55
+ for (const entry of form_data.data ?? []) {
56
+ if (entry.question?.question_field_id !== field_id)
57
+ continue;
58
+ for (const cd of entry.client_data ?? []) {
59
+ const inputs = Array.isArray(cd.client_input)
60
+ ? cd.client_input
61
+ : [cd.client_input];
62
+ // Prefer text input; fall back to option code.
63
+ for (const inp of inputs) {
64
+ if (inp?.data_text != null && String(inp.data_text).trim().length > 0) {
65
+ return String(inp.data_text);
66
+ }
67
+ }
68
+ for (const inp of inputs) {
69
+ if (inp?.data_option != null && String(inp.data_option).trim().length > 0) {
70
+ return String(inp.data_option);
71
+ }
72
+ }
73
+ }
74
+ }
75
+ return null;
76
+ }
77
+ //# sourceMappingURL=resolve_variable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve_variable.js","sourceRoot":"","sources":["../../src/lib/resolve_variable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAaH,0FAA0F;AAC1F,MAAM,UAAU,gBAAgB,CAAC,GAAW,EAAE,GAAmB;IAC/D,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACtC,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAE1B,gFAAgF;IAChF,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC;QAC5D,OAAO,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,CAAC;IAED,4CAA4C;IAC5C,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;QAClB,OAAO,SAAS,CAAC,iBAAiB,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,sBAAsB,CAAC,KAAoB,EAAE,GAAmB;IAC9E,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;QACxB,MAAM,CAAC,GAAG,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK,IAAI;YAAE,OAAO,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,SAAS,CAAC,CAAU;IAC3B,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAC/C,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3B,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAS,iBAAiB,CAAC,SAAqB,EAAE,QAAgB;IAChE,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;QACzC,IAAI,KAAK,CAAC,QAAQ,EAAE,iBAAiB,KAAK,QAAQ;YAAE,SAAS;QAE7D,KAAK,MAAM,EAAE,IAAI,KAAK,CAAC,WAAW,IAAI,EAAE,EAAE,CAAC;YACzC,MAAM,MAAM,GAAoB,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC;gBAC5D,CAAC,CAAC,EAAE,CAAC,YAAY;gBACjB,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC;YACtB,+CAA+C;YAC/C,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;gBACzB,IAAI,GAAG,EAAE,SAAS,IAAI,IAAI,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACtE,OAAO,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;gBAC/B,CAAC;YACH,CAAC;YACD,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;gBACzB,IAAI,GAAG,EAAE,WAAW,IAAI,IAAI,IAAI,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC1E,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;gBACjC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * Server-side validation route handler factory.
3
3
  *
4
- * Creates a POST handler that executes validation rules against uploaded documents
5
- * using LLM analysis, and returns ClarificationItems for any issues found.
4
+ * Creates a POST handler that executes validation rules against uploaded
5
+ * documents or plain text using LLM analysis, and returns ClarificationItems
6
+ * for any issues found.
6
7
  *
7
8
  * Usage:
8
9
  * import { create_validation_route } from 'hazo_collab_forms/lib';
@@ -12,7 +13,29 @@
12
13
  * hazo_llm_api is dynamically imported so it's only required at runtime.
13
14
  */
14
15
  import 'server-only';
15
- import type { ValidationRouteOptions } from '../types/validation.js';
16
+ import type { ValidationIssue, ValidationRouteOptions, ValidationFileEntry } from '../types/validation.js';
17
+ /**
18
+ * Parse the LLM response into a ValidationRuleResult.
19
+ *
20
+ * Expected shape (per validation/response_wrapper in hazo_prompts):
21
+ * {
22
+ * "summary": "...", // optional rule-level explanation
23
+ * "issues": [ // empty = passed
24
+ * { "description": "...", "amount": "...", "date": "...", "reason": "...",
25
+ * "client_comment": "...", "confidence": 0.9 }
26
+ * ],
27
+ * "confidence": 0.95 // optional rule-level confidence
28
+ * }
29
+ *
30
+ * Tolerates: direct JSON, fenced code block, regex-extracted object, and
31
+ * top-level arrays (treated as the issues array).
32
+ */
33
+ export declare function parse_response(text: string, rule_id: string): {
34
+ summary?: string;
35
+ issues: ValidationIssue[];
36
+ confidence?: number;
37
+ extracted_data?: Record<string, unknown>;
38
+ };
16
39
  /**
17
40
  * Creates a POST route handler for document validation.
18
41
  *
@@ -24,4 +47,5 @@ import type { ValidationRouteOptions } from '../types/validation.js';
24
47
  * 5. Returns the results
25
48
  */
26
49
  export declare function create_validation_route(options?: ValidationRouteOptions): (request: Request) => Promise<Response>;
50
+ export type { ValidationFileEntry };
27
51
  //# sourceMappingURL=validation_handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validation_handler.d.ts","sourceRoot":"","sources":["../../src/lib/validation_handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,EAKV,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAoLhC;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,sBAAsB,IAyM3C,SAAS,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC,CAyMhE"}
1
+ {"version":3,"file":"validation_handler.d.ts","sourceRoot":"","sources":["../../src/lib/validation_handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,EAKV,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AA2DhC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC1C,CAuFA;AAgED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,sBAAsB,IA2O3C,SAAS,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC,CAwKhE;AAGD,YAAY,EAAE,mBAAmB,EAAE,CAAC"}