@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
@@ -0,0 +1,41 @@
1
+ /*
2
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
3
+ * Copyright (c) 2026 Hexastack.
4
+ * Full terms: see LICENSE.md.
5
+ */
6
+
7
+ import { z } from "zod";
8
+
9
+ import { baseStubSchema } from "../shared/base";
10
+
11
+ export enum StatsType {
12
+ outgoing = "outgoing",
13
+ new_users = "new_users",
14
+ all_messages = "all_messages",
15
+ incoming = "incoming",
16
+ returning_users = "returning_users",
17
+ retention = "retention",
18
+ echo = "echo",
19
+ new_threads = "new_threads",
20
+ handoffs = "handoffs",
21
+ }
22
+
23
+ const statsTypeSchema = z.enum(StatsType);
24
+ const statsObjectSchema = baseStubSchema.extend({
25
+ type: statsTypeSchema,
26
+ day: z.coerce.date(),
27
+ value: z.coerce.number(),
28
+ name: z.string(),
29
+ });
30
+
31
+ export const statsStubSchema = statsObjectSchema;
32
+
33
+ export const statsSchema = statsObjectSchema;
34
+
35
+ export const statsFullSchema = statsObjectSchema;
36
+
37
+ export type StatsStub = z.infer<typeof statsStubSchema>;
38
+
39
+ export type Stats = z.infer<typeof statsSchema>;
40
+
41
+ export type StatsFull = z.infer<typeof statsFullSchema>;
@@ -0,0 +1,75 @@
1
+ /*
2
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
3
+ * Copyright (c) 2026 Hexastack.
4
+ * Full terms: see LICENSE.md.
5
+ */
6
+
7
+ import { z } from "zod";
8
+
9
+ import { asId, withAliases } from "../shared/aliases";
10
+ import { baseStubSchema } from "../shared/base";
11
+ import { preprocess } from "../shared/preprocess";
12
+ import { userProfileAssignedSchema } from "../user/user-profile-assigned";
13
+
14
+ export enum AttachmentCreatedByRef {
15
+ User = "User",
16
+ Subscriber = "Subscriber",
17
+ }
18
+
19
+ export enum AttachmentResourceRef {
20
+ SettingAttachment = "Setting",
21
+ UserAvatar = "User",
22
+ SubscriberAvatar = "Subscriber",
23
+ ContentAttachment = "Content",
24
+ MessageAttachment = "Message",
25
+ }
26
+
27
+ export enum AttachmentAccess {
28
+ Public = "public",
29
+ Private = "private",
30
+ }
31
+
32
+ const attachmentAliasMap = {
33
+ createdById: "createdBy",
34
+ } as const;
35
+
36
+ export const attachmentOwnerSchema = userProfileAssignedSchema;
37
+
38
+ const attachmentStubObjectSchema = baseStubSchema.extend({
39
+ name: z.string(),
40
+ type: z.string(),
41
+ size: z.coerce.number(),
42
+ location: z.string(),
43
+ channel: preprocess(
44
+ (value) => (value == null ? undefined : value),
45
+ z.record(z.string(), z.unknown()).optional(),
46
+ ).optional(),
47
+ createdByRef: z.enum(AttachmentCreatedByRef).optional(),
48
+ resourceRef: z.enum(AttachmentResourceRef),
49
+ access: z.enum(AttachmentAccess),
50
+ url: preprocess((value) => (value == null ? "" : value), z.string()),
51
+ });
52
+
53
+ export const attachmentStubSchema = attachmentStubObjectSchema;
54
+
55
+ export const attachmentSchema = preprocess(
56
+ (value) => withAliases(value, attachmentAliasMap),
57
+ attachmentStubObjectSchema.extend({
58
+ createdBy: preprocess(
59
+ (value) => (value == null ? null : asId(value)),
60
+ z.string().nullable(),
61
+ ).optional(),
62
+ }),
63
+ );
64
+
65
+ export const attachmentFullSchema = attachmentStubObjectSchema.extend({
66
+ createdBy: attachmentOwnerSchema.nullable().optional(),
67
+ });
68
+
69
+ export type AttachmentOwner = z.infer<typeof attachmentOwnerSchema>;
70
+
71
+ export type AttachmentStub = z.infer<typeof attachmentStubSchema>;
72
+
73
+ export type Attachment = z.infer<typeof attachmentSchema>;
74
+
75
+ export type AttachmentFull = z.infer<typeof attachmentFullSchema>;
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
3
+ * Copyright (c) 2026 Hexastack.
4
+ * Full terms: see LICENSE.md.
5
+ */
6
+
7
+ export {
8
+ AttachmentAccess,
9
+ AttachmentCreatedByRef,
10
+ AttachmentResourceRef,
11
+ attachmentFullSchema,
12
+ attachmentOwnerSchema,
13
+ attachmentSchema,
14
+ attachmentStubSchema,
15
+ type Attachment,
16
+ type AttachmentFull,
17
+ type AttachmentOwner,
18
+ type AttachmentStub,
19
+ } from "./attachment";
@@ -0,0 +1,42 @@
1
+ /*
2
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
3
+ * Copyright (c) 2026 Hexastack.
4
+ * Full terms: see LICENSE.md.
5
+ */
6
+
7
+ import { z } from "zod";
8
+
9
+ import { baseStubSchema } from "../shared/base";
10
+ import { preprocess } from "../shared/preprocess";
11
+
12
+ const nullableRecordSchema = preprocess(
13
+ (value) => (value == null ? null : value),
14
+ z.unknown().nullable(),
15
+ );
16
+
17
+ export const auditLogSchema = baseStubSchema.extend({
18
+ resourceId: z.string(),
19
+ resourceType: z.string(),
20
+ resourceLabel: z.string().nullable(),
21
+ operationId: z.string(),
22
+ operationType: z.string(),
23
+ operationStatus: z.enum(["UNSPECIFIED", "SUCCEEDED", "FAILED"]),
24
+ actorId: z.string(),
25
+ actorType: z.string(),
26
+ actorLabel: z.string().nullable(),
27
+ actorIp: z.string().nullable(),
28
+ actorAgent: z.string().nullable(),
29
+ requestId: z.string().nullable(),
30
+ requestMethod: z.string().nullable(),
31
+ requestPath: z.string().nullable(),
32
+ dataBefore: nullableRecordSchema,
33
+ dataAfter: nullableRecordSchema,
34
+ dataDiff: nullableRecordSchema,
35
+ raw: nullableRecordSchema,
36
+ });
37
+
38
+ export const auditLogFullSchema = auditLogSchema;
39
+
40
+ export type AuditLog = z.infer<typeof auditLogSchema>;
41
+
42
+ export type AuditLogFull = z.infer<typeof auditLogFullSchema>;
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
3
+ * Copyright (c) 2026 Hexastack.
4
+ * Full terms: see LICENSE.md.
5
+ */
6
+
7
+ export {
8
+ auditLogFullSchema,
9
+ auditLogSchema,
10
+ type AuditLog,
11
+ type AuditLogFull,
12
+ } from "./audit-log";
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
3
+ * Copyright (c) 2026 Hexastack.
4
+ * Full terms: see LICENSE.md.
5
+ */
6
+
7
+ import { z } from "zod";
8
+
9
+ const jsonObjectSchema: z.ZodType<Record<string, unknown>> = z.record(
10
+ z.string(),
11
+ z.unknown(),
12
+ );
13
+ const channelMetadataObjectSchema = z.object({
14
+ name: z.string(),
15
+ settingsSchema: jsonObjectSchema,
16
+ });
17
+
18
+ export const channelMetadataSchema = channelMetadataObjectSchema;
19
+
20
+ export type ChannelMetadata = z.infer<typeof channelMetadataSchema>;
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
3
+ * Copyright (c) 2026 Hexastack.
4
+ * Full terms: see LICENSE.md.
5
+ */
6
+
7
+ export {
8
+ sourceSchema,
9
+ sourceStubSchema,
10
+ type Source,
11
+ type SourceStub,
12
+ } from "./source";
13
+
14
+ export { sourceFullSchema, type SourceFull } from "./source-full";
15
+
16
+ export {
17
+ channelMetadataSchema,
18
+ type ChannelMetadata,
19
+ } from "./channel-metadata";
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
3
+ * Copyright (c) 2026 Hexastack.
4
+ * Full terms: see LICENSE.md.
5
+ */
6
+
7
+ import { z } from "zod";
8
+
9
+ import { withAliases } from "../shared/aliases";
10
+ import { preprocess } from "../shared/preprocess";
11
+ import { workflowSchema } from "../workflow/workflow";
12
+
13
+ import { sourceAliasMap, sourceObjectSchema } from "./source";
14
+
15
+ export const sourceFullSchema = preprocess(
16
+ (value) => withAliases(value, sourceAliasMap),
17
+ sourceObjectSchema.extend({
18
+ defaultWorkflow: preprocess(
19
+ (value) => (value == null ? null : value),
20
+ z.lazy(() => workflowSchema).nullable(),
21
+ ),
22
+ }),
23
+ );
24
+
25
+ export type SourceFull = z.infer<typeof sourceFullSchema>;
@@ -0,0 +1,42 @@
1
+ /*
2
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
3
+ * Copyright (c) 2026 Hexastack.
4
+ * Full terms: see LICENSE.md.
5
+ */
6
+
7
+ import { z } from "zod";
8
+
9
+ import { asId, withAliases } from "../shared/aliases";
10
+ import { baseStubSchema } from "../shared/base";
11
+ import { preprocess } from "../shared/preprocess";
12
+
13
+ export const sourceAliasMap = {
14
+ defaultWorkflowId: "defaultWorkflow",
15
+ } as const;
16
+
17
+ export const sourceObjectSchema = baseStubSchema.extend({
18
+ name: z.string(),
19
+ channel: z.string(),
20
+ settings: preprocess(
21
+ (value) =>
22
+ value && typeof value === "object" && !Array.isArray(value) ? value : {},
23
+ z.record(z.string(), z.unknown()),
24
+ ),
25
+ state: z.coerce.boolean(),
26
+ });
27
+
28
+ export const sourceStubSchema = sourceObjectSchema;
29
+
30
+ export const sourceSchema = preprocess(
31
+ (value) => withAliases(value, sourceAliasMap),
32
+ sourceObjectSchema.extend({
33
+ defaultWorkflow: preprocess(
34
+ (value) => (value == null ? null : asId(value)),
35
+ z.string().nullable(),
36
+ ),
37
+ }),
38
+ );
39
+
40
+ export type SourceStub = z.infer<typeof sourceStubSchema>;
41
+
42
+ export type Source = z.infer<typeof sourceSchema>;
@@ -0,0 +1,44 @@
1
+ /*
2
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
3
+ * Copyright (c) 2026 Hexastack.
4
+ * Full terms: see LICENSE.md.
5
+ */
6
+
7
+ import { z } from "zod";
8
+
9
+ export enum FileType {
10
+ image = "image",
11
+ video = "video",
12
+ audio = "audio",
13
+ file = "file",
14
+ unknown = "unknown",
15
+ }
16
+
17
+ export const fileTypeSchema = z.enum(FileType);
18
+
19
+ export const attachmentRefSchema = z.union([
20
+ z.object({
21
+ id: z.string().nullable(),
22
+ url: z.string().optional(),
23
+ }),
24
+ z.object({
25
+ id: z.string().nullable().optional(),
26
+ url: z.string(),
27
+ }),
28
+ ]);
29
+
30
+ export type AttachmentRef = z.infer<typeof attachmentRefSchema>;
31
+
32
+ export const attachmentPayloadSchema = z.object({
33
+ type: fileTypeSchema,
34
+ payload: attachmentRefSchema,
35
+ });
36
+
37
+ export type AttachmentPayload = z.infer<typeof attachmentPayloadSchema>;
38
+
39
+ export type TAttachmentForeignKey = AttachmentRef;
40
+
41
+ export interface IAttachmentPayload {
42
+ type: FileType;
43
+ payload: AttachmentRef;
44
+ }
@@ -0,0 +1,90 @@
1
+ /*
2
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
3
+ * Copyright (c) 2026 Hexastack.
4
+ * Full terms: see LICENSE.md.
5
+ */
6
+
7
+ import { z } from "zod";
8
+
9
+ export enum ButtonType {
10
+ postback = "postback",
11
+ web_url = "web_url",
12
+ }
13
+
14
+ export type PostBackButton = {
15
+ type: ButtonType.postback;
16
+ title: string;
17
+ payload: string;
18
+ };
19
+
20
+ export type WebviewHeightRatio = "compact" | "tall" | "full";
21
+
22
+ export type WebUrlButton = {
23
+ type: ButtonType.web_url;
24
+ title: string;
25
+ url: string;
26
+ messenger_extensions?: boolean;
27
+ webview_height_ratio?: WebviewHeightRatio;
28
+ };
29
+
30
+ export type Button = PostBackButton | WebUrlButton;
31
+
32
+ export type AnyButton = Button;
33
+
34
+ export const buttonSchema = z
35
+ .object({
36
+ type: z.enum([ButtonType.postback, ButtonType.web_url]).meta({
37
+ title: "Type",
38
+ description: "The type of button.",
39
+ }),
40
+ title: z.string().meta({
41
+ title: "Title",
42
+ description: "The label shown to the user.",
43
+ }),
44
+ payload: z.string().optional().meta({
45
+ title: "Payload",
46
+ description: "The value sent back when the button is clicked.",
47
+ }),
48
+ url: z
49
+ .union([z.url(), z.literal("")])
50
+ .optional()
51
+ .meta({
52
+ title: "URL",
53
+ description: "The destination URL opened when the button is clicked.",
54
+ }),
55
+ messenger_extensions: z.boolean().optional().meta({
56
+ title: "Messenger extensions",
57
+ description: "Whether to enable Messenger Extensions for the webview.",
58
+ }),
59
+ webview_height_ratio: z.enum(["compact", "tall", "full"]).optional().meta({
60
+ title: "Webview height ratio",
61
+ description: "The height of the webview.",
62
+ }),
63
+ })
64
+ .superRefine((button, ctx) => {
65
+ if (button.type === ButtonType.postback && !button.payload) {
66
+ ctx.addIssue({
67
+ code: z.ZodIssueCode.custom,
68
+ path: ["payload"],
69
+ message: "Payload is required for postback buttons.",
70
+ });
71
+ }
72
+
73
+ if (button.type === ButtonType.web_url && !button.url) {
74
+ ctx.addIssue({
75
+ code: z.ZodIssueCode.custom,
76
+ path: ["url"],
77
+ message: "URL is required for web_url buttons.",
78
+ });
79
+ }
80
+ }) as unknown as z.ZodType<Button>;
81
+
82
+ export enum PayloadType {
83
+ location = "location",
84
+ attachment = "attachment",
85
+ quickReply = "quickReply",
86
+ button = "button",
87
+ outcome = "outcome",
88
+ menu = "menu",
89
+ content = "content",
90
+ }
@@ -0,0 +1,173 @@
1
+ /*
2
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
3
+ * Copyright (c) 2026 Hexastack.
4
+ * Full terms: see LICENSE.md.
5
+ */
6
+
7
+ export {
8
+ fileTypeSchema,
9
+ attachmentRefSchema,
10
+ attachmentPayloadSchema,
11
+ FileType,
12
+ type AttachmentRef,
13
+ type AttachmentPayload,
14
+ type IAttachmentPayload,
15
+ type TAttachmentForeignKey,
16
+ } from "./attachment";
17
+
18
+ export {
19
+ buttonSchema,
20
+ ButtonType,
21
+ PayloadType,
22
+ type AnyButton,
23
+ type Button,
24
+ type PostBackButton,
25
+ type WebUrlButton,
26
+ type WebviewHeightRatio,
27
+ } from "./button";
28
+
29
+ export {
30
+ contentOptionsSchema,
31
+ fallbackOptionsSchema,
32
+ ActionOptionsSchema,
33
+ type ActionOptions,
34
+ type ContentOptions,
35
+ type FallbackOptions,
36
+ } from "./options";
37
+
38
+ export {
39
+ coordinatesSchema,
40
+ payloadSchema,
41
+ stdQuickReplySchema,
42
+ type Payload,
43
+ type StdQuickReply,
44
+ } from "./quick-reply";
45
+
46
+ export {
47
+ incomingMessageType,
48
+ outgoingMessageTypeSchema,
49
+ payloadTypeSchema,
50
+ stdOutgoingTextMessageDataSchema,
51
+ stdOutgoingQuickRepliesMessageDataSchema,
52
+ stdOutgoingButtonsMessageDataSchema,
53
+ stdOutgoingListMessageDataSchema,
54
+ stdOutgoingAttachmentMessageDataSchema,
55
+ stdOutgoingSystemMessageDataSchema,
56
+ stdOutgoingTextMessageSchema,
57
+ stdOutgoingQuickRepliesMessageSchema,
58
+ stdOutgoingButtonsMessageSchema,
59
+ contentElementSchema,
60
+ contentPaginationSchema,
61
+ stdOutgoingListMessageSchema,
62
+ stdOutgoingCarouselMessageSchema,
63
+ stdOutgoingAttachmentMessageSchema,
64
+ stdOutgoingSystemMessageSchema,
65
+ stdOutgoingMessageSchema,
66
+ stdIncomingTextMessageDataSchema,
67
+ stdIncomingPayloadMessageDataSchema,
68
+ stdIncomingLocationMessageDataSchema,
69
+ stdIncomingAttachmentMessageDataSchema,
70
+ stdIncomingTextMessageSchema,
71
+ stdIncomingPostBackMessageSchema,
72
+ stdIncomingQuickReplyMessageSchema,
73
+ stdIncomingLocationMessageSchema,
74
+ stdIncomingAttachmentMessageSchema,
75
+ stdIncomingMessageSchema,
76
+ stdOutgoingTextEnvelopeSchema,
77
+ stdOutgoingQuickRepliesEnvelopeSchema,
78
+ stdOutgoingButtonsEnvelopeSchema,
79
+ stdOutgoingListEnvelopeSchema,
80
+ stdOutgoingAttachmentEnvelopeSchema,
81
+ stdOutgoingSystemEnvelopeSchema,
82
+ stdOutgoingMessageEnvelopeSchema,
83
+ stdOutgoingEnvelopeSchema,
84
+ IncomingMessageType,
85
+ OutgoingMessageType,
86
+ StdEventType,
87
+ type AnyMessage,
88
+ type ContentElement,
89
+ type ContentPagination,
90
+ type IncomingMessage,
91
+ type IncomingMessageTypeLiteral,
92
+ type OutgoingMessage,
93
+ type OutgoingMessageTypeLiteral,
94
+ type OutgoingPopulatedListMessage,
95
+ type PayloadTypeLiteral,
96
+ type StdIncomingAttachmentMessageData,
97
+ type StdIncomingAttachmentMessage,
98
+ type StdIncomingLocationMessageData,
99
+ type StdIncomingLocationMessage,
100
+ type StdIncomingPayloadMessageData,
101
+ type StdIncomingQuickReplyMessage,
102
+ type StdIncomingMessage,
103
+ type StdIncomingPostBackMessage,
104
+ type StdIncomingTextMessageData,
105
+ type StdIncomingTextMessage,
106
+ type StdOutgoingAttachmentMessageData,
107
+ type StdOutgoingAttachmentEnvelope,
108
+ type StdOutgoingAttachmentMessage,
109
+ type StdOutgoingButtonsMessageData,
110
+ type StdOutgoingButtonsEnvelope,
111
+ type StdOutgoingButtonsMessage,
112
+ type StdOutgoingCarouselMessage,
113
+ type StdOutgoingEnvelope,
114
+ type StdOutgoingListMessageData,
115
+ type StdOutgoingListEnvelope,
116
+ type StdOutgoingListMessage,
117
+ type StdOutgoingMessage,
118
+ type StdOutgoingQuickRepliesMessageData,
119
+ type StdOutgoingMessageEnvelope,
120
+ type StdOutgoingQuickRepliesEnvelope,
121
+ type StdOutgoingQuickRepliesMessage,
122
+ type StdOutgoingSystemMessageData,
123
+ type StdOutgoingSystemEnvelope,
124
+ type StdOutgoingSystemMessage,
125
+ type StdOutgoingTextMessageData,
126
+ type StdOutgoingTextEnvelope,
127
+ type StdOutgoingTextMessage,
128
+ } from "./message-contract";
129
+
130
+ export {
131
+ labelGroupFullSchema,
132
+ labelGroupSchema,
133
+ labelGroupStubSchema,
134
+ type LabelGroup,
135
+ type LabelGroupFull,
136
+ type LabelGroupStub,
137
+ } from "./label-group";
138
+
139
+ export {
140
+ labelFullSchema,
141
+ labelSchema,
142
+ labelStubSchema,
143
+ type Label,
144
+ type LabelFull,
145
+ type LabelStub,
146
+ } from "./label";
147
+
148
+ export {
149
+ subscriberFullSchema,
150
+ subscriberSchema,
151
+ subscriberStubSchema,
152
+ type Subscriber,
153
+ type SubscriberFull,
154
+ type SubscriberStub,
155
+ } from "./subscriber";
156
+
157
+ export {
158
+ threadFullSchema,
159
+ threadSchema,
160
+ threadStubSchema,
161
+ type Thread,
162
+ type ThreadFull,
163
+ type ThreadStub,
164
+ } from "./thread";
165
+
166
+ export {
167
+ messageFullSchema,
168
+ messageSchema,
169
+ messageStubSchema,
170
+ type Message,
171
+ type MessageFull,
172
+ type MessageStub,
173
+ } from "./message";
@@ -0,0 +1,35 @@
1
+ /*
2
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
3
+ * Copyright (c) 2026 Hexastack.
4
+ * Full terms: see LICENSE.md.
5
+ */
6
+
7
+ import { z } from "zod";
8
+
9
+ import { baseStubSchema } from "../shared/base";
10
+ import { preprocess } from "../shared/preprocess";
11
+
12
+ import { labelSchema } from "./label";
13
+
14
+ const labelGroupObjectSchema = baseStubSchema.extend({
15
+ name: z.string(),
16
+ });
17
+
18
+ export const labelGroupStubSchema = labelGroupObjectSchema;
19
+
20
+ export const labelGroupSchema = labelGroupObjectSchema.extend({
21
+ labels: preprocess(() => undefined, z.undefined().optional()).optional(),
22
+ });
23
+
24
+ export const labelGroupFullSchema = labelGroupObjectSchema.extend({
25
+ labels: preprocess(
26
+ (value) => (Array.isArray(value) ? value : []),
27
+ z.array(z.lazy(() => labelSchema)),
28
+ ).optional(),
29
+ });
30
+
31
+ export type LabelGroupStub = z.infer<typeof labelGroupStubSchema>;
32
+
33
+ export type LabelGroup = z.infer<typeof labelGroupSchema>;
34
+
35
+ export type LabelGroupFull = z.infer<typeof labelGroupFullSchema>;
@@ -0,0 +1,56 @@
1
+ /*
2
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
3
+ * Copyright (c) 2026 Hexastack.
4
+ * Full terms: see LICENSE.md.
5
+ */
6
+
7
+ import { z } from "zod";
8
+
9
+ import { asId, withAliases } from "../shared/aliases";
10
+ import { baseStubSchema } from "../shared/base";
11
+ import { preprocess } from "../shared/preprocess";
12
+
13
+ import { labelGroupSchema } from "./label-group";
14
+ import { subscriberSchema } from "./subscriber";
15
+
16
+ const nullableOptionalStringSchema = z.string().nullable().optional();
17
+ const labelAliasMap = {
18
+ groupId: "group",
19
+ } as const;
20
+ const labelStubObjectSchema = baseStubSchema.extend({
21
+ title: z.string(),
22
+ name: z.string(),
23
+ label_id: z.record(z.string(), z.unknown()).nullable().optional(),
24
+ description: nullableOptionalStringSchema,
25
+ builtin: z.coerce.boolean(),
26
+ });
27
+
28
+ export const labelStubSchema = labelStubObjectSchema;
29
+
30
+ export const labelSchema = preprocess(
31
+ (value) => withAliases(value, labelAliasMap),
32
+ labelStubObjectSchema.extend({
33
+ group: preprocess(
34
+ (value) => (value == null ? null : asId(value)),
35
+ z.string().nullable(),
36
+ ).optional(),
37
+ users: preprocess(() => undefined, z.undefined().optional()).optional(),
38
+ }),
39
+ );
40
+
41
+ export const labelFullSchema = labelStubObjectSchema.extend({
42
+ users: preprocess(
43
+ (value) => (Array.isArray(value) ? value : []),
44
+ z.array(z.lazy(() => subscriberSchema)),
45
+ ).optional(),
46
+ group: z
47
+ .lazy(() => labelGroupSchema)
48
+ .nullable()
49
+ .optional(),
50
+ });
51
+
52
+ export type LabelStub = z.infer<typeof labelStubSchema>;
53
+
54
+ export type Label = z.infer<typeof labelSchema>;
55
+
56
+ export type LabelFull = z.infer<typeof labelFullSchema>;