@hexabot-ai/types 3.0.0-alpha.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 (294) hide show
  1. package/LICENSE.md +120 -0
  2. package/README.md +172 -0
  3. package/dist/cjs/analytics/index.js +18 -0
  4. package/dist/cjs/analytics/integration-health.js +30 -0
  5. package/dist/cjs/analytics/stats.js +32 -0
  6. package/dist/cjs/attachment/attachment.js +53 -0
  7. package/dist/cjs/attachment/index.js +16 -0
  8. package/dist/cjs/audit/audit-log.js +33 -0
  9. package/dist/cjs/audit/index.js +11 -0
  10. package/dist/cjs/channel/channel-metadata.js +15 -0
  11. package/dist/cjs/channel/index.js +15 -0
  12. package/dist/cjs/channel/source-full.js +16 -0
  13. package/dist/cjs/channel/source.js +25 -0
  14. package/dist/cjs/chat/attachment.js +32 -0
  15. package/dist/cjs/chat/button.js +70 -0
  16. package/dist/cjs/chat/index.js +87 -0
  17. package/dist/cjs/chat/label-group.js +22 -0
  18. package/dist/cjs/chat/label.js +37 -0
  19. package/dist/cjs/chat/message-contract.js +183 -0
  20. package/dist/cjs/chat/message.js +107 -0
  21. package/dist/cjs/chat/options.js +122 -0
  22. package/dist/cjs/chat/quick-reply.js +35 -0
  23. package/dist/cjs/chat/subscriber.js +36 -0
  24. package/dist/cjs/chat/thread.js +36 -0
  25. package/dist/cjs/cms/content-type.js +17 -0
  26. package/dist/cjs/cms/content.js +29 -0
  27. package/dist/cjs/cms/index.js +21 -0
  28. package/dist/cjs/cms/menu.js +36 -0
  29. package/dist/cjs/dummy/dummy.js +18 -0
  30. package/dist/cjs/dummy/index.js +12 -0
  31. package/dist/cjs/i18n/index.js +16 -0
  32. package/dist/cjs/i18n/language.js +19 -0
  33. package/dist/cjs/i18n/translation.js +17 -0
  34. package/dist/cjs/index.js +32 -0
  35. package/dist/cjs/setting/index.js +18 -0
  36. package/dist/cjs/setting/metadata.js +17 -0
  37. package/dist/cjs/setting/setting.js +36 -0
  38. package/dist/cjs/shared/aliases.js +41 -0
  39. package/dist/cjs/shared/base.js +14 -0
  40. package/dist/cjs/shared/object.js +19 -0
  41. package/dist/cjs/shared/preprocess.js +13 -0
  42. package/dist/cjs/shared/profile.js +33 -0
  43. package/dist/cjs/user/credential.js +26 -0
  44. package/dist/cjs/user/domain.js +56 -0
  45. package/dist/cjs/user/index.js +39 -0
  46. package/dist/cjs/user/model.js +24 -0
  47. package/dist/cjs/user/permission.js +32 -0
  48. package/dist/cjs/user/role.js +24 -0
  49. package/dist/cjs/user/user-profile-assigned.js +38 -0
  50. package/dist/cjs/user/user-profile.js +12 -0
  51. package/dist/cjs/user/user.js +44 -0
  52. package/dist/cjs/workflow/domain.js +44 -0
  53. package/dist/cjs/workflow/helpers.js +35 -0
  54. package/dist/cjs/workflow/index.js +40 -0
  55. package/dist/cjs/workflow/mcp-server.js +33 -0
  56. package/dist/cjs/workflow/memory-definition.js +21 -0
  57. package/dist/cjs/workflow/memory-record.js +44 -0
  58. package/dist/cjs/workflow/workflow-run.js +100 -0
  59. package/dist/cjs/workflow/workflow-version.js +39 -0
  60. package/dist/cjs/workflow/workflow.js +98 -0
  61. package/dist/esm/analytics/index.js +7 -0
  62. package/dist/esm/analytics/integration-health.js +27 -0
  63. package/dist/esm/analytics/stats.js +29 -0
  64. package/dist/esm/attachment/attachment.js +50 -0
  65. package/dist/esm/attachment/index.js +6 -0
  66. package/dist/esm/audit/audit-log.js +30 -0
  67. package/dist/esm/audit/index.js +6 -0
  68. package/dist/esm/channel/channel-metadata.js +12 -0
  69. package/dist/esm/channel/index.js +8 -0
  70. package/dist/esm/channel/source-full.js +13 -0
  71. package/dist/esm/channel/source.js +22 -0
  72. package/dist/esm/chat/attachment.js +29 -0
  73. package/dist/esm/chat/button.js +67 -0
  74. package/dist/esm/chat/index.js +15 -0
  75. package/dist/esm/chat/label-group.js +19 -0
  76. package/dist/esm/chat/label.js +34 -0
  77. package/dist/esm/chat/message-contract.js +180 -0
  78. package/dist/esm/chat/message.js +104 -0
  79. package/dist/esm/chat/options.js +119 -0
  80. package/dist/esm/chat/quick-reply.js +32 -0
  81. package/dist/esm/chat/subscriber.js +33 -0
  82. package/dist/esm/chat/thread.js +33 -0
  83. package/dist/esm/cms/content-type.js +14 -0
  84. package/dist/esm/cms/content.js +26 -0
  85. package/dist/esm/cms/index.js +8 -0
  86. package/dist/esm/cms/menu.js +33 -0
  87. package/dist/esm/dummy/dummy.js +15 -0
  88. package/dist/esm/dummy/index.js +6 -0
  89. package/dist/esm/i18n/index.js +7 -0
  90. package/dist/esm/i18n/language.js +16 -0
  91. package/dist/esm/i18n/translation.js +14 -0
  92. package/dist/esm/index.js +16 -0
  93. package/dist/esm/setting/index.js +7 -0
  94. package/dist/esm/setting/metadata.js +14 -0
  95. package/dist/esm/setting/setting.js +33 -0
  96. package/dist/esm/shared/aliases.js +35 -0
  97. package/dist/esm/shared/base.js +11 -0
  98. package/dist/esm/shared/object.js +14 -0
  99. package/dist/esm/shared/preprocess.js +9 -0
  100. package/dist/esm/shared/profile.js +30 -0
  101. package/dist/esm/user/credential.js +23 -0
  102. package/dist/esm/user/domain.js +53 -0
  103. package/dist/esm/user/index.js +13 -0
  104. package/dist/esm/user/model.js +21 -0
  105. package/dist/esm/user/permission.js +29 -0
  106. package/dist/esm/user/role.js +21 -0
  107. package/dist/esm/user/user-profile-assigned.js +35 -0
  108. package/dist/esm/user/user-profile.js +9 -0
  109. package/dist/esm/user/user.js +41 -0
  110. package/dist/esm/workflow/domain.js +41 -0
  111. package/dist/esm/workflow/helpers.js +30 -0
  112. package/dist/esm/workflow/index.js +12 -0
  113. package/dist/esm/workflow/mcp-server.js +30 -0
  114. package/dist/esm/workflow/memory-definition.js +18 -0
  115. package/dist/esm/workflow/memory-record.js +41 -0
  116. package/dist/esm/workflow/workflow-run.js +96 -0
  117. package/dist/esm/workflow/workflow-version.js +36 -0
  118. package/dist/esm/workflow/workflow.js +94 -0
  119. package/dist/types/analytics/index.d.ts +3 -0
  120. package/dist/types/analytics/index.d.ts.map +1 -0
  121. package/dist/types/analytics/integration-health.d.ts +55 -0
  122. package/dist/types/analytics/integration-health.d.ts.map +1 -0
  123. package/dist/types/analytics/stats.d.ts +43 -0
  124. package/dist/types/analytics/stats.d.ts.map +1 -0
  125. package/dist/types/attachment/attachment.d.ts +212 -0
  126. package/dist/types/attachment/attachment.d.ts.map +1 -0
  127. package/dist/types/attachment/index.d.ts +2 -0
  128. package/dist/types/attachment/index.d.ts.map +1 -0
  129. package/dist/types/audit/audit-log.d.ts +58 -0
  130. package/dist/types/audit/audit-log.d.ts.map +1 -0
  131. package/dist/types/audit/index.d.ts +2 -0
  132. package/dist/types/audit/index.d.ts.map +1 -0
  133. package/dist/types/channel/channel-metadata.d.ts +7 -0
  134. package/dist/types/channel/channel-metadata.d.ts.map +1 -0
  135. package/dist/types/channel/index.d.ts +4 -0
  136. package/dist/types/channel/index.d.ts.map +1 -0
  137. package/dist/types/channel/source-full.d.ts +58 -0
  138. package/dist/types/channel/source-full.d.ts.map +1 -0
  139. package/dist/types/channel/source.d.ts +44 -0
  140. package/dist/types/channel/source.d.ts.map +1 -0
  141. package/dist/types/chat/attachment.d.ts +34 -0
  142. package/dist/types/chat/attachment.d.ts.map +1 -0
  143. package/dist/types/chat/button.d.ts +31 -0
  144. package/dist/types/chat/button.d.ts.map +1 -0
  145. package/dist/types/chat/index.d.ts +11 -0
  146. package/dist/types/chat/index.d.ts.map +1 -0
  147. package/dist/types/chat/label-group.d.ts +47 -0
  148. package/dist/types/chat/label-group.d.ts.map +1 -0
  149. package/dist/types/chat/label.d.ts +102 -0
  150. package/dist/types/chat/label.d.ts.map +1 -0
  151. package/dist/types/chat/message-contract.d.ts +883 -0
  152. package/dist/types/chat/message-contract.d.ts.map +1 -0
  153. package/dist/types/chat/message.d.ts +1132 -0
  154. package/dist/types/chat/message.d.ts.map +1 -0
  155. package/dist/types/chat/options.d.ts +64 -0
  156. package/dist/types/chat/options.d.ts.map +1 -0
  157. package/dist/types/chat/quick-reply.d.ts +32 -0
  158. package/dist/types/chat/quick-reply.d.ts.map +1 -0
  159. package/dist/types/chat/subscriber.d.ts +236 -0
  160. package/dist/types/chat/subscriber.d.ts.map +1 -0
  161. package/dist/types/chat/thread.d.ts +126 -0
  162. package/dist/types/chat/thread.d.ts.map +1 -0
  163. package/dist/types/cms/content-type.d.ts +26 -0
  164. package/dist/types/cms/content-type.d.ts.map +1 -0
  165. package/dist/types/cms/content.d.ts +49 -0
  166. package/dist/types/cms/content.d.ts.map +1 -0
  167. package/dist/types/cms/index.d.ts +4 -0
  168. package/dist/types/cms/index.d.ts.map +1 -0
  169. package/dist/types/cms/menu.d.ts +85 -0
  170. package/dist/types/cms/menu.d.ts.map +1 -0
  171. package/dist/types/dummy/dummy.d.ts +26 -0
  172. package/dist/types/dummy/dummy.d.ts.map +1 -0
  173. package/dist/types/dummy/index.d.ts +2 -0
  174. package/dist/types/dummy/index.d.ts.map +1 -0
  175. package/dist/types/i18n/index.d.ts +3 -0
  176. package/dist/types/i18n/index.d.ts.map +1 -0
  177. package/dist/types/i18n/language.d.ts +32 -0
  178. package/dist/types/i18n/language.d.ts.map +1 -0
  179. package/dist/types/i18n/translation.d.ts +26 -0
  180. package/dist/types/i18n/translation.d.ts.map +1 -0
  181. package/dist/types/index.d.ts +12 -0
  182. package/dist/types/index.d.ts.map +1 -0
  183. package/dist/types/setting/index.d.ts +3 -0
  184. package/dist/types/setting/index.d.ts.map +1 -0
  185. package/dist/types/setting/metadata.d.ts +26 -0
  186. package/dist/types/setting/metadata.d.ts.map +1 -0
  187. package/dist/types/setting/setting.d.ts +41 -0
  188. package/dist/types/setting/setting.d.ts.map +1 -0
  189. package/dist/types/shared/aliases.d.ts +4 -0
  190. package/dist/types/shared/aliases.d.ts.map +1 -0
  191. package/dist/types/shared/base.d.ts +7 -0
  192. package/dist/types/shared/base.d.ts.map +1 -0
  193. package/dist/types/shared/object.d.ts +3 -0
  194. package/dist/types/shared/object.d.ts.map +1 -0
  195. package/dist/types/shared/preprocess.d.ts +3 -0
  196. package/dist/types/shared/preprocess.d.ts.map +1 -0
  197. package/dist/types/shared/profile.d.ts +40 -0
  198. package/dist/types/shared/profile.d.ts.map +1 -0
  199. package/dist/types/user/credential.d.ts +97 -0
  200. package/dist/types/user/credential.d.ts.map +1 -0
  201. package/dist/types/user/domain.d.ts +54 -0
  202. package/dist/types/user/domain.d.ts.map +1 -0
  203. package/dist/types/user/index.d.ts +9 -0
  204. package/dist/types/user/index.d.ts.map +1 -0
  205. package/dist/types/user/model.d.ts +142 -0
  206. package/dist/types/user/model.d.ts.map +1 -0
  207. package/dist/types/user/permission.d.ts +90 -0
  208. package/dist/types/user/permission.d.ts.map +1 -0
  209. package/dist/types/user/role.d.ts +111 -0
  210. package/dist/types/user/role.d.ts.map +1 -0
  211. package/dist/types/user/user-profile-assigned.d.ts +181 -0
  212. package/dist/types/user/user-profile-assigned.d.ts.map +1 -0
  213. package/dist/types/user/user-profile.d.ts +32 -0
  214. package/dist/types/user/user-profile.d.ts.map +1 -0
  215. package/dist/types/user/user.d.ts +270 -0
  216. package/dist/types/user/user.d.ts.map +1 -0
  217. package/dist/types/workflow/domain.d.ts +32 -0
  218. package/dist/types/workflow/domain.d.ts.map +1 -0
  219. package/dist/types/workflow/helpers.d.ts +117 -0
  220. package/dist/types/workflow/helpers.d.ts.map +1 -0
  221. package/dist/types/workflow/index.d.ts +8 -0
  222. package/dist/types/workflow/index.d.ts.map +1 -0
  223. package/dist/types/workflow/mcp-server.d.ts +67 -0
  224. package/dist/types/workflow/mcp-server.d.ts.map +1 -0
  225. package/dist/types/workflow/memory-definition.d.ts +35 -0
  226. package/dist/types/workflow/memory-definition.d.ts.map +1 -0
  227. package/dist/types/workflow/memory-record.d.ts +284 -0
  228. package/dist/types/workflow/memory-record.d.ts.map +1 -0
  229. package/dist/types/workflow/workflow-run.d.ts +375 -0
  230. package/dist/types/workflow/workflow-run.d.ts.map +1 -0
  231. package/dist/types/workflow/workflow-version.d.ts +179 -0
  232. package/dist/types/workflow/workflow-version.d.ts.map +1 -0
  233. package/dist/types/workflow/workflow.d.ts +366 -0
  234. package/dist/types/workflow/workflow.d.ts.map +1 -0
  235. package/package.json +59 -0
  236. package/src/analytics/index.ts +26 -0
  237. package/src/analytics/integration-health.ts +44 -0
  238. package/src/analytics/stats.ts +41 -0
  239. package/src/attachment/attachment.ts +75 -0
  240. package/src/attachment/index.ts +19 -0
  241. package/src/audit/audit-log.ts +42 -0
  242. package/src/audit/index.ts +12 -0
  243. package/src/channel/channel-metadata.ts +20 -0
  244. package/src/channel/index.ts +19 -0
  245. package/src/channel/source-full.ts +25 -0
  246. package/src/channel/source.ts +42 -0
  247. package/src/chat/attachment.ts +44 -0
  248. package/src/chat/button.ts +90 -0
  249. package/src/chat/index.ts +173 -0
  250. package/src/chat/label-group.ts +35 -0
  251. package/src/chat/label.ts +56 -0
  252. package/src/chat/message-contract.ts +370 -0
  253. package/src/chat/message.ts +164 -0
  254. package/src/chat/options.ts +130 -0
  255. package/src/chat/quick-reply.ts +41 -0
  256. package/src/chat/subscriber.ts +73 -0
  257. package/src/chat/thread.ts +55 -0
  258. package/src/cms/content-type.ts +26 -0
  259. package/src/cms/content.ts +48 -0
  260. package/src/cms/index.ts +33 -0
  261. package/src/cms/menu.ts +54 -0
  262. package/src/dummy/dummy.ts +30 -0
  263. package/src/dummy/index.ts +14 -0
  264. package/src/i18n/index.ts +23 -0
  265. package/src/i18n/language.ts +28 -0
  266. package/src/i18n/translation.ts +26 -0
  267. package/src/index.test.ts +1271 -0
  268. package/src/index.ts +27 -0
  269. package/src/setting/index.ts +25 -0
  270. package/src/setting/metadata.ts +26 -0
  271. package/src/setting/setting.ts +46 -0
  272. package/src/shared/aliases.ts +48 -0
  273. package/src/shared/base.ts +13 -0
  274. package/src/shared/object.ts +19 -0
  275. package/src/shared/preprocess.ts +14 -0
  276. package/src/shared/profile.ts +49 -0
  277. package/src/user/credential.ts +45 -0
  278. package/src/user/domain.ts +94 -0
  279. package/src/user/index.ts +78 -0
  280. package/src/user/model.ts +40 -0
  281. package/src/user/permission.ts +51 -0
  282. package/src/user/role.ts +43 -0
  283. package/src/user/user-profile-assigned.ts +70 -0
  284. package/src/user/user-profile.ts +21 -0
  285. package/src/user/user.ts +87 -0
  286. package/src/workflow/domain.ts +47 -0
  287. package/src/workflow/helpers.ts +40 -0
  288. package/src/workflow/index.ts +70 -0
  289. package/src/workflow/mcp-server.ts +64 -0
  290. package/src/workflow/memory-definition.ts +31 -0
  291. package/src/workflow/memory-record.ts +71 -0
  292. package/src/workflow/workflow-run.ts +156 -0
  293. package/src/workflow/workflow-version.ts +68 -0
  294. package/src/workflow/workflow.ts +163 -0
package/LICENSE.md ADDED
@@ -0,0 +1,120 @@
1
+ # Fair Core License, Version 1.0, ALv2 Future License
2
+
3
+ ## Abbreviation
4
+
5
+ FCL-1.0-ALv2
6
+
7
+ ## Notice
8
+
9
+ Copyright 2025 Hexastack
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Limitations,
26
+ Patents, Redistribution and Trademark clauses below, we hereby grant you the
27
+ right to use, copy, modify, create derivative works, publicly perform, publicly
28
+ display and redistribute the Software for any Permitted Purpose identified
29
+ below.
30
+
31
+ ### Permitted Purpose
32
+
33
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
34
+ means making the Software available to others in a commercial product or
35
+ service that:
36
+
37
+ 1. substitutes for the Software;
38
+
39
+ 2. substitutes for any other product or service we offer using the Software
40
+ that exists as of the date we make the Software available; or
41
+
42
+ 3. offers the same or substantially similar functionality as the Software.
43
+
44
+ Permitted Purposes specifically include using the Software:
45
+
46
+ 1. for your internal use and access;
47
+
48
+ 2. for non-commercial education;
49
+
50
+ 3. for non-commercial research; and
51
+
52
+ 4. in connection with professional services that you provide to a licensee
53
+ using the Software in accordance with these Terms and Conditions.
54
+
55
+ ### Limitations
56
+
57
+ You must not move, change, disable, or circumvent the license key functionality
58
+ in the Software; or modify any portion of the Software protected by the license
59
+ key to:
60
+
61
+ 1. enable access to the protected functionality without a valid license key; or
62
+
63
+ 2. remove the protected functionality.
64
+
65
+ ### Patents
66
+
67
+ To the extent your use for a Permitted Purpose would necessarily infringe our
68
+ patents, the license grant above includes a license under our patents. If you
69
+ make a claim against any party that the Software infringes or contributes to
70
+ the infringement of any patent, then your patent license to the Software ends
71
+ immediately.
72
+
73
+ ### Redistribution
74
+
75
+ The Terms and Conditions apply to all copies, modifications and derivatives of
76
+ the Software.
77
+
78
+ If you redistribute any copies, modifications or derivatives of the Software,
79
+ you must include a copy of or a link to these Terms and Conditions and not
80
+ remove any copyright or other proprietary notices provided in or with the
81
+ Software.
82
+
83
+ ### Disclaimer
84
+
85
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
86
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
87
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
88
+
89
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
90
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
91
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
92
+
93
+ In the event the provision of this Disclaimer section is unenforceable under
94
+ applicable law, the licenses granted herein are void.
95
+
96
+ ### Trademarks
97
+
98
+ Except for displaying the License Details and identifying us as the origin of
99
+ the Software, you have no right under these Terms and Conditions to use our
100
+ trademarks, trade names, service marks or product names.
101
+
102
+ ## Grant of Future License
103
+
104
+ We hereby irrevocably grant you an additional license to use the Software,
105
+ under the Apache License, Version 2.0, that is effective on the second
106
+ anniversary of the date we make the Software available. On or after that date,
107
+ you may use the Software under the Apache License, Version 2.0, in which case
108
+ the following will apply:
109
+
110
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
111
+ this file except in compliance with the License.
112
+
113
+ You may obtain a copy of the License at
114
+
115
+ http://www.apache.org/licenses/LICENSE-2.0
116
+
117
+ Unless required by applicable law or agreed to in writing, software distributed
118
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
119
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
120
+ specific language governing permissions and limitations under the License.
package/README.md ADDED
@@ -0,0 +1,172 @@
1
+ # @hexabot-ai/types
2
+
3
+ Shared zod-first runtime contracts for Hexabot API entity outputs.
4
+
5
+ ## Migrated Modules
6
+
7
+ - `analytics`: `Stats*`, `IntegrationHealth*`
8
+ - `audit`: `AuditLog*`
9
+ - `channel`: `Source*`, `ChannelMetadata*`
10
+ - `chat`: `LabelGroup*`, `Label*`, `Subscriber*`, `Thread*`, `Message*`
11
+ - `cms`: `ContentType*`, `Content*`, `Menu*`
12
+ - `i18n`: `Language*`, `Translation*`
13
+ - `setting`: `Setting*`, `Metadata*`
14
+ - `user`: `UserProfile*`, `Model*`, `Permission*`, `Role*`, `Credential*`, `User*`
15
+ - `workflow`: `Workflow*`, `WorkflowVersion*`, `WorkflowRun*`, `MemoryDefinition*`, `MemoryRecord*`, `McpServer*`
16
+ - `utils/test/dummy`: `Dummy*`
17
+ - `attachment`: `Attachment*`
18
+
19
+ `AuditLog` includes nullable `actorLabel` and `resourceLabel` display fields in
20
+ addition to the stable actor/resource identifiers.
21
+
22
+ ## Standard Export Pattern
23
+
24
+ Each migrated entity exposes:
25
+
26
+ - `*StubSchema`, `*Schema`, `*FullSchema`
27
+ - `type *Stub`, `type *`, `type *Full`
28
+
29
+ Example:
30
+
31
+ ```ts
32
+ import {
33
+ subscriberFullSchema,
34
+ type SubscriberFull,
35
+ } from "@hexabot-ai/types";
36
+
37
+ const payload: SubscriberFull = subscriberFullSchema.parse(data);
38
+ ```
39
+
40
+ ## Shared Chat Message Contracts
41
+
42
+ Chat message contracts are centralized in `@hexabot-ai/types` and are strictly discriminator-based.
43
+
44
+ ```ts
45
+ import {
46
+ ActionOptionsSchema,
47
+ ButtonType,
48
+ FileType,
49
+ IncomingMessageType,
50
+ OutgoingMessageType,
51
+ stdOutgoingMessageSchema,
52
+ attachmentPayloadSchema,
53
+ messageSchema,
54
+ stdIncomingMessageSchema,
55
+ stdOutgoingEnvelopeSchema,
56
+ } from "@hexabot-ai/types";
57
+ ```
58
+
59
+ ### Outgoing Contract (`StdOutgoingMessage`)
60
+
61
+ All outgoing messages use:
62
+
63
+ - `{ type, data }`
64
+
65
+ `type` discriminator variants:
66
+
67
+ - `text`: `data = { text }`
68
+ - `quickReply`: `data = { text, quickReplies }`
69
+ - `buttons`: `data = { text, buttons }`
70
+ - `attachment`: `data = { attachment, quickReplies? }`
71
+ - `list`: `data = { options, elements, pagination }`
72
+ - `carousel`: `data = { options, elements, pagination }`
73
+
74
+ Example:
75
+
76
+ ```ts
77
+ const outgoing = stdOutgoingMessageSchema.parse({
78
+ type: OutgoingMessageType.quickReply,
79
+ data: {
80
+ text: "Choose one",
81
+ quickReplies: [{ title: "Yes", payload: "yes" }],
82
+ },
83
+ });
84
+ ```
85
+
86
+ ### Incoming Contract (`StdIncomingMessage`)
87
+
88
+ All incoming messages use:
89
+
90
+ - `{ type, data }`
91
+
92
+ `type` discriminator variants:
93
+
94
+ - `text`: `data = { text }`
95
+ - `postback`: `data = { text, payload }`
96
+ - `quickReply`: `data = { text, payload }`
97
+ - `location`: `data = { coordinates: { lat, lon } }`
98
+ - `attachment`: `data = { serializedText, attachment }`
99
+ `attachment` can be a single attachment or an array.
100
+
101
+ Example:
102
+
103
+ ```ts
104
+ const incoming = stdIncomingMessageSchema.parse({
105
+ type: IncomingMessageType.location,
106
+ data: {
107
+ coordinates: { lat: 36.8, lon: 10.2 },
108
+ },
109
+ });
110
+ ```
111
+
112
+ ### Envelopes and Persistence
113
+
114
+ - `StdOutgoingMessageEnvelope` is the same contract as `StdOutgoingMessage` (`{ type, data }`).
115
+ - `StdOutgoingEnvelope` adds the system envelope variant:
116
+ - `type: OutgoingMessageType.system`
117
+ - `data: { outcome?: string; data?: unknown }`
118
+ - Persisted chat message entities (`messageSchema`) validate `message` as:
119
+ - `StdIncomingMessage | StdOutgoingMessage`
120
+
121
+ Legacy flat payloads and alias-based message shapes are intentionally unsupported.
122
+
123
+ ## Workflow Parser Bridge
124
+
125
+ Use a parser-aware full workflow schema to preserve `definitionYml` and `definition` derivation:
126
+
127
+ ```ts
128
+ import { createWorkflowFullSchema } from "@hexabot-ai/types";
129
+
130
+ const workflow = createWorkflowFullSchema({
131
+ parseDefinition: (definitionYml) => {
132
+ // API-side parser with binding-aware validation
133
+ return parseWorkflowDefinition(definitionYml);
134
+ },
135
+ }).parse(data);
136
+ ```
137
+
138
+ You can also build a reusable schema:
139
+
140
+ ```ts
141
+ import { createWorkflowFullSchema } from "@hexabot-ai/types";
142
+
143
+ const schema = createWorkflowFullSchema({ parseDefinition });
144
+ const workflow = schema.parse(data);
145
+ ```
146
+
147
+ ## Alias Compatibility
148
+
149
+ Common ORM alias mappings from legacy class-transformer DTOs are preserved, including:
150
+
151
+ - `groupId`, `contentTypeId`, `parentId`
152
+ - `sourceId`, `defaultWorkflowId`
153
+ - `subscriberId`, `senderId`, `recipientId`, `sentById`, `threadId`
154
+ - `ownerId`, `modelId`, `roleId`, `credentialId`
155
+ - `currentVersionId`, `publishedVersionId`, `createdById`
156
+ - `workflowId`, `workflowVersionId`, `triggeredById`
157
+ - `definitionId`, `runId`
158
+
159
+ Unknown keys are stripped by default.
160
+
161
+ ## Compatibility Notes
162
+
163
+ - Legacy API enum/type paths can re-export from this package without value changes.
164
+ - Schema parsing preserves nullable/optional normalization used by API entity outputs.
165
+ - Mixed owner/triggeredBy contracts (`Subscriber | User`) are supported in workflow full contracts.
166
+ - Sensitive output parity is preserved for credentials (`value` is not part of output contracts).
167
+
168
+ ## Breaking-Change Notes
169
+
170
+ - Runtime DTO output classes are replaced by zod schemas + inferred TS types.
171
+ - `@Type(() => OutputClass)` patterns should be replaced by direct zod schema parsing.
172
+ - Consumers that previously instantiated output DTO classes (`new X()`) must use plain objects typed by exported `type X`.
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /*
3
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
4
+ * Copyright (c) 2026 Hexastack.
5
+ * Full terms: see LICENSE.md.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.statsStubSchema = exports.statsSchema = exports.statsFullSchema = exports.StatsType = exports.integrationHealthStatusSchema = exports.integrationHealthResponseSchema = exports.integrationHealthKindSchema = exports.integrationHealthItemSchema = void 0;
9
+ var integration_health_1 = require("./integration-health");
10
+ Object.defineProperty(exports, "integrationHealthItemSchema", { enumerable: true, get: function () { return integration_health_1.integrationHealthItemSchema; } });
11
+ Object.defineProperty(exports, "integrationHealthKindSchema", { enumerable: true, get: function () { return integration_health_1.integrationHealthKindSchema; } });
12
+ Object.defineProperty(exports, "integrationHealthResponseSchema", { enumerable: true, get: function () { return integration_health_1.integrationHealthResponseSchema; } });
13
+ Object.defineProperty(exports, "integrationHealthStatusSchema", { enumerable: true, get: function () { return integration_health_1.integrationHealthStatusSchema; } });
14
+ var stats_1 = require("./stats");
15
+ Object.defineProperty(exports, "StatsType", { enumerable: true, get: function () { return stats_1.StatsType; } });
16
+ Object.defineProperty(exports, "statsFullSchema", { enumerable: true, get: function () { return stats_1.statsFullSchema; } });
17
+ Object.defineProperty(exports, "statsSchema", { enumerable: true, get: function () { return stats_1.statsSchema; } });
18
+ Object.defineProperty(exports, "statsStubSchema", { enumerable: true, get: function () { return stats_1.statsStubSchema; } });
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ /*
3
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
4
+ * Copyright (c) 2026 Hexastack.
5
+ * Full terms: see LICENSE.md.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.integrationHealthResponseSchema = exports.integrationHealthItemSchema = exports.integrationHealthKindSchema = exports.integrationHealthStatusSchema = void 0;
9
+ const zod_1 = require("zod");
10
+ exports.integrationHealthStatusSchema = zod_1.z.enum([
11
+ "healthy",
12
+ "warning",
13
+ "unhealthy",
14
+ "disabled",
15
+ ]);
16
+ exports.integrationHealthKindSchema = zod_1.z.enum(["channel", "service"]);
17
+ exports.integrationHealthItemSchema = zod_1.z.object({
18
+ id: zod_1.z.string(),
19
+ kind: exports.integrationHealthKindSchema,
20
+ name: zod_1.z.string(),
21
+ status: exports.integrationHealthStatusSchema,
22
+ checkedAt: zod_1.z.string().datetime({ offset: true }),
23
+ reason: zod_1.z.string().optional(),
24
+ message: zod_1.z.string().optional(),
25
+ details: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
26
+ });
27
+ exports.integrationHealthResponseSchema = zod_1.z.object({
28
+ checkedAt: zod_1.z.string().datetime({ offset: true }),
29
+ integrations: zod_1.z.array(exports.integrationHealthItemSchema),
30
+ });
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ /*
3
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
4
+ * Copyright (c) 2026 Hexastack.
5
+ * Full terms: see LICENSE.md.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.statsFullSchema = exports.statsSchema = exports.statsStubSchema = exports.StatsType = void 0;
9
+ const zod_1 = require("zod");
10
+ const base_1 = require("../shared/base");
11
+ var StatsType;
12
+ (function (StatsType) {
13
+ StatsType["outgoing"] = "outgoing";
14
+ StatsType["new_users"] = "new_users";
15
+ StatsType["all_messages"] = "all_messages";
16
+ StatsType["incoming"] = "incoming";
17
+ StatsType["returning_users"] = "returning_users";
18
+ StatsType["retention"] = "retention";
19
+ StatsType["echo"] = "echo";
20
+ StatsType["new_threads"] = "new_threads";
21
+ StatsType["handoffs"] = "handoffs";
22
+ })(StatsType || (exports.StatsType = StatsType = {}));
23
+ const statsTypeSchema = zod_1.z.enum(StatsType);
24
+ const statsObjectSchema = base_1.baseStubSchema.extend({
25
+ type: statsTypeSchema,
26
+ day: zod_1.z.coerce.date(),
27
+ value: zod_1.z.coerce.number(),
28
+ name: zod_1.z.string(),
29
+ });
30
+ exports.statsStubSchema = statsObjectSchema;
31
+ exports.statsSchema = statsObjectSchema;
32
+ exports.statsFullSchema = statsObjectSchema;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ /*
3
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
4
+ * Copyright (c) 2026 Hexastack.
5
+ * Full terms: see LICENSE.md.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.attachmentFullSchema = exports.attachmentSchema = exports.attachmentStubSchema = exports.attachmentOwnerSchema = exports.AttachmentAccess = exports.AttachmentResourceRef = exports.AttachmentCreatedByRef = void 0;
9
+ const zod_1 = require("zod");
10
+ const aliases_1 = require("../shared/aliases");
11
+ const base_1 = require("../shared/base");
12
+ const preprocess_1 = require("../shared/preprocess");
13
+ const user_profile_assigned_1 = require("../user/user-profile-assigned");
14
+ var AttachmentCreatedByRef;
15
+ (function (AttachmentCreatedByRef) {
16
+ AttachmentCreatedByRef["User"] = "User";
17
+ AttachmentCreatedByRef["Subscriber"] = "Subscriber";
18
+ })(AttachmentCreatedByRef || (exports.AttachmentCreatedByRef = AttachmentCreatedByRef = {}));
19
+ var AttachmentResourceRef;
20
+ (function (AttachmentResourceRef) {
21
+ AttachmentResourceRef["SettingAttachment"] = "Setting";
22
+ AttachmentResourceRef["UserAvatar"] = "User";
23
+ AttachmentResourceRef["SubscriberAvatar"] = "Subscriber";
24
+ AttachmentResourceRef["ContentAttachment"] = "Content";
25
+ AttachmentResourceRef["MessageAttachment"] = "Message";
26
+ })(AttachmentResourceRef || (exports.AttachmentResourceRef = AttachmentResourceRef = {}));
27
+ var AttachmentAccess;
28
+ (function (AttachmentAccess) {
29
+ AttachmentAccess["Public"] = "public";
30
+ AttachmentAccess["Private"] = "private";
31
+ })(AttachmentAccess || (exports.AttachmentAccess = AttachmentAccess = {}));
32
+ const attachmentAliasMap = {
33
+ createdById: "createdBy",
34
+ };
35
+ exports.attachmentOwnerSchema = user_profile_assigned_1.userProfileAssignedSchema;
36
+ const attachmentStubObjectSchema = base_1.baseStubSchema.extend({
37
+ name: zod_1.z.string(),
38
+ type: zod_1.z.string(),
39
+ size: zod_1.z.coerce.number(),
40
+ location: zod_1.z.string(),
41
+ channel: (0, preprocess_1.preprocess)((value) => (value == null ? undefined : value), zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional()).optional(),
42
+ createdByRef: zod_1.z.enum(AttachmentCreatedByRef).optional(),
43
+ resourceRef: zod_1.z.enum(AttachmentResourceRef),
44
+ access: zod_1.z.enum(AttachmentAccess),
45
+ url: (0, preprocess_1.preprocess)((value) => (value == null ? "" : value), zod_1.z.string()),
46
+ });
47
+ exports.attachmentStubSchema = attachmentStubObjectSchema;
48
+ exports.attachmentSchema = (0, preprocess_1.preprocess)((value) => (0, aliases_1.withAliases)(value, attachmentAliasMap), attachmentStubObjectSchema.extend({
49
+ createdBy: (0, preprocess_1.preprocess)((value) => (value == null ? null : (0, aliases_1.asId)(value)), zod_1.z.string().nullable()).optional(),
50
+ }));
51
+ exports.attachmentFullSchema = attachmentStubObjectSchema.extend({
52
+ createdBy: exports.attachmentOwnerSchema.nullable().optional(),
53
+ });
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ /*
3
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
4
+ * Copyright (c) 2026 Hexastack.
5
+ * Full terms: see LICENSE.md.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.attachmentStubSchema = exports.attachmentSchema = exports.attachmentOwnerSchema = exports.attachmentFullSchema = exports.AttachmentResourceRef = exports.AttachmentCreatedByRef = exports.AttachmentAccess = void 0;
9
+ var attachment_1 = require("./attachment");
10
+ Object.defineProperty(exports, "AttachmentAccess", { enumerable: true, get: function () { return attachment_1.AttachmentAccess; } });
11
+ Object.defineProperty(exports, "AttachmentCreatedByRef", { enumerable: true, get: function () { return attachment_1.AttachmentCreatedByRef; } });
12
+ Object.defineProperty(exports, "AttachmentResourceRef", { enumerable: true, get: function () { return attachment_1.AttachmentResourceRef; } });
13
+ Object.defineProperty(exports, "attachmentFullSchema", { enumerable: true, get: function () { return attachment_1.attachmentFullSchema; } });
14
+ Object.defineProperty(exports, "attachmentOwnerSchema", { enumerable: true, get: function () { return attachment_1.attachmentOwnerSchema; } });
15
+ Object.defineProperty(exports, "attachmentSchema", { enumerable: true, get: function () { return attachment_1.attachmentSchema; } });
16
+ Object.defineProperty(exports, "attachmentStubSchema", { enumerable: true, get: function () { return attachment_1.attachmentStubSchema; } });
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ /*
3
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
4
+ * Copyright (c) 2026 Hexastack.
5
+ * Full terms: see LICENSE.md.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.auditLogFullSchema = exports.auditLogSchema = void 0;
9
+ const zod_1 = require("zod");
10
+ const base_1 = require("../shared/base");
11
+ const preprocess_1 = require("../shared/preprocess");
12
+ const nullableRecordSchema = (0, preprocess_1.preprocess)((value) => (value == null ? null : value), zod_1.z.unknown().nullable());
13
+ exports.auditLogSchema = base_1.baseStubSchema.extend({
14
+ resourceId: zod_1.z.string(),
15
+ resourceType: zod_1.z.string(),
16
+ resourceLabel: zod_1.z.string().nullable(),
17
+ operationId: zod_1.z.string(),
18
+ operationType: zod_1.z.string(),
19
+ operationStatus: zod_1.z.enum(["UNSPECIFIED", "SUCCEEDED", "FAILED"]),
20
+ actorId: zod_1.z.string(),
21
+ actorType: zod_1.z.string(),
22
+ actorLabel: zod_1.z.string().nullable(),
23
+ actorIp: zod_1.z.string().nullable(),
24
+ actorAgent: zod_1.z.string().nullable(),
25
+ requestId: zod_1.z.string().nullable(),
26
+ requestMethod: zod_1.z.string().nullable(),
27
+ requestPath: zod_1.z.string().nullable(),
28
+ dataBefore: nullableRecordSchema,
29
+ dataAfter: nullableRecordSchema,
30
+ dataDiff: nullableRecordSchema,
31
+ raw: nullableRecordSchema,
32
+ });
33
+ exports.auditLogFullSchema = exports.auditLogSchema;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /*
3
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
4
+ * Copyright (c) 2026 Hexastack.
5
+ * Full terms: see LICENSE.md.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.auditLogSchema = exports.auditLogFullSchema = void 0;
9
+ var audit_log_1 = require("./audit-log");
10
+ Object.defineProperty(exports, "auditLogFullSchema", { enumerable: true, get: function () { return audit_log_1.auditLogFullSchema; } });
11
+ Object.defineProperty(exports, "auditLogSchema", { enumerable: true, get: function () { return audit_log_1.auditLogSchema; } });
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /*
3
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
4
+ * Copyright (c) 2026 Hexastack.
5
+ * Full terms: see LICENSE.md.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.channelMetadataSchema = void 0;
9
+ const zod_1 = require("zod");
10
+ const jsonObjectSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.unknown());
11
+ const channelMetadataObjectSchema = zod_1.z.object({
12
+ name: zod_1.z.string(),
13
+ settingsSchema: jsonObjectSchema,
14
+ });
15
+ exports.channelMetadataSchema = channelMetadataObjectSchema;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /*
3
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
4
+ * Copyright (c) 2026 Hexastack.
5
+ * Full terms: see LICENSE.md.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.channelMetadataSchema = exports.sourceFullSchema = exports.sourceStubSchema = exports.sourceSchema = void 0;
9
+ var source_1 = require("./source");
10
+ Object.defineProperty(exports, "sourceSchema", { enumerable: true, get: function () { return source_1.sourceSchema; } });
11
+ Object.defineProperty(exports, "sourceStubSchema", { enumerable: true, get: function () { return source_1.sourceStubSchema; } });
12
+ var source_full_1 = require("./source-full");
13
+ Object.defineProperty(exports, "sourceFullSchema", { enumerable: true, get: function () { return source_full_1.sourceFullSchema; } });
14
+ var channel_metadata_1 = require("./channel-metadata");
15
+ Object.defineProperty(exports, "channelMetadataSchema", { enumerable: true, get: function () { return channel_metadata_1.channelMetadataSchema; } });
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ /*
3
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
4
+ * Copyright (c) 2026 Hexastack.
5
+ * Full terms: see LICENSE.md.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.sourceFullSchema = void 0;
9
+ const zod_1 = require("zod");
10
+ const aliases_1 = require("../shared/aliases");
11
+ const preprocess_1 = require("../shared/preprocess");
12
+ const workflow_1 = require("../workflow/workflow");
13
+ const source_1 = require("./source");
14
+ exports.sourceFullSchema = (0, preprocess_1.preprocess)((value) => (0, aliases_1.withAliases)(value, source_1.sourceAliasMap), source_1.sourceObjectSchema.extend({
15
+ defaultWorkflow: (0, preprocess_1.preprocess)((value) => (value == null ? null : value), zod_1.z.lazy(() => workflow_1.workflowSchema).nullable()),
16
+ }));
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ /*
3
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
4
+ * Copyright (c) 2026 Hexastack.
5
+ * Full terms: see LICENSE.md.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.sourceSchema = exports.sourceStubSchema = exports.sourceObjectSchema = exports.sourceAliasMap = void 0;
9
+ const zod_1 = require("zod");
10
+ const aliases_1 = require("../shared/aliases");
11
+ const base_1 = require("../shared/base");
12
+ const preprocess_1 = require("../shared/preprocess");
13
+ exports.sourceAliasMap = {
14
+ defaultWorkflowId: "defaultWorkflow",
15
+ };
16
+ exports.sourceObjectSchema = base_1.baseStubSchema.extend({
17
+ name: zod_1.z.string(),
18
+ channel: zod_1.z.string(),
19
+ settings: (0, preprocess_1.preprocess)((value) => value && typeof value === "object" && !Array.isArray(value) ? value : {}, zod_1.z.record(zod_1.z.string(), zod_1.z.unknown())),
20
+ state: zod_1.z.coerce.boolean(),
21
+ });
22
+ exports.sourceStubSchema = exports.sourceObjectSchema;
23
+ exports.sourceSchema = (0, preprocess_1.preprocess)((value) => (0, aliases_1.withAliases)(value, exports.sourceAliasMap), exports.sourceObjectSchema.extend({
24
+ defaultWorkflow: (0, preprocess_1.preprocess)((value) => (value == null ? null : (0, aliases_1.asId)(value)), zod_1.z.string().nullable()),
25
+ }));
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ /*
3
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
4
+ * Copyright (c) 2026 Hexastack.
5
+ * Full terms: see LICENSE.md.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.attachmentPayloadSchema = exports.attachmentRefSchema = exports.fileTypeSchema = exports.FileType = void 0;
9
+ const zod_1 = require("zod");
10
+ var FileType;
11
+ (function (FileType) {
12
+ FileType["image"] = "image";
13
+ FileType["video"] = "video";
14
+ FileType["audio"] = "audio";
15
+ FileType["file"] = "file";
16
+ FileType["unknown"] = "unknown";
17
+ })(FileType || (exports.FileType = FileType = {}));
18
+ exports.fileTypeSchema = zod_1.z.enum(FileType);
19
+ exports.attachmentRefSchema = zod_1.z.union([
20
+ zod_1.z.object({
21
+ id: zod_1.z.string().nullable(),
22
+ url: zod_1.z.string().optional(),
23
+ }),
24
+ zod_1.z.object({
25
+ id: zod_1.z.string().nullable().optional(),
26
+ url: zod_1.z.string(),
27
+ }),
28
+ ]);
29
+ exports.attachmentPayloadSchema = zod_1.z.object({
30
+ type: exports.fileTypeSchema,
31
+ payload: exports.attachmentRefSchema,
32
+ });
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ /*
3
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
4
+ * Copyright (c) 2026 Hexastack.
5
+ * Full terms: see LICENSE.md.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.PayloadType = exports.buttonSchema = exports.ButtonType = void 0;
9
+ const zod_1 = require("zod");
10
+ var ButtonType;
11
+ (function (ButtonType) {
12
+ ButtonType["postback"] = "postback";
13
+ ButtonType["web_url"] = "web_url";
14
+ })(ButtonType || (exports.ButtonType = ButtonType = {}));
15
+ exports.buttonSchema = zod_1.z
16
+ .object({
17
+ type: zod_1.z.enum([ButtonType.postback, ButtonType.web_url]).meta({
18
+ title: "Type",
19
+ description: "The type of button.",
20
+ }),
21
+ title: zod_1.z.string().meta({
22
+ title: "Title",
23
+ description: "The label shown to the user.",
24
+ }),
25
+ payload: zod_1.z.string().optional().meta({
26
+ title: "Payload",
27
+ description: "The value sent back when the button is clicked.",
28
+ }),
29
+ url: zod_1.z
30
+ .union([zod_1.z.url(), zod_1.z.literal("")])
31
+ .optional()
32
+ .meta({
33
+ title: "URL",
34
+ description: "The destination URL opened when the button is clicked.",
35
+ }),
36
+ messenger_extensions: zod_1.z.boolean().optional().meta({
37
+ title: "Messenger extensions",
38
+ description: "Whether to enable Messenger Extensions for the webview.",
39
+ }),
40
+ webview_height_ratio: zod_1.z.enum(["compact", "tall", "full"]).optional().meta({
41
+ title: "Webview height ratio",
42
+ description: "The height of the webview.",
43
+ }),
44
+ })
45
+ .superRefine((button, ctx) => {
46
+ if (button.type === ButtonType.postback && !button.payload) {
47
+ ctx.addIssue({
48
+ code: zod_1.z.ZodIssueCode.custom,
49
+ path: ["payload"],
50
+ message: "Payload is required for postback buttons.",
51
+ });
52
+ }
53
+ if (button.type === ButtonType.web_url && !button.url) {
54
+ ctx.addIssue({
55
+ code: zod_1.z.ZodIssueCode.custom,
56
+ path: ["url"],
57
+ message: "URL is required for web_url buttons.",
58
+ });
59
+ }
60
+ });
61
+ var PayloadType;
62
+ (function (PayloadType) {
63
+ PayloadType["location"] = "location";
64
+ PayloadType["attachment"] = "attachment";
65
+ PayloadType["quickReply"] = "quickReply";
66
+ PayloadType["button"] = "button";
67
+ PayloadType["outcome"] = "outcome";
68
+ PayloadType["menu"] = "menu";
69
+ PayloadType["content"] = "content";
70
+ })(PayloadType || (exports.PayloadType = PayloadType = {}));