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,270 +0,0 @@
1
- /**
2
- * Microsoft Teams Video Conferencing Provider
3
- *
4
- * Concrete implementation of VideoConferencingProvider using Microsoft Graph API
5
- * to create and manage Microsoft Teams online meetings.
6
- *
7
- * @packageDocumentation
8
- */
9
- import { defineProvider } from '../registry.js';
10
- const GRAPH_API_URL = 'https://graph.microsoft.com/v1.0';
11
- /**
12
- * Microsoft Teams provider info
13
- */
14
- export const teamsInfo = {
15
- id: 'meeting.teams',
16
- name: 'Microsoft Teams',
17
- description: 'Microsoft Teams video conferencing via Microsoft Graph API',
18
- category: 'video-conferencing',
19
- website: 'https://teams.microsoft.com',
20
- docsUrl: 'https://docs.microsoft.com/en-us/graph/api/resources/onlinemeeting',
21
- requiredConfig: ['accessToken'],
22
- optionalConfig: ['clientId', 'clientSecret', 'tenantId'],
23
- };
24
- /**
25
- * Create Microsoft Teams provider
26
- */
27
- export function createTeamsProvider(config) {
28
- let accessToken;
29
- let clientId;
30
- let clientSecret;
31
- let tenantId;
32
- let tokenExpiresAt = 0;
33
- let currentUserId;
34
- /**
35
- * Refresh OAuth access token
36
- */
37
- async function refreshAccessToken() {
38
- if (!clientId || !clientSecret || !tenantId) {
39
- throw new Error('clientId, clientSecret, and tenantId required for token refresh');
40
- }
41
- const response = await fetch(`https://login.microsoftonline.com/${tenantId}/oauth2/v2.0/token`, {
42
- method: 'POST',
43
- headers: {
44
- 'Content-Type': 'application/x-www-form-urlencoded',
45
- },
46
- body: new URLSearchParams({
47
- client_id: clientId,
48
- client_secret: clientSecret,
49
- scope: 'https://graph.microsoft.com/.default',
50
- grant_type: 'client_credentials',
51
- }),
52
- });
53
- if (!response.ok) {
54
- throw new Error(`Failed to refresh access token: HTTP ${response.status}`);
55
- }
56
- const data = (await response.json());
57
- accessToken = data.access_token;
58
- tokenExpiresAt = Date.now() + data.expires_in * 1000;
59
- return accessToken;
60
- }
61
- /**
62
- * Get valid access token
63
- */
64
- async function getAccessToken() {
65
- // Return cached token if still valid (with 5-minute buffer)
66
- if (accessToken && Date.now() < tokenExpiresAt - 300000) {
67
- return accessToken;
68
- }
69
- // Try to refresh if we have credentials
70
- if (tenantId && clientId && clientSecret) {
71
- return refreshAccessToken();
72
- }
73
- // Otherwise use the provided token
74
- return accessToken;
75
- }
76
- /**
77
- * Make authenticated API request
78
- */
79
- async function apiRequest(endpoint, options = {}) {
80
- const token = await getAccessToken();
81
- const url = endpoint.startsWith('http') ? endpoint : `${GRAPH_API_URL}${endpoint}`;
82
- const response = await fetch(url, {
83
- ...options,
84
- headers: {
85
- Authorization: `Bearer ${token}`,
86
- 'Content-Type': 'application/json',
87
- ...options.headers,
88
- },
89
- });
90
- if (!response.ok) {
91
- const errorData = await response.json().catch(() => ({}));
92
- throw new Error(`Microsoft Graph API error: ${response.status} - ${errorData?.error?.message || response.statusText}`);
93
- }
94
- return response.json();
95
- }
96
- /**
97
- * Get current user ID
98
- */
99
- async function getUserId() {
100
- if (currentUserId) {
101
- return currentUserId;
102
- }
103
- const user = await apiRequest('/me');
104
- currentUserId = user.id;
105
- return currentUserId;
106
- }
107
- /**
108
- * Convert Graph online meeting to MeetingData
109
- */
110
- function convertMeeting(meeting) {
111
- const startTime = new Date(meeting.startDateTime);
112
- const endTime = new Date(meeting.endDateTime);
113
- const duration = Math.round((endTime.getTime() - startTime.getTime()) / 60000); // minutes
114
- return {
115
- id: meeting.id,
116
- topic: meeting.subject,
117
- startTime,
118
- duration,
119
- joinUrl: meeting.joinWebUrl || meeting.joinUrl || '',
120
- hostId: meeting.participants?.organizer?.identity?.user?.id || '',
121
- status: 'waiting',
122
- createdAt: new Date(meeting.creationDateTime),
123
- };
124
- }
125
- return {
126
- info: teamsInfo,
127
- async initialize(cfg) {
128
- accessToken = cfg.accessToken;
129
- clientId = cfg.clientId;
130
- clientSecret = cfg.clientSecret;
131
- tenantId = cfg.tenantId;
132
- if (!accessToken) {
133
- throw new Error('Microsoft Teams requires accessToken');
134
- }
135
- },
136
- async healthCheck() {
137
- const start = Date.now();
138
- try {
139
- // Get current user to verify API access
140
- await apiRequest('/me');
141
- return {
142
- healthy: true,
143
- latencyMs: Date.now() - start,
144
- message: 'Connected',
145
- checkedAt: new Date(),
146
- };
147
- }
148
- catch (error) {
149
- return {
150
- healthy: false,
151
- latencyMs: Date.now() - start,
152
- message: error instanceof Error ? error.message : 'Unknown error',
153
- checkedAt: new Date(),
154
- };
155
- }
156
- },
157
- async dispose() {
158
- // Clear cached token
159
- accessToken = '';
160
- tokenExpiresAt = 0;
161
- currentUserId = undefined;
162
- },
163
- async createMeeting(meeting) {
164
- const userId = await getUserId();
165
- const startTime = meeting.startTime || new Date();
166
- const endTime = new Date(startTime.getTime() + (meeting.duration || 60) * 60000);
167
- const body = {
168
- subject: meeting.topic,
169
- startDateTime: startTime.toISOString(),
170
- endDateTime: endTime.toISOString(),
171
- participants: {
172
- attendees: [],
173
- },
174
- };
175
- const response = await apiRequest(`/users/${userId}/onlineMeetings`, {
176
- method: 'POST',
177
- body: JSON.stringify(body),
178
- });
179
- return convertMeeting(response);
180
- },
181
- async getMeeting(meetingId) {
182
- try {
183
- const userId = await getUserId();
184
- const response = await apiRequest(`/users/${userId}/onlineMeetings/${meetingId}`);
185
- return convertMeeting(response);
186
- }
187
- catch (error) {
188
- if (error instanceof Error && error.message.includes('404')) {
189
- return null;
190
- }
191
- throw error;
192
- }
193
- },
194
- async updateMeeting(meetingId, updates) {
195
- const userId = await getUserId();
196
- // First get the current meeting
197
- const current = await this.getMeeting(meetingId);
198
- if (!current) {
199
- throw new Error(`Meeting ${meetingId} not found`);
200
- }
201
- const body = {};
202
- if (updates.topic)
203
- body.subject = updates.topic;
204
- if (updates.startTime) {
205
- const endTime = new Date(updates.startTime.getTime() + (updates.duration || current.duration || 60) * 60000);
206
- body.startDateTime = updates.startTime.toISOString();
207
- body.endDateTime = endTime.toISOString();
208
- }
209
- const response = await apiRequest(`/users/${userId}/onlineMeetings/${meetingId}`, {
210
- method: 'PATCH',
211
- body: JSON.stringify(body),
212
- });
213
- return convertMeeting(response);
214
- },
215
- async deleteMeeting(meetingId) {
216
- try {
217
- const userId = await getUserId();
218
- await apiRequest(`/users/${userId}/onlineMeetings/${meetingId}`, {
219
- method: 'DELETE',
220
- });
221
- return true;
222
- }
223
- catch (error) {
224
- if (error instanceof Error && error.message.includes('404')) {
225
- return false;
226
- }
227
- throw error;
228
- }
229
- },
230
- async listMeetings(options = {}) {
231
- const userId = await getUserId();
232
- const params = new URLSearchParams();
233
- if (options.limit)
234
- params.append('$top', options.limit.toString());
235
- // Note: Graph API doesn't provide easy filtering by time for online meetings
236
- // We'll fetch and filter client-side if needed
237
- let endpoint = `/users/${userId}/onlineMeetings`;
238
- if (params.toString()) {
239
- endpoint += `?${params.toString()}`;
240
- }
241
- // Handle pagination cursor
242
- const url = options.cursor || endpoint;
243
- const response = await apiRequest(url);
244
- return {
245
- items: response.value.map(convertMeeting),
246
- hasMore: !!response['@odata.nextLink'],
247
- nextCursor: response['@odata.nextLink'],
248
- };
249
- },
250
- endMeeting: async function (meetingId) {
251
- // Microsoft Teams doesn't support programmatically ending meetings
252
- // We can delete the meeting instead
253
- return await this.deleteMeeting(meetingId);
254
- },
255
- async getParticipants(meetingId) {
256
- // Microsoft Graph API doesn't provide detailed participant data
257
- // This would require Teams Meeting Recording APIs with admin consent
258
- return [];
259
- },
260
- async getRecordings(meetingId) {
261
- // Microsoft Teams recordings are stored in OneDrive/SharePoint
262
- // This would require additional Graph API calls with different permissions
263
- return [];
264
- },
265
- };
266
- }
267
- /**
268
- * Microsoft Teams provider definition
269
- */
270
- export const teamsProvider = defineProvider(teamsInfo, async (config) => createTeamsProvider(config));
@@ -1,332 +0,0 @@
1
- /**
2
- * Zoom Video Conferencing Provider
3
- *
4
- * Concrete implementation of VideoConferencingProvider using Zoom API v2.
5
- *
6
- * @packageDocumentation
7
- */
8
- import { defineProvider } from '../registry.js';
9
- const ZOOM_API_URL = 'https://api.zoom.us/v2';
10
- /**
11
- * Zoom provider info
12
- */
13
- export const zoomInfo = {
14
- id: 'video-conferencing.zoom',
15
- name: 'Zoom',
16
- description: 'Zoom video conferencing and webinar platform',
17
- category: 'video-conferencing',
18
- website: 'https://zoom.us',
19
- docsUrl: 'https://developers.zoom.us/docs/api/',
20
- requiredConfig: ['accountId', 'clientId', 'clientSecret'],
21
- optionalConfig: ['accessToken'],
22
- };
23
- /**
24
- * Create Zoom video conferencing provider
25
- */
26
- export function createZoomProvider(config) {
27
- let accountId;
28
- let clientId;
29
- let clientSecret;
30
- let accessToken;
31
- let tokenExpiresAt = 0;
32
- /**
33
- * Get OAuth access token using Server-to-Server OAuth
34
- */
35
- async function getAccessToken() {
36
- // Return cached token if still valid (with 5-minute buffer)
37
- if (accessToken && Date.now() < tokenExpiresAt - 300000) {
38
- return accessToken;
39
- }
40
- // Get new token
41
- const credentials = Buffer.from(`${clientId}:${clientSecret}`).toString('base64');
42
- const response = await fetch(`https://zoom.us/oauth/token?grant_type=account_credentials&account_id=${accountId}`, {
43
- method: 'POST',
44
- headers: {
45
- Authorization: `Basic ${credentials}`,
46
- 'Content-Type': 'application/x-www-form-urlencoded',
47
- },
48
- });
49
- if (!response.ok) {
50
- throw new Error(`Failed to get access token: HTTP ${response.status}`);
51
- }
52
- const data = (await response.json());
53
- accessToken = data.access_token;
54
- tokenExpiresAt = Date.now() + data.expires_in * 1000;
55
- return accessToken;
56
- }
57
- /**
58
- * Make authenticated API request
59
- */
60
- async function apiRequest(endpoint, options = {}) {
61
- const token = await getAccessToken();
62
- const url = `${ZOOM_API_URL}${endpoint}`;
63
- const response = await fetch(url, {
64
- ...options,
65
- headers: {
66
- Authorization: `Bearer ${token}`,
67
- 'Content-Type': 'application/json',
68
- ...options.headers,
69
- },
70
- });
71
- if (!response.ok) {
72
- const errorData = await response.json().catch(() => ({}));
73
- throw new Error(`Zoom API error: ${response.status} - ${errorData?.message || response.statusText}`);
74
- }
75
- return response.json();
76
- }
77
- /**
78
- * Convert Zoom meeting response to MeetingData
79
- */
80
- function convertMeeting(meeting) {
81
- return {
82
- id: meeting.id.toString(),
83
- topic: meeting.topic,
84
- startTime: meeting.start_time ? new Date(meeting.start_time) : undefined,
85
- duration: meeting.duration,
86
- timezone: meeting.timezone,
87
- agenda: meeting.agenda,
88
- joinUrl: meeting.join_url,
89
- hostId: meeting.host_id,
90
- status: meeting.status,
91
- password: meeting.password,
92
- createdAt: new Date(meeting.created_at),
93
- };
94
- }
95
- return {
96
- info: zoomInfo,
97
- async initialize(cfg) {
98
- accountId = cfg.accountId;
99
- clientId = cfg.clientId;
100
- clientSecret = cfg.clientSecret;
101
- accessToken = cfg.accessToken;
102
- if (!accountId || !clientId || !clientSecret) {
103
- throw new Error('Zoom requires accountId, clientId, and clientSecret');
104
- }
105
- },
106
- async healthCheck() {
107
- const start = Date.now();
108
- try {
109
- // Get current user to verify API access
110
- await apiRequest('/users/me');
111
- return {
112
- healthy: true,
113
- latencyMs: Date.now() - start,
114
- message: 'Connected',
115
- checkedAt: new Date(),
116
- };
117
- }
118
- catch (error) {
119
- return {
120
- healthy: false,
121
- latencyMs: Date.now() - start,
122
- message: error instanceof Error ? error.message : 'Unknown error',
123
- checkedAt: new Date(),
124
- };
125
- }
126
- },
127
- async dispose() {
128
- // Clear cached token
129
- accessToken = undefined;
130
- tokenExpiresAt = 0;
131
- },
132
- async createMeeting(meeting) {
133
- const body = {
134
- topic: meeting.topic,
135
- type: meeting.startTime ? 2 : 1, // 1 = instant, 2 = scheduled
136
- ...(meeting.startTime && {
137
- start_time: meeting.startTime.toISOString(),
138
- }),
139
- ...(meeting.duration && { duration: meeting.duration }),
140
- ...(meeting.timezone && { timezone: meeting.timezone }),
141
- ...(meeting.agenda && { agenda: meeting.agenda }),
142
- ...(meeting.password && { password: meeting.password }),
143
- };
144
- if (meeting.settings) {
145
- body.settings = {
146
- ...(meeting.settings.hostVideo !== undefined && {
147
- host_video: meeting.settings.hostVideo,
148
- }),
149
- ...(meeting.settings.participantVideo !== undefined && {
150
- participant_video: meeting.settings.participantVideo,
151
- }),
152
- ...(meeting.settings.joinBeforeHost !== undefined && {
153
- join_before_host: meeting.settings.joinBeforeHost,
154
- }),
155
- ...(meeting.settings.muteUponEntry !== undefined && {
156
- mute_upon_entry: meeting.settings.muteUponEntry,
157
- }),
158
- ...(meeting.settings.waitingRoom !== undefined && {
159
- waiting_room: meeting.settings.waitingRoom,
160
- }),
161
- ...(meeting.settings.autoRecording && {
162
- auto_recording: meeting.settings.autoRecording,
163
- }),
164
- };
165
- }
166
- const response = await apiRequest('/users/me/meetings', {
167
- method: 'POST',
168
- body: JSON.stringify(body),
169
- });
170
- return convertMeeting(response);
171
- },
172
- async getMeeting(meetingId) {
173
- try {
174
- const response = await apiRequest(`/meetings/${meetingId}`);
175
- return convertMeeting(response);
176
- }
177
- catch (error) {
178
- if (error instanceof Error && error.message.includes('404')) {
179
- return null;
180
- }
181
- throw error;
182
- }
183
- },
184
- async updateMeeting(meetingId, updates) {
185
- const body = {};
186
- if (updates.topic)
187
- body.topic = updates.topic;
188
- if (updates.startTime)
189
- body.start_time = updates.startTime.toISOString();
190
- if (updates.duration !== undefined)
191
- body.duration = updates.duration;
192
- if (updates.timezone)
193
- body.timezone = updates.timezone;
194
- if (updates.agenda !== undefined)
195
- body.agenda = updates.agenda;
196
- if (updates.password !== undefined)
197
- body.password = updates.password;
198
- if (updates.settings) {
199
- body.settings = {
200
- ...(updates.settings.hostVideo !== undefined && {
201
- host_video: updates.settings.hostVideo,
202
- }),
203
- ...(updates.settings.participantVideo !== undefined && {
204
- participant_video: updates.settings.participantVideo,
205
- }),
206
- ...(updates.settings.joinBeforeHost !== undefined && {
207
- join_before_host: updates.settings.joinBeforeHost,
208
- }),
209
- ...(updates.settings.muteUponEntry !== undefined && {
210
- mute_upon_entry: updates.settings.muteUponEntry,
211
- }),
212
- ...(updates.settings.waitingRoom !== undefined && {
213
- waiting_room: updates.settings.waitingRoom,
214
- }),
215
- ...(updates.settings.autoRecording !== undefined && {
216
- auto_recording: updates.settings.autoRecording,
217
- }),
218
- };
219
- }
220
- await apiRequest(`/meetings/${meetingId}`, {
221
- method: 'PATCH',
222
- body: JSON.stringify(body),
223
- });
224
- // Fetch updated meeting
225
- const updated = await this.getMeeting(meetingId);
226
- if (!updated) {
227
- throw new Error(`Failed to fetch updated meeting ${meetingId}`);
228
- }
229
- return updated;
230
- },
231
- async deleteMeeting(meetingId) {
232
- try {
233
- await apiRequest(`/meetings/${meetingId}`, {
234
- method: 'DELETE',
235
- });
236
- return true;
237
- }
238
- catch (error) {
239
- if (error instanceof Error && error.message.includes('404')) {
240
- return false;
241
- }
242
- throw error;
243
- }
244
- },
245
- async listMeetings(options = {}) {
246
- const params = new URLSearchParams();
247
- // Map type option to Zoom API parameter
248
- const typeMap = {
249
- scheduled: 'scheduled',
250
- live: 'live',
251
- upcoming: 'upcoming',
252
- previous: 'previous_meetings',
253
- };
254
- if (options.type) {
255
- params.append('type', typeMap[options.type] || 'scheduled');
256
- }
257
- else {
258
- params.append('type', 'scheduled');
259
- }
260
- if (options.limit)
261
- params.append('page_size', options.limit.toString());
262
- if (options.cursor)
263
- params.append('next_page_token', options.cursor);
264
- const response = await apiRequest(`/users/me/meetings?${params.toString()}`);
265
- return {
266
- items: response.meetings.map(convertMeeting),
267
- total: response.total_records,
268
- hasMore: !!response.next_page_token,
269
- nextCursor: response.next_page_token,
270
- };
271
- },
272
- async endMeeting(meetingId) {
273
- try {
274
- await apiRequest(`/meetings/${meetingId}/status`, {
275
- method: 'PUT',
276
- body: JSON.stringify({ action: 'end' }),
277
- });
278
- return true;
279
- }
280
- catch (error) {
281
- if (error instanceof Error && error.message.includes('404')) {
282
- return false;
283
- }
284
- throw error;
285
- }
286
- },
287
- async getParticipants(meetingId) {
288
- try {
289
- const response = await apiRequest(`/past_meetings/${meetingId}/participants`);
290
- return response.participants.map((p) => ({
291
- id: p.id,
292
- name: p.name,
293
- email: p.user_email,
294
- joinTime: new Date(p.join_time),
295
- leaveTime: p.leave_time ? new Date(p.leave_time) : undefined,
296
- duration: p.duration,
297
- }));
298
- }
299
- catch (error) {
300
- if (error instanceof Error && error.message.includes('404')) {
301
- return [];
302
- }
303
- throw error;
304
- }
305
- },
306
- async getRecordings(meetingId) {
307
- try {
308
- const response = await apiRequest(`/meetings/${meetingId}/recordings`);
309
- return response.recording_files.map((r) => ({
310
- id: r.id,
311
- meetingId: r.meeting_id,
312
- type: r.recording_type === 'audio_only' ? 'audio' :
313
- r.file_type === 'TRANSCRIPT' ? 'transcript' : 'video',
314
- url: r.download_url,
315
- size: r.file_size,
316
- duration: undefined, // Not provided in this endpoint
317
- createdAt: new Date(r.recording_start),
318
- }));
319
- }
320
- catch (error) {
321
- if (error instanceof Error && error.message.includes('404')) {
322
- return [];
323
- }
324
- throw error;
325
- }
326
- },
327
- };
328
- }
329
- /**
330
- * Zoom provider definition
331
- */
332
- export const zoomProvider = defineProvider(zoomInfo, async (config) => createZoomProvider(config));