@corsair-dev/googlecalendar 0.1.4 → 0.1.6
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.
- package/dist/client.d.ts +0 -12
- package/dist/client.d.ts.map +1 -1
- package/dist/endpoints/types.d.ts +208 -0
- package/dist/endpoints/types.d.ts.map +1 -1
- package/dist/index.d.ts +213 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/subscribe.d.ts +9 -0
- package/dist/subscribe.d.ts.map +1 -0
- package/dist/subscribe.test.d.ts +2 -0
- package/dist/subscribe.test.d.ts.map +1 -0
- package/dist/webhooks/tenant-matcher.d.ts +3 -0
- package/dist/webhooks/tenant-matcher.d.ts.map +1 -0
- package/package.json +4 -6
package/dist/client.d.ts
CHANGED
|
@@ -2,18 +2,6 @@ export declare class GoogleCalendarAPIError extends Error {
|
|
|
2
2
|
readonly code?: number | undefined;
|
|
3
3
|
constructor(message: string, code?: number | undefined);
|
|
4
4
|
}
|
|
5
|
-
export declare function getValidAccessToken({ accessToken, expiresAt, clientId, clientSecret, refreshToken, forceRefresh, }: {
|
|
6
|
-
clientId: string;
|
|
7
|
-
clientSecret: string;
|
|
8
|
-
accessToken?: string | null;
|
|
9
|
-
expiresAt?: string | null;
|
|
10
|
-
refreshToken: string;
|
|
11
|
-
forceRefresh?: boolean;
|
|
12
|
-
}): Promise<{
|
|
13
|
-
accessToken: string;
|
|
14
|
-
expiresAt: number;
|
|
15
|
-
refreshed: boolean;
|
|
16
|
-
}>;
|
|
17
5
|
type CalendarRequestOptions = {
|
|
18
6
|
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
19
7
|
body?: Record<string, unknown>;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAGA,qBAAa,sBAAuB,SAAQ,KAAK;aAG/B,IAAI,CAAC,EAAE,MAAM;gBAD7B,OAAO,EAAE,MAAM,EACC,IAAI,CAAC,EAAE,MAAM,YAAA;CAK9B;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAGA,qBAAa,sBAAuB,SAAQ,KAAK;aAG/B,IAAI,CAAC,EAAE,MAAM;gBAD7B,OAAO,EAAE,MAAM,EACC,IAAI,CAAC,EAAE,MAAM,YAAA;CAK9B;AAID,KAAK,sBAAsB,GAAG;IAC7B,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;CAC9D,CAAC;AAEF,wBAAsB,mBAAmB,CAAC,CAAC,EAC1C,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,sBAA2B,GAClC,OAAO,CAAC,CAAC,CAAC,CA2BZ;AAUD,wBAAsB,gCAAgC,CAAC,CAAC,EACvD,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;CAAE,EAC1D,OAAO,GAAE,sBAA2B,GAClC,OAAO,CAAC,CAAC,CAAC,CAUZ"}
|
|
@@ -322,6 +322,58 @@ export declare const GoogleCalendarEndpointOutputSchemas: {
|
|
|
322
322
|
guestsCanSeeOtherGuests: z.ZodOptional<z.ZodBoolean>;
|
|
323
323
|
privateCopy: z.ZodOptional<z.ZodBoolean>;
|
|
324
324
|
locked: z.ZodOptional<z.ZodBoolean>;
|
|
325
|
+
conferenceData: z.ZodOptional<z.ZodObject<{
|
|
326
|
+
createRequest: z.ZodOptional<z.ZodObject<{
|
|
327
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
328
|
+
conferenceSolutionKey: z.ZodOptional<z.ZodObject<{
|
|
329
|
+
type: z.ZodOptional<z.ZodString>;
|
|
330
|
+
}, z.core.$strip>>;
|
|
331
|
+
status: z.ZodOptional<z.ZodObject<{
|
|
332
|
+
statusCode: z.ZodOptional<z.ZodString>;
|
|
333
|
+
}, z.core.$strip>>;
|
|
334
|
+
}, z.core.$strip>>;
|
|
335
|
+
entryPoints: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
336
|
+
entryPointType: z.ZodOptional<z.ZodString>;
|
|
337
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
338
|
+
label: z.ZodOptional<z.ZodString>;
|
|
339
|
+
pin: z.ZodOptional<z.ZodString>;
|
|
340
|
+
accessCode: z.ZodOptional<z.ZodString>;
|
|
341
|
+
meetingCode: z.ZodOptional<z.ZodString>;
|
|
342
|
+
passcode: z.ZodOptional<z.ZodString>;
|
|
343
|
+
password: z.ZodOptional<z.ZodString>;
|
|
344
|
+
}, z.core.$strip>>>;
|
|
345
|
+
conferenceSolution: z.ZodOptional<z.ZodObject<{
|
|
346
|
+
key: z.ZodOptional<z.ZodObject<{
|
|
347
|
+
type: z.ZodOptional<z.ZodString>;
|
|
348
|
+
}, z.core.$strip>>;
|
|
349
|
+
name: z.ZodOptional<z.ZodString>;
|
|
350
|
+
iconUri: z.ZodOptional<z.ZodString>;
|
|
351
|
+
}, z.core.$strip>>;
|
|
352
|
+
conferenceId: z.ZodOptional<z.ZodString>;
|
|
353
|
+
signature: z.ZodOptional<z.ZodString>;
|
|
354
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
355
|
+
}, z.core.$strip>>;
|
|
356
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
357
|
+
fileUrl: z.ZodOptional<z.ZodString>;
|
|
358
|
+
title: z.ZodOptional<z.ZodString>;
|
|
359
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
360
|
+
iconLink: z.ZodOptional<z.ZodString>;
|
|
361
|
+
fileId: z.ZodOptional<z.ZodString>;
|
|
362
|
+
}, z.core.$strip>>>;
|
|
363
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
364
|
+
url: z.ZodOptional<z.ZodString>;
|
|
365
|
+
title: z.ZodOptional<z.ZodString>;
|
|
366
|
+
}, z.core.$strip>>;
|
|
367
|
+
gadget: z.ZodOptional<z.ZodObject<{
|
|
368
|
+
type: z.ZodOptional<z.ZodString>;
|
|
369
|
+
title: z.ZodOptional<z.ZodString>;
|
|
370
|
+
link: z.ZodOptional<z.ZodString>;
|
|
371
|
+
iconLink: z.ZodOptional<z.ZodString>;
|
|
372
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
373
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
374
|
+
display: z.ZodOptional<z.ZodString>;
|
|
375
|
+
preferences: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
376
|
+
}, z.core.$strip>>;
|
|
325
377
|
eventType: z.ZodOptional<z.ZodEnum<{
|
|
326
378
|
default: "default";
|
|
327
379
|
outOfOffice: "outOfOffice";
|
|
@@ -422,6 +474,58 @@ export declare const GoogleCalendarEndpointOutputSchemas: {
|
|
|
422
474
|
guestsCanSeeOtherGuests: z.ZodOptional<z.ZodBoolean>;
|
|
423
475
|
privateCopy: z.ZodOptional<z.ZodBoolean>;
|
|
424
476
|
locked: z.ZodOptional<z.ZodBoolean>;
|
|
477
|
+
conferenceData: z.ZodOptional<z.ZodObject<{
|
|
478
|
+
createRequest: z.ZodOptional<z.ZodObject<{
|
|
479
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
480
|
+
conferenceSolutionKey: z.ZodOptional<z.ZodObject<{
|
|
481
|
+
type: z.ZodOptional<z.ZodString>;
|
|
482
|
+
}, z.core.$strip>>;
|
|
483
|
+
status: z.ZodOptional<z.ZodObject<{
|
|
484
|
+
statusCode: z.ZodOptional<z.ZodString>;
|
|
485
|
+
}, z.core.$strip>>;
|
|
486
|
+
}, z.core.$strip>>;
|
|
487
|
+
entryPoints: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
488
|
+
entryPointType: z.ZodOptional<z.ZodString>;
|
|
489
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
490
|
+
label: z.ZodOptional<z.ZodString>;
|
|
491
|
+
pin: z.ZodOptional<z.ZodString>;
|
|
492
|
+
accessCode: z.ZodOptional<z.ZodString>;
|
|
493
|
+
meetingCode: z.ZodOptional<z.ZodString>;
|
|
494
|
+
passcode: z.ZodOptional<z.ZodString>;
|
|
495
|
+
password: z.ZodOptional<z.ZodString>;
|
|
496
|
+
}, z.core.$strip>>>;
|
|
497
|
+
conferenceSolution: z.ZodOptional<z.ZodObject<{
|
|
498
|
+
key: z.ZodOptional<z.ZodObject<{
|
|
499
|
+
type: z.ZodOptional<z.ZodString>;
|
|
500
|
+
}, z.core.$strip>>;
|
|
501
|
+
name: z.ZodOptional<z.ZodString>;
|
|
502
|
+
iconUri: z.ZodOptional<z.ZodString>;
|
|
503
|
+
}, z.core.$strip>>;
|
|
504
|
+
conferenceId: z.ZodOptional<z.ZodString>;
|
|
505
|
+
signature: z.ZodOptional<z.ZodString>;
|
|
506
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
507
|
+
}, z.core.$strip>>;
|
|
508
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
509
|
+
fileUrl: z.ZodOptional<z.ZodString>;
|
|
510
|
+
title: z.ZodOptional<z.ZodString>;
|
|
511
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
512
|
+
iconLink: z.ZodOptional<z.ZodString>;
|
|
513
|
+
fileId: z.ZodOptional<z.ZodString>;
|
|
514
|
+
}, z.core.$strip>>>;
|
|
515
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
516
|
+
url: z.ZodOptional<z.ZodString>;
|
|
517
|
+
title: z.ZodOptional<z.ZodString>;
|
|
518
|
+
}, z.core.$strip>>;
|
|
519
|
+
gadget: z.ZodOptional<z.ZodObject<{
|
|
520
|
+
type: z.ZodOptional<z.ZodString>;
|
|
521
|
+
title: z.ZodOptional<z.ZodString>;
|
|
522
|
+
link: z.ZodOptional<z.ZodString>;
|
|
523
|
+
iconLink: z.ZodOptional<z.ZodString>;
|
|
524
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
525
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
526
|
+
display: z.ZodOptional<z.ZodString>;
|
|
527
|
+
preferences: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
528
|
+
}, z.core.$strip>>;
|
|
425
529
|
eventType: z.ZodOptional<z.ZodEnum<{
|
|
426
530
|
default: "default";
|
|
427
531
|
outOfOffice: "outOfOffice";
|
|
@@ -539,6 +643,58 @@ export declare const GoogleCalendarEndpointOutputSchemas: {
|
|
|
539
643
|
guestsCanSeeOtherGuests: z.ZodOptional<z.ZodBoolean>;
|
|
540
644
|
privateCopy: z.ZodOptional<z.ZodBoolean>;
|
|
541
645
|
locked: z.ZodOptional<z.ZodBoolean>;
|
|
646
|
+
conferenceData: z.ZodOptional<z.ZodObject<{
|
|
647
|
+
createRequest: z.ZodOptional<z.ZodObject<{
|
|
648
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
649
|
+
conferenceSolutionKey: z.ZodOptional<z.ZodObject<{
|
|
650
|
+
type: z.ZodOptional<z.ZodString>;
|
|
651
|
+
}, z.core.$strip>>;
|
|
652
|
+
status: z.ZodOptional<z.ZodObject<{
|
|
653
|
+
statusCode: z.ZodOptional<z.ZodString>;
|
|
654
|
+
}, z.core.$strip>>;
|
|
655
|
+
}, z.core.$strip>>;
|
|
656
|
+
entryPoints: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
657
|
+
entryPointType: z.ZodOptional<z.ZodString>;
|
|
658
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
659
|
+
label: z.ZodOptional<z.ZodString>;
|
|
660
|
+
pin: z.ZodOptional<z.ZodString>;
|
|
661
|
+
accessCode: z.ZodOptional<z.ZodString>;
|
|
662
|
+
meetingCode: z.ZodOptional<z.ZodString>;
|
|
663
|
+
passcode: z.ZodOptional<z.ZodString>;
|
|
664
|
+
password: z.ZodOptional<z.ZodString>;
|
|
665
|
+
}, z.core.$strip>>>;
|
|
666
|
+
conferenceSolution: z.ZodOptional<z.ZodObject<{
|
|
667
|
+
key: z.ZodOptional<z.ZodObject<{
|
|
668
|
+
type: z.ZodOptional<z.ZodString>;
|
|
669
|
+
}, z.core.$strip>>;
|
|
670
|
+
name: z.ZodOptional<z.ZodString>;
|
|
671
|
+
iconUri: z.ZodOptional<z.ZodString>;
|
|
672
|
+
}, z.core.$strip>>;
|
|
673
|
+
conferenceId: z.ZodOptional<z.ZodString>;
|
|
674
|
+
signature: z.ZodOptional<z.ZodString>;
|
|
675
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
676
|
+
}, z.core.$strip>>;
|
|
677
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
678
|
+
fileUrl: z.ZodOptional<z.ZodString>;
|
|
679
|
+
title: z.ZodOptional<z.ZodString>;
|
|
680
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
681
|
+
iconLink: z.ZodOptional<z.ZodString>;
|
|
682
|
+
fileId: z.ZodOptional<z.ZodString>;
|
|
683
|
+
}, z.core.$strip>>>;
|
|
684
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
685
|
+
url: z.ZodOptional<z.ZodString>;
|
|
686
|
+
title: z.ZodOptional<z.ZodString>;
|
|
687
|
+
}, z.core.$strip>>;
|
|
688
|
+
gadget: z.ZodOptional<z.ZodObject<{
|
|
689
|
+
type: z.ZodOptional<z.ZodString>;
|
|
690
|
+
title: z.ZodOptional<z.ZodString>;
|
|
691
|
+
link: z.ZodOptional<z.ZodString>;
|
|
692
|
+
iconLink: z.ZodOptional<z.ZodString>;
|
|
693
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
694
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
695
|
+
display: z.ZodOptional<z.ZodString>;
|
|
696
|
+
preferences: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
697
|
+
}, z.core.$strip>>;
|
|
542
698
|
eventType: z.ZodOptional<z.ZodEnum<{
|
|
543
699
|
default: "default";
|
|
544
700
|
outOfOffice: "outOfOffice";
|
|
@@ -640,6 +796,58 @@ export declare const GoogleCalendarEndpointOutputSchemas: {
|
|
|
640
796
|
guestsCanSeeOtherGuests: z.ZodOptional<z.ZodBoolean>;
|
|
641
797
|
privateCopy: z.ZodOptional<z.ZodBoolean>;
|
|
642
798
|
locked: z.ZodOptional<z.ZodBoolean>;
|
|
799
|
+
conferenceData: z.ZodOptional<z.ZodObject<{
|
|
800
|
+
createRequest: z.ZodOptional<z.ZodObject<{
|
|
801
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
802
|
+
conferenceSolutionKey: z.ZodOptional<z.ZodObject<{
|
|
803
|
+
type: z.ZodOptional<z.ZodString>;
|
|
804
|
+
}, z.core.$strip>>;
|
|
805
|
+
status: z.ZodOptional<z.ZodObject<{
|
|
806
|
+
statusCode: z.ZodOptional<z.ZodString>;
|
|
807
|
+
}, z.core.$strip>>;
|
|
808
|
+
}, z.core.$strip>>;
|
|
809
|
+
entryPoints: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
810
|
+
entryPointType: z.ZodOptional<z.ZodString>;
|
|
811
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
812
|
+
label: z.ZodOptional<z.ZodString>;
|
|
813
|
+
pin: z.ZodOptional<z.ZodString>;
|
|
814
|
+
accessCode: z.ZodOptional<z.ZodString>;
|
|
815
|
+
meetingCode: z.ZodOptional<z.ZodString>;
|
|
816
|
+
passcode: z.ZodOptional<z.ZodString>;
|
|
817
|
+
password: z.ZodOptional<z.ZodString>;
|
|
818
|
+
}, z.core.$strip>>>;
|
|
819
|
+
conferenceSolution: z.ZodOptional<z.ZodObject<{
|
|
820
|
+
key: z.ZodOptional<z.ZodObject<{
|
|
821
|
+
type: z.ZodOptional<z.ZodString>;
|
|
822
|
+
}, z.core.$strip>>;
|
|
823
|
+
name: z.ZodOptional<z.ZodString>;
|
|
824
|
+
iconUri: z.ZodOptional<z.ZodString>;
|
|
825
|
+
}, z.core.$strip>>;
|
|
826
|
+
conferenceId: z.ZodOptional<z.ZodString>;
|
|
827
|
+
signature: z.ZodOptional<z.ZodString>;
|
|
828
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
829
|
+
}, z.core.$strip>>;
|
|
830
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
831
|
+
fileUrl: z.ZodOptional<z.ZodString>;
|
|
832
|
+
title: z.ZodOptional<z.ZodString>;
|
|
833
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
834
|
+
iconLink: z.ZodOptional<z.ZodString>;
|
|
835
|
+
fileId: z.ZodOptional<z.ZodString>;
|
|
836
|
+
}, z.core.$strip>>>;
|
|
837
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
838
|
+
url: z.ZodOptional<z.ZodString>;
|
|
839
|
+
title: z.ZodOptional<z.ZodString>;
|
|
840
|
+
}, z.core.$strip>>;
|
|
841
|
+
gadget: z.ZodOptional<z.ZodObject<{
|
|
842
|
+
type: z.ZodOptional<z.ZodString>;
|
|
843
|
+
title: z.ZodOptional<z.ZodString>;
|
|
844
|
+
link: z.ZodOptional<z.ZodString>;
|
|
845
|
+
iconLink: z.ZodOptional<z.ZodString>;
|
|
846
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
847
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
848
|
+
display: z.ZodOptional<z.ZodString>;
|
|
849
|
+
preferences: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
850
|
+
}, z.core.$strip>>;
|
|
643
851
|
eventType: z.ZodOptional<z.ZodEnum<{
|
|
644
852
|
default: "default";
|
|
645
853
|
outOfOffice: "outOfOffice";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../endpoints/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../endpoints/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AA2P3E,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOrC,CAAC;AAEX,MAAM,MAAM,4BAA4B,GAAG;KACzC,CAAC,IAAI,MAAM,OAAO,kCAAkC,GAAG,CAAC,CAAC,KAAK,CAC9D,CAAC,OAAO,kCAAkC,CAAC,CAAC,CAAC,CAAC,CAC9C;CACD,CAAC;AA8HF,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOtC,CAAC;AAEX,MAAM,MAAM,6BAA6B,GAAG;IAC3C,YAAY,EAAE,KAAK,CAAC;IACpB,SAAS,EAAE,KAAK,CAAC;IACjB,aAAa,EAAE,iBAAiB,CAAC;IACjC,YAAY,EAAE,KAAK,CAAC;IACpB,YAAY,EAAE,IAAI,CAAC;IACnB,uBAAuB,EAAE,gBAAgB,CAAC;CAC1C,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -213,6 +213,58 @@ export declare const googlecalendarEndpointSchemas: {
|
|
|
213
213
|
guestsCanSeeOtherGuests: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
214
214
|
privateCopy: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
215
215
|
locked: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
216
|
+
conferenceData: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
217
|
+
createRequest: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
218
|
+
requestId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
219
|
+
conferenceSolutionKey: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
220
|
+
type: import("zod").ZodOptional<import("zod").ZodString>;
|
|
221
|
+
}, import("zod/v4/core").$strip>>;
|
|
222
|
+
status: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
223
|
+
statusCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
224
|
+
}, import("zod/v4/core").$strip>>;
|
|
225
|
+
}, import("zod/v4/core").$strip>>;
|
|
226
|
+
entryPoints: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
227
|
+
entryPointType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
228
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
229
|
+
label: import("zod").ZodOptional<import("zod").ZodString>;
|
|
230
|
+
pin: import("zod").ZodOptional<import("zod").ZodString>;
|
|
231
|
+
accessCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
232
|
+
meetingCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
233
|
+
passcode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
234
|
+
password: import("zod").ZodOptional<import("zod").ZodString>;
|
|
235
|
+
}, import("zod/v4/core").$strip>>>;
|
|
236
|
+
conferenceSolution: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
237
|
+
key: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
238
|
+
type: import("zod").ZodOptional<import("zod").ZodString>;
|
|
239
|
+
}, import("zod/v4/core").$strip>>;
|
|
240
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
241
|
+
iconUri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
242
|
+
}, import("zod/v4/core").$strip>>;
|
|
243
|
+
conferenceId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
244
|
+
signature: import("zod").ZodOptional<import("zod").ZodString>;
|
|
245
|
+
notes: import("zod").ZodOptional<import("zod").ZodString>;
|
|
246
|
+
}, import("zod/v4/core").$strip>>;
|
|
247
|
+
attachments: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
248
|
+
fileUrl: import("zod").ZodOptional<import("zod").ZodString>;
|
|
249
|
+
title: import("zod").ZodOptional<import("zod").ZodString>;
|
|
250
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
251
|
+
iconLink: import("zod").ZodOptional<import("zod").ZodString>;
|
|
252
|
+
fileId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
253
|
+
}, import("zod/v4/core").$strip>>>;
|
|
254
|
+
source: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
255
|
+
url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
256
|
+
title: import("zod").ZodOptional<import("zod").ZodString>;
|
|
257
|
+
}, import("zod/v4/core").$strip>>;
|
|
258
|
+
gadget: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
259
|
+
type: import("zod").ZodOptional<import("zod").ZodString>;
|
|
260
|
+
title: import("zod").ZodOptional<import("zod").ZodString>;
|
|
261
|
+
link: import("zod").ZodOptional<import("zod").ZodString>;
|
|
262
|
+
iconLink: import("zod").ZodOptional<import("zod").ZodString>;
|
|
263
|
+
width: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
264
|
+
height: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
265
|
+
display: import("zod").ZodOptional<import("zod").ZodString>;
|
|
266
|
+
preferences: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
267
|
+
}, import("zod/v4/core").$strip>>;
|
|
216
268
|
eventType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
217
269
|
default: "default";
|
|
218
270
|
outOfOffice: "outOfOffice";
|
|
@@ -321,6 +373,58 @@ export declare const googlecalendarEndpointSchemas: {
|
|
|
321
373
|
guestsCanSeeOtherGuests: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
322
374
|
privateCopy: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
323
375
|
locked: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
376
|
+
conferenceData: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
377
|
+
createRequest: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
378
|
+
requestId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
379
|
+
conferenceSolutionKey: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
380
|
+
type: import("zod").ZodOptional<import("zod").ZodString>;
|
|
381
|
+
}, import("zod/v4/core").$strip>>;
|
|
382
|
+
status: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
383
|
+
statusCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
384
|
+
}, import("zod/v4/core").$strip>>;
|
|
385
|
+
}, import("zod/v4/core").$strip>>;
|
|
386
|
+
entryPoints: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
387
|
+
entryPointType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
388
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
389
|
+
label: import("zod").ZodOptional<import("zod").ZodString>;
|
|
390
|
+
pin: import("zod").ZodOptional<import("zod").ZodString>;
|
|
391
|
+
accessCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
392
|
+
meetingCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
393
|
+
passcode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
394
|
+
password: import("zod").ZodOptional<import("zod").ZodString>;
|
|
395
|
+
}, import("zod/v4/core").$strip>>>;
|
|
396
|
+
conferenceSolution: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
397
|
+
key: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
398
|
+
type: import("zod").ZodOptional<import("zod").ZodString>;
|
|
399
|
+
}, import("zod/v4/core").$strip>>;
|
|
400
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
401
|
+
iconUri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
402
|
+
}, import("zod/v4/core").$strip>>;
|
|
403
|
+
conferenceId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
404
|
+
signature: import("zod").ZodOptional<import("zod").ZodString>;
|
|
405
|
+
notes: import("zod").ZodOptional<import("zod").ZodString>;
|
|
406
|
+
}, import("zod/v4/core").$strip>>;
|
|
407
|
+
attachments: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
408
|
+
fileUrl: import("zod").ZodOptional<import("zod").ZodString>;
|
|
409
|
+
title: import("zod").ZodOptional<import("zod").ZodString>;
|
|
410
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
411
|
+
iconLink: import("zod").ZodOptional<import("zod").ZodString>;
|
|
412
|
+
fileId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
413
|
+
}, import("zod/v4/core").$strip>>>;
|
|
414
|
+
source: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
415
|
+
url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
416
|
+
title: import("zod").ZodOptional<import("zod").ZodString>;
|
|
417
|
+
}, import("zod/v4/core").$strip>>;
|
|
418
|
+
gadget: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
419
|
+
type: import("zod").ZodOptional<import("zod").ZodString>;
|
|
420
|
+
title: import("zod").ZodOptional<import("zod").ZodString>;
|
|
421
|
+
link: import("zod").ZodOptional<import("zod").ZodString>;
|
|
422
|
+
iconLink: import("zod").ZodOptional<import("zod").ZodString>;
|
|
423
|
+
width: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
424
|
+
height: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
425
|
+
display: import("zod").ZodOptional<import("zod").ZodString>;
|
|
426
|
+
preferences: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
427
|
+
}, import("zod/v4/core").$strip>>;
|
|
324
428
|
eventType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
325
429
|
default: "default";
|
|
326
430
|
outOfOffice: "outOfOffice";
|
|
@@ -458,6 +562,58 @@ export declare const googlecalendarEndpointSchemas: {
|
|
|
458
562
|
guestsCanSeeOtherGuests: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
459
563
|
privateCopy: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
460
564
|
locked: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
565
|
+
conferenceData: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
566
|
+
createRequest: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
567
|
+
requestId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
568
|
+
conferenceSolutionKey: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
569
|
+
type: import("zod").ZodOptional<import("zod").ZodString>;
|
|
570
|
+
}, import("zod/v4/core").$strip>>;
|
|
571
|
+
status: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
572
|
+
statusCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
573
|
+
}, import("zod/v4/core").$strip>>;
|
|
574
|
+
}, import("zod/v4/core").$strip>>;
|
|
575
|
+
entryPoints: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
576
|
+
entryPointType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
577
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
578
|
+
label: import("zod").ZodOptional<import("zod").ZodString>;
|
|
579
|
+
pin: import("zod").ZodOptional<import("zod").ZodString>;
|
|
580
|
+
accessCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
581
|
+
meetingCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
582
|
+
passcode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
583
|
+
password: import("zod").ZodOptional<import("zod").ZodString>;
|
|
584
|
+
}, import("zod/v4/core").$strip>>>;
|
|
585
|
+
conferenceSolution: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
586
|
+
key: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
587
|
+
type: import("zod").ZodOptional<import("zod").ZodString>;
|
|
588
|
+
}, import("zod/v4/core").$strip>>;
|
|
589
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
590
|
+
iconUri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
591
|
+
}, import("zod/v4/core").$strip>>;
|
|
592
|
+
conferenceId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
593
|
+
signature: import("zod").ZodOptional<import("zod").ZodString>;
|
|
594
|
+
notes: import("zod").ZodOptional<import("zod").ZodString>;
|
|
595
|
+
}, import("zod/v4/core").$strip>>;
|
|
596
|
+
attachments: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
597
|
+
fileUrl: import("zod").ZodOptional<import("zod").ZodString>;
|
|
598
|
+
title: import("zod").ZodOptional<import("zod").ZodString>;
|
|
599
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
600
|
+
iconLink: import("zod").ZodOptional<import("zod").ZodString>;
|
|
601
|
+
fileId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
602
|
+
}, import("zod/v4/core").$strip>>>;
|
|
603
|
+
source: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
604
|
+
url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
605
|
+
title: import("zod").ZodOptional<import("zod").ZodString>;
|
|
606
|
+
}, import("zod/v4/core").$strip>>;
|
|
607
|
+
gadget: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
608
|
+
type: import("zod").ZodOptional<import("zod").ZodString>;
|
|
609
|
+
title: import("zod").ZodOptional<import("zod").ZodString>;
|
|
610
|
+
link: import("zod").ZodOptional<import("zod").ZodString>;
|
|
611
|
+
iconLink: import("zod").ZodOptional<import("zod").ZodString>;
|
|
612
|
+
width: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
613
|
+
height: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
614
|
+
display: import("zod").ZodOptional<import("zod").ZodString>;
|
|
615
|
+
preferences: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
616
|
+
}, import("zod/v4/core").$strip>>;
|
|
461
617
|
eventType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
462
618
|
default: "default";
|
|
463
619
|
outOfOffice: "outOfOffice";
|
|
@@ -652,6 +808,58 @@ export declare const googlecalendarEndpointSchemas: {
|
|
|
652
808
|
guestsCanSeeOtherGuests: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
653
809
|
privateCopy: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
654
810
|
locked: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
811
|
+
conferenceData: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
812
|
+
createRequest: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
813
|
+
requestId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
814
|
+
conferenceSolutionKey: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
815
|
+
type: import("zod").ZodOptional<import("zod").ZodString>;
|
|
816
|
+
}, import("zod/v4/core").$strip>>;
|
|
817
|
+
status: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
818
|
+
statusCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
819
|
+
}, import("zod/v4/core").$strip>>;
|
|
820
|
+
}, import("zod/v4/core").$strip>>;
|
|
821
|
+
entryPoints: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
822
|
+
entryPointType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
823
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
824
|
+
label: import("zod").ZodOptional<import("zod").ZodString>;
|
|
825
|
+
pin: import("zod").ZodOptional<import("zod").ZodString>;
|
|
826
|
+
accessCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
827
|
+
meetingCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
828
|
+
passcode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
829
|
+
password: import("zod").ZodOptional<import("zod").ZodString>;
|
|
830
|
+
}, import("zod/v4/core").$strip>>>;
|
|
831
|
+
conferenceSolution: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
832
|
+
key: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
833
|
+
type: import("zod").ZodOptional<import("zod").ZodString>;
|
|
834
|
+
}, import("zod/v4/core").$strip>>;
|
|
835
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
836
|
+
iconUri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
837
|
+
}, import("zod/v4/core").$strip>>;
|
|
838
|
+
conferenceId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
839
|
+
signature: import("zod").ZodOptional<import("zod").ZodString>;
|
|
840
|
+
notes: import("zod").ZodOptional<import("zod").ZodString>;
|
|
841
|
+
}, import("zod/v4/core").$strip>>;
|
|
842
|
+
attachments: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
843
|
+
fileUrl: import("zod").ZodOptional<import("zod").ZodString>;
|
|
844
|
+
title: import("zod").ZodOptional<import("zod").ZodString>;
|
|
845
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
846
|
+
iconLink: import("zod").ZodOptional<import("zod").ZodString>;
|
|
847
|
+
fileId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
848
|
+
}, import("zod/v4/core").$strip>>>;
|
|
849
|
+
source: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
850
|
+
url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
851
|
+
title: import("zod").ZodOptional<import("zod").ZodString>;
|
|
852
|
+
}, import("zod/v4/core").$strip>>;
|
|
853
|
+
gadget: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
854
|
+
type: import("zod").ZodOptional<import("zod").ZodString>;
|
|
855
|
+
title: import("zod").ZodOptional<import("zod").ZodString>;
|
|
856
|
+
link: import("zod").ZodOptional<import("zod").ZodString>;
|
|
857
|
+
iconLink: import("zod").ZodOptional<import("zod").ZodString>;
|
|
858
|
+
width: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
859
|
+
height: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
860
|
+
display: import("zod").ZodOptional<import("zod").ZodString>;
|
|
861
|
+
preferences: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
862
|
+
}, import("zod/v4/core").$strip>>;
|
|
655
863
|
eventType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
656
864
|
default: "default";
|
|
657
865
|
outOfOffice: "outOfOffice";
|
|
@@ -742,6 +950,11 @@ export type GoogleCalendarPluginOptions = {
|
|
|
742
950
|
};
|
|
743
951
|
export type GoogleCalendarKeyBuilderContext = KeyBuilderContext<GoogleCalendarPluginOptions>;
|
|
744
952
|
declare const defaultAuthType: "oauth_2";
|
|
953
|
+
export declare const googleCalendarAuthConfig: {
|
|
954
|
+
readonly oauth_2: {
|
|
955
|
+
readonly account: readonly ["channel_id"];
|
|
956
|
+
};
|
|
957
|
+
};
|
|
745
958
|
export type BaseGoogleCalendarPlugin<T extends GoogleCalendarPluginOptions> = CorsairPlugin<'googlecalendar', typeof GoogleCalendarSchema, typeof googleCalendarEndpointsNested, typeof googleCalendarWebhooksNested, T, typeof defaultAuthType>;
|
|
746
959
|
export type InternalGoogleCalendarPlugin = BaseGoogleCalendarPlugin<GoogleCalendarPluginOptions>;
|
|
747
960
|
export type ExternalGoogleCalendarPlugin<T extends GoogleCalendarPluginOptions> = BaseGoogleCalendarPlugin<T>;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,aAAa,EACb,YAAY,EACZ,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"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"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AuthMissingError as Y}from"corsair/core";import{request as Q}from"corsair/http";var k=class extends Error{constructor(a,r){super(a);this.code=r;this.name="GoogleCalendarAPIError"}},X="https://www.googleapis.com/calendar/v3";async function ee(t,n,a){let r=await fetch("https://oauth2.googleapis.com/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:t,client_secret:n,refresh_token:a,grant_type:"refresh_token"})});if(!r.ok){let c=await r.text();throw new k(`Failed to refresh access token: ${c}`,r.status)}return await r.json()}async function w({accessToken:t,expiresAt:n,clientId:a,clientSecret:r,refreshToken:s,forceRefresh:c=!1}){let d=Math.floor(Date.now()/1e3);if(!c&&t&&n&&Number(n)>d+300)return{accessToken:t,expiresAt:Number(n),refreshed:!1};let p=await ee(a,r,s);return{accessToken:p.access_token,expiresAt:d+p.expires_in,refreshed:!0}}async function E(t,n,a={}){let{method:r="GET",body:s,query:c}=a;return await Q({BASE:X,VERSION:"1.0.0",WITH_CREDENTIALS:!1,CREDENTIALS:"omit",TOKEN:n,HEADERS:{"Content-Type":"application/json"}},{method:r,url:t,body:r==="POST"||r==="PUT"||r==="PATCH"?s:void 0,mediaType:"application/json",query:c})}function te(t){return t instanceof Error&&"status"in t&&t.status===401}async function u(t,n,a={}){try{return await E(t,n.key,a)}catch(r){if(te(r)&&n._refreshAuth){let s=await n._refreshAuth();return await E(t,s,a)}throw r}}import{logEventFromContext as ne}from"corsair/core";var I=async(t,n)=>{let a=await u("/freeBusy",t,{method:"POST",body:{timeMin:n.timeMin,timeMax:n.timeMax,timeZone:n.timeZone,groupExpansionMax:n.groupExpansionMax,calendarExpansionMax:n.calendarExpansionMax,items:n.items}});return await ne(t,"googlecalendar.calendar.getAvailability",{...n},"completed"),a};import{logEventFromContext as C}from"corsair/core";var A=async(t,n)=>{let a=n.calendarId||"primary",r=await u(`/calendars/${a}/events`,t,{method:"POST",body:n.event});if(r.id&&t.db.events)try{await t.db.events.upsertByEntityId(r.id,{...r,id:r.id,calendarId:a,createdAt:new Date})}catch(s){console.warn("Failed to save event to database:",s)}return await C(t,"googlecalendar.events.create",{...n},"completed"),r},P=async(t,n)=>{let a=n.calendarId||"primary",r=await u(`/calendars/${a}/events/${n.id}`,t,{method:"GET",query:{timeZone:n.timeZone,maxAttendees:n.maxAttendees}});if(r.id&&t.db.events)try{await t.db.events.upsertByEntityId(r.id,{...r,id:r.id,calendarId:a,createdAt:new Date})}catch(s){console.warn("Failed to save event to database:",s)}return await C(t,"googlecalendar.events.get",{...n},"completed"),r},D=async(t,n)=>{let a=n.calendarId||"primary",r=await u(`/calendars/${a}/events`,t,{method:"GET",query:n});if(r.items&&t.db.events)try{for(let s of r.items)s.id&&await t.db.events.upsertByEntityId(s.id,{...s,id:s.id,calendarId:a,createdAt:new Date})}catch(s){console.warn("Failed to save events to database:",s)}return await C(t,"googlecalendar.events.getMany",{...n},"completed"),r},O=async(t,n)=>{let a=n.calendarId||"primary",r=await u(`/calendars/${a}/events/${n.id}`,t,{method:"PUT",body:n.event,query:{sendUpdates:n.sendUpdates,sendNotifications:n.sendNotifications,conferenceDataVersion:n.conferenceDataVersion,maxAttendees:n.maxAttendees,supportsAttachments:n.supportsAttachments}});if(r.id&&t.db.events)try{await t.db.events.upsertByEntityId(r.id,{...r,id:r.id,calendarId:a,createdAt:new Date})}catch(s){console.warn("Failed to save event to database:",s)}return await C(t,"googlecalendar.events.update",{...n},"completed"),r},M=async(t,n)=>{let a=n.calendarId||"primary";if(await u(`/calendars/${a}/events/${n.id}`,t,{method:"DELETE",query:{sendUpdates:n.sendUpdates,sendNotifications:n.sendNotifications}}),t.db.events)try{await t.db.events.deleteByEntityId(n.id)}catch(r){console.warn("Failed to delete event from database:",r)}await C(t,"googlecalendar.events.delete",{...n},"completed")};import{z as e}from"zod";var y=e.object({date:e.string().optional().describe('All-day event date in "YYYY-MM-DD" format'),dateTime:e.string().optional().describe('RFC 3339 timestamp, e.g. "2024-12-25T10:00:00-07:00". Required for timed events.'),timeZone:e.string().optional().describe('IANA time zone name, e.g. "America/New_York"')}),N=e.object({id:e.string().optional(),email:e.string().optional().describe("Attendee's email address. Required when adding an attendee."),displayName:e.string().optional(),organizer:e.boolean().optional(),self:e.boolean().optional(),resource:e.boolean().optional(),optional:e.boolean().optional(),responseStatus:e.enum(["needsAction","declined","tentative","accepted"]).optional(),comment:e.string().optional(),additionalGuests:e.number().optional()}),R=e.object({id:e.string().optional(),email:e.string().optional(),displayName:e.string().optional(),self:e.boolean().optional()}),U=e.object({method:e.enum(["email","popup"]).optional(),minutes:e.number().optional()}),_=e.object({useDefault:e.boolean().optional().describe("Use the calendar default reminders"),overrides:e.array(U).optional().describe("Custom reminders. Only used when useDefault is false.")}),W=e.object({summary:e.string().optional().describe("Title of the event"),description:e.string().optional().describe("Description of the event. HTML is supported."),location:e.string().optional().describe("Geographic location of the event as free-form text"),start:y.optional().describe('Start time. Use "date" for all-day events, "dateTime" for timed events.'),end:y.optional().describe('End time. Use "date" for all-day events, "dateTime" for timed events.'),attendees:e.array(N).optional().describe("List of attendees. Each attendee must include an email."),recurrence:e.array(e.string()).optional().describe('RRULE / EXDATE lines per RFC 5545, e.g. ["RRULE:FREQ=WEEKLY;COUNT=5"]'),colorId:e.string().optional().describe("Color ID (1\u201311). Use the colors endpoint to see options."),transparency:e.enum(["opaque","transparent"]).optional().describe('"opaque" blocks time on the calendar (default); "transparent" does not'),visibility:e.enum(["default","public","private","confidential"]).optional(),eventType:e.enum(["default","outOfOffice","focusTime","workingLocation","birthday","fromGmail"]).optional(),status:e.enum(["confirmed","tentative","cancelled"]).optional(),reminders:_.optional(),guestsCanModify:e.boolean().optional(),guestsCanInviteOthers:e.boolean().optional(),guestsCanSeeOtherGuests:e.boolean().optional(),anyoneCanAddSelf:e.boolean().optional(),sequence:e.number().optional().describe("Sequence number for recurring event updates"),originalStartTime:y.optional().describe("Original start time for a recurring event instance"),recurringEventId:e.string().optional().describe("ID of the recurring event this instance belongs to")}),re=e.object({calendarId:e.string().optional().describe('Calendar ID. Defaults to "primary".'),event:W.describe('Event body. Provide at minimum "summary", "start", and "end".'),sendUpdates:e.enum(["all","externalOnly","none"]).optional(),sendNotifications:e.boolean().optional(),conferenceDataVersion:e.number().optional(),maxAttendees:e.number().optional(),supportsAttachments:e.boolean().optional()}),ie=e.object({calendarId:e.string().optional(),id:e.string(),timeZone:e.string().optional(),maxAttendees:e.number().optional()}),se=e.object({calendarId:e.string().optional(),timeMin:e.string().optional(),timeMax:e.string().optional(),timeZone:e.string().optional(),updatedMin:e.string().optional(),singleEvents:e.boolean().optional(),maxResults:e.number().optional(),pageToken:e.string().optional(),q:e.string().optional(),orderBy:e.enum(["startTime","updated"]).optional(),iCalUID:e.string().optional(),showDeleted:e.boolean().optional(),showHiddenInvitations:e.boolean().optional()}),le=e.object({calendarId:e.string().optional().describe('Calendar ID. Defaults to "primary".'),id:e.string().describe("Event ID to update"),event:W.describe("Updated event fields"),sendUpdates:e.enum(["all","externalOnly","none"]).optional(),sendNotifications:e.boolean().optional(),conferenceDataVersion:e.number().optional(),maxAttendees:e.number().optional(),supportsAttachments:e.boolean().optional()}),de=e.object({calendarId:e.string().optional(),id:e.string(),sendUpdates:e.enum(["all","externalOnly","none"]).optional(),sendNotifications:e.boolean().optional()}),pe=e.object({timeMin:e.string(),timeMax:e.string(),timeZone:e.string().optional(),groupExpansionMax:e.number().optional(),calendarExpansionMax:e.number().optional(),items:e.array(e.object({id:e.string()})).optional()}),m={eventsCreate:re,eventsGet:ie,eventsGetMany:se,eventsUpdate:le,eventsDelete:de,calendarGetAvailability:pe},G=e.object({id:e.string().optional(),status:e.enum(["confirmed","tentative","cancelled"]).optional(),htmlLink:e.string().optional(),created:e.string().optional(),updated:e.string().optional(),summary:e.string().optional(),description:e.string().optional(),location:e.string().optional(),colorId:e.string().optional(),creator:R.optional(),organizer:R.optional(),start:y.optional(),end:y.optional(),endTimeUnspecified:e.boolean().optional(),recurrence:e.array(e.string()).optional(),recurringEventId:e.string().optional(),originalStartTime:y.optional(),transparency:e.enum(["opaque","transparent"]).optional(),visibility:e.enum(["default","public","private","confidential"]).optional(),iCalUID:e.string().optional(),sequence:e.number().optional(),attendees:e.array(N).optional(),attendeesOmitted:e.boolean().optional(),hangoutLink:e.string().optional(),reminders:_.optional(),anyoneCanAddSelf:e.boolean().optional(),guestsCanInviteOthers:e.boolean().optional(),guestsCanModify:e.boolean().optional(),guestsCanSeeOtherGuests:e.boolean().optional(),privateCopy:e.boolean().optional(),locked:e.boolean().optional(),eventType:e.enum(["default","outOfOffice","focusTime","workingLocation","birthday","fromGmail"]).optional()}),ce=e.object({kind:e.string().optional(),etag:e.string().optional(),summary:e.string().optional(),description:e.string().optional(),updated:e.string().optional(),timeZone:e.string().optional(),accessRole:e.string().optional(),defaultReminders:e.array(U).optional(),nextPageToken:e.string().optional(),nextSyncToken:e.string().optional(),items:e.array(G).optional()}),ue=e.object({busy:e.array(e.object({start:e.string().optional(),end:e.string().optional()})).optional(),errors:e.array(e.object({domain:e.string().optional(),reason:e.string().optional()})).optional()}),ge=e.object({kind:e.string().optional(),calendars:e.record(e.string(),ue).optional(),groups:e.record(e.string(),e.object({calendars:e.array(e.string()).optional(),errors:e.array(e.object({domain:e.string().optional(),reason:e.string().optional()})).optional()})).optional(),timeMin:e.string().optional(),timeMax:e.string().optional()}),v={eventsCreate:G,eventsGet:G,eventsGetMany:ce,eventsUpdate:G,eventsDelete:e.void(),calendarGetAvailability:ge};var b={create:A,get:P,getMany:D,update:O,delete:M},j={getAvailability:I};import{z as o}from"zod";var S=o.object({date:o.string().optional(),dateTime:o.string().optional(),timeZone:o.string().optional()}),me=o.object({id:o.string().optional(),email:o.string().optional(),displayName:o.string().optional(),organizer:o.boolean().optional(),self:o.boolean().optional(),resource:o.boolean().optional(),optional:o.boolean().optional(),responseStatus:o.enum(["needsAction","declined","tentative","accepted"]).optional(),comment:o.string().optional(),additionalGuests:o.number().optional()}),q=o.object({id:o.string().optional(),email:o.string().optional(),displayName:o.string().optional(),self:o.boolean().optional()}),ve=o.object({method:o.enum(["email","popup"]).optional(),minutes:o.number().optional()}),fe=o.object({useDefault:o.boolean().optional(),overrides:o.array(ve).optional()}),B=o.object({id:o.string(),status:o.enum(["confirmed","tentative","cancelled"]).optional(),htmlLink:o.string().optional(),created:o.string().optional(),updated:o.string().optional(),summary:o.string().optional(),description:o.string().optional(),location:o.string().optional(),colorId:o.string().optional(),creator:q.optional(),organizer:q.optional(),start:S.optional(),end:S.optional(),endTimeUnspecified:o.boolean().optional(),recurrence:o.array(o.string()).optional(),recurringEventId:o.string().optional(),originalStartTime:S.optional(),transparency:o.enum(["opaque","transparent"]).optional(),visibility:o.enum(["default","public","private","confidential"]).optional(),iCalUID:o.string().optional(),sequence:o.number().optional(),attendees:o.array(me).optional(),attendeesOmitted:o.boolean().optional(),hangoutLink:o.string().optional(),reminders:fe.optional(),anyoneCanAddSelf:o.boolean().optional(),guestsCanInviteOthers:o.boolean().optional(),guestsCanModify:o.boolean().optional(),guestsCanSeeOtherGuests:o.boolean().optional(),privateCopy:o.boolean().optional(),locked:o.boolean().optional(),eventType:o.enum(["default","outOfOffice","focusTime","workingLocation","birthday","fromGmail"]).optional(),calendarId:o.string().optional(),createdAt:o.coerce.date().optional()}),L=o.object({id:o.string(),summary:o.string().optional(),description:o.string().optional(),location:o.string().optional(),timeZone:o.string().optional(),createdAt:o.coerce.date().optional()});var z={version:"1.0.0",entities:{events:B,calendars:L}};import{logEventFromContext as x}from"corsair/core";import{z as i}from"zod";var ye=i.object({data:i.string().optional(),attributes:i.record(i.string(),i.string()).optional(),messageId:i.string().optional(),publishTime:i.string().optional()}),F=i.object({message:ye.optional(),subscription:i.string().optional(),event:i.unknown().optional()}),Je=i.object({resourceId:i.string().optional(),resourceState:i.string().optional(),resourceUri:i.string().optional(),channelId:i.string().optional(),channelExpiration:i.string().optional(),channelToken:i.string().optional(),changed:i.string().optional()}),be=i.object({type:i.literal("eventCreated"),calendarId:i.string(),event:i.custom(),timestamp:i.string()}),he=i.object({type:i.literal("eventUpdated"),calendarId:i.string(),event:i.custom(),timestamp:i.string()}),Ee=i.object({type:i.literal("eventDeleted"),calendarId:i.string(),eventId:i.string(),timestamp:i.string()}),K=i.union([be,he,Ee]);function h(t){let n=Buffer.from(t,"base64").toString("utf-8");return JSON.parse(n)}function T(t){return n=>{let a=n.body;if(!a.message?.data)return!1;try{let r=h(a.message.data);return!!r.channelId&&!!r.resourceId&&!!r.resourceUri&&r.resourceUri.includes("/calendar/")}catch{return!1}}}var Ce=/\/calendars\/([^\/\?]+)/,Ge=/\/calendars\/[^\/]+\/events\/([^\/\?]+)/,ke=120*1e3,we=5e3;function Se(t){return{calendarId:t.match(Ce)?.[1],eventId:t.match(Ge)?.[1]}}function Te(t){return!t.created||!t.updated?!1:Math.abs(new Date(t.updated).getTime()-new Date(t.created).getTime())<we}function xe(t,n,a){return E(`/calendars/${n}/events/${a}`,t,{method:"GET"})}async function H(t,n){let a=new Date(Date.now()-ke).toISOString();return(await E(`/calendars/${n}/events`,t,{method:"GET",query:{maxResults:10,orderBy:"updated",updatedMin:a,showDeleted:!0}})).items??[]}async function Ie(t,n,a){return a?xe(t,n,a):(await H(t,n)).at(-1)??null}async function Ae(t,n,a,r){return a||((await H(t,n)).find(d=>d.status==="cancelled")?.id??r.resourceId??"")}async function $(t,n,a){a&&t.db.events&&await t.db.events.deleteByEntityId(a);let r={type:"eventDeleted",calendarId:n,eventId:a,timestamp:new Date().toISOString()};return await x(t,"googlecalendar.webhook.eventDeleted",{...r},"completed"),{eventData:r}}var V={match:T("eventChanged"),handler:async(t,n)=>{let a=n.payload;if(!a.message?.data)return{success:!1,error:"No message data in notification"};let r=h(a.message.data);if(!r.resourceUri)return{success:!1,error:"Invalid push notification format"};let{calendarId:s,eventId:c}=Se(r.resourceUri);if(!s)return{success:!1,error:"Could not parse calendar ID from resource URI"};let d=t.key;try{if(r.resourceState==="not_exists"){let g=await Ae(d,s,c,r),{eventData:J}=await $(t,s,g);return{success:!0,data:J}}let l=await Ie(d,s,c);if(!l)return{success:!1,error:"No recently updated events found in calendar"};if(l.status==="cancelled"){let{eventData:g}=await $(t,s,l.id??"");return{success:!0,data:g}}let p="";if(l.id&&t.db.events&&(p=(await t.db.events.upsertByEntityId(l.id,{...l,id:l.id,calendarId:s,createdAt:new Date}))?.id??""),Te(l)){let g={type:"eventCreated",calendarId:s,event:l,timestamp:new Date().toISOString()};return await x(t,"googlecalendar.webhook.eventCreated",{...g},"completed"),{success:!0,corsairEntityId:p,data:g}}let f={type:"eventUpdated",calendarId:s,event:l,timestamp:new Date().toISOString()};return await x(t,"googlecalendar.webhook.eventUpdated",{...f},"completed"),{success:!0,corsairEntityId:p,data:f}}catch(l){return console.error("Failed to process webhook:",l),{success:!1,error:`Failed to process event: ${l instanceof Error?l.message:"Unknown error"}`}}}};var Z={onEventChanged:V};var Pe={events:{create:b.create,get:b.get,getMany:b.getMany,update:b.update,delete:b.delete},calendar:{getAvailability:j.getAvailability}},De={"events.create":{input:m.eventsCreate,output:v.eventsCreate},"events.get":{input:m.eventsGet,output:v.eventsGet},"events.getMany":{input:m.eventsGetMany,output:v.eventsGetMany},"events.update":{input:m.eventsUpdate,output:v.eventsUpdate},"events.delete":{input:m.eventsDelete,output:v.eventsDelete},"calendar.getAvailability":{input:m.calendarGetAvailability,output:v.calendarGetAvailability}},Oe={onEventChanged:Z.onEventChanged},Me={onEventChanged:{description:"A Google Calendar event was created, updated, or deleted",payload:F,response:K}},Re="oauth_2",Ne={"events.create":{riskLevel:"write",description:"Create a new calendar event"},"events.get":{riskLevel:"read",description:"Get a specific calendar event"},"events.getMany":{riskLevel:"read",description:"List calendar events"},"events.update":{riskLevel:"write",description:"Update an existing calendar event"},"events.delete":{riskLevel:"destructive",description:"Delete a calendar event [DESTRUCTIVE]"},"calendar.getAvailability":{riskLevel:"read",description:"Get free/busy availability for a calendar"}};function gt(t={}){let n={...t,authType:t.authType??Re};return{id:"googlecalendar",schema:z,options:n,oauthConfig:{providerName:"Google",authUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",scopes:["https://www.googleapis.com/auth/calendar"],authParams:{access_type:"offline",prompt:"consent"}},hooks:n.hooks,webhookHooks:n.webhookHooks,endpoints:Pe,webhooks:Oe,endpointMeta:Ne,endpointSchemas:De,webhookSchemas:Me,keyBuilder:async a=>{let r=a.authType;if(n.key)return n.key;if(a.authType==="oauth_2"){let[s,c,d]=await Promise.all([a.keys.get_access_token(),a.keys.get_expires_at(),a.keys.get_refresh_token()]);if(!d)throw new Y("googlecalendar","oauth_2");let l=await a.keys.get_integration_credentials();if(!l.client_id||!l.client_secret)throw new Error("[corsair:googlecalendar] No client id or client secret");try{let p=await w({accessToken:s,expiresAt:c,refreshToken:d,clientId:l.client_id,clientSecret:l.client_secret});return p.refreshed&&await Promise.all([a.keys.set_access_token(p.accessToken),a.keys.set_expires_at(String(p.expiresAt))]),a._refreshAuth=async()=>{let f=await w({accessToken:null,expiresAt:null,refreshToken:d,clientId:l.client_id,clientSecret:l.client_secret,forceRefresh:!0});return await a.keys.set_access_token(f.accessToken),await a.keys.set_expires_at(String(f.expiresAt)),f.accessToken},p.accessToken}catch(p){throw console.error("[corsair:googlecalendar] Failed to get valid access token:",p),p}}throw new Y("googlecalendar","oauth_2")},pluginWebhookMatcher:a=>{let r=a.headers;if(!(r.from==="noreply@google.com"||typeof r["user-agent"]=="string"&&r["user-agent"].includes("APIs-Google")))return!1;let c=a.body;if(!c?.message?.data)return!1;try{let d=h(c.message.data);return!!d.resourceUri&&d.resourceUri.includes("calendar")}catch{return!1}}}}export{T as createGoogleCalendarWebhookMatcher,h as decodePubSubMessage,gt as googlecalendar,De as googlecalendarEndpointSchemas};
|
|
1
|
+
import{AuthMissingError as Ne,getOAuthAccessToken as We}from"corsair/core";import{logEventFromContext as te}from"corsair/core";import{request as Q}from"corsair/http";var X="https://www.googleapis.com/calendar/v3";async function h(t,o,i={}){let{method:a="GET",body:s,query:d}=i;return await Q({BASE:X,VERSION:"1.0.0",WITH_CREDENTIALS:!1,CREDENTIALS:"omit",TOKEN:o,HEADERS:{"Content-Type":"application/json"}},{method:a,url:t,body:a==="POST"||a==="PUT"||a==="PATCH"?s:void 0,mediaType:"application/json",query:d})}function ee(t){return t instanceof Error&&"status"in t&&t.status===401}async function c(t,o,i={}){try{return await h(t,o.key,i)}catch(a){if(ee(a)&&o._refreshAuth){let s=await o._refreshAuth();return await h(t,s,i)}throw a}}var T=async(t,o)=>{let i=await c("/freeBusy",t,{method:"POST",body:{timeMin:o.timeMin,timeMax:o.timeMax,timeZone:o.timeZone,groupExpansionMax:o.groupExpansionMax,calendarExpansionMax:o.calendarExpansionMax,items:o.items}});return await te(t,"googlecalendar.calendar.getAvailability",{...o},"completed"),i};import{logEventFromContext as f}from"corsair/core";var I=async(t,o)=>{let i=o.calendarId||"primary",a=await c(`/calendars/${i}/events`,t,{method:"POST",body:o.event});if(a.id&&t.db.events)try{await t.db.events.upsertByEntityId(a.id,{...a,id:a.id,calendarId:i,createdAt:new Date})}catch(s){console.warn("Failed to save event to database:",s)}return await f(t,"googlecalendar.events.create",{...o},"completed"),a},x=async(t,o)=>{let i=o.calendarId||"primary",a=await c(`/calendars/${i}/events/${o.id}`,t,{method:"GET",query:{timeZone:o.timeZone,maxAttendees:o.maxAttendees}});if(a.id&&t.db.events)try{await t.db.events.upsertByEntityId(a.id,{...a,id:a.id,calendarId:i,createdAt:new Date})}catch(s){console.warn("Failed to save event to database:",s)}return await f(t,"googlecalendar.events.get",{...o},"completed"),a},P=async(t,o)=>{let i=o.calendarId||"primary",a=await c(`/calendars/${i}/events`,t,{method:"GET",query:o});if(a.items&&t.db.events)try{for(let s of a.items)s.id&&await t.db.events.upsertByEntityId(s.id,{...s,id:s.id,calendarId:i,createdAt:new Date})}catch(s){console.warn("Failed to save events to database:",s)}return await f(t,"googlecalendar.events.getMany",{...o},"completed"),a},A=async(t,o)=>{let i=o.calendarId||"primary",a=await c(`/calendars/${i}/events/${o.id}`,t,{method:"PUT",body:o.event,query:{sendUpdates:o.sendUpdates,sendNotifications:o.sendNotifications,conferenceDataVersion:o.conferenceDataVersion,maxAttendees:o.maxAttendees,supportsAttachments:o.supportsAttachments}});if(a.id&&t.db.events)try{await t.db.events.upsertByEntityId(a.id,{...a,id:a.id,calendarId:i,createdAt:new Date})}catch(s){console.warn("Failed to save event to database:",s)}return await f(t,"googlecalendar.events.update",{...o},"completed"),a},D=async(t,o)=>{let i=o.calendarId||"primary";if(await c(`/calendars/${i}/events/${o.id}`,t,{method:"DELETE",query:{sendUpdates:o.sendUpdates,sendNotifications:o.sendNotifications}}),t.db.events)try{await t.db.events.deleteByEntityId(o.id)}catch(a){console.warn("Failed to delete event from database:",a)}await f(t,"googlecalendar.events.delete",{...o},"completed")};import{z as e}from"zod";var v=e.object({date:e.string().optional().describe('All-day event date in "YYYY-MM-DD" format'),dateTime:e.string().optional().describe('RFC 3339 timestamp, e.g. "2024-12-25T10:00:00-07:00". Required for timed events.'),timeZone:e.string().optional().describe('IANA time zone name, e.g. "America/New_York"')}),M=e.object({id:e.string().optional(),email:e.string().optional().describe("Attendee's email address. Required when adding an attendee."),displayName:e.string().optional(),organizer:e.boolean().optional(),self:e.boolean().optional(),resource:e.boolean().optional(),optional:e.boolean().optional(),responseStatus:e.enum(["needsAction","declined","tentative","accepted"]).optional(),comment:e.string().optional(),additionalGuests:e.number().optional()}),O=e.object({id:e.string().optional(),email:e.string().optional(),displayName:e.string().optional(),self:e.boolean().optional()}),R=e.object({method:e.enum(["email","popup"]).optional(),minutes:e.number().optional()}),U=e.object({useDefault:e.boolean().optional().describe("Use the calendar default reminders"),overrides:e.array(R).optional().describe("Custom reminders. Only used when useDefault is false.")}),ae=e.object({fileUrl:e.string().optional(),title:e.string().optional(),mimeType:e.string().optional(),iconLink:e.string().optional(),fileId:e.string().optional()}),ie=e.object({createRequest:e.object({requestId:e.string().optional(),conferenceSolutionKey:e.object({type:e.string().optional()}).optional(),status:e.object({statusCode:e.string().optional()}).optional()}).optional(),entryPoints:e.array(e.object({entryPointType:e.string().optional(),uri:e.string().optional(),label:e.string().optional(),pin:e.string().optional(),accessCode:e.string().optional(),meetingCode:e.string().optional(),passcode:e.string().optional(),password:e.string().optional()})).optional(),conferenceSolution:e.object({key:e.object({type:e.string().optional()}).optional(),name:e.string().optional(),iconUri:e.string().optional()}).optional(),conferenceId:e.string().optional(),signature:e.string().optional(),notes:e.string().optional()}),N=e.object({summary:e.string().optional().describe("Title of the event"),description:e.string().optional().describe("Description of the event. HTML is supported."),location:e.string().optional().describe("Geographic location of the event as free-form text"),start:v.optional().describe('Start time. Use "date" for all-day events, "dateTime" for timed events.'),end:v.optional().describe('End time. Use "date" for all-day events, "dateTime" for timed events.'),attendees:e.array(M).optional().describe("List of attendees. Each attendee must include an email."),recurrence:e.array(e.string()).optional().describe('RRULE / EXDATE lines per RFC 5545, e.g. ["RRULE:FREQ=WEEKLY;COUNT=5"]'),colorId:e.string().optional().describe("Color ID (1\u201311). Use the colors endpoint to see options."),transparency:e.enum(["opaque","transparent"]).optional().describe('"opaque" blocks time on the calendar (default); "transparent" does not'),visibility:e.enum(["default","public","private","confidential"]).optional(),eventType:e.enum(["default","outOfOffice","focusTime","workingLocation","birthday","fromGmail"]).optional(),status:e.enum(["confirmed","tentative","cancelled"]).optional(),reminders:U.optional(),guestsCanModify:e.boolean().optional(),guestsCanInviteOthers:e.boolean().optional(),guestsCanSeeOtherGuests:e.boolean().optional(),anyoneCanAddSelf:e.boolean().optional(),sequence:e.number().optional().describe("Sequence number for recurring event updates"),originalStartTime:v.optional().describe("Original start time for a recurring event instance"),recurringEventId:e.string().optional().describe("ID of the recurring event this instance belongs to")}),re=e.object({calendarId:e.string().optional().describe('Calendar ID. Defaults to "primary".'),event:N.describe('Event body. Provide at minimum "summary", "start", and "end".'),sendUpdates:e.enum(["all","externalOnly","none"]).optional(),sendNotifications:e.boolean().optional(),conferenceDataVersion:e.number().optional(),maxAttendees:e.number().optional(),supportsAttachments:e.boolean().optional()}),se=e.object({calendarId:e.string().optional(),id:e.string(),timeZone:e.string().optional(),maxAttendees:e.number().optional()}),le=e.object({calendarId:e.string().optional(),timeMin:e.string().optional(),timeMax:e.string().optional(),timeZone:e.string().optional(),updatedMin:e.string().optional(),singleEvents:e.boolean().optional(),maxResults:e.number().optional(),pageToken:e.string().optional(),q:e.string().optional(),orderBy:e.enum(["startTime","updated"]).optional(),iCalUID:e.string().optional(),showDeleted:e.boolean().optional(),showHiddenInvitations:e.boolean().optional()}),de=e.object({calendarId:e.string().optional().describe('Calendar ID. Defaults to "primary".'),id:e.string().describe("Event ID to update"),event:N.describe("Updated event fields"),sendUpdates:e.enum(["all","externalOnly","none"]).optional(),sendNotifications:e.boolean().optional(),conferenceDataVersion:e.number().optional(),maxAttendees:e.number().optional(),supportsAttachments:e.boolean().optional()}),pe=e.object({calendarId:e.string().optional(),id:e.string(),sendUpdates:e.enum(["all","externalOnly","none"]).optional(),sendNotifications:e.boolean().optional()}),ce=e.object({timeMin:e.string(),timeMax:e.string(),timeZone:e.string().optional(),groupExpansionMax:e.number().optional(),calendarExpansionMax:e.number().optional(),items:e.array(e.object({id:e.string()})).optional()}),u={eventsCreate:re,eventsGet:se,eventsGetMany:le,eventsUpdate:de,eventsDelete:pe,calendarGetAvailability:ce},C=e.object({id:e.string().optional(),status:e.enum(["confirmed","tentative","cancelled"]).optional(),htmlLink:e.string().optional(),created:e.string().optional(),updated:e.string().optional(),summary:e.string().optional(),description:e.string().optional(),location:e.string().optional(),colorId:e.string().optional(),creator:O.optional(),organizer:O.optional(),start:v.optional(),end:v.optional(),endTimeUnspecified:e.boolean().optional(),recurrence:e.array(e.string()).optional(),recurringEventId:e.string().optional(),originalStartTime:v.optional(),transparency:e.enum(["opaque","transparent"]).optional(),visibility:e.enum(["default","public","private","confidential"]).optional(),iCalUID:e.string().optional(),sequence:e.number().optional(),attendees:e.array(M).optional(),attendeesOmitted:e.boolean().optional(),hangoutLink:e.string().optional(),reminders:U.optional(),anyoneCanAddSelf:e.boolean().optional(),guestsCanInviteOthers:e.boolean().optional(),guestsCanModify:e.boolean().optional(),guestsCanSeeOtherGuests:e.boolean().optional(),privateCopy:e.boolean().optional(),locked:e.boolean().optional(),conferenceData:ie.optional(),attachments:e.array(ae).optional(),source:e.object({url:e.string().optional(),title:e.string().optional()}).optional(),gadget:e.object({type:e.string().optional(),title:e.string().optional(),link:e.string().optional(),iconLink:e.string().optional(),width:e.number().optional(),height:e.number().optional(),display:e.string().optional(),preferences:e.record(e.string(),e.string()).optional()}).optional(),eventType:e.enum(["default","outOfOffice","focusTime","workingLocation","birthday","fromGmail"]).optional()}),ge=e.object({kind:e.string().optional(),etag:e.string().optional(),summary:e.string().optional(),description:e.string().optional(),updated:e.string().optional(),timeZone:e.string().optional(),accessRole:e.string().optional(),defaultReminders:e.array(R).optional(),nextPageToken:e.string().optional(),nextSyncToken:e.string().optional(),items:e.array(C).optional()}),ue=e.object({busy:e.array(e.object({start:e.string().optional(),end:e.string().optional()})).optional(),errors:e.array(e.object({domain:e.string().optional(),reason:e.string().optional()})).optional()}),me=e.object({kind:e.string().optional(),calendars:e.record(e.string(),ue).optional(),groups:e.record(e.string(),e.object({calendars:e.array(e.string()).optional(),errors:e.array(e.object({domain:e.string().optional(),reason:e.string().optional()})).optional()})).optional(),timeMin:e.string().optional(),timeMax:e.string().optional()}),m={eventsCreate:C,eventsGet:C,eventsGetMany:ge,eventsUpdate:C,eventsDelete:e.void(),calendarGetAvailability:me};var b={create:I,get:x,getMany:P,update:A,delete:D},W={getAvailability:T};import{z as n}from"zod";var G=n.object({date:n.string().optional(),dateTime:n.string().optional(),timeZone:n.string().optional()}),ve=n.object({id:n.string().optional(),email:n.string().optional(),displayName:n.string().optional(),organizer:n.boolean().optional(),self:n.boolean().optional(),resource:n.boolean().optional(),optional:n.boolean().optional(),responseStatus:n.enum(["needsAction","declined","tentative","accepted"]).optional(),comment:n.string().optional(),additionalGuests:n.number().optional()}),j=n.object({id:n.string().optional(),email:n.string().optional(),displayName:n.string().optional(),self:n.boolean().optional()}),be=n.object({method:n.enum(["email","popup"]).optional(),minutes:n.number().optional()}),ye=n.object({useDefault:n.boolean().optional(),overrides:n.array(be).optional()}),q=n.object({id:n.string(),status:n.enum(["confirmed","tentative","cancelled"]).optional(),htmlLink:n.string().optional(),created:n.string().optional(),updated:n.string().optional(),summary:n.string().optional(),description:n.string().optional(),location:n.string().optional(),colorId:n.string().optional(),creator:j.optional(),organizer:j.optional(),start:G.optional(),end:G.optional(),endTimeUnspecified:n.boolean().optional(),recurrence:n.array(n.string()).optional(),recurringEventId:n.string().optional(),originalStartTime:G.optional(),transparency:n.enum(["opaque","transparent"]).optional(),visibility:n.enum(["default","public","private","confidential"]).optional(),iCalUID:n.string().optional(),sequence:n.number().optional(),attendees:n.array(ve).optional(),attendeesOmitted:n.boolean().optional(),hangoutLink:n.string().optional(),reminders:ye.optional(),anyoneCanAddSelf:n.boolean().optional(),guestsCanInviteOthers:n.boolean().optional(),guestsCanModify:n.boolean().optional(),guestsCanSeeOtherGuests:n.boolean().optional(),privateCopy:n.boolean().optional(),locked:n.boolean().optional(),eventType:n.enum(["default","outOfOffice","focusTime","workingLocation","birthday","fromGmail"]).optional(),calendarId:n.string().optional(),createdAt:n.coerce.date().optional()}),B=n.object({id:n.string(),summary:n.string().optional(),description:n.string().optional(),location:n.string().optional(),timeZone:n.string().optional(),createdAt:n.coerce.date().optional()});var L={version:"1.0.0",entities:{events:q,calendars:B}};import{googleChannelSubscribe as he}from"corsair/core";var _=(t,o)=>he(t,{webhookUrl:o.webhookUrl,watchUrl:"https://www.googleapis.com/calendar/v3/calendars/primary/events/watch"});import{logEventFromContext as S}from"corsair/core";import{z as r}from"zod";var fe=r.object({data:r.string().optional(),attributes:r.record(r.string(),r.string()).optional(),messageId:r.string().optional(),publishTime:r.string().optional()}),z=r.object({message:fe.optional(),subscription:r.string().optional(),event:r.unknown().optional()}),lt=r.object({resourceId:r.string().optional(),resourceState:r.string().optional(),resourceUri:r.string().optional(),channelId:r.string().optional(),channelExpiration:r.string().optional(),channelToken:r.string().optional(),changed:r.string().optional()}),Ee=r.object({type:r.literal("eventCreated"),calendarId:r.string(),event:r.custom(),timestamp:r.string()}),Ce=r.object({type:r.literal("eventUpdated"),calendarId:r.string(),event:r.custom(),timestamp:r.string()}),Ge=r.object({type:r.literal("eventDeleted"),calendarId:r.string(),eventId:r.string(),timestamp:r.string()}),F=r.union([Ee,Ce,Ge]);function y(t){let o=Buffer.from(t,"base64").toString("utf-8");return JSON.parse(o)}function k(t){return o=>{let i=o.body;if(!i.message?.data)return!1;try{let a=y(i.message.data);return!!a.channelId&&!!a.resourceId&&!!a.resourceUri&&a.resourceUri.includes("/calendar/")}catch{return!1}}}var ke=/\/calendars\/([^\/\?]+)/,Se=/\/calendars\/[^\/]+\/events\/([^\/\?]+)/,we=120*1e3,Te=5e3;function Ie(t){return{calendarId:t.match(ke)?.[1],eventId:t.match(Se)?.[1]}}function xe(t){return!t.created||!t.updated?!1:Math.abs(new Date(t.updated).getTime()-new Date(t.created).getTime())<Te}function Pe(t,o,i){return h(`/calendars/${o}/events/${i}`,t,{method:"GET"})}async function H(t,o){let i=new Date(Date.now()-we).toISOString();return(await h(`/calendars/${o}/events`,t,{method:"GET",query:{maxResults:10,orderBy:"updated",updatedMin:i,showDeleted:!0}})).items??[]}async function Ae(t,o,i){return i?Pe(t,o,i):(await H(t,o)).at(-1)??null}async function De(t,o,i,a){return i||((await H(t,o)).find(p=>p.status==="cancelled")?.id??a.resourceId??"")}async function K(t,o,i){i&&t.db.events&&await t.db.events.deleteByEntityId(i);let a={type:"eventDeleted",calendarId:o,eventId:i,timestamp:new Date().toISOString()};return await S(t,"googlecalendar.webhook.eventDeleted",{...a},"completed"),{eventData:a}}var $={match:k("eventChanged"),handler:async(t,o)=>{let i=o.payload;if(!i.message?.data)return{success:!1,error:"No message data in notification"};let a=y(i.message.data);if(!a.resourceUri)return{success:!1,error:"Invalid push notification format"};let{calendarId:s,eventId:d}=Ie(a.resourceUri);if(!s)return{success:!1,error:"Could not parse calendar ID from resource URI"};let p=t.key;try{if(a.resourceState==="not_exists"){let g=await De(p,s,d,a),{eventData:J}=await K(t,s,g);return{success:!0,data:J}}let l=await Ae(p,s,d);if(!l)return{success:!1,error:"No recently updated events found in calendar"};if(l.status==="cancelled"){let{eventData:g}=await K(t,s,l.id??"");return{success:!0,data:g}}let E="";if(l.id&&t.db.events&&(E=(await t.db.events.upsertByEntityId(l.id,{...l,id:l.id,calendarId:s,createdAt:new Date}))?.id??""),xe(l)){let g={type:"eventCreated",calendarId:s,event:l,timestamp:new Date().toISOString()};return await S(t,"googlecalendar.webhook.eventCreated",{...g},"completed"),{success:!0,corsairEntityId:E,data:g}}let w={type:"eventUpdated",calendarId:s,event:l,timestamp:new Date().toISOString()};return await S(t,"googlecalendar.webhook.eventUpdated",{...w},"completed"),{success:!0,corsairEntityId:E,data:w}}catch(l){return console.error("Failed to process webhook:",l),{success:!1,error:`Failed to process event: ${l instanceof Error?l.message:"Unknown error"}`}}}};var Z={onEventChanged:$};import{asRecord as Oe,decodePubSubData as Me,firstString as V,getHeader as Re,readBodyRecord as Ue}from"corsair/core";function Y(t){let o=V([Re(t.headers,"x-goog-channel-id")]);if(o)return{linkType:"channel_id",externalId:o};let i=Ue(t);if(!i)return null;let a=Oe(Me(i)),s=V([a?.channelId]);return s?{linkType:"channel_id",externalId:s}:null}var je={events:{create:b.create,get:b.get,getMany:b.getMany,update:b.update,delete:b.delete},calendar:{getAvailability:W.getAvailability}},qe={"events.create":{input:u.eventsCreate,output:m.eventsCreate},"events.get":{input:u.eventsGet,output:m.eventsGet},"events.getMany":{input:u.eventsGetMany,output:m.eventsGetMany},"events.update":{input:u.eventsUpdate,output:m.eventsUpdate},"events.delete":{input:u.eventsDelete,output:m.eventsDelete},"calendar.getAvailability":{input:u.calendarGetAvailability,output:m.calendarGetAvailability}},Be={onEventChanged:Z.onEventChanged},Le={onEventChanged:{description:"A Google Calendar event was created, updated, or deleted",payload:z,response:F}},_e="oauth_2",ze={"events.create":{riskLevel:"write",description:"Create a new calendar event"},"events.get":{riskLevel:"read",description:"Get a specific calendar event"},"events.getMany":{riskLevel:"read",description:"List calendar events"},"events.update":{riskLevel:"write",description:"Update an existing calendar event"},"events.delete":{riskLevel:"destructive",description:"Delete a calendar event [DESTRUCTIVE]"},"calendar.getAvailability":{riskLevel:"read",description:"Get free/busy availability for a calendar"}},Fe={oauth_2:{account:["channel_id"]}};function It(t={}){let o={...t,authType:t.authType??_e};return{id:"googlecalendar",authConfig:Fe,schema:L,options:o,oauthConfig:{providerName:"Google",authUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",scopes:["https://www.googleapis.com/auth/calendar"],authParams:{access_type:"offline",prompt:"consent"}},hooks:o.hooks,webhookHooks:o.webhookHooks,endpoints:je,webhooks:Be,endpointMeta:ze,endpointSchemas:qe,webhookSchemas:Le,keyBuilder:async i=>{let a=i.authType;if(o.key)return o.key;if(i.authType==="oauth_2")return We(i,{plugin:"googlecalendar",tokenUrl:"https://oauth2.googleapis.com/token"});throw new Ne("googlecalendar","oauth_2")},pluginWebhookMatcher:i=>{let a=i.headers;if(!(a.from==="noreply@google.com"||typeof a["user-agent"]=="string"&&a["user-agent"].includes("APIs-Google")))return!1;let d=i.body;if(!d?.message?.data)return!1;try{let p=y(d.message.data);return!!p.resourceUri&&p.resourceUri.includes("calendar")}catch{return!1}},pluginTenantWebhookMatcher:Y,subscribe:_}}export{k as createGoogleCalendarWebhookMatcher,y as decodePubSubMessage,Fe as googleCalendarAuthConfig,It as googlecalendar,qe as googlecalendarEndpointSchemas};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { googleChannelSubscribe } from 'corsair/core';
|
|
2
|
+
/**
|
|
3
|
+
* BYO subscribe for Google Calendar — thin wrapper over the shared Google
|
|
4
|
+
* channel watch, on the connected user's primary calendar.
|
|
5
|
+
*/
|
|
6
|
+
export declare const googlecalendarSubscribe: (ctx: Parameters<typeof googleChannelSubscribe>[0], input: {
|
|
7
|
+
webhookUrl: string;
|
|
8
|
+
}) => Promise<import("corsair/core").CorsairPluginSubscribeResult | null>;
|
|
9
|
+
//# sourceMappingURL=subscribe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribe.d.ts","sourceRoot":"","sources":["../subscribe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GACnC,KAAK,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,EACjD,OAAO;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,wEAM3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribe.test.d.ts","sourceRoot":"","sources":["../subscribe.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenant-matcher.d.ts","sourceRoot":"","sources":["../../webhooks/tenant-matcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAW1E,wBAAgB,gCAAgC,CAC/C,OAAO,EAAE,iBAAiB,GACxB,kBAAkB,GAAG,IAAI,CAiB3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corsair-dev/googlecalendar",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Google calendar plugin for Corsair",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"corsair": ">=0.1.
|
|
21
|
+
"corsair": ">=0.1.120",
|
|
22
22
|
"zod": "^4.1.13"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"tsup": "^8.0.1",
|
|
28
28
|
"typescript": "^5.9.3",
|
|
29
29
|
"zod": "^4.1.13",
|
|
30
|
-
"
|
|
30
|
+
"jest": "^29.7.0",
|
|
31
|
+
"corsair": "0.1.120"
|
|
31
32
|
},
|
|
32
33
|
"keywords": [
|
|
33
34
|
"corsair",
|
|
@@ -39,9 +40,6 @@
|
|
|
39
40
|
"files": [
|
|
40
41
|
"dist"
|
|
41
42
|
],
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"jest": "^29.7.0"
|
|
44
|
-
},
|
|
45
43
|
"scripts": {
|
|
46
44
|
"build": "rm -rf dist && tsc --build --force && tsup",
|
|
47
45
|
"typecheck": "tsc --noEmit",
|