@automate.ax/integration-contracts 0.131.1 → 0.132.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.
@@ -25,6 +25,7 @@ export declare const GOOGLE_CALENDAR_EVENT_DELETED_SCHEMA: z.ZodObject<{
25
25
  organizer: z.ZodBoolean;
26
26
  self: z.ZodBoolean;
27
27
  }, z.core.$strip>>;
28
+ attendeesOmitted: z.ZodBoolean;
28
29
  calendarId: z.ZodString;
29
30
  colorId: z.ZodOptional<z.ZodString>;
30
31
  conference: z.ZodOptional<z.ZodObject<{
@@ -104,7 +105,14 @@ export declare const GOOGLE_CALENDAR_EVENT_DELETED_SCHEMA: z.ZodObject<{
104
105
  opaque: "opaque";
105
106
  transparent: "transparent";
106
107
  }>;
107
- type: z.ZodString;
108
+ type: z.ZodEnum<{
109
+ default: "default";
110
+ birthday: "birthday";
111
+ focusTime: "focusTime";
112
+ fromGmail: "fromGmail";
113
+ outOfOffice: "outOfOffice";
114
+ workingLocation: "workingLocation";
115
+ }>;
108
116
  updatedAt: z.ZodOptional<z.ZodString>;
109
117
  visibility: z.ZodEnum<{
110
118
  default: "default";
@@ -142,6 +150,7 @@ export declare const GOOGLE_CALENDAR_EVENT_CHANGED_SCHEMA: z.ZodDiscriminatedUni
142
150
  organizer: z.ZodBoolean;
143
151
  self: z.ZodBoolean;
144
152
  }, z.core.$strip>>;
153
+ attendeesOmitted: z.ZodBoolean;
145
154
  calendarId: z.ZodString;
146
155
  colorId: z.ZodOptional<z.ZodString>;
147
156
  conference: z.ZodOptional<z.ZodObject<{
@@ -221,7 +230,14 @@ export declare const GOOGLE_CALENDAR_EVENT_CHANGED_SCHEMA: z.ZodDiscriminatedUni
221
230
  opaque: "opaque";
222
231
  transparent: "transparent";
223
232
  }>;
224
- type: z.ZodString;
233
+ type: z.ZodEnum<{
234
+ default: "default";
235
+ birthday: "birthday";
236
+ focusTime: "focusTime";
237
+ fromGmail: "fromGmail";
238
+ outOfOffice: "outOfOffice";
239
+ workingLocation: "workingLocation";
240
+ }>;
225
241
  updatedAt: z.ZodOptional<z.ZodString>;
226
242
  visibility: z.ZodEnum<{
227
243
  default: "default";
@@ -256,6 +272,7 @@ export declare const GOOGLE_CALENDAR_EVENT_CHANGED_SCHEMA: z.ZodDiscriminatedUni
256
272
  organizer: z.ZodBoolean;
257
273
  self: z.ZodBoolean;
258
274
  }, z.core.$strip>>;
275
+ attendeesOmitted: z.ZodBoolean;
259
276
  calendarId: z.ZodString;
260
277
  colorId: z.ZodOptional<z.ZodString>;
261
278
  conference: z.ZodOptional<z.ZodObject<{
@@ -335,7 +352,14 @@ export declare const GOOGLE_CALENDAR_EVENT_CHANGED_SCHEMA: z.ZodDiscriminatedUni
335
352
  opaque: "opaque";
336
353
  transparent: "transparent";
337
354
  }>;
338
- type: z.ZodString;
355
+ type: z.ZodEnum<{
356
+ default: "default";
357
+ birthday: "birthday";
358
+ focusTime: "focusTime";
359
+ fromGmail: "fromGmail";
360
+ outOfOffice: "outOfOffice";
361
+ workingLocation: "workingLocation";
362
+ }>;
339
363
  updatedAt: z.ZodOptional<z.ZodString>;
340
364
  visibility: z.ZodEnum<{
341
365
  default: "default";
@@ -370,6 +394,7 @@ export declare const GOOGLE_CALENDAR_EVENT_CHANGED_SCHEMA: z.ZodDiscriminatedUni
370
394
  organizer: z.ZodBoolean;
371
395
  self: z.ZodBoolean;
372
396
  }, z.core.$strip>>;
397
+ attendeesOmitted: z.ZodBoolean;
373
398
  calendarId: z.ZodString;
374
399
  colorId: z.ZodOptional<z.ZodString>;
375
400
  conference: z.ZodOptional<z.ZodObject<{
@@ -449,7 +474,14 @@ export declare const GOOGLE_CALENDAR_EVENT_CHANGED_SCHEMA: z.ZodDiscriminatedUni
449
474
  opaque: "opaque";
450
475
  transparent: "transparent";
451
476
  }>;
452
- type: z.ZodString;
477
+ type: z.ZodEnum<{
478
+ default: "default";
479
+ birthday: "birthday";
480
+ focusTime: "focusTime";
481
+ fromGmail: "fromGmail";
482
+ outOfOffice: "outOfOffice";
483
+ workingLocation: "workingLocation";
484
+ }>;
453
485
  updatedAt: z.ZodOptional<z.ZodString>;
454
486
  visibility: z.ZodEnum<{
455
487
  default: "default";
@@ -1,6 +1,7 @@
1
1
  import { Buffer } from "node:buffer";
2
2
  import { auth, calendar } from "@googleapis/calendar";
3
3
  import * as z from "zod";
4
+ import { CALENDAR_ACCESS_ROLE_SCHEMA, EVENT_TYPE_SCHEMA, } from "./schemas.js";
4
5
  const GOOGLE_CALENDAR_HOSTS = new Set(["calendar.google.com", "www.google.com"]);
5
6
  const GOOGLE_CALENDAR_SECRET_SCHEMA = z.object({
6
7
  accessToken: z.string().min(1),
@@ -166,6 +167,7 @@ export function normalizeCalendarEvent(event, calendarId) {
166
167
  },
167
168
  ]
168
169
  : []),
170
+ attendeesOmitted: event.attendeesOmitted ?? false,
169
171
  calendarId,
170
172
  colorId: event.colorId ?? undefined,
171
173
  conference: normalizeConference(event.conferenceData),
@@ -207,7 +209,7 @@ export function normalizeCalendarEvent(event, calendarId) {
207
209
  status: normalizeEventStatus(event.status),
208
210
  summary: event.summary ?? "",
209
211
  transparency: event.transparency === "transparent" ? "transparent" : "opaque",
210
- type: event.eventType ?? "default",
212
+ type: normalizeEventType(event.eventType),
211
213
  updatedAt: event.updated ?? undefined,
212
214
  visibility: normalizeVisibility(event.visibility),
213
215
  };
@@ -241,7 +243,7 @@ export function normalizeCalendar(value, id) {
241
243
  }
242
244
  const listEntry = "accessRole" in value ? value : undefined;
243
245
  return {
244
- accessRole: listEntry?.accessRole ?? undefined,
246
+ accessRole: normalizeCalendarAccessRole(listEntry?.accessRole),
245
247
  autoAcceptInvitations: value.autoAcceptInvitations ?? false,
246
248
  backgroundColor: listEntry?.backgroundColor ?? undefined,
247
249
  colorId: listEntry?.colorId ?? undefined,
@@ -505,6 +507,15 @@ function normalizeReminderMethod(value) {
505
507
  function normalizeEventStatus(value) {
506
508
  return value === "tentative" || value === "cancelled" ? value : "confirmed";
507
509
  }
510
+ /**
511
+ * Narrows a provider event type.
512
+ *
513
+ * @param value - Provider event type.
514
+ */
515
+ function normalizeEventType(value) {
516
+ const result = EVENT_TYPE_SCHEMA.safeParse(value ?? "default");
517
+ return result.success ? result.data : "default";
518
+ }
508
519
  /**
509
520
  * Narrows an event visibility.
510
521
  *
@@ -524,10 +535,20 @@ function normalizeAclRole(value) {
524
535
  return value === "none" ||
525
536
  value === "freeBusyReader" ||
526
537
  value === "reader" ||
538
+ value === "writerWithoutPrivateAccess" ||
527
539
  value === "writer"
528
540
  ? value
529
541
  : "owner";
530
542
  }
543
+ /**
544
+ * Narrows an authenticated user's calendar access role.
545
+ *
546
+ * @param value - Provider calendar access role.
547
+ */
548
+ function normalizeCalendarAccessRole(value) {
549
+ const result = CALENDAR_ACCESS_ROLE_SCHEMA.safeParse(value);
550
+ return result.success ? result.data : undefined;
551
+ }
531
552
  /**
532
553
  * Narrows an ACL scope type.
533
554
  *
@@ -37,6 +37,7 @@ export declare const googleCalendarTriggerContracts: {
37
37
  organizer: z.ZodBoolean;
38
38
  self: z.ZodBoolean;
39
39
  }, z.core.$strip>>;
40
+ attendeesOmitted: z.ZodBoolean;
40
41
  calendarId: z.ZodString;
41
42
  colorId: z.ZodOptional<z.ZodString>;
42
43
  conference: z.ZodOptional<z.ZodObject<{
@@ -116,7 +117,14 @@ export declare const googleCalendarTriggerContracts: {
116
117
  opaque: "opaque";
117
118
  transparent: "transparent";
118
119
  }>;
119
- type: z.ZodString;
120
+ type: z.ZodEnum<{
121
+ default: "default";
122
+ birthday: "birthday";
123
+ focusTime: "focusTime";
124
+ fromGmail: "fromGmail";
125
+ outOfOffice: "outOfOffice";
126
+ workingLocation: "workingLocation";
127
+ }>;
120
128
  updatedAt: z.ZodOptional<z.ZodString>;
121
129
  visibility: z.ZodEnum<{
122
130
  default: "default";
@@ -151,6 +159,7 @@ export declare const googleCalendarTriggerContracts: {
151
159
  organizer: z.ZodBoolean;
152
160
  self: z.ZodBoolean;
153
161
  }, z.core.$strip>>;
162
+ attendeesOmitted: z.ZodBoolean;
154
163
  calendarId: z.ZodString;
155
164
  colorId: z.ZodOptional<z.ZodString>;
156
165
  conference: z.ZodOptional<z.ZodObject<{
@@ -230,7 +239,14 @@ export declare const googleCalendarTriggerContracts: {
230
239
  opaque: "opaque";
231
240
  transparent: "transparent";
232
241
  }>;
233
- type: z.ZodString;
242
+ type: z.ZodEnum<{
243
+ default: "default";
244
+ birthday: "birthday";
245
+ focusTime: "focusTime";
246
+ fromGmail: "fromGmail";
247
+ outOfOffice: "outOfOffice";
248
+ workingLocation: "workingLocation";
249
+ }>;
234
250
  updatedAt: z.ZodOptional<z.ZodString>;
235
251
  visibility: z.ZodEnum<{
236
252
  default: "default";
@@ -265,6 +281,7 @@ export declare const googleCalendarTriggerContracts: {
265
281
  organizer: z.ZodBoolean;
266
282
  self: z.ZodBoolean;
267
283
  }, z.core.$strip>>;
284
+ attendeesOmitted: z.ZodBoolean;
268
285
  calendarId: z.ZodString;
269
286
  colorId: z.ZodOptional<z.ZodString>;
270
287
  conference: z.ZodOptional<z.ZodObject<{
@@ -344,7 +361,14 @@ export declare const googleCalendarTriggerContracts: {
344
361
  opaque: "opaque";
345
362
  transparent: "transparent";
346
363
  }>;
347
- type: z.ZodString;
364
+ type: z.ZodEnum<{
365
+ default: "default";
366
+ birthday: "birthday";
367
+ focusTime: "focusTime";
368
+ fromGmail: "fromGmail";
369
+ outOfOffice: "outOfOffice";
370
+ workingLocation: "workingLocation";
371
+ }>;
348
372
  updatedAt: z.ZodOptional<z.ZodString>;
349
373
  visibility: z.ZodEnum<{
350
374
  default: "default";
@@ -385,6 +409,7 @@ export declare const googleCalendarTriggerContracts: {
385
409
  organizer: z.ZodBoolean;
386
410
  self: z.ZodBoolean;
387
411
  }, z.core.$strip>>;
412
+ attendeesOmitted: z.ZodBoolean;
388
413
  calendarId: z.ZodString;
389
414
  colorId: z.ZodOptional<z.ZodString>;
390
415
  conference: z.ZodOptional<z.ZodObject<{
@@ -464,7 +489,14 @@ export declare const googleCalendarTriggerContracts: {
464
489
  opaque: "opaque";
465
490
  transparent: "transparent";
466
491
  }>;
467
- type: z.ZodString;
492
+ type: z.ZodEnum<{
493
+ default: "default";
494
+ birthday: "birthday";
495
+ focusTime: "focusTime";
496
+ fromGmail: "fromGmail";
497
+ outOfOffice: "outOfOffice";
498
+ workingLocation: "workingLocation";
499
+ }>;
468
500
  updatedAt: z.ZodOptional<z.ZodString>;
469
501
  visibility: z.ZodEnum<{
470
502
  default: "default";
@@ -504,6 +536,7 @@ export declare const googleCalendarTriggerContracts: {
504
536
  organizer: z.ZodBoolean;
505
537
  self: z.ZodBoolean;
506
538
  }, z.core.$strip>>;
539
+ attendeesOmitted: z.ZodBoolean;
507
540
  calendarId: z.ZodString;
508
541
  colorId: z.ZodOptional<z.ZodString>;
509
542
  conference: z.ZodOptional<z.ZodObject<{
@@ -583,7 +616,14 @@ export declare const googleCalendarTriggerContracts: {
583
616
  opaque: "opaque";
584
617
  transparent: "transparent";
585
618
  }>;
586
- type: z.ZodString;
619
+ type: z.ZodEnum<{
620
+ default: "default";
621
+ birthday: "birthday";
622
+ focusTime: "focusTime";
623
+ fromGmail: "fromGmail";
624
+ outOfOffice: "outOfOffice";
625
+ workingLocation: "workingLocation";
626
+ }>;
587
627
  updatedAt: z.ZodOptional<z.ZodString>;
588
628
  visibility: z.ZodEnum<{
589
629
  default: "default";
@@ -623,6 +663,7 @@ export declare const googleCalendarTriggerContracts: {
623
663
  organizer: z.ZodBoolean;
624
664
  self: z.ZodBoolean;
625
665
  }, z.core.$strip>>;
666
+ attendeesOmitted: z.ZodBoolean;
626
667
  calendarId: z.ZodString;
627
668
  colorId: z.ZodOptional<z.ZodString>;
628
669
  conference: z.ZodOptional<z.ZodObject<{
@@ -702,7 +743,14 @@ export declare const googleCalendarTriggerContracts: {
702
743
  opaque: "opaque";
703
744
  transparent: "transparent";
704
745
  }>;
705
- type: z.ZodString;
746
+ type: z.ZodEnum<{
747
+ default: "default";
748
+ birthday: "birthday";
749
+ focusTime: "focusTime";
750
+ fromGmail: "fromGmail";
751
+ outOfOffice: "outOfOffice";
752
+ workingLocation: "workingLocation";
753
+ }>;
706
754
  updatedAt: z.ZodOptional<z.ZodString>;
707
755
  visibility: z.ZodEnum<{
708
756
  default: "default";
@@ -8,6 +8,29 @@ export declare const SEND_UPDATES_SCHEMA: z.ZodEnum<{
8
8
  externalOnly: "externalOnly";
9
9
  none: "none";
10
10
  }>;
11
+ export declare const CALENDAR_ACCESS_ROLE_SCHEMA: z.ZodEnum<{
12
+ owner: "owner";
13
+ freeBusyReader: "freeBusyReader";
14
+ reader: "reader";
15
+ writerWithoutPrivateAccess: "writerWithoutPrivateAccess";
16
+ writer: "writer";
17
+ }>;
18
+ export declare const ACL_ROLE_SCHEMA: z.ZodEnum<{
19
+ owner: "owner";
20
+ none: "none";
21
+ freeBusyReader: "freeBusyReader";
22
+ reader: "reader";
23
+ writerWithoutPrivateAccess: "writerWithoutPrivateAccess";
24
+ writer: "writer";
25
+ }>;
26
+ export declare const EVENT_TYPE_SCHEMA: z.ZodEnum<{
27
+ default: "default";
28
+ birthday: "birthday";
29
+ focusTime: "focusTime";
30
+ fromGmail: "fromGmail";
31
+ outOfOffice: "outOfOffice";
32
+ workingLocation: "workingLocation";
33
+ }>;
11
34
  export declare const EVENT_STATUS_SCHEMA: z.ZodEnum<{
12
35
  cancelled: "cancelled";
13
36
  confirmed: "confirmed";
@@ -206,6 +229,7 @@ export declare const CALENDAR_EVENT_SCHEMA: z.ZodObject<{
206
229
  organizer: z.ZodBoolean;
207
230
  self: z.ZodBoolean;
208
231
  }, z.core.$strip>>;
232
+ attendeesOmitted: z.ZodBoolean;
209
233
  calendarId: z.ZodString;
210
234
  colorId: z.ZodOptional<z.ZodString>;
211
235
  conference: z.ZodOptional<z.ZodObject<{
@@ -285,7 +309,14 @@ export declare const CALENDAR_EVENT_SCHEMA: z.ZodObject<{
285
309
  opaque: "opaque";
286
310
  transparent: "transparent";
287
311
  }>;
288
- type: z.ZodString;
312
+ type: z.ZodEnum<{
313
+ default: "default";
314
+ birthday: "birthday";
315
+ focusTime: "focusTime";
316
+ fromGmail: "fromGmail";
317
+ outOfOffice: "outOfOffice";
318
+ workingLocation: "workingLocation";
319
+ }>;
289
320
  updatedAt: z.ZodOptional<z.ZodString>;
290
321
  visibility: z.ZodEnum<{
291
322
  default: "default";
@@ -319,6 +350,7 @@ export declare const EVENT_PAGE_SCHEMA: z.ZodObject<{
319
350
  organizer: z.ZodBoolean;
320
351
  self: z.ZodBoolean;
321
352
  }, z.core.$strip>>;
353
+ attendeesOmitted: z.ZodBoolean;
322
354
  calendarId: z.ZodString;
323
355
  colorId: z.ZodOptional<z.ZodString>;
324
356
  conference: z.ZodOptional<z.ZodObject<{
@@ -398,7 +430,14 @@ export declare const EVENT_PAGE_SCHEMA: z.ZodObject<{
398
430
  opaque: "opaque";
399
431
  transparent: "transparent";
400
432
  }>;
401
- type: z.ZodString;
433
+ type: z.ZodEnum<{
434
+ default: "default";
435
+ birthday: "birthday";
436
+ focusTime: "focusTime";
437
+ fromGmail: "fromGmail";
438
+ outOfOffice: "outOfOffice";
439
+ workingLocation: "workingLocation";
440
+ }>;
402
441
  updatedAt: z.ZodOptional<z.ZodString>;
403
442
  visibility: z.ZodEnum<{
404
443
  default: "default";
@@ -426,7 +465,13 @@ export declare const CALENDAR_NOTIFICATION_SCHEMA: z.ZodObject<{
426
465
  }>;
427
466
  }, z.core.$strip>;
428
467
  export declare const CALENDAR_SCHEMA: z.ZodObject<{
429
- accessRole: z.ZodOptional<z.ZodString>;
468
+ accessRole: z.ZodOptional<z.ZodEnum<{
469
+ owner: "owner";
470
+ freeBusyReader: "freeBusyReader";
471
+ reader: "reader";
472
+ writerWithoutPrivateAccess: "writerWithoutPrivateAccess";
473
+ writer: "writer";
474
+ }>>;
430
475
  autoAcceptInvitations: z.ZodBoolean;
431
476
  backgroundColor: z.ZodOptional<z.ZodString>;
432
477
  colorId: z.ZodOptional<z.ZodString>;
@@ -459,7 +504,13 @@ export declare const CALENDAR_SCHEMA: z.ZodObject<{
459
504
  }, z.core.$strip>;
460
505
  export declare const CALENDAR_PAGE_SCHEMA: z.ZodObject<{
461
506
  calendars: z.ZodArray<z.ZodObject<{
462
- accessRole: z.ZodOptional<z.ZodString>;
507
+ accessRole: z.ZodOptional<z.ZodEnum<{
508
+ owner: "owner";
509
+ freeBusyReader: "freeBusyReader";
510
+ reader: "reader";
511
+ writerWithoutPrivateAccess: "writerWithoutPrivateAccess";
512
+ writer: "writer";
513
+ }>>;
463
514
  autoAcceptInvitations: z.ZodBoolean;
464
515
  backgroundColor: z.ZodOptional<z.ZodString>;
465
516
  colorId: z.ZodOptional<z.ZodString>;
@@ -555,6 +606,7 @@ export declare const ACL_RULE_SCHEMA: z.ZodObject<{
555
606
  none: "none";
556
607
  freeBusyReader: "freeBusyReader";
557
608
  reader: "reader";
609
+ writerWithoutPrivateAccess: "writerWithoutPrivateAccess";
558
610
  writer: "writer";
559
611
  }>;
560
612
  scope: z.ZodObject<{
@@ -575,6 +627,7 @@ export declare const ACL_PAGE_SCHEMA: z.ZodObject<{
575
627
  none: "none";
576
628
  freeBusyReader: "freeBusyReader";
577
629
  reader: "reader";
630
+ writerWithoutPrivateAccess: "writerWithoutPrivateAccess";
578
631
  writer: "writer";
579
632
  }>;
580
633
  scope: z.ZodObject<{
@@ -4,6 +4,25 @@ export const EVENT_REFERENCE_SCHEMA = z.string().trim().min(1);
4
4
  export const RFC3339_SCHEMA = z.iso.datetime({ offset: true });
5
5
  export const DATE_SCHEMA = z.iso.date();
6
6
  export const SEND_UPDATES_SCHEMA = z.enum(["all", "externalOnly", "none"]);
7
+ export const CALENDAR_ACCESS_ROLE_SCHEMA = z.enum([
8
+ "freeBusyReader",
9
+ "reader",
10
+ "writerWithoutPrivateAccess",
11
+ "writer",
12
+ "owner",
13
+ ]);
14
+ export const ACL_ROLE_SCHEMA = z.enum([
15
+ "none",
16
+ ...CALENDAR_ACCESS_ROLE_SCHEMA.options,
17
+ ]);
18
+ export const EVENT_TYPE_SCHEMA = z.enum([
19
+ "birthday",
20
+ "default",
21
+ "focusTime",
22
+ "fromGmail",
23
+ "outOfOffice",
24
+ "workingLocation",
25
+ ]);
7
26
  export const EVENT_STATUS_SCHEMA = z.enum([
8
27
  "confirmed",
9
28
  "tentative",
@@ -176,6 +195,8 @@ export const CALENDAR_EVENT_SCHEMA = z.object({
176
195
  attachments: EVENT_ATTACHMENT_SCHEMA.array(),
177
196
  /** Invited people and resources. */
178
197
  attendees: EVENT_ATTENDEE_SCHEMA.array(),
198
+ /** Whether the provider omitted attendees from this representation. */
199
+ attendeesOmitted: z.boolean(),
179
200
  /** Calendar from which this representation was read. */
180
201
  calendarId: z.string(),
181
202
  /** Calendar color palette identifier. */
@@ -232,7 +253,7 @@ export const CALENDAR_EVENT_SCHEMA = z.object({
232
253
  /** Whether the event blocks time. */
233
254
  transparency: z.enum(["opaque", "transparent"]),
234
255
  /** Provider event type. */
235
- type: z.string(),
256
+ type: EVENT_TYPE_SCHEMA,
236
257
  /** Last update timestamp. */
237
258
  updatedAt: z.string().optional(),
238
259
  /** Event visibility. */
@@ -268,7 +289,7 @@ export const CALENDAR_NOTIFICATION_SCHEMA = z.object({
268
289
  });
269
290
  export const CALENDAR_SCHEMA = z.object({
270
291
  /** Access role of the authenticated user. */
271
- accessRole: z.string().optional(),
292
+ accessRole: CALENDAR_ACCESS_ROLE_SCHEMA.optional(),
272
293
  /** Whether a resource calendar automatically accepts invitations. */
273
294
  autoAcceptInvitations: z.boolean(),
274
295
  /** Calendar background color. */
@@ -365,7 +386,7 @@ export const ACL_RULE_SCHEMA = z.object({
365
386
  /** Immutable ACL rule identifier. */
366
387
  id: z.string(),
367
388
  /** Permission role. */
368
- role: z.enum(["none", "freeBusyReader", "reader", "writer", "owner"]),
389
+ role: ACL_ROLE_SCHEMA,
369
390
  /** Principal or public scope receiving access. */
370
391
  scope: ACL_SCOPE_SCHEMA,
371
392
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automate.ax/integration-contracts",
3
- "version": "0.131.1",
3
+ "version": "0.132.0",
4
4
  "description": "Shared integration payload contracts and provider primitives for Automate.ax.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -59,9 +59,9 @@
59
59
  }
60
60
  },
61
61
  "dependencies": {
62
- "@automate.ax/codec": "0.131.1",
62
+ "@automate.ax/codec": "0.132.0",
63
63
  "@cfworker/json-schema": "^4.1.1",
64
- "@googleapis/calendar": "^15.0.0",
64
+ "@googleapis/calendar": "^16.0.0",
65
65
  "@googleapis/forms": "^6.0.1",
66
66
  "@googleapis/gmail": "^12.0.0",
67
67
  "@googleapis/meet": "^5.0.0",
@@ -4,10 +4,12 @@ import * as z from "zod"
4
4
  import {
5
5
  ACL_PAGE_SCHEMA,
6
6
  ACL_RULE_SCHEMA,
7
+ CALENDAR_ACCESS_ROLE_SCHEMA,
7
8
  CALENDAR_EVENT_SCHEMA,
8
9
  CALENDAR_PAGE_SCHEMA,
9
10
  CALENDAR_SCHEMA,
10
11
  COLOR_PALETTE_SCHEMA,
12
+ EVENT_TYPE_SCHEMA,
11
13
  EVENT_PAGE_SCHEMA,
12
14
  EVENT_DETAILS_INPUT_SCHEMA,
13
15
  EVENT_SCHEDULE_INPUT_SCHEMA,
@@ -213,6 +215,7 @@ export function normalizeCalendarEvent(
213
215
  ]
214
216
  : [],
215
217
  ),
218
+ attendeesOmitted: event.attendeesOmitted ?? false,
216
219
  calendarId,
217
220
  colorId: event.colorId ?? undefined,
218
221
  conference: normalizeConference(event.conferenceData),
@@ -257,7 +260,7 @@ export function normalizeCalendarEvent(
257
260
  summary: event.summary ?? "",
258
261
  transparency:
259
262
  event.transparency === "transparent" ? "transparent" : "opaque",
260
- type: event.eventType ?? "default",
263
+ type: normalizeEventType(event.eventType),
261
264
  updatedAt: event.updated ?? undefined,
262
265
  visibility: normalizeVisibility(event.visibility),
263
266
  }
@@ -301,7 +304,7 @@ export function normalizeCalendar(
301
304
  }
302
305
  const listEntry = "accessRole" in value ? value : undefined
303
306
  return {
304
- accessRole: listEntry?.accessRole ?? undefined,
307
+ accessRole: normalizeCalendarAccessRole(listEntry?.accessRole),
305
308
  autoAcceptInvitations: value.autoAcceptInvitations ?? false,
306
309
  backgroundColor: listEntry?.backgroundColor ?? undefined,
307
310
  colorId: listEntry?.colorId ?? undefined,
@@ -631,6 +634,16 @@ function normalizeEventStatus(value: string | null | undefined) {
631
634
  return value === "tentative" || value === "cancelled" ? value : "confirmed"
632
635
  }
633
636
 
637
+ /**
638
+ * Narrows a provider event type.
639
+ *
640
+ * @param value - Provider event type.
641
+ */
642
+ function normalizeEventType(value: string | null | undefined) {
643
+ const result = EVENT_TYPE_SCHEMA.safeParse(value ?? "default")
644
+ return result.success ? result.data : "default"
645
+ }
646
+
634
647
  /**
635
648
  * Narrows an event visibility.
636
649
  *
@@ -651,11 +664,22 @@ function normalizeAclRole(value: string | null | undefined) {
651
664
  return value === "none" ||
652
665
  value === "freeBusyReader" ||
653
666
  value === "reader" ||
667
+ value === "writerWithoutPrivateAccess" ||
654
668
  value === "writer"
655
669
  ? value
656
670
  : "owner"
657
671
  }
658
672
 
673
+ /**
674
+ * Narrows an authenticated user's calendar access role.
675
+ *
676
+ * @param value - Provider calendar access role.
677
+ */
678
+ function normalizeCalendarAccessRole(value: string | null | undefined) {
679
+ const result = CALENDAR_ACCESS_ROLE_SCHEMA.safeParse(value)
680
+ return result.success ? result.data : undefined
681
+ }
682
+
659
683
  /**
660
684
  * Narrows an ACL scope type.
661
685
  *
@@ -5,6 +5,25 @@ export const EVENT_REFERENCE_SCHEMA = z.string().trim().min(1)
5
5
  export const RFC3339_SCHEMA = z.iso.datetime({ offset: true })
6
6
  export const DATE_SCHEMA = z.iso.date()
7
7
  export const SEND_UPDATES_SCHEMA = z.enum(["all", "externalOnly", "none"])
8
+ export const CALENDAR_ACCESS_ROLE_SCHEMA = z.enum([
9
+ "freeBusyReader",
10
+ "reader",
11
+ "writerWithoutPrivateAccess",
12
+ "writer",
13
+ "owner",
14
+ ])
15
+ export const ACL_ROLE_SCHEMA = z.enum([
16
+ "none",
17
+ ...CALENDAR_ACCESS_ROLE_SCHEMA.options,
18
+ ])
19
+ export const EVENT_TYPE_SCHEMA = z.enum([
20
+ "birthday",
21
+ "default",
22
+ "focusTime",
23
+ "fromGmail",
24
+ "outOfOffice",
25
+ "workingLocation",
26
+ ])
8
27
  export const EVENT_STATUS_SCHEMA = z.enum([
9
28
  "confirmed",
10
29
  "tentative",
@@ -238,6 +257,9 @@ export const CALENDAR_EVENT_SCHEMA = z.object({
238
257
  /** Invited people and resources. */
239
258
  attendees: EVENT_ATTENDEE_SCHEMA.array(),
240
259
 
260
+ /** Whether the provider omitted attendees from this representation. */
261
+ attendeesOmitted: z.boolean(),
262
+
241
263
  /** Calendar from which this representation was read. */
242
264
  calendarId: z.string(),
243
265
 
@@ -320,7 +342,7 @@ export const CALENDAR_EVENT_SCHEMA = z.object({
320
342
  transparency: z.enum(["opaque", "transparent"]),
321
343
 
322
344
  /** Provider event type. */
323
- type: z.string(),
345
+ type: EVENT_TYPE_SCHEMA,
324
346
 
325
347
  /** Last update timestamp. */
326
348
  updatedAt: z.string().optional(),
@@ -367,7 +389,7 @@ export const CALENDAR_NOTIFICATION_SCHEMA = z.object({
367
389
 
368
390
  export const CALENDAR_SCHEMA = z.object({
369
391
  /** Access role of the authenticated user. */
370
- accessRole: z.string().optional(),
392
+ accessRole: CALENDAR_ACCESS_ROLE_SCHEMA.optional(),
371
393
 
372
394
  /** Whether a resource calendar automatically accepts invitations. */
373
395
  autoAcceptInvitations: z.boolean(),
@@ -511,7 +533,7 @@ export const ACL_RULE_SCHEMA = z.object({
511
533
  id: z.string(),
512
534
 
513
535
  /** Permission role. */
514
- role: z.enum(["none", "freeBusyReader", "reader", "writer", "owner"]),
536
+ role: ACL_ROLE_SCHEMA,
515
537
 
516
538
  /** Principal or public scope receiving access. */
517
539
  scope: ACL_SCOPE_SCHEMA,