digital-tools 2.1.1 → 2.3.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 (293) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +2 -0
  3. package/dist/client.d.ts +109 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +69 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/define.d.ts +2 -2
  8. package/dist/define.d.ts.map +1 -1
  9. package/dist/define.js +22 -20
  10. package/dist/define.js.map +1 -1
  11. package/dist/function-ref.d.ts +229 -0
  12. package/dist/function-ref.d.ts.map +1 -0
  13. package/dist/function-ref.js +28 -0
  14. package/dist/function-ref.js.map +1 -0
  15. package/dist/function-sugar.d.ts +57 -0
  16. package/dist/function-sugar.d.ts.map +1 -0
  17. package/dist/function-sugar.js +79 -0
  18. package/dist/function-sugar.js.map +1 -0
  19. package/dist/index.d.ts +10 -3
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +24 -4
  22. package/dist/index.js.map +1 -1
  23. package/dist/providers/analytics/mixpanel.d.ts.map +1 -1
  24. package/dist/providers/analytics/mixpanel.js +21 -18
  25. package/dist/providers/analytics/mixpanel.js.map +1 -1
  26. package/dist/providers/calendar/cal-com.d.ts.map +1 -1
  27. package/dist/providers/calendar/cal-com.js +10 -10
  28. package/dist/providers/calendar/cal-com.js.map +1 -1
  29. package/dist/providers/calendar/google-calendar.d.ts.map +1 -1
  30. package/dist/providers/calendar/google-calendar.js +4 -4
  31. package/dist/providers/calendar/google-calendar.js.map +1 -1
  32. package/dist/providers/crm/hubspot.d.ts.map +1 -1
  33. package/dist/providers/crm/hubspot.js +107 -85
  34. package/dist/providers/crm/hubspot.js.map +1 -1
  35. package/dist/providers/development/github.d.ts.map +1 -1
  36. package/dist/providers/development/github.js +40 -43
  37. package/dist/providers/development/github.js.map +1 -1
  38. package/dist/providers/ecommerce/shopify.d.ts.map +1 -1
  39. package/dist/providers/ecommerce/shopify.js +79 -62
  40. package/dist/providers/ecommerce/shopify.js.map +1 -1
  41. package/dist/providers/email/resend.d.ts.map +1 -1
  42. package/dist/providers/email/resend.js +20 -16
  43. package/dist/providers/email/resend.js.map +1 -1
  44. package/dist/providers/email/sendgrid.d.ts.map +1 -1
  45. package/dist/providers/email/sendgrid.js +12 -9
  46. package/dist/providers/email/sendgrid.js.map +1 -1
  47. package/dist/providers/finance/stripe.d.ts.map +1 -1
  48. package/dist/providers/finance/stripe.js +44 -42
  49. package/dist/providers/finance/stripe.js.map +1 -1
  50. package/dist/providers/forms/typeform.d.ts.map +1 -1
  51. package/dist/providers/forms/typeform.js +68 -58
  52. package/dist/providers/forms/typeform.js.map +1 -1
  53. package/dist/providers/knowledge/notion.d.ts.map +1 -1
  54. package/dist/providers/knowledge/notion.js +75 -41
  55. package/dist/providers/knowledge/notion.js.map +1 -1
  56. package/dist/providers/marketing/mailchimp.d.ts.map +1 -1
  57. package/dist/providers/marketing/mailchimp.js +74 -61
  58. package/dist/providers/marketing/mailchimp.js.map +1 -1
  59. package/dist/providers/media/cloudinary.d.ts.map +1 -1
  60. package/dist/providers/media/cloudinary.js +30 -28
  61. package/dist/providers/media/cloudinary.js.map +1 -1
  62. package/dist/providers/messaging/slack.d.ts.map +1 -1
  63. package/dist/providers/messaging/slack.js +75 -58
  64. package/dist/providers/messaging/slack.js.map +1 -1
  65. package/dist/providers/messaging/twilio-sms.d.ts.map +1 -1
  66. package/dist/providers/messaging/twilio-sms.js +33 -15
  67. package/dist/providers/messaging/twilio-sms.js.map +1 -1
  68. package/dist/providers/project-management/linear.d.ts.map +1 -1
  69. package/dist/providers/project-management/linear.js +31 -27
  70. package/dist/providers/project-management/linear.js.map +1 -1
  71. package/dist/providers/spreadsheet/google-sheets.d.ts.map +1 -1
  72. package/dist/providers/spreadsheet/google-sheets.js +21 -18
  73. package/dist/providers/spreadsheet/google-sheets.js.map +1 -1
  74. package/dist/providers/spreadsheet/xlsx.d.ts.map +1 -1
  75. package/dist/providers/spreadsheet/xlsx.js +4 -4
  76. package/dist/providers/spreadsheet/xlsx.js.map +1 -1
  77. package/dist/providers/storage/index.js +1 -0
  78. package/dist/providers/storage/index.js.map +1 -1
  79. package/dist/providers/storage/s3.d.ts.map +1 -1
  80. package/dist/providers/storage/s3.js +36 -27
  81. package/dist/providers/storage/s3.js.map +1 -1
  82. package/dist/providers/support/zendesk.d.ts.map +1 -1
  83. package/dist/providers/support/zendesk.js +24 -25
  84. package/dist/providers/support/zendesk.js.map +1 -1
  85. package/dist/providers/tasks/todoist.d.ts.map +1 -1
  86. package/dist/providers/tasks/todoist.js +18 -18
  87. package/dist/providers/tasks/todoist.js.map +1 -1
  88. package/dist/providers/video-conferencing/google-meet.d.ts.map +1 -1
  89. package/dist/providers/video-conferencing/google-meet.js +11 -11
  90. package/dist/providers/video-conferencing/google-meet.js.map +1 -1
  91. package/dist/providers/video-conferencing/jitsi.js +14 -14
  92. package/dist/providers/video-conferencing/jitsi.js.map +1 -1
  93. package/dist/providers/video-conferencing/teams.d.ts.map +1 -1
  94. package/dist/providers/video-conferencing/teams.js +9 -7
  95. package/dist/providers/video-conferencing/teams.js.map +1 -1
  96. package/dist/providers/video-conferencing/zoom.d.ts.map +1 -1
  97. package/dist/providers/video-conferencing/zoom.js +26 -24
  98. package/dist/providers/video-conferencing/zoom.js.map +1 -1
  99. package/dist/tools/data.d.ts.map +1 -1
  100. package/dist/tools/data.js +5 -12
  101. package/dist/tools/data.js.map +1 -1
  102. package/dist/tools/index.d.ts +1 -0
  103. package/dist/tools/index.d.ts.map +1 -1
  104. package/dist/tools/index.js +1 -0
  105. package/dist/tools/index.js.map +1 -1
  106. package/dist/tools/system.d.ts +289 -0
  107. package/dist/tools/system.d.ts.map +1 -0
  108. package/dist/tools/system.js +752 -0
  109. package/dist/tools/system.js.map +1 -0
  110. package/dist/tools/web.d.ts.map +1 -1
  111. package/dist/tools/web.js +22 -10
  112. package/dist/tools/web.js.map +1 -1
  113. package/dist/track-record.d.ts +101 -0
  114. package/dist/track-record.d.ts.map +1 -0
  115. package/dist/track-record.js +17 -0
  116. package/dist/track-record.js.map +1 -0
  117. package/dist/types.d.ts +210 -9
  118. package/dist/types.d.ts.map +1 -1
  119. package/dist/verb-registration.d.ts +122 -0
  120. package/dist/verb-registration.d.ts.map +1 -0
  121. package/dist/verb-registration.js +176 -0
  122. package/dist/verb-registration.js.map +1 -0
  123. package/dist/worker.d.ts +93 -0
  124. package/dist/worker.d.ts.map +1 -0
  125. package/dist/worker.js +315 -0
  126. package/dist/worker.js.map +1 -0
  127. package/dist/wrap.d.ts +89 -0
  128. package/dist/wrap.d.ts.map +1 -0
  129. package/dist/wrap.js +225 -0
  130. package/dist/wrap.js.map +1 -0
  131. package/package.json +21 -4
  132. package/src/client.ts +136 -0
  133. package/src/define.ts +31 -37
  134. package/src/function-ref.ts +264 -0
  135. package/src/function-sugar.ts +134 -0
  136. package/src/index.ts +132 -10
  137. package/src/providers/analytics/mixpanel.ts +19 -18
  138. package/src/providers/calendar/cal-com.ts +29 -18
  139. package/src/providers/calendar/google-calendar.ts +20 -14
  140. package/src/providers/crm/hubspot.ts +225 -99
  141. package/src/providers/development/github.ts +206 -135
  142. package/src/providers/ecommerce/shopify.ts +250 -89
  143. package/src/providers/email/resend.ts +101 -28
  144. package/src/providers/email/sendgrid.ts +12 -9
  145. package/src/providers/finance/stripe.ts +128 -49
  146. package/src/providers/forms/typeform.ts +74 -58
  147. package/src/providers/knowledge/notion.ts +340 -88
  148. package/src/providers/marketing/mailchimp.ts +86 -70
  149. package/src/providers/media/cloudinary.ts +99 -41
  150. package/src/providers/messaging/slack.ts +283 -85
  151. package/src/providers/messaging/twilio-sms.ts +35 -15
  152. package/src/providers/project-management/linear.ts +143 -55
  153. package/src/providers/spreadsheet/google-sheets.ts +222 -56
  154. package/src/providers/spreadsheet/xlsx.ts +47 -16
  155. package/src/providers/storage/s3.ts +119 -47
  156. package/src/providers/support/zendesk.ts +196 -46
  157. package/src/providers/tasks/todoist.ts +20 -26
  158. package/src/providers/video-conferencing/google-meet.ts +17 -20
  159. package/src/providers/video-conferencing/jitsi.ts +14 -14
  160. package/src/providers/video-conferencing/teams.ts +14 -13
  161. package/src/providers/video-conferencing/zoom.ts +54 -49
  162. package/src/tools/data.ts +6 -16
  163. package/src/tools/index.ts +1 -0
  164. package/src/tools/system.ts +887 -0
  165. package/src/tools/web.ts +22 -10
  166. package/src/track-record.ts +106 -0
  167. package/src/types.ts +241 -13
  168. package/src/verb-registration.ts +197 -0
  169. package/src/worker.ts +370 -0
  170. package/src/wrap.ts +260 -0
  171. package/test/client.test.ts +146 -0
  172. package/test/communication-tools-extended.test.ts +734 -0
  173. package/test/data-tools-extended.test.ts +743 -0
  174. package/test/define-extended.test.ts +819 -0
  175. package/test/define.test.ts +150 -41
  176. package/test/entities.test.ts +623 -0
  177. package/test/extended-entities.test.ts +1228 -0
  178. package/test/provider-implementations.test.ts +725 -0
  179. package/test/provider-registry-extended.test.ts +583 -0
  180. package/test/providers/google-sheets.test.ts +851 -0
  181. package/test/providers/helpers.ts +554 -0
  182. package/test/providers/hubspot.test.ts +576 -0
  183. package/test/providers/slack.test.ts +932 -0
  184. package/test/providers/stripe.test.ts +701 -0
  185. package/test/providers.test.ts +578 -0
  186. package/test/system-tools-extended.test.ts +632 -0
  187. package/test/system.test.ts +673 -0
  188. package/test/tools.test.ts +15 -11
  189. package/test/types.test.ts +402 -0
  190. package/test/verb-registration.test.ts +395 -0
  191. package/test/web-tools.test.ts +553 -0
  192. package/test/worker-extended.test.ts +699 -0
  193. package/test/worker.test.ts +576 -0
  194. package/test/wrap.test.ts +366 -0
  195. package/tsconfig.json +3 -13
  196. package/vitest.config.ts +37 -0
  197. package/wrangler.jsonc +9 -0
  198. package/.turbo/turbo-build.log +0 -5
  199. package/dist/providers/voice/vapi.d.ts +0 -27
  200. package/dist/providers/voice/vapi.d.ts.map +0 -1
  201. package/dist/providers/voice/vapi.js +0 -440
  202. package/dist/providers/voice/vapi.js.map +0 -1
  203. package/src/define.js +0 -267
  204. package/src/entities/advertising.js +0 -999
  205. package/src/entities/ai.js +0 -756
  206. package/src/entities/analytics.js +0 -1588
  207. package/src/entities/automation.js +0 -601
  208. package/src/entities/communication.js +0 -1150
  209. package/src/entities/crm.js +0 -1386
  210. package/src/entities/design.js +0 -546
  211. package/src/entities/development.js +0 -2212
  212. package/src/entities/document.js +0 -874
  213. package/src/entities/ecommerce.js +0 -1429
  214. package/src/entities/experiment.js +0 -1039
  215. package/src/entities/finance.js +0 -3478
  216. package/src/entities/forms.js +0 -1892
  217. package/src/entities/hr.js +0 -661
  218. package/src/entities/identity.js +0 -997
  219. package/src/entities/index.js +0 -282
  220. package/src/entities/infrastructure.js +0 -1153
  221. package/src/entities/knowledge.js +0 -1438
  222. package/src/entities/marketing.js +0 -1610
  223. package/src/entities/media.js +0 -1634
  224. package/src/entities/notification.js +0 -1199
  225. package/src/entities/presentation.js +0 -1274
  226. package/src/entities/productivity.js +0 -1317
  227. package/src/entities/project-management.js +0 -1136
  228. package/src/entities/recruiting.js +0 -736
  229. package/src/entities/shipping.js +0 -509
  230. package/src/entities/signature.js +0 -1102
  231. package/src/entities/site.js +0 -222
  232. package/src/entities/spreadsheet.js +0 -1341
  233. package/src/entities/storage.js +0 -1198
  234. package/src/entities/support.js +0 -1166
  235. package/src/entities/video-conferencing.js +0 -1750
  236. package/src/entities/video.js +0 -950
  237. package/src/entities.js +0 -1663
  238. package/src/index.js +0 -74
  239. package/src/providers/analytics/index.js +0 -17
  240. package/src/providers/analytics/mixpanel.js +0 -255
  241. package/src/providers/calendar/cal-com.js +0 -303
  242. package/src/providers/calendar/google-calendar.js +0 -335
  243. package/src/providers/calendar/index.js +0 -20
  244. package/src/providers/crm/hubspot.js +0 -566
  245. package/src/providers/crm/index.js +0 -17
  246. package/src/providers/development/github.js +0 -472
  247. package/src/providers/development/index.js +0 -17
  248. package/src/providers/ecommerce/index.js +0 -17
  249. package/src/providers/ecommerce/shopify.js +0 -378
  250. package/src/providers/email/index.js +0 -20
  251. package/src/providers/email/resend.js +0 -258
  252. package/src/providers/email/sendgrid.js +0 -161
  253. package/src/providers/finance/index.js +0 -17
  254. package/src/providers/finance/stripe.js +0 -549
  255. package/src/providers/forms/index.js +0 -17
  256. package/src/providers/forms/typeform.js +0 -500
  257. package/src/providers/index.js +0 -123
  258. package/src/providers/knowledge/index.js +0 -17
  259. package/src/providers/knowledge/notion.js +0 -389
  260. package/src/providers/marketing/index.js +0 -17
  261. package/src/providers/marketing/mailchimp.js +0 -443
  262. package/src/providers/media/cloudinary.js +0 -318
  263. package/src/providers/media/index.js +0 -17
  264. package/src/providers/messaging/index.js +0 -20
  265. package/src/providers/messaging/slack.js +0 -393
  266. package/src/providers/messaging/twilio-sms.js +0 -249
  267. package/src/providers/project-management/index.js +0 -17
  268. package/src/providers/project-management/linear.js +0 -575
  269. package/src/providers/registry.js +0 -86
  270. package/src/providers/spreadsheet/google-sheets.js +0 -375
  271. package/src/providers/spreadsheet/index.js +0 -20
  272. package/src/providers/spreadsheet/xlsx.js +0 -423
  273. package/src/providers/storage/index.js +0 -24
  274. package/src/providers/storage/s3.js +0 -419
  275. package/src/providers/support/index.js +0 -17
  276. package/src/providers/support/zendesk.js +0 -373
  277. package/src/providers/tasks/index.js +0 -17
  278. package/src/providers/tasks/todoist.js +0 -286
  279. package/src/providers/types.js +0 -9
  280. package/src/providers/video-conferencing/google-meet.js +0 -286
  281. package/src/providers/video-conferencing/index.js +0 -31
  282. package/src/providers/video-conferencing/jitsi.js +0 -254
  283. package/src/providers/video-conferencing/teams.js +0 -270
  284. package/src/providers/video-conferencing/zoom.js +0 -332
  285. package/src/registry.js +0 -128
  286. package/src/tools/communication.js +0 -184
  287. package/src/tools/data.js +0 -205
  288. package/src/tools/index.js +0 -11
  289. package/src/tools/web.js +0 -137
  290. package/src/types.js +0 -10
  291. package/test/define.test.js +0 -306
  292. package/test/registry.test.js +0 -357
  293. package/test/tools.test.js +0 -363
@@ -1,1199 +0,0 @@
1
- /**
2
- * Notification Entity Types (Nouns)
3
- *
4
- * Notification and messaging primitives for push, SMS, email, and in-app notifications.
5
- *
6
- * @packageDocumentation
7
- */
8
- // =============================================================================
9
- // Notification
10
- // =============================================================================
11
- /**
12
- * Notification entity
13
- *
14
- * A notification message sent to users through various channels.
15
- */
16
- export const Notification = {
17
- singular: 'notification',
18
- plural: 'notifications',
19
- description: 'A notification message sent to users through various channels',
20
- properties: {
21
- id: {
22
- type: 'string',
23
- description: 'Unique notification identifier',
24
- },
25
- title: {
26
- type: 'string',
27
- description: 'Notification title',
28
- },
29
- body: {
30
- type: 'string',
31
- description: 'Notification body content',
32
- },
33
- channel: {
34
- type: 'string',
35
- description: 'Delivery channel: email, sms, push, in-app, webhook',
36
- examples: ['email', 'sms', 'push', 'in-app', 'webhook'],
37
- },
38
- status: {
39
- type: 'string',
40
- description: 'Delivery status',
41
- examples: ['pending', 'sent', 'delivered', 'failed', 'bounced'],
42
- },
43
- priority: {
44
- type: 'string',
45
- optional: true,
46
- description: 'Notification priority',
47
- examples: ['low', 'normal', 'high', 'urgent'],
48
- },
49
- category: {
50
- type: 'string',
51
- optional: true,
52
- description: 'Notification category for grouping',
53
- },
54
- recipientId: {
55
- type: 'string',
56
- description: 'Recipient user ID',
57
- },
58
- recipientEmail: {
59
- type: 'string',
60
- optional: true,
61
- description: 'Recipient email address',
62
- },
63
- recipientPhone: {
64
- type: 'string',
65
- optional: true,
66
- description: 'Recipient phone number',
67
- },
68
- recipientDeviceToken: {
69
- type: 'string',
70
- optional: true,
71
- description: 'Recipient device token for push',
72
- },
73
- senderId: {
74
- type: 'string',
75
- optional: true,
76
- description: 'Sender user or system ID',
77
- },
78
- templateId: {
79
- type: 'string',
80
- optional: true,
81
- description: 'Template used for this notification',
82
- },
83
- data: {
84
- type: 'json',
85
- optional: true,
86
- description: 'Template variables and custom data',
87
- },
88
- scheduledAt: {
89
- type: 'datetime',
90
- optional: true,
91
- description: 'Scheduled send time',
92
- },
93
- sentAt: {
94
- type: 'datetime',
95
- optional: true,
96
- description: 'Actual send time',
97
- },
98
- deliveredAt: {
99
- type: 'datetime',
100
- optional: true,
101
- description: 'Delivery confirmation time',
102
- },
103
- readAt: {
104
- type: 'datetime',
105
- optional: true,
106
- description: 'Time when notification was read',
107
- },
108
- clickedAt: {
109
- type: 'datetime',
110
- optional: true,
111
- description: 'Time when notification was clicked',
112
- },
113
- expiresAt: {
114
- type: 'datetime',
115
- optional: true,
116
- description: 'Notification expiration time',
117
- },
118
- actionUrl: {
119
- type: 'url',
120
- optional: true,
121
- description: 'URL to open when clicked',
122
- },
123
- imageUrl: {
124
- type: 'url',
125
- optional: true,
126
- description: 'Image URL for rich notifications',
127
- },
128
- icon: {
129
- type: 'string',
130
- optional: true,
131
- description: 'Icon identifier or URL',
132
- },
133
- badge: {
134
- type: 'number',
135
- optional: true,
136
- description: 'Badge count for app icon',
137
- },
138
- sound: {
139
- type: 'string',
140
- optional: true,
141
- description: 'Sound to play on delivery',
142
- },
143
- tags: {
144
- type: 'string',
145
- array: true,
146
- optional: true,
147
- description: 'Tags for filtering and analytics',
148
- },
149
- metadata: {
150
- type: 'json',
151
- optional: true,
152
- description: 'Additional metadata',
153
- },
154
- errorMessage: {
155
- type: 'string',
156
- optional: true,
157
- description: 'Error message if delivery failed',
158
- },
159
- retryCount: {
160
- type: 'number',
161
- optional: true,
162
- description: 'Number of delivery retry attempts',
163
- },
164
- },
165
- relationships: {
166
- recipient: {
167
- type: 'User',
168
- description: 'User receiving the notification',
169
- },
170
- template: {
171
- type: 'NotificationTemplate',
172
- required: false,
173
- description: 'Template used',
174
- },
175
- campaign: {
176
- type: 'NotificationCampaign',
177
- required: false,
178
- description: 'Campaign this notification belongs to',
179
- },
180
- },
181
- actions: [
182
- 'send',
183
- 'schedule',
184
- 'cancel',
185
- 'retry',
186
- 'read',
187
- 'click',
188
- ],
189
- events: [
190
- 'sent',
191
- 'delivered',
192
- 'failed',
193
- 'bounced',
194
- 'read',
195
- 'clicked',
196
- ],
197
- };
198
- // =============================================================================
199
- // NotificationTemplate
200
- // =============================================================================
201
- /**
202
- * NotificationTemplate entity
203
- *
204
- * A reusable template for notifications.
205
- */
206
- export const NotificationTemplate = {
207
- singular: 'notification-template',
208
- plural: 'notification-templates',
209
- description: 'A reusable template for notifications',
210
- properties: {
211
- id: {
212
- type: 'string',
213
- description: 'Unique template identifier',
214
- },
215
- name: {
216
- type: 'string',
217
- description: 'Template name',
218
- },
219
- slug: {
220
- type: 'string',
221
- description: 'URL-friendly identifier',
222
- },
223
- description: {
224
- type: 'string',
225
- optional: true,
226
- description: 'Template description',
227
- },
228
- channel: {
229
- type: 'string',
230
- description: 'Target channel: email, sms, push, in-app',
231
- examples: ['email', 'sms', 'push', 'in-app'],
232
- },
233
- subject: {
234
- type: 'string',
235
- optional: true,
236
- description: 'Subject line for email notifications',
237
- },
238
- title: {
239
- type: 'string',
240
- optional: true,
241
- description: 'Title template with variables',
242
- },
243
- body: {
244
- type: 'string',
245
- description: 'Body template with variables',
246
- },
247
- htmlBody: {
248
- type: 'string',
249
- optional: true,
250
- description: 'HTML body for email notifications',
251
- },
252
- variables: {
253
- type: 'string',
254
- array: true,
255
- optional: true,
256
- description: 'List of template variables',
257
- },
258
- defaultData: {
259
- type: 'json',
260
- optional: true,
261
- description: 'Default values for variables',
262
- },
263
- category: {
264
- type: 'string',
265
- optional: true,
266
- description: 'Template category',
267
- },
268
- locale: {
269
- type: 'string',
270
- optional: true,
271
- description: 'Template locale/language',
272
- },
273
- version: {
274
- type: 'number',
275
- optional: true,
276
- description: 'Template version number',
277
- },
278
- isActive: {
279
- type: 'boolean',
280
- optional: true,
281
- description: 'Whether template is active',
282
- },
283
- },
284
- relationships: {
285
- notifications: {
286
- type: 'Notification[]',
287
- backref: 'template',
288
- description: 'Notifications using this template',
289
- },
290
- translations: {
291
- type: 'NotificationTemplate[]',
292
- required: false,
293
- description: 'Translated versions',
294
- },
295
- },
296
- actions: [
297
- 'create',
298
- 'update',
299
- 'preview',
300
- 'duplicate',
301
- 'activate',
302
- 'deactivate',
303
- ],
304
- events: [
305
- 'created',
306
- 'updated',
307
- 'activated',
308
- 'deactivated',
309
- ],
310
- };
311
- // =============================================================================
312
- // NotificationCampaign
313
- // =============================================================================
314
- /**
315
- * NotificationCampaign entity
316
- *
317
- * A campaign for sending bulk notifications.
318
- */
319
- export const NotificationCampaign = {
320
- singular: 'notification-campaign',
321
- plural: 'notification-campaigns',
322
- description: 'A campaign for sending bulk notifications',
323
- properties: {
324
- id: {
325
- type: 'string',
326
- description: 'Unique campaign identifier',
327
- },
328
- name: {
329
- type: 'string',
330
- description: 'Campaign name',
331
- },
332
- description: {
333
- type: 'string',
334
- optional: true,
335
- description: 'Campaign description',
336
- },
337
- status: {
338
- type: 'string',
339
- description: 'Campaign status',
340
- examples: ['draft', 'scheduled', 'running', 'paused', 'completed', 'cancelled'],
341
- },
342
- channel: {
343
- type: 'string',
344
- description: 'Notification channel',
345
- },
346
- templateId: {
347
- type: 'string',
348
- optional: true,
349
- description: 'Template ID to use',
350
- },
351
- segmentId: {
352
- type: 'string',
353
- optional: true,
354
- description: 'Target audience segment',
355
- },
356
- audienceFilter: {
357
- type: 'json',
358
- optional: true,
359
- description: 'Custom audience filter criteria',
360
- },
361
- scheduledAt: {
362
- type: 'datetime',
363
- optional: true,
364
- description: 'Scheduled start time',
365
- },
366
- startedAt: {
367
- type: 'datetime',
368
- optional: true,
369
- description: 'Actual start time',
370
- },
371
- completedAt: {
372
- type: 'datetime',
373
- optional: true,
374
- description: 'Completion time',
375
- },
376
- totalRecipients: {
377
- type: 'number',
378
- optional: true,
379
- description: 'Total number of recipients',
380
- },
381
- sentCount: {
382
- type: 'number',
383
- optional: true,
384
- description: 'Number of notifications sent',
385
- },
386
- deliveredCount: {
387
- type: 'number',
388
- optional: true,
389
- description: 'Number delivered',
390
- },
391
- failedCount: {
392
- type: 'number',
393
- optional: true,
394
- description: 'Number failed',
395
- },
396
- openRate: {
397
- type: 'number',
398
- optional: true,
399
- description: 'Open rate percentage',
400
- },
401
- clickRate: {
402
- type: 'number',
403
- optional: true,
404
- description: 'Click rate percentage',
405
- },
406
- throttleRate: {
407
- type: 'number',
408
- optional: true,
409
- description: 'Messages per second limit',
410
- },
411
- },
412
- relationships: {
413
- notifications: {
414
- type: 'Notification[]',
415
- backref: 'campaign',
416
- description: 'Notifications in this campaign',
417
- },
418
- template: {
419
- type: 'NotificationTemplate',
420
- required: false,
421
- description: 'Template used',
422
- },
423
- segment: {
424
- type: 'Segment',
425
- required: false,
426
- description: 'Target segment',
427
- },
428
- },
429
- actions: [
430
- 'create',
431
- 'schedule',
432
- 'start',
433
- 'pause',
434
- 'resume',
435
- 'cancel',
436
- ],
437
- events: [
438
- 'created',
439
- 'scheduled',
440
- 'started',
441
- 'paused',
442
- 'resumed',
443
- 'completed',
444
- 'cancelled',
445
- ],
446
- };
447
- // =============================================================================
448
- // SMS
449
- // =============================================================================
450
- /**
451
- * SMS entity
452
- *
453
- * An SMS text message.
454
- */
455
- export const SMS = {
456
- singular: 'sms',
457
- plural: 'sms-messages',
458
- description: 'An SMS text message',
459
- properties: {
460
- id: {
461
- type: 'string',
462
- description: 'Unique SMS identifier',
463
- },
464
- from: {
465
- type: 'string',
466
- description: 'Sender phone number',
467
- },
468
- to: {
469
- type: 'string',
470
- description: 'Recipient phone number',
471
- },
472
- body: {
473
- type: 'string',
474
- description: 'Message body (max 1600 chars)',
475
- },
476
- status: {
477
- type: 'string',
478
- description: 'Message status',
479
- examples: ['queued', 'sending', 'sent', 'delivered', 'failed', 'undelivered'],
480
- },
481
- direction: {
482
- type: 'string',
483
- description: 'Message direction',
484
- examples: ['inbound', 'outbound'],
485
- },
486
- segments: {
487
- type: 'number',
488
- optional: true,
489
- description: 'Number of message segments',
490
- },
491
- encoding: {
492
- type: 'string',
493
- optional: true,
494
- description: 'Message encoding: GSM-7, UCS-2',
495
- },
496
- price: {
497
- type: 'number',
498
- optional: true,
499
- description: 'Message cost',
500
- },
501
- currency: {
502
- type: 'string',
503
- optional: true,
504
- description: 'Currency for price',
505
- },
506
- carrier: {
507
- type: 'string',
508
- optional: true,
509
- description: 'Recipient carrier name',
510
- },
511
- countryCode: {
512
- type: 'string',
513
- optional: true,
514
- description: 'Recipient country code',
515
- },
516
- errorCode: {
517
- type: 'string',
518
- optional: true,
519
- description: 'Error code if failed',
520
- },
521
- errorMessage: {
522
- type: 'string',
523
- optional: true,
524
- description: 'Error message if failed',
525
- },
526
- mediaUrls: {
527
- type: 'url',
528
- array: true,
529
- optional: true,
530
- description: 'Media URLs for MMS',
531
- },
532
- messagingServiceId: {
533
- type: 'string',
534
- optional: true,
535
- description: 'Messaging service ID',
536
- },
537
- conversationId: {
538
- type: 'string',
539
- optional: true,
540
- description: 'Conversation thread ID',
541
- },
542
- queuedAt: {
543
- type: 'datetime',
544
- optional: true,
545
- description: 'Time queued for sending',
546
- },
547
- sentAt: {
548
- type: 'datetime',
549
- optional: true,
550
- description: 'Time sent to carrier',
551
- },
552
- deliveredAt: {
553
- type: 'datetime',
554
- optional: true,
555
- description: 'Time delivered to recipient',
556
- },
557
- },
558
- relationships: {
559
- conversation: {
560
- type: 'SMSConversation',
561
- required: false,
562
- description: 'Parent conversation thread',
563
- },
564
- notification: {
565
- type: 'Notification',
566
- required: false,
567
- description: 'Parent notification if triggered by one',
568
- },
569
- },
570
- actions: [
571
- 'send',
572
- 'schedule',
573
- 'cancel',
574
- 'redact',
575
- ],
576
- events: [
577
- 'queued',
578
- 'sent',
579
- 'delivered',
580
- 'failed',
581
- 'received',
582
- ],
583
- };
584
- // =============================================================================
585
- // SMSConversation
586
- // =============================================================================
587
- /**
588
- * SMSConversation entity
589
- *
590
- * A conversation thread of SMS messages.
591
- */
592
- export const SMSConversation = {
593
- singular: 'sms-conversation',
594
- plural: 'sms-conversations',
595
- description: 'A conversation thread of SMS messages',
596
- properties: {
597
- id: {
598
- type: 'string',
599
- description: 'Unique conversation identifier',
600
- },
601
- participants: {
602
- type: 'string',
603
- array: true,
604
- description: 'Phone numbers in the conversation',
605
- },
606
- status: {
607
- type: 'string',
608
- description: 'Conversation status',
609
- examples: ['active', 'closed', 'archived'],
610
- },
611
- lastMessageAt: {
612
- type: 'datetime',
613
- optional: true,
614
- description: 'Timestamp of last message',
615
- },
616
- lastMessagePreview: {
617
- type: 'string',
618
- optional: true,
619
- description: 'Preview of last message',
620
- },
621
- messageCount: {
622
- type: 'number',
623
- optional: true,
624
- description: 'Total message count',
625
- },
626
- unreadCount: {
627
- type: 'number',
628
- optional: true,
629
- description: 'Unread message count',
630
- },
631
- assignedTo: {
632
- type: 'string',
633
- optional: true,
634
- description: 'Assigned agent ID',
635
- },
636
- tags: {
637
- type: 'string',
638
- array: true,
639
- optional: true,
640
- description: 'Conversation tags',
641
- },
642
- metadata: {
643
- type: 'json',
644
- optional: true,
645
- description: 'Custom metadata',
646
- },
647
- },
648
- relationships: {
649
- messages: {
650
- type: 'SMS[]',
651
- backref: 'conversation',
652
- description: 'Messages in this conversation',
653
- },
654
- contact: {
655
- type: 'Contact',
656
- required: false,
657
- description: 'Associated contact',
658
- },
659
- },
660
- actions: [
661
- 'send',
662
- 'close',
663
- 'archive',
664
- 'assign',
665
- 'read',
666
- ],
667
- events: [
668
- 'messageReceived',
669
- 'messageSent',
670
- 'closed',
671
- 'assigned',
672
- ],
673
- };
674
- // =============================================================================
675
- // PushNotification
676
- // =============================================================================
677
- /**
678
- * PushNotification entity
679
- *
680
- * A mobile push notification.
681
- */
682
- export const PushNotification = {
683
- singular: 'push-notification',
684
- plural: 'push-notifications',
685
- description: 'A mobile push notification',
686
- properties: {
687
- id: {
688
- type: 'string',
689
- description: 'Unique push notification identifier',
690
- },
691
- title: {
692
- type: 'string',
693
- description: 'Notification title',
694
- },
695
- body: {
696
- type: 'string',
697
- description: 'Notification body',
698
- },
699
- subtitle: {
700
- type: 'string',
701
- optional: true,
702
- description: 'Notification subtitle (iOS)',
703
- },
704
- status: {
705
- type: 'string',
706
- description: 'Delivery status',
707
- examples: ['pending', 'sent', 'delivered', 'failed'],
708
- },
709
- platform: {
710
- type: 'string',
711
- description: 'Target platform',
712
- examples: ['ios', 'android', 'web'],
713
- },
714
- deviceToken: {
715
- type: 'string',
716
- description: 'Device push token',
717
- },
718
- userId: {
719
- type: 'string',
720
- optional: true,
721
- description: 'Target user ID',
722
- },
723
- topic: {
724
- type: 'string',
725
- optional: true,
726
- description: 'Push topic for topic-based delivery',
727
- },
728
- collapseKey: {
729
- type: 'string',
730
- optional: true,
731
- description: 'Collapse key for grouping',
732
- },
733
- priority: {
734
- type: 'string',
735
- optional: true,
736
- description: 'Delivery priority',
737
- examples: ['normal', 'high'],
738
- },
739
- ttl: {
740
- type: 'number',
741
- optional: true,
742
- description: 'Time to live in seconds',
743
- },
744
- badge: {
745
- type: 'number',
746
- optional: true,
747
- description: 'Badge count to display',
748
- },
749
- sound: {
750
- type: 'string',
751
- optional: true,
752
- description: 'Sound to play',
753
- },
754
- icon: {
755
- type: 'string',
756
- optional: true,
757
- description: 'Notification icon (Android)',
758
- },
759
- image: {
760
- type: 'url',
761
- optional: true,
762
- description: 'Image URL for rich notification',
763
- },
764
- clickAction: {
765
- type: 'string',
766
- optional: true,
767
- description: 'Action to perform on click',
768
- },
769
- data: {
770
- type: 'json',
771
- optional: true,
772
- description: 'Custom data payload',
773
- },
774
- category: {
775
- type: 'string',
776
- optional: true,
777
- description: 'Notification category for actions',
778
- },
779
- threadId: {
780
- type: 'string',
781
- optional: true,
782
- description: 'Thread ID for grouping (iOS)',
783
- },
784
- channelId: {
785
- type: 'string',
786
- optional: true,
787
- description: 'Notification channel ID (Android)',
788
- },
789
- contentAvailable: {
790
- type: 'boolean',
791
- optional: true,
792
- description: 'Enable background processing',
793
- },
794
- mutableContent: {
795
- type: 'boolean',
796
- optional: true,
797
- description: 'Allow notification modification (iOS)',
798
- },
799
- sentAt: {
800
- type: 'datetime',
801
- optional: true,
802
- description: 'Time sent to push service',
803
- },
804
- deliveredAt: {
805
- type: 'datetime',
806
- optional: true,
807
- description: 'Time delivered to device',
808
- },
809
- openedAt: {
810
- type: 'datetime',
811
- optional: true,
812
- description: 'Time notification was opened',
813
- },
814
- errorCode: {
815
- type: 'string',
816
- optional: true,
817
- description: 'Error code if failed',
818
- },
819
- errorMessage: {
820
- type: 'string',
821
- optional: true,
822
- description: 'Error message if failed',
823
- },
824
- },
825
- relationships: {
826
- device: {
827
- type: 'Device',
828
- description: 'Target device',
829
- },
830
- user: {
831
- type: 'User',
832
- required: false,
833
- description: 'Target user',
834
- },
835
- notification: {
836
- type: 'Notification',
837
- required: false,
838
- description: 'Parent notification',
839
- },
840
- },
841
- actions: [
842
- 'send',
843
- 'schedule',
844
- 'cancel',
845
- ],
846
- events: [
847
- 'sent',
848
- 'delivered',
849
- 'failed',
850
- 'opened',
851
- 'dismissed',
852
- ],
853
- };
854
- // =============================================================================
855
- // Device
856
- // =============================================================================
857
- /**
858
- * Device entity
859
- *
860
- * A user device registered for push notifications.
861
- */
862
- export const Device = {
863
- singular: 'device',
864
- plural: 'devices',
865
- description: 'A user device registered for push notifications',
866
- properties: {
867
- id: {
868
- type: 'string',
869
- description: 'Unique device identifier',
870
- },
871
- userId: {
872
- type: 'string',
873
- description: 'Owner user ID',
874
- },
875
- platform: {
876
- type: 'string',
877
- description: 'Device platform',
878
- examples: ['ios', 'android', 'web'],
879
- },
880
- pushToken: {
881
- type: 'string',
882
- optional: true,
883
- description: 'Push notification token',
884
- },
885
- tokenUpdatedAt: {
886
- type: 'datetime',
887
- optional: true,
888
- description: 'When token was last updated',
889
- },
890
- deviceModel: {
891
- type: 'string',
892
- optional: true,
893
- description: 'Device model name',
894
- },
895
- deviceName: {
896
- type: 'string',
897
- optional: true,
898
- description: 'User-defined device name',
899
- },
900
- osVersion: {
901
- type: 'string',
902
- optional: true,
903
- description: 'Operating system version',
904
- },
905
- appVersion: {
906
- type: 'string',
907
- optional: true,
908
- description: 'App version installed',
909
- },
910
- appBuild: {
911
- type: 'string',
912
- optional: true,
913
- description: 'App build number',
914
- },
915
- locale: {
916
- type: 'string',
917
- optional: true,
918
- description: 'Device locale',
919
- },
920
- timezone: {
921
- type: 'string',
922
- optional: true,
923
- description: 'Device timezone',
924
- },
925
- isActive: {
926
- type: 'boolean',
927
- optional: true,
928
- description: 'Whether device is active',
929
- },
930
- lastActiveAt: {
931
- type: 'datetime',
932
- optional: true,
933
- description: 'Last activity timestamp',
934
- },
935
- notificationsEnabled: {
936
- type: 'boolean',
937
- optional: true,
938
- description: 'Whether notifications are enabled',
939
- },
940
- metadata: {
941
- type: 'json',
942
- optional: true,
943
- description: 'Additional device metadata',
944
- },
945
- },
946
- relationships: {
947
- user: {
948
- type: 'User',
949
- description: 'Device owner',
950
- },
951
- notifications: {
952
- type: 'PushNotification[]',
953
- backref: 'device',
954
- description: 'Notifications sent to this device',
955
- },
956
- },
957
- actions: [
958
- 'register',
959
- 'updateToken',
960
- 'deactivate',
961
- 'delete',
962
- ],
963
- events: [
964
- 'registered',
965
- 'tokenUpdated',
966
- 'deactivated',
967
- 'deleted',
968
- ],
969
- };
970
- // =============================================================================
971
- // NotificationPreference
972
- // =============================================================================
973
- /**
974
- * NotificationPreference entity
975
- *
976
- * User preferences for notifications.
977
- */
978
- export const NotificationPreference = {
979
- singular: 'notification-preference',
980
- plural: 'notification-preferences',
981
- description: 'User preferences for notifications',
982
- properties: {
983
- id: {
984
- type: 'string',
985
- description: 'Unique preference identifier',
986
- },
987
- userId: {
988
- type: 'string',
989
- description: 'User ID',
990
- },
991
- category: {
992
- type: 'string',
993
- description: 'Notification category',
994
- },
995
- emailEnabled: {
996
- type: 'boolean',
997
- optional: true,
998
- description: 'Receive email notifications',
999
- },
1000
- smsEnabled: {
1001
- type: 'boolean',
1002
- optional: true,
1003
- description: 'Receive SMS notifications',
1004
- },
1005
- pushEnabled: {
1006
- type: 'boolean',
1007
- optional: true,
1008
- description: 'Receive push notifications',
1009
- },
1010
- inAppEnabled: {
1011
- type: 'boolean',
1012
- optional: true,
1013
- description: 'Receive in-app notifications',
1014
- },
1015
- frequency: {
1016
- type: 'string',
1017
- optional: true,
1018
- description: 'Notification frequency',
1019
- examples: ['instant', 'daily', 'weekly'],
1020
- },
1021
- quietHoursStart: {
1022
- type: 'string',
1023
- optional: true,
1024
- description: 'Quiet hours start time',
1025
- },
1026
- quietHoursEnd: {
1027
- type: 'string',
1028
- optional: true,
1029
- description: 'Quiet hours end time',
1030
- },
1031
- timezone: {
1032
- type: 'string',
1033
- optional: true,
1034
- description: 'User timezone for scheduling',
1035
- },
1036
- },
1037
- relationships: {
1038
- user: {
1039
- type: 'User',
1040
- description: 'User who owns these preferences',
1041
- },
1042
- },
1043
- actions: [
1044
- 'update',
1045
- 'enableAll',
1046
- 'disableAll',
1047
- 'setQuietHours',
1048
- ],
1049
- events: [
1050
- 'updated',
1051
- 'channelEnabled',
1052
- 'channelDisabled',
1053
- ],
1054
- };
1055
- // =============================================================================
1056
- // InAppNotification
1057
- // =============================================================================
1058
- /**
1059
- * InAppNotification entity
1060
- *
1061
- * An in-application notification displayed within the app UI.
1062
- */
1063
- export const InAppNotification = {
1064
- singular: 'in-app-notification',
1065
- plural: 'in-app-notifications',
1066
- description: 'An in-application notification displayed within the app UI',
1067
- properties: {
1068
- id: {
1069
- type: 'string',
1070
- description: 'Unique notification identifier',
1071
- },
1072
- userId: {
1073
- type: 'string',
1074
- description: 'Target user ID',
1075
- },
1076
- title: {
1077
- type: 'string',
1078
- description: 'Notification title',
1079
- },
1080
- body: {
1081
- type: 'string',
1082
- description: 'Notification body',
1083
- },
1084
- type: {
1085
- type: 'string',
1086
- description: 'Notification type',
1087
- examples: ['info', 'success', 'warning', 'error'],
1088
- },
1089
- category: {
1090
- type: 'string',
1091
- optional: true,
1092
- description: 'Notification category',
1093
- },
1094
- icon: {
1095
- type: 'string',
1096
- optional: true,
1097
- description: 'Icon identifier',
1098
- },
1099
- imageUrl: {
1100
- type: 'url',
1101
- optional: true,
1102
- description: 'Image URL',
1103
- },
1104
- actionUrl: {
1105
- type: 'url',
1106
- optional: true,
1107
- description: 'URL to navigate on click',
1108
- },
1109
- actionLabel: {
1110
- type: 'string',
1111
- optional: true,
1112
- description: 'Action button label',
1113
- },
1114
- isRead: {
1115
- type: 'boolean',
1116
- optional: true,
1117
- description: 'Whether notification has been read',
1118
- },
1119
- isArchived: {
1120
- type: 'boolean',
1121
- optional: true,
1122
- description: 'Whether notification is archived',
1123
- },
1124
- isPinned: {
1125
- type: 'boolean',
1126
- optional: true,
1127
- description: 'Whether notification is pinned',
1128
- },
1129
- expiresAt: {
1130
- type: 'datetime',
1131
- optional: true,
1132
- description: 'Expiration timestamp',
1133
- },
1134
- readAt: {
1135
- type: 'datetime',
1136
- optional: true,
1137
- description: 'When notification was read',
1138
- },
1139
- clickedAt: {
1140
- type: 'datetime',
1141
- optional: true,
1142
- description: 'When notification was clicked',
1143
- },
1144
- metadata: {
1145
- type: 'json',
1146
- optional: true,
1147
- description: 'Custom metadata',
1148
- },
1149
- },
1150
- relationships: {
1151
- user: {
1152
- type: 'User',
1153
- description: 'Target user',
1154
- },
1155
- notification: {
1156
- type: 'Notification',
1157
- required: false,
1158
- description: 'Parent notification',
1159
- },
1160
- },
1161
- actions: [
1162
- 'create',
1163
- 'read',
1164
- 'unread',
1165
- 'archive',
1166
- 'pin',
1167
- 'delete',
1168
- ],
1169
- events: [
1170
- 'created',
1171
- 'read',
1172
- 'clicked',
1173
- 'archived',
1174
- ],
1175
- };
1176
- // =============================================================================
1177
- // Exports
1178
- // =============================================================================
1179
- export const NotificationEntities = {
1180
- Notification,
1181
- NotificationTemplate,
1182
- NotificationCampaign,
1183
- SMS,
1184
- SMSConversation,
1185
- PushNotification,
1186
- Device,
1187
- NotificationPreference,
1188
- InAppNotification,
1189
- };
1190
- export const NotificationCategories = [
1191
- 'notification',
1192
- 'template',
1193
- 'campaign',
1194
- 'sms',
1195
- 'push',
1196
- 'device',
1197
- 'preference',
1198
- 'in-app',
1199
- ];