@automate.ax/integration-contracts 0.75.0 → 0.77.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 (144) hide show
  1. package/dist/airtable/api.js +1 -1
  2. package/dist/airtable/index.d.ts +1 -1
  3. package/dist/airtable/index.js +1 -1
  4. package/dist/airtable/schemas.d.ts +1 -1
  5. package/dist/airtable/schemas.js +1 -1
  6. package/dist/asana/api.d.ts +1 -1
  7. package/dist/asana/api.js +1 -1
  8. package/dist/asana/index.d.ts +1 -1
  9. package/dist/asana/index.js +1 -1
  10. package/dist/asana/schemas.d.ts +1 -1
  11. package/dist/asana/schemas.js +1 -1
  12. package/dist/brevo/api.d.ts +1 -1
  13. package/dist/brevo/api.js +1 -1
  14. package/dist/brevo/index.d.ts +1 -1
  15. package/dist/brevo/index.js +1 -1
  16. package/dist/brevo/schemas.d.ts +1 -1
  17. package/dist/brevo/schemas.js +1 -1
  18. package/dist/github/index.d.ts +1 -1
  19. package/dist/github/index.js +1 -1
  20. package/dist/github/schemas.d.ts +1 -1
  21. package/dist/github/schemas.js +1 -1
  22. package/dist/gmail/gmail.d.ts +1 -1
  23. package/dist/gmail/gmail.js +4 -3
  24. package/dist/gmail/index.d.ts +1 -1
  25. package/dist/gmail/index.js +1 -1
  26. package/dist/gmail/schemas.d.ts +417 -5
  27. package/dist/gmail/schemas.js +107 -3
  28. package/dist/google-calendar/event-schemas.d.ts +1 -1
  29. package/dist/google-calendar/event-schemas.js +1 -1
  30. package/dist/google-calendar/google-calendar.d.ts +1 -1
  31. package/dist/google-calendar/google-calendar.js +1 -1
  32. package/dist/google-calendar/index.d.ts +1 -1
  33. package/dist/google-calendar/index.js +1 -1
  34. package/dist/google-calendar/schemas.d.ts +1 -1
  35. package/dist/google-calendar/schemas.js +1 -1
  36. package/dist/google-forms/event-schemas.d.ts +1 -1
  37. package/dist/google-forms/event-schemas.js +1 -1
  38. package/dist/google-forms/google-forms.d.ts +1 -1
  39. package/dist/google-forms/google-forms.js +1 -1
  40. package/dist/google-forms/index.d.ts +1 -1
  41. package/dist/google-forms/index.js +1 -1
  42. package/dist/google-forms/schemas.d.ts +1 -1
  43. package/dist/google-forms/schemas.js +1 -1
  44. package/dist/google-meet/google-meet.d.ts +173 -0
  45. package/dist/google-meet/google-meet.js +371 -0
  46. package/dist/google-meet/index.d.ts +295 -0
  47. package/dist/google-meet/index.js +87 -0
  48. package/dist/google-meet/schemas.d.ts +269 -0
  49. package/dist/google-meet/schemas.js +197 -0
  50. package/dist/linear/api.d.ts +1 -1
  51. package/dist/linear/api.js +1 -1
  52. package/dist/linear/index.d.ts +1 -1
  53. package/dist/linear/index.js +1 -1
  54. package/dist/linear/schemas.d.ts +91 -1
  55. package/dist/linear/schemas.js +64 -1
  56. package/dist/outlook/graph.d.ts +1 -1
  57. package/dist/outlook/graph.js +1 -1
  58. package/dist/outlook/index.d.ts +2 -2
  59. package/dist/outlook/index.js +1 -1
  60. package/dist/outlook/schemas.d.ts +7 -7
  61. package/dist/outlook/schemas.js +1 -1
  62. package/dist/resend/index.d.ts +1 -1
  63. package/dist/resend/index.js +1 -1
  64. package/dist/resend/schemas.d.ts +1 -1
  65. package/dist/resend/schemas.js +1 -1
  66. package/dist/slack/index.d.ts +1 -1
  67. package/dist/slack/index.js +1 -1
  68. package/dist/slack/schemas.d.ts +1 -1
  69. package/dist/slack/schemas.js +1 -1
  70. package/dist/teams/graph.d.ts +1 -1
  71. package/dist/teams/graph.js +1 -1
  72. package/dist/teams/index.d.ts +1 -1
  73. package/dist/teams/index.js +1 -1
  74. package/dist/teams/schemas.d.ts +1 -1
  75. package/dist/teams/schemas.js +1 -1
  76. package/dist/trello/api.d.ts +1 -1
  77. package/dist/trello/api.js +1 -1
  78. package/dist/trello/event-schemas.d.ts +1 -1
  79. package/dist/trello/event-schemas.js +1 -1
  80. package/dist/trello/index.d.ts +1 -1
  81. package/dist/trello/index.js +1 -1
  82. package/dist/trello/schemas.d.ts +1 -1
  83. package/dist/trello/schemas.js +1 -1
  84. package/dist/triggers.d.ts +2 -1
  85. package/dist/triggers.js +2 -0
  86. package/dist/vercel/index.d.ts +1 -1
  87. package/dist/vercel/index.js +1 -1
  88. package/dist/vercel/schemas.d.ts +1 -1
  89. package/dist/vercel/schemas.js +1 -1
  90. package/dist/whatsapp/api.d.ts +1 -1
  91. package/dist/whatsapp/api.js +1 -1
  92. package/dist/whatsapp/index.d.ts +1 -1
  93. package/dist/whatsapp/index.js +1 -1
  94. package/dist/whatsapp/schemas.d.ts +1 -1
  95. package/dist/whatsapp/schemas.js +1 -1
  96. package/package.json +11 -5
  97. package/src/airtable/api.ts +1 -1
  98. package/src/airtable/index.ts +1 -1
  99. package/src/airtable/schemas.ts +1 -1
  100. package/src/asana/api.ts +1 -1
  101. package/src/asana/index.ts +1 -1
  102. package/src/asana/schemas.ts +1 -1
  103. package/src/brevo/api.ts +1 -1
  104. package/src/brevo/index.ts +1 -1
  105. package/src/brevo/schemas.ts +1 -1
  106. package/src/github/index.ts +1 -1
  107. package/src/github/schemas.ts +1 -1
  108. package/src/gmail/gmail.ts +4 -3
  109. package/src/gmail/index.ts +1 -1
  110. package/src/gmail/schemas.ts +107 -3
  111. package/src/google-calendar/event-schemas.ts +1 -1
  112. package/src/google-calendar/google-calendar.ts +1 -1
  113. package/src/google-calendar/index.ts +1 -1
  114. package/src/google-calendar/schemas.ts +1 -1
  115. package/src/google-forms/event-schemas.ts +1 -1
  116. package/src/google-forms/google-forms.ts +1 -1
  117. package/src/google-forms/index.ts +1 -1
  118. package/src/google-forms/schemas.ts +1 -1
  119. package/src/google-meet/google-meet.ts +445 -0
  120. package/src/google-meet/index.ts +117 -0
  121. package/src/google-meet/schemas.ts +274 -0
  122. package/src/linear/api.ts +1 -1
  123. package/src/linear/index.ts +1 -1
  124. package/src/linear/schemas.ts +84 -1
  125. package/src/outlook/graph.ts +1 -1
  126. package/src/outlook/index.ts +1 -1
  127. package/src/outlook/schemas.ts +1 -1
  128. package/src/resend/index.ts +1 -1
  129. package/src/resend/schemas.ts +1 -1
  130. package/src/slack/index.ts +1 -1
  131. package/src/slack/schemas.ts +1 -1
  132. package/src/teams/graph.ts +1 -1
  133. package/src/teams/index.ts +1 -1
  134. package/src/teams/schemas.ts +1 -1
  135. package/src/trello/api.ts +1 -1
  136. package/src/trello/event-schemas.ts +1 -1
  137. package/src/trello/index.ts +1 -1
  138. package/src/trello/schemas.ts +1 -1
  139. package/src/triggers.ts +3 -0
  140. package/src/vercel/index.ts +1 -1
  141. package/src/vercel/schemas.ts +1 -1
  142. package/src/whatsapp/api.ts +1 -1
  143. package/src/whatsapp/index.ts +1 -1
  144. package/src/whatsapp/schemas.ts +1 -1
@@ -0,0 +1,445 @@
1
+ import { auth, meet, type meet_v2 } from "@googleapis/meet"
2
+ import { z } from "zod"
3
+ import type { z as zod } from "zod"
4
+ import {
5
+ GOOGLE_MEET_CONFERENCE_RECORD_SCHEMA,
6
+ GOOGLE_MEET_PARTICIPANT_SCHEMA,
7
+ GOOGLE_MEET_PARTICIPANT_SESSION_SCHEMA,
8
+ GOOGLE_MEET_RECORDING_SCHEMA,
9
+ GOOGLE_MEET_SMART_NOTE_SCHEMA,
10
+ GOOGLE_MEET_SPACE_CONFIG_SCHEMA,
11
+ GOOGLE_MEET_SPACE_SCHEMA,
12
+ GOOGLE_MEET_TRANSCRIPT_ENTRY_SCHEMA,
13
+ GOOGLE_MEET_TRANSCRIPT_SCHEMA,
14
+ } from "./schemas"
15
+
16
+ const GOOGLE_MEET_SECRET_SCHEMA = z.object({
17
+ accessToken: z.string().min(1),
18
+ })
19
+ const GOOGLE_MEET_HOSTS = new Set(["meet.google.com", "meet.google"])
20
+
21
+ /**
22
+ * Creates the official Meet client from a resolved Google integration secret.
23
+ *
24
+ * @param secret - Refreshed Google integration secret.
25
+ */
26
+ export function getGoogleMeetApi(secret: Record<string, unknown>) {
27
+ const { accessToken } = GOOGLE_MEET_SECRET_SCHEMA.parse(secret)
28
+ return meet({
29
+ auth: new auth.OAuth2({ credentials: { access_token: accessToken } }),
30
+ version: "v2",
31
+ })
32
+ }
33
+
34
+ /**
35
+ * Accepts a space resource name, meeting code, opaque space ID, or Meet URL.
36
+ *
37
+ * @param space - Meeting-space reference to normalize.
38
+ * @throws When a URL does not point to Google Meet.
39
+ */
40
+ export function normalizeGoogleMeetSpaceName(space: string) {
41
+ const value = space.trim()
42
+ if (value.startsWith("spaces/")) return value
43
+ if (!URL.canParse(value)) return `spaces/${value}`
44
+
45
+ const url = new URL(value)
46
+ if (!GOOGLE_MEET_HOSTS.has(url.hostname)) {
47
+ throw new Error(`Expected a Google Meet URL, received "${value}".`)
48
+ }
49
+
50
+ const meetingCode = url.pathname.split("/").find(Boolean)
51
+ if (!meetingCode) {
52
+ throw new Error(`Expected a Google Meet meeting URL, received "${value}".`)
53
+ }
54
+ return `spaces/${meetingCode}`
55
+ }
56
+
57
+ /**
58
+ * Accepts a conference-record resource name or raw record ID.
59
+ *
60
+ * @param record - Conference-record reference to normalize.
61
+ */
62
+ export function normalizeGoogleMeetConferenceRecordName(record: string) {
63
+ const value = record.trim()
64
+ return value.startsWith("conferenceRecords/")
65
+ ? value
66
+ : `conferenceRecords/${value}`
67
+ }
68
+
69
+ /**
70
+ * Converts a code-first space configuration into Google's request shape.
71
+ *
72
+ * @param config - Public meeting-space configuration.
73
+ */
74
+ export function toGoogleMeetSpaceConfig(
75
+ config: zod.infer<typeof GOOGLE_MEET_SPACE_CONFIG_SCHEMA>,
76
+ ): meet_v2.Schema$SpaceConfig {
77
+ return {
78
+ accessType: config.accessType?.toUpperCase(),
79
+ artifactConfig: config.artifacts
80
+ ? {
81
+ recordingConfig: {
82
+ autoRecordingGeneration: toAutoGeneration(
83
+ config.artifacts.recording,
84
+ ),
85
+ },
86
+ smartNotesConfig: {
87
+ autoSmartNotesGeneration: toAutoGeneration(
88
+ config.artifacts.smartNotes,
89
+ ),
90
+ },
91
+ transcriptionConfig: {
92
+ autoTranscriptionGeneration: toAutoGeneration(
93
+ config.artifacts.transcription,
94
+ ),
95
+ },
96
+ }
97
+ : undefined,
98
+ attendanceReportGenerationType:
99
+ config.attendanceReport === undefined
100
+ ? undefined
101
+ : config.attendanceReport
102
+ ? "GENERATE_REPORT"
103
+ : "DO_NOT_GENERATE",
104
+ entryPointAccess:
105
+ config.entryPointAccess === "creatorAppOnly"
106
+ ? "CREATOR_APP_ONLY"
107
+ : config.entryPointAccess?.toUpperCase(),
108
+ moderation:
109
+ config.moderation === undefined
110
+ ? undefined
111
+ : config.moderation
112
+ ? "ON"
113
+ : "OFF",
114
+ moderationRestrictions: config.moderationRestrictions
115
+ ? {
116
+ chatRestriction: toRestriction(config.moderationRestrictions.chat),
117
+ defaultJoinAsViewerType:
118
+ config.moderationRestrictions.defaultJoinAsViewer === undefined
119
+ ? undefined
120
+ : config.moderationRestrictions.defaultJoinAsViewer
121
+ ? "ON"
122
+ : "OFF",
123
+ presentRestriction: toRestriction(
124
+ config.moderationRestrictions.present,
125
+ ),
126
+ reactionRestriction: toRestriction(
127
+ config.moderationRestrictions.reactions,
128
+ ),
129
+ }
130
+ : undefined,
131
+ }
132
+ }
133
+
134
+ /**
135
+ * Builds an exact field mask for a partial code-first space configuration.
136
+ *
137
+ * @param config - Public settings included in a partial update.
138
+ */
139
+ export function getGoogleMeetSpaceConfigUpdateMask(
140
+ config: zod.infer<typeof GOOGLE_MEET_SPACE_CONFIG_SCHEMA>,
141
+ ) {
142
+ return [
143
+ config.accessType !== undefined && "config.accessType",
144
+ config.attendanceReport !== undefined &&
145
+ "config.attendanceReportGenerationType",
146
+ config.entryPointAccess !== undefined && "config.entryPointAccess",
147
+ config.moderation !== undefined && "config.moderation",
148
+ config.moderationRestrictions?.chat !== undefined &&
149
+ "config.moderationRestrictions.chatRestriction",
150
+ config.moderationRestrictions?.defaultJoinAsViewer !== undefined &&
151
+ "config.moderationRestrictions.defaultJoinAsViewerType",
152
+ config.moderationRestrictions?.present !== undefined &&
153
+ "config.moderationRestrictions.presentRestriction",
154
+ config.moderationRestrictions?.reactions !== undefined &&
155
+ "config.moderationRestrictions.reactionRestriction",
156
+ config.artifacts?.recording !== undefined &&
157
+ "config.artifactConfig.recordingConfig.autoRecordingGeneration",
158
+ config.artifacts?.smartNotes !== undefined &&
159
+ "config.artifactConfig.smartNotesConfig.autoSmartNotesGeneration",
160
+ config.artifacts?.transcription !== undefined &&
161
+ "config.artifactConfig.transcriptionConfig.autoTranscriptionGeneration",
162
+ ]
163
+ .filter((value): value is string => Boolean(value))
164
+ .join(",")
165
+ }
166
+
167
+ /**
168
+ * Normalizes a Google Meet space without leaking provider nulls or enums.
169
+ *
170
+ * @param value - Provider meeting-space resource.
171
+ */
172
+ export function normalizeGoogleMeetSpace(value: meet_v2.Schema$Space) {
173
+ return GOOGLE_MEET_SPACE_SCHEMA.parse({
174
+ activeConference: value.activeConference?.conferenceRecord ?? undefined,
175
+ config: value.config ? normalizeSpaceConfig(value.config) : undefined,
176
+ gatewaySipAccess: (value.gatewaySipAccess ?? []).map((access) => ({
177
+ sipAccessCode: access.sipAccessCode ?? undefined,
178
+ uri: access.uri,
179
+ })),
180
+ meetingCode: value.meetingCode,
181
+ meetingUri: value.meetingUri,
182
+ name: value.name,
183
+ phoneAccess: (value.phoneAccess ?? []).map((access) => ({
184
+ languageCode: access.languageCode ?? undefined,
185
+ phoneNumber: access.phoneNumber,
186
+ pin: access.pin,
187
+ regionCode: access.regionCode ?? undefined,
188
+ })),
189
+ })
190
+ }
191
+
192
+ /**
193
+ * Normalizes one conference record.
194
+ *
195
+ * @param value - Provider conference-record resource.
196
+ */
197
+ export function normalizeGoogleMeetConferenceRecord(
198
+ value: meet_v2.Schema$ConferenceRecord,
199
+ ) {
200
+ return GOOGLE_MEET_CONFERENCE_RECORD_SCHEMA.parse({
201
+ endTime: value.endTime ?? undefined,
202
+ expireTime: value.expireTime ?? undefined,
203
+ name: value.name,
204
+ space: value.space,
205
+ startTime: value.startTime,
206
+ })
207
+ }
208
+
209
+ /**
210
+ * Normalizes one conference participant and its identity variant.
211
+ *
212
+ * @param value - Provider participant resource.
213
+ */
214
+ export function normalizeGoogleMeetParticipant(
215
+ value: meet_v2.Schema$Participant,
216
+ ) {
217
+ return GOOGLE_MEET_PARTICIPANT_SCHEMA.parse({
218
+ earliestStartTime: value.earliestStartTime ?? undefined,
219
+ latestEndTime: value.latestEndTime ?? undefined,
220
+ name: value.name,
221
+ user: value.signedinUser
222
+ ? {
223
+ displayName: value.signedinUser.displayName,
224
+ type: "signedIn",
225
+ user: value.signedinUser.user ?? undefined,
226
+ }
227
+ : value.anonymousUser
228
+ ? { displayName: value.anonymousUser.displayName, type: "anonymous" }
229
+ : { displayName: value.phoneUser?.displayName, type: "phone" },
230
+ })
231
+ }
232
+
233
+ /**
234
+ * Normalizes one participant-device session.
235
+ *
236
+ * @param value - Provider participant-session resource.
237
+ */
238
+ export function normalizeGoogleMeetParticipantSession(
239
+ value: meet_v2.Schema$ParticipantSession,
240
+ ) {
241
+ return GOOGLE_MEET_PARTICIPANT_SESSION_SCHEMA.parse({
242
+ endTime: value.endTime ?? undefined,
243
+ name: value.name,
244
+ startTime: value.startTime,
245
+ })
246
+ }
247
+
248
+ /**
249
+ * Normalizes one recording artifact.
250
+ *
251
+ * @param value - Provider recording resource.
252
+ */
253
+ export function normalizeGoogleMeetRecording(value: meet_v2.Schema$Recording) {
254
+ return GOOGLE_MEET_RECORDING_SCHEMA.parse({
255
+ driveDestination: value.driveDestination
256
+ ? {
257
+ exportUri: value.driveDestination.exportUri ?? undefined,
258
+ fileId: value.driveDestination.file ?? undefined,
259
+ }
260
+ : undefined,
261
+ endTime: value.endTime ?? undefined,
262
+ name: value.name,
263
+ startTime: value.startTime ?? undefined,
264
+ state: normalizeArtifactState(value.state),
265
+ })
266
+ }
267
+
268
+ /**
269
+ * Normalizes one transcript artifact.
270
+ *
271
+ * @param value - Provider transcript resource.
272
+ */
273
+ export function normalizeGoogleMeetTranscript(
274
+ value: meet_v2.Schema$Transcript,
275
+ ) {
276
+ return GOOGLE_MEET_TRANSCRIPT_SCHEMA.parse({
277
+ docsDestination: normalizeDocsDestination(value.docsDestination),
278
+ endTime: value.endTime ?? undefined,
279
+ name: value.name,
280
+ startTime: value.startTime ?? undefined,
281
+ state: normalizeArtifactState(value.state),
282
+ })
283
+ }
284
+
285
+ /**
286
+ * Normalizes one structured transcript segment.
287
+ *
288
+ * @param value - Provider transcript-entry resource.
289
+ */
290
+ export function normalizeGoogleMeetTranscriptEntry(
291
+ value: meet_v2.Schema$TranscriptEntry,
292
+ ) {
293
+ return GOOGLE_MEET_TRANSCRIPT_ENTRY_SCHEMA.parse({
294
+ endTime: value.endTime,
295
+ languageCode: value.languageCode,
296
+ name: value.name,
297
+ participant: value.participant,
298
+ startTime: value.startTime,
299
+ text: value.text,
300
+ })
301
+ }
302
+
303
+ /**
304
+ * Normalizes one Meet smart-note artifact.
305
+ *
306
+ * @param value - Provider smart-note resource.
307
+ */
308
+ export function normalizeGoogleMeetSmartNote(value: meet_v2.Schema$SmartNote) {
309
+ return GOOGLE_MEET_SMART_NOTE_SCHEMA.parse({
310
+ docsDestination: normalizeDocsDestination(value.docsDestination),
311
+ endTime: value.endTime ?? undefined,
312
+ name: value.name,
313
+ startTime: value.startTime ?? undefined,
314
+ state: normalizeArtifactState(value.state),
315
+ })
316
+ }
317
+
318
+ /**
319
+ * Normalizes provider meeting-space settings.
320
+ *
321
+ * @param value - Provider settings to normalize.
322
+ */
323
+ function normalizeSpaceConfig(value: meet_v2.Schema$SpaceConfig) {
324
+ return GOOGLE_MEET_SPACE_CONFIG_SCHEMA.parse({
325
+ accessType: value.accessType?.toLowerCase(),
326
+ artifacts: value.artifactConfig
327
+ ? {
328
+ recording: fromAutoGeneration(
329
+ value.artifactConfig.recordingConfig?.autoRecordingGeneration,
330
+ ),
331
+ smartNotes: fromAutoGeneration(
332
+ value.artifactConfig.smartNotesConfig?.autoSmartNotesGeneration,
333
+ ),
334
+ transcription: fromAutoGeneration(
335
+ value.artifactConfig.transcriptionConfig
336
+ ?.autoTranscriptionGeneration,
337
+ ),
338
+ }
339
+ : undefined,
340
+ attendanceReport:
341
+ value.attendanceReportGenerationType === undefined ||
342
+ value.attendanceReportGenerationType === null
343
+ ? undefined
344
+ : value.attendanceReportGenerationType === "GENERATE_REPORT",
345
+ entryPointAccess:
346
+ value.entryPointAccess === "CREATOR_APP_ONLY"
347
+ ? "creatorAppOnly"
348
+ : value.entryPointAccess?.toLowerCase(),
349
+ moderation:
350
+ value.moderation === undefined || value.moderation === null
351
+ ? undefined
352
+ : value.moderation === "ON",
353
+ moderationRestrictions: value.moderationRestrictions
354
+ ? {
355
+ chat: fromRestriction(value.moderationRestrictions.chatRestriction),
356
+ defaultJoinAsViewer:
357
+ value.moderationRestrictions.defaultJoinAsViewerType ===
358
+ undefined ||
359
+ value.moderationRestrictions.defaultJoinAsViewerType === null
360
+ ? undefined
361
+ : value.moderationRestrictions.defaultJoinAsViewerType === "ON",
362
+ present: fromRestriction(
363
+ value.moderationRestrictions.presentRestriction,
364
+ ),
365
+ reactions: fromRestriction(
366
+ value.moderationRestrictions.reactionRestriction,
367
+ ),
368
+ }
369
+ : undefined,
370
+ })
371
+ }
372
+
373
+ /**
374
+ * Maps a public boolean to Google's auto-generation enum.
375
+ *
376
+ * @param value - Public automatic-generation setting.
377
+ */
378
+ function toAutoGeneration(value?: boolean) {
379
+ return value === undefined ? undefined : value ? "ON" : "OFF"
380
+ }
381
+
382
+ /**
383
+ * Maps Google's auto-generation enum to a public boolean.
384
+ *
385
+ * @param value - Provider automatic-generation enum.
386
+ */
387
+ function fromAutoGeneration(value?: string | null) {
388
+ return value === undefined || value === null ? undefined : value === "ON"
389
+ }
390
+
391
+ /**
392
+ * Maps a public moderation restriction to Google's enum.
393
+ *
394
+ * @param value - Public moderation restriction.
395
+ */
396
+ function toRestriction(value?: "hostsOnly" | "noRestriction") {
397
+ return value === "hostsOnly"
398
+ ? "HOSTS_ONLY"
399
+ : value === "noRestriction"
400
+ ? "NO_RESTRICTION"
401
+ : undefined
402
+ }
403
+
404
+ /**
405
+ * Maps Google's moderation restriction to a public enum.
406
+ *
407
+ * @param value - Provider moderation restriction.
408
+ */
409
+ function fromRestriction(value?: string | null) {
410
+ return value === "HOSTS_ONLY"
411
+ ? "hostsOnly"
412
+ : value === "NO_RESTRICTION"
413
+ ? "noRestriction"
414
+ : undefined
415
+ }
416
+
417
+ /**
418
+ * Normalizes Google's artifact lifecycle state.
419
+ *
420
+ * @param value - Provider artifact state.
421
+ */
422
+ function normalizeArtifactState(value?: string | null) {
423
+ switch (z.enum(["STARTED", "ENDED", "FILE_GENERATED"]).parse(value)) {
424
+ case "STARTED":
425
+ return "started"
426
+ case "ENDED":
427
+ return "ended"
428
+ case "FILE_GENERATED":
429
+ return "fileGenerated"
430
+ }
431
+ }
432
+
433
+ /**
434
+ * Normalizes a generated Google Docs destination.
435
+ *
436
+ * @param value - Provider document destination.
437
+ */
438
+ function normalizeDocsDestination(value?: meet_v2.Schema$DocsDestination) {
439
+ return value
440
+ ? {
441
+ documentId: value.document ?? undefined,
442
+ exportUri: value.exportUri ?? undefined,
443
+ }
444
+ : undefined
445
+ }
@@ -0,0 +1,117 @@
1
+ import { z } from "zod"
2
+ import {
3
+ GOOGLE_MEET_CONFERENCE_RECORD_SCHEMA,
4
+ GOOGLE_MEET_PARTICIPANT_SESSION_SCHEMA,
5
+ GOOGLE_MEET_RECORDING_SCHEMA,
6
+ GOOGLE_MEET_SMART_NOTE_SCHEMA,
7
+ GOOGLE_MEET_TRANSCRIPT_SCHEMA,
8
+ } from "./schemas"
9
+
10
+ export * from "./google-meet"
11
+ export * from "./schemas"
12
+
13
+ /** Canonical Google Meet target selected by one subscription. */
14
+ export const GOOGLE_MEET_TRIGGER_CONFIG_SCHEMA = z.object({
15
+ /** Stable space resource name, or omitted for all owned meeting spaces. */
16
+ spaceName: z.string().optional(),
17
+ })
18
+
19
+ export const GOOGLE_MEET_RECORDING_STARTED_EVENT_SCHEMA =
20
+ GOOGLE_MEET_RECORDING_SCHEMA.extend({ state: z.literal("started") })
21
+ export const GOOGLE_MEET_RECORDING_ENDED_EVENT_SCHEMA =
22
+ GOOGLE_MEET_RECORDING_SCHEMA.extend({ state: z.literal("ended") })
23
+ export const GOOGLE_MEET_RECORDING_FILE_GENERATED_EVENT_SCHEMA =
24
+ GOOGLE_MEET_RECORDING_SCHEMA.extend({ state: z.literal("fileGenerated") })
25
+ export const GOOGLE_MEET_SMART_NOTE_STARTED_EVENT_SCHEMA =
26
+ GOOGLE_MEET_SMART_NOTE_SCHEMA.extend({ state: z.literal("started") })
27
+ export const GOOGLE_MEET_SMART_NOTE_ENDED_EVENT_SCHEMA =
28
+ GOOGLE_MEET_SMART_NOTE_SCHEMA.extend({ state: z.literal("ended") })
29
+ export const GOOGLE_MEET_SMART_NOTE_FILE_GENERATED_EVENT_SCHEMA =
30
+ GOOGLE_MEET_SMART_NOTE_SCHEMA.extend({ state: z.literal("fileGenerated") })
31
+ export const GOOGLE_MEET_TRANSCRIPT_STARTED_EVENT_SCHEMA =
32
+ GOOGLE_MEET_TRANSCRIPT_SCHEMA.extend({ state: z.literal("started") })
33
+ export const GOOGLE_MEET_TRANSCRIPT_ENDED_EVENT_SCHEMA =
34
+ GOOGLE_MEET_TRANSCRIPT_SCHEMA.extend({ state: z.literal("ended") })
35
+ export const GOOGLE_MEET_TRANSCRIPT_FILE_GENERATED_EVENT_SCHEMA =
36
+ GOOGLE_MEET_TRANSCRIPT_SCHEMA.extend({ state: z.literal("fileGenerated") })
37
+
38
+ export const googleMeetTriggerContracts = {
39
+ "googleMeet.conference.ended": {
40
+ configSchema: GOOGLE_MEET_TRIGGER_CONFIG_SCHEMA,
41
+ eventSchema: GOOGLE_MEET_CONFERENCE_RECORD_SCHEMA,
42
+ },
43
+ "googleMeet.conference.started": {
44
+ configSchema: GOOGLE_MEET_TRIGGER_CONFIG_SCHEMA,
45
+ eventSchema: GOOGLE_MEET_CONFERENCE_RECORD_SCHEMA,
46
+ },
47
+ "googleMeet.participant.joined": {
48
+ configSchema: GOOGLE_MEET_TRIGGER_CONFIG_SCHEMA,
49
+ eventSchema: GOOGLE_MEET_PARTICIPANT_SESSION_SCHEMA,
50
+ },
51
+ "googleMeet.participant.left": {
52
+ configSchema: GOOGLE_MEET_TRIGGER_CONFIG_SCHEMA,
53
+ eventSchema: GOOGLE_MEET_PARTICIPANT_SESSION_SCHEMA,
54
+ },
55
+ "googleMeet.recording.ended": {
56
+ configSchema: GOOGLE_MEET_TRIGGER_CONFIG_SCHEMA,
57
+ eventSchema: GOOGLE_MEET_RECORDING_ENDED_EVENT_SCHEMA,
58
+ },
59
+ "googleMeet.recording.fileGenerated": {
60
+ configSchema: GOOGLE_MEET_TRIGGER_CONFIG_SCHEMA,
61
+ eventSchema: GOOGLE_MEET_RECORDING_FILE_GENERATED_EVENT_SCHEMA,
62
+ },
63
+ "googleMeet.recording.started": {
64
+ configSchema: GOOGLE_MEET_TRIGGER_CONFIG_SCHEMA,
65
+ eventSchema: GOOGLE_MEET_RECORDING_STARTED_EVENT_SCHEMA,
66
+ },
67
+ "googleMeet.smartNote.ended": {
68
+ configSchema: GOOGLE_MEET_TRIGGER_CONFIG_SCHEMA,
69
+ eventSchema: GOOGLE_MEET_SMART_NOTE_ENDED_EVENT_SCHEMA,
70
+ },
71
+ "googleMeet.smartNote.fileGenerated": {
72
+ configSchema: GOOGLE_MEET_TRIGGER_CONFIG_SCHEMA,
73
+ eventSchema: GOOGLE_MEET_SMART_NOTE_FILE_GENERATED_EVENT_SCHEMA,
74
+ },
75
+ "googleMeet.smartNote.started": {
76
+ configSchema: GOOGLE_MEET_TRIGGER_CONFIG_SCHEMA,
77
+ eventSchema: GOOGLE_MEET_SMART_NOTE_STARTED_EVENT_SCHEMA,
78
+ },
79
+ "googleMeet.transcript.ended": {
80
+ configSchema: GOOGLE_MEET_TRIGGER_CONFIG_SCHEMA,
81
+ eventSchema: GOOGLE_MEET_TRANSCRIPT_ENDED_EVENT_SCHEMA,
82
+ },
83
+ "googleMeet.transcript.fileGenerated": {
84
+ configSchema: GOOGLE_MEET_TRIGGER_CONFIG_SCHEMA,
85
+ eventSchema: GOOGLE_MEET_TRANSCRIPT_FILE_GENERATED_EVENT_SCHEMA,
86
+ },
87
+ "googleMeet.transcript.started": {
88
+ configSchema: GOOGLE_MEET_TRIGGER_CONFIG_SCHEMA,
89
+ eventSchema: GOOGLE_MEET_TRANSCRIPT_STARTED_EVENT_SCHEMA,
90
+ },
91
+ } as const
92
+
93
+ export const GOOGLE_MEET_PROVIDER_EVENT_TYPES = {
94
+ "googleMeet.conference.ended": "google.workspace.meet.conference.v2.ended",
95
+ "googleMeet.conference.started":
96
+ "google.workspace.meet.conference.v2.started",
97
+ "googleMeet.participant.joined":
98
+ "google.workspace.meet.participant.v2.joined",
99
+ "googleMeet.participant.left": "google.workspace.meet.participant.v2.left",
100
+ "googleMeet.recording.ended": "google.workspace.meet.recording.v2.ended",
101
+ "googleMeet.recording.fileGenerated":
102
+ "google.workspace.meet.recording.v2.fileGenerated",
103
+ "googleMeet.recording.started": "google.workspace.meet.recording.v2.started",
104
+ "googleMeet.smartNote.ended": "google.workspace.meet.smartNote.v2.ended",
105
+ "googleMeet.smartNote.fileGenerated":
106
+ "google.workspace.meet.smartNote.v2.fileGenerated",
107
+ "googleMeet.smartNote.started": "google.workspace.meet.smartNote.v2.started",
108
+ "googleMeet.transcript.ended": "google.workspace.meet.transcript.v2.ended",
109
+ "googleMeet.transcript.fileGenerated":
110
+ "google.workspace.meet.transcript.v2.fileGenerated",
111
+ "googleMeet.transcript.started":
112
+ "google.workspace.meet.transcript.v2.started",
113
+ } as const satisfies Record<keyof typeof googleMeetTriggerContracts, string>
114
+
115
+ export type GoogleMeetTriggerType = keyof typeof googleMeetTriggerContracts
116
+ export type GoogleMeetProviderEventType =
117
+ (typeof GOOGLE_MEET_PROVIDER_EVENT_TYPES)[GoogleMeetTriggerType]