@marktoflow/integrations 2.0.0-alpha.6 → 2.0.0-alpha.7
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/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -1
- package/dist/index.js.map +1 -1
- package/dist/services/google-calendar.d.ts +220 -0
- package/dist/services/google-calendar.d.ts.map +1 -0
- package/dist/services/google-calendar.js +318 -0
- package/dist/services/google-calendar.js.map +1 -0
- package/dist/services/google-docs.d.ts +197 -0
- package/dist/services/google-docs.d.ts.map +1 -0
- package/dist/services/google-docs.js +293 -0
- package/dist/services/google-docs.js.map +1 -0
- package/dist/services/google-drive.d.ts +149 -0
- package/dist/services/google-drive.d.ts.map +1 -0
- package/dist/services/google-drive.js +288 -0
- package/dist/services/google-drive.js.map +1 -0
- package/dist/services/google-sheets.d.ts +165 -0
- package/dist/services/google-sheets.d.ts.map +1 -0
- package/dist/services/google-sheets.js +352 -0
- package/dist/services/google-sheets.js.map +1 -0
- package/dist/services/mysql.d.ts +91 -0
- package/dist/services/mysql.d.ts.map +1 -0
- package/dist/services/mysql.js +250 -0
- package/dist/services/mysql.js.map +1 -0
- package/dist/services/postgres.d.ts +83 -0
- package/dist/services/postgres.d.ts.map +1 -0
- package/dist/services/postgres.js +230 -0
- package/dist/services/postgres.js.map +1 -0
- package/dist/services/supabase.d.ts +193 -0
- package/dist/services/supabase.d.ts.map +1 -0
- package/dist/services/supabase.js +328 -0
- package/dist/services/supabase.js.map +1 -0
- package/dist/services/telegram.d.ts +247 -0
- package/dist/services/telegram.d.ts.map +1 -0
- package/dist/services/telegram.js +247 -0
- package/dist/services/telegram.js.map +1 -0
- package/dist/services/whatsapp.d.ts +311 -0
- package/dist/services/whatsapp.d.ts.map +1 -0
- package/dist/services/whatsapp.js +253 -0
- package/dist/services/whatsapp.js.map +1 -0
- package/package.json +21 -5
package/dist/index.d.ts
CHANGED
|
@@ -9,10 +9,19 @@ export { OutlookActions, OutlookInitializer, OutlookEmail, CalendarEvent, type G
|
|
|
9
9
|
export { OutlookTrigger, type OutlookTriggerConfig, type OutlookTriggerPayload, type GraphSubscription, type GraphNotification, createOutlookWebhookHandler, } from './services/outlook-trigger.js';
|
|
10
10
|
export * from './services/linear.js';
|
|
11
11
|
export { NotionClient, NotionInitializer, NotionPage, NotionDatabase, NotionBlock, type CreatePageOptions as NotionCreatePageOptions, type QueryDatabaseOptions, type SearchOptions as NotionSearchOptions, } from './services/notion.js';
|
|
12
|
-
export
|
|
12
|
+
export { DiscordClient, DiscordInitializer, type DiscordMessage, type DiscordChannel, type DiscordGuild, type SendMessageOptions as DiscordSendMessageOptions, } from './services/discord.js';
|
|
13
13
|
export * from './services/airtable.js';
|
|
14
14
|
export * from './services/confluence.js';
|
|
15
15
|
export * from './services/http.js';
|
|
16
|
+
export * from './services/google-sheets.js';
|
|
17
|
+
export * from './services/google-calendar.js';
|
|
18
|
+
export * from './services/google-drive.js';
|
|
19
|
+
export * from './services/google-docs.js';
|
|
20
|
+
export { TelegramClient, TelegramInitializer, type TelegramMessage, type TelegramUser, type SendMessageOptions as TelegramSendMessageOptions, } from './services/telegram.js';
|
|
21
|
+
export { WhatsAppClient, WhatsAppInitializer, type WhatsAppMessage, type WhatsAppTemplate, type SendTextOptions as WhatsAppSendTextOptions, type SendTemplateOptions as WhatsAppSendTemplateOptions, type SendMediaOptions as WhatsAppSendMediaOptions, type SendLocationOptions as WhatsAppSendLocationOptions, type SendInteractiveOptions as WhatsAppSendInteractiveOptions, } from './services/whatsapp.js';
|
|
22
|
+
export * from './services/supabase.js';
|
|
23
|
+
export { PostgresClient, PostgresInitializer, type PostgresConfig, type QueryResult as PostgresQueryResult, type PostgresTransaction, } from './services/postgres.js';
|
|
24
|
+
export { MySQLClient, MySQLInitializer, type MySQLConfig, type QueryResult as MySQLQueryResult, type MySQLTransaction, } from './services/mysql.js';
|
|
16
25
|
export { SlackSocketTrigger } from './services/slack-socket.js';
|
|
17
26
|
export * from './adapters/ollama.js';
|
|
18
27
|
export * from './adapters/claude-code.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAiC/C,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,WAAW,QA6CzD;AAGD,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,KAAK,gBAAgB,IAAI,qBAAqB,EAC9C,KAAK,eAAe,IAAI,oBAAoB,EAC5C,KAAK,gBAAgB,IAAI,qBAAqB,EAC9C,KAAK,kBAAkB,IAAI,uBAAuB,GACnD,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,yBAAyB,GAC1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,KAAK,gBAAgB,IAAI,uBAAuB,EAChD,KAAK,eAAe,IAAI,sBAAsB,EAC9C,KAAK,gBAAgB,IAAI,uBAAuB,EAChD,KAAK,kBAAkB,IAAI,yBAAyB,GACrD,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,2BAA2B,GAC5B,MAAM,+BAA+B,CAAC;AACvC,cAAc,sBAAsB,CA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AC;AAG7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAG7C,cAAc,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,15 @@ import { DiscordInitializer } from './services/discord.js';
|
|
|
10
10
|
import { AirtableInitializer } from './services/airtable.js';
|
|
11
11
|
import { ConfluenceInitializer } from './services/confluence.js';
|
|
12
12
|
import { HttpInitializer } from './services/http.js';
|
|
13
|
+
import { GoogleSheetsInitializer } from './services/google-sheets.js';
|
|
14
|
+
import { GoogleCalendarInitializer } from './services/google-calendar.js';
|
|
15
|
+
import { GoogleDriveInitializer } from './services/google-drive.js';
|
|
16
|
+
import { GoogleDocsInitializer } from './services/google-docs.js';
|
|
17
|
+
import { TelegramInitializer } from './services/telegram.js';
|
|
18
|
+
import { WhatsAppInitializer } from './services/whatsapp.js';
|
|
19
|
+
import { SupabaseInitializer } from './services/supabase.js';
|
|
20
|
+
import { PostgresInitializer } from './services/postgres.js';
|
|
21
|
+
import { MySQLInitializer } from './services/mysql.js';
|
|
13
22
|
// AI Adapters
|
|
14
23
|
import { OllamaInitializer } from './adapters/ollama.js';
|
|
15
24
|
import { ClaudeCodeInitializer } from './adapters/claude-code.js';
|
|
@@ -21,6 +30,8 @@ export function registerIntegrations(registry) {
|
|
|
21
30
|
// Communication & Collaboration
|
|
22
31
|
registry.registerInitializer('@slack/web-api', SlackInitializer);
|
|
23
32
|
registry.registerInitializer('discord', DiscordInitializer);
|
|
33
|
+
registry.registerInitializer('telegram', TelegramInitializer);
|
|
34
|
+
registry.registerInitializer('whatsapp', WhatsAppInitializer);
|
|
24
35
|
// Email
|
|
25
36
|
registry.registerInitializer('googleapis', GmailInitializer);
|
|
26
37
|
registry.registerInitializer('@microsoft/microsoft-graph-client', OutlookInitializer);
|
|
@@ -34,6 +45,14 @@ export function registerIntegrations(registry) {
|
|
|
34
45
|
registry.registerInitializer('@octokit/rest', GitHubInitializer);
|
|
35
46
|
// Data & Databases
|
|
36
47
|
registry.registerInitializer('airtable', AirtableInitializer);
|
|
48
|
+
registry.registerInitializer('supabase', SupabaseInitializer);
|
|
49
|
+
registry.registerInitializer('pg', PostgresInitializer);
|
|
50
|
+
registry.registerInitializer('mysql2', MySQLInitializer);
|
|
51
|
+
// Google Services
|
|
52
|
+
registry.registerInitializer('google-sheets', GoogleSheetsInitializer);
|
|
53
|
+
registry.registerInitializer('google-calendar', GoogleCalendarInitializer);
|
|
54
|
+
registry.registerInitializer('google-drive', GoogleDriveInitializer);
|
|
55
|
+
registry.registerInitializer('google-docs', GoogleDocsInitializer);
|
|
37
56
|
// Generic HTTP
|
|
38
57
|
registry.registerInitializer('http', HttpInitializer);
|
|
39
58
|
// AI Adapters
|
|
@@ -54,10 +73,19 @@ export { OutlookActions, OutlookInitializer, } from './services/outlook.js';
|
|
|
54
73
|
export { OutlookTrigger, createOutlookWebhookHandler, } from './services/outlook-trigger.js';
|
|
55
74
|
export * from './services/linear.js';
|
|
56
75
|
export { NotionClient, NotionInitializer, } from './services/notion.js';
|
|
57
|
-
export
|
|
76
|
+
export { DiscordClient, DiscordInitializer, } from './services/discord.js';
|
|
58
77
|
export * from './services/airtable.js';
|
|
59
78
|
export * from './services/confluence.js';
|
|
60
79
|
export * from './services/http.js';
|
|
80
|
+
export * from './services/google-sheets.js';
|
|
81
|
+
export * from './services/google-calendar.js';
|
|
82
|
+
export * from './services/google-drive.js';
|
|
83
|
+
export * from './services/google-docs.js';
|
|
84
|
+
export { TelegramClient, TelegramInitializer, } from './services/telegram.js';
|
|
85
|
+
export { WhatsAppClient, WhatsAppInitializer, } from './services/whatsapp.js';
|
|
86
|
+
export * from './services/supabase.js';
|
|
87
|
+
export { PostgresClient, PostgresInitializer, } from './services/postgres.js';
|
|
88
|
+
export { MySQLClient, MySQLInitializer, } from './services/mysql.js';
|
|
61
89
|
// Export triggers
|
|
62
90
|
export { SlackSocketTrigger } from './services/slack-socket.js';
|
|
63
91
|
// Export AI adapters
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,WAAW;AACX,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,WAAW;AACX,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAA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;AAChC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EACL,cAAc,EACd,mBAAmB,GAIpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,WAAW,EACX,gBAAgB,GAIjB,MAAM,qBAAqB,CAAC;AAE7B,kBAAkB;AAClB,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,qBAAqB;AACrB,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAE7C,eAAe;AACf,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Calendar Integration
|
|
3
|
+
*
|
|
4
|
+
* Calendar and event management.
|
|
5
|
+
* API Docs: https://developers.google.com/calendar/api
|
|
6
|
+
*/
|
|
7
|
+
import { calendar_v3 } from 'googleapis';
|
|
8
|
+
import { SDKInitializer } from '@marktoflow/core';
|
|
9
|
+
export interface CalendarEvent {
|
|
10
|
+
id: string;
|
|
11
|
+
summary: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
location?: string;
|
|
14
|
+
start: {
|
|
15
|
+
dateTime?: string;
|
|
16
|
+
date?: string;
|
|
17
|
+
timeZone?: string;
|
|
18
|
+
};
|
|
19
|
+
end: {
|
|
20
|
+
dateTime?: string;
|
|
21
|
+
date?: string;
|
|
22
|
+
timeZone?: string;
|
|
23
|
+
};
|
|
24
|
+
attendees?: {
|
|
25
|
+
email: string;
|
|
26
|
+
displayName?: string;
|
|
27
|
+
responseStatus?: string;
|
|
28
|
+
}[];
|
|
29
|
+
creator?: {
|
|
30
|
+
email: string;
|
|
31
|
+
displayName?: string;
|
|
32
|
+
};
|
|
33
|
+
organizer?: {
|
|
34
|
+
email: string;
|
|
35
|
+
displayName?: string;
|
|
36
|
+
};
|
|
37
|
+
status?: string;
|
|
38
|
+
htmlLink?: string;
|
|
39
|
+
recurringEventId?: string;
|
|
40
|
+
recurrence?: string[];
|
|
41
|
+
reminders?: {
|
|
42
|
+
useDefault: boolean;
|
|
43
|
+
overrides?: {
|
|
44
|
+
method: string;
|
|
45
|
+
minutes: number;
|
|
46
|
+
}[];
|
|
47
|
+
};
|
|
48
|
+
conferenceData?: {
|
|
49
|
+
conferenceId?: string;
|
|
50
|
+
conferenceSolution?: {
|
|
51
|
+
name: string;
|
|
52
|
+
iconUri?: string;
|
|
53
|
+
};
|
|
54
|
+
entryPoints?: {
|
|
55
|
+
entryPointType: string;
|
|
56
|
+
uri: string;
|
|
57
|
+
label?: string;
|
|
58
|
+
}[];
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export interface CalendarInfo {
|
|
62
|
+
id: string;
|
|
63
|
+
summary: string;
|
|
64
|
+
description?: string;
|
|
65
|
+
location?: string;
|
|
66
|
+
timeZone?: string;
|
|
67
|
+
accessRole?: string;
|
|
68
|
+
primary?: boolean;
|
|
69
|
+
}
|
|
70
|
+
export interface CreateEventOptions {
|
|
71
|
+
summary: string;
|
|
72
|
+
description?: string;
|
|
73
|
+
location?: string;
|
|
74
|
+
start: {
|
|
75
|
+
dateTime?: string;
|
|
76
|
+
date?: string;
|
|
77
|
+
timeZone?: string;
|
|
78
|
+
};
|
|
79
|
+
end: {
|
|
80
|
+
dateTime?: string;
|
|
81
|
+
date?: string;
|
|
82
|
+
timeZone?: string;
|
|
83
|
+
};
|
|
84
|
+
attendees?: string[] | {
|
|
85
|
+
email: string;
|
|
86
|
+
displayName?: string;
|
|
87
|
+
}[];
|
|
88
|
+
recurrence?: string[];
|
|
89
|
+
reminders?: {
|
|
90
|
+
useDefault?: boolean;
|
|
91
|
+
overrides?: {
|
|
92
|
+
method: 'email' | 'popup';
|
|
93
|
+
minutes: number;
|
|
94
|
+
}[];
|
|
95
|
+
};
|
|
96
|
+
conferenceData?: {
|
|
97
|
+
createRequest?: {
|
|
98
|
+
requestId: string;
|
|
99
|
+
conferenceSolutionKey?: {
|
|
100
|
+
type: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
sendUpdates?: 'all' | 'externalOnly' | 'none';
|
|
105
|
+
}
|
|
106
|
+
export interface UpdateEventOptions extends Partial<CreateEventOptions> {
|
|
107
|
+
sendUpdates?: 'all' | 'externalOnly' | 'none';
|
|
108
|
+
}
|
|
109
|
+
export interface ListEventsOptions {
|
|
110
|
+
timeMin?: string;
|
|
111
|
+
timeMax?: string;
|
|
112
|
+
maxResults?: number;
|
|
113
|
+
orderBy?: 'startTime' | 'updated';
|
|
114
|
+
q?: string;
|
|
115
|
+
singleEvents?: boolean;
|
|
116
|
+
showDeleted?: boolean;
|
|
117
|
+
pageToken?: string;
|
|
118
|
+
}
|
|
119
|
+
export interface FreeBusyQuery {
|
|
120
|
+
timeMin: string;
|
|
121
|
+
timeMax: string;
|
|
122
|
+
items: {
|
|
123
|
+
id: string;
|
|
124
|
+
}[];
|
|
125
|
+
timeZone?: string;
|
|
126
|
+
}
|
|
127
|
+
export interface FreeBusyResponse {
|
|
128
|
+
calendars: {
|
|
129
|
+
[calendarId: string]: {
|
|
130
|
+
busy: {
|
|
131
|
+
start: string;
|
|
132
|
+
end: string;
|
|
133
|
+
}[];
|
|
134
|
+
errors?: unknown[];
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Google Calendar actions for workflow integration
|
|
140
|
+
*/
|
|
141
|
+
export declare class GoogleCalendarActions {
|
|
142
|
+
private calendar;
|
|
143
|
+
constructor(calendar: calendar_v3.Calendar);
|
|
144
|
+
/**
|
|
145
|
+
* List user's calendars
|
|
146
|
+
*/
|
|
147
|
+
listCalendars(): Promise<CalendarInfo[]>;
|
|
148
|
+
/**
|
|
149
|
+
* Get a specific calendar
|
|
150
|
+
*/
|
|
151
|
+
getCalendar(calendarId?: string): Promise<CalendarInfo>;
|
|
152
|
+
/**
|
|
153
|
+
* List events from a calendar
|
|
154
|
+
*/
|
|
155
|
+
listEvents(calendarId?: string, options?: ListEventsOptions): Promise<{
|
|
156
|
+
events: CalendarEvent[];
|
|
157
|
+
nextPageToken?: string;
|
|
158
|
+
}>;
|
|
159
|
+
/**
|
|
160
|
+
* Get a specific event
|
|
161
|
+
*/
|
|
162
|
+
getEvent(calendarId: string, eventId: string): Promise<CalendarEvent>;
|
|
163
|
+
/**
|
|
164
|
+
* Create a new event
|
|
165
|
+
*/
|
|
166
|
+
createEvent(calendarId: string | undefined, options: CreateEventOptions): Promise<CalendarEvent>;
|
|
167
|
+
/**
|
|
168
|
+
* Update an existing event
|
|
169
|
+
*/
|
|
170
|
+
updateEvent(calendarId: string, eventId: string, options: UpdateEventOptions): Promise<CalendarEvent>;
|
|
171
|
+
/**
|
|
172
|
+
* Delete an event
|
|
173
|
+
*/
|
|
174
|
+
deleteEvent(calendarId: string, eventId: string, sendUpdates?: 'all' | 'externalOnly' | 'none'): Promise<void>;
|
|
175
|
+
/**
|
|
176
|
+
* Quick add event using natural language
|
|
177
|
+
*/
|
|
178
|
+
quickAddEvent(calendarId: string | undefined, text: string): Promise<CalendarEvent>;
|
|
179
|
+
/**
|
|
180
|
+
* Move event to another calendar
|
|
181
|
+
*/
|
|
182
|
+
moveEvent(sourceCalendarId: string, eventId: string, destinationCalendarId: string): Promise<CalendarEvent>;
|
|
183
|
+
/**
|
|
184
|
+
* Query free/busy information
|
|
185
|
+
*/
|
|
186
|
+
queryFreeBusy(query: FreeBusyQuery): Promise<FreeBusyResponse>;
|
|
187
|
+
/**
|
|
188
|
+
* Create a calendar
|
|
189
|
+
*/
|
|
190
|
+
createCalendar(summary: string, options?: {
|
|
191
|
+
description?: string;
|
|
192
|
+
location?: string;
|
|
193
|
+
timeZone?: string;
|
|
194
|
+
}): Promise<CalendarInfo>;
|
|
195
|
+
/**
|
|
196
|
+
* Delete a calendar
|
|
197
|
+
*/
|
|
198
|
+
deleteCalendar(calendarId: string): Promise<void>;
|
|
199
|
+
/**
|
|
200
|
+
* Watch for changes to a calendar
|
|
201
|
+
*/
|
|
202
|
+
watchEvents(calendarId: string, webhookUrl: string, options?: {
|
|
203
|
+
token?: string;
|
|
204
|
+
expiration?: number;
|
|
205
|
+
}): Promise<{
|
|
206
|
+
id: string;
|
|
207
|
+
resourceId: string;
|
|
208
|
+
expiration: string;
|
|
209
|
+
}>;
|
|
210
|
+
/**
|
|
211
|
+
* Stop watching for changes
|
|
212
|
+
*/
|
|
213
|
+
stopWatching(channelId: string, resourceId: string): Promise<void>;
|
|
214
|
+
/**
|
|
215
|
+
* Parse calendar event from API response
|
|
216
|
+
*/
|
|
217
|
+
private parseEvent;
|
|
218
|
+
}
|
|
219
|
+
export declare const GoogleCalendarInitializer: SDKInitializer;
|
|
220
|
+
//# sourceMappingURL=google-calendar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-calendar.d.ts","sourceRoot":"","sources":["../../src/services/google-calendar.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAU,WAAW,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAc,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE9D,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,GAAG,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7D,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,E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AAC;IAkBlE;;OAEG;IACG,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASxE;;OAEG;IACH,OAAO,CAAC,UAAU;CAgEnB;AAED,eAAO,MAAM,yBAAyB,EAAE,cA0BvC,CAAC"}
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Calendar Integration
|
|
3
|
+
*
|
|
4
|
+
* Calendar and event management.
|
|
5
|
+
* API Docs: https://developers.google.com/calendar/api
|
|
6
|
+
*/
|
|
7
|
+
import { google } from 'googleapis';
|
|
8
|
+
/**
|
|
9
|
+
* Google Calendar actions for workflow integration
|
|
10
|
+
*/
|
|
11
|
+
export class GoogleCalendarActions {
|
|
12
|
+
calendar;
|
|
13
|
+
constructor(calendar) {
|
|
14
|
+
this.calendar = calendar;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* List user's calendars
|
|
18
|
+
*/
|
|
19
|
+
async listCalendars() {
|
|
20
|
+
const response = await this.calendar.calendarList.list();
|
|
21
|
+
return (response.data.items?.map((cal) => ({
|
|
22
|
+
id: cal.id ?? '',
|
|
23
|
+
summary: cal.summary ?? '',
|
|
24
|
+
description: cal.description ?? undefined,
|
|
25
|
+
location: cal.location ?? undefined,
|
|
26
|
+
timeZone: cal.timeZone ?? undefined,
|
|
27
|
+
accessRole: cal.accessRole ?? undefined,
|
|
28
|
+
primary: cal.primary ?? undefined,
|
|
29
|
+
})) ?? []);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get a specific calendar
|
|
33
|
+
*/
|
|
34
|
+
async getCalendar(calendarId = 'primary') {
|
|
35
|
+
const response = await this.calendar.calendars.get({ calendarId });
|
|
36
|
+
return {
|
|
37
|
+
id: response.data.id ?? '',
|
|
38
|
+
summary: response.data.summary ?? '',
|
|
39
|
+
description: response.data.description ?? undefined,
|
|
40
|
+
location: response.data.location ?? undefined,
|
|
41
|
+
timeZone: response.data.timeZone ?? undefined,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* List events from a calendar
|
|
46
|
+
*/
|
|
47
|
+
async listEvents(calendarId = 'primary', options = {}) {
|
|
48
|
+
const response = await this.calendar.events.list({
|
|
49
|
+
calendarId,
|
|
50
|
+
timeMin: options.timeMin,
|
|
51
|
+
timeMax: options.timeMax,
|
|
52
|
+
maxResults: options.maxResults ?? 250,
|
|
53
|
+
orderBy: options.orderBy,
|
|
54
|
+
q: options.q,
|
|
55
|
+
singleEvents: options.singleEvents ?? true,
|
|
56
|
+
showDeleted: options.showDeleted ?? false,
|
|
57
|
+
pageToken: options.pageToken,
|
|
58
|
+
});
|
|
59
|
+
return {
|
|
60
|
+
events: response.data.items?.map((event) => this.parseEvent(event)) ?? [],
|
|
61
|
+
nextPageToken: response.data.nextPageToken ?? undefined,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get a specific event
|
|
66
|
+
*/
|
|
67
|
+
async getEvent(calendarId, eventId) {
|
|
68
|
+
const response = await this.calendar.events.get({
|
|
69
|
+
calendarId,
|
|
70
|
+
eventId,
|
|
71
|
+
});
|
|
72
|
+
return this.parseEvent(response.data);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Create a new event
|
|
76
|
+
*/
|
|
77
|
+
async createEvent(calendarId = 'primary', options) {
|
|
78
|
+
const attendees = options.attendees?.map((a) => (typeof a === 'string' ? { email: a } : a));
|
|
79
|
+
const response = await this.calendar.events.insert({
|
|
80
|
+
calendarId,
|
|
81
|
+
sendUpdates: options.sendUpdates,
|
|
82
|
+
conferenceDataVersion: options.conferenceData ? 1 : undefined,
|
|
83
|
+
requestBody: {
|
|
84
|
+
summary: options.summary,
|
|
85
|
+
description: options.description,
|
|
86
|
+
location: options.location,
|
|
87
|
+
start: options.start,
|
|
88
|
+
end: options.end,
|
|
89
|
+
attendees,
|
|
90
|
+
recurrence: options.recurrence,
|
|
91
|
+
reminders: options.reminders,
|
|
92
|
+
conferenceData: options.conferenceData,
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
return this.parseEvent(response.data);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Update an existing event
|
|
99
|
+
*/
|
|
100
|
+
async updateEvent(calendarId, eventId, options) {
|
|
101
|
+
const attendees = options.attendees?.map((a) => (typeof a === 'string' ? { email: a } : a));
|
|
102
|
+
const response = await this.calendar.events.patch({
|
|
103
|
+
calendarId,
|
|
104
|
+
eventId,
|
|
105
|
+
sendUpdates: options.sendUpdates,
|
|
106
|
+
conferenceDataVersion: options.conferenceData ? 1 : undefined,
|
|
107
|
+
requestBody: {
|
|
108
|
+
summary: options.summary,
|
|
109
|
+
description: options.description,
|
|
110
|
+
location: options.location,
|
|
111
|
+
start: options.start,
|
|
112
|
+
end: options.end,
|
|
113
|
+
attendees,
|
|
114
|
+
recurrence: options.recurrence,
|
|
115
|
+
reminders: options.reminders,
|
|
116
|
+
conferenceData: options.conferenceData,
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
return this.parseEvent(response.data);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Delete an event
|
|
123
|
+
*/
|
|
124
|
+
async deleteEvent(calendarId, eventId, sendUpdates) {
|
|
125
|
+
await this.calendar.events.delete({
|
|
126
|
+
calendarId,
|
|
127
|
+
eventId,
|
|
128
|
+
sendUpdates,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Quick add event using natural language
|
|
133
|
+
*/
|
|
134
|
+
async quickAddEvent(calendarId = 'primary', text) {
|
|
135
|
+
const response = await this.calendar.events.quickAdd({
|
|
136
|
+
calendarId,
|
|
137
|
+
text,
|
|
138
|
+
});
|
|
139
|
+
return this.parseEvent(response.data);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Move event to another calendar
|
|
143
|
+
*/
|
|
144
|
+
async moveEvent(sourceCalendarId, eventId, destinationCalendarId) {
|
|
145
|
+
const response = await this.calendar.events.move({
|
|
146
|
+
calendarId: sourceCalendarId,
|
|
147
|
+
eventId,
|
|
148
|
+
destination: destinationCalendarId,
|
|
149
|
+
});
|
|
150
|
+
return this.parseEvent(response.data);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Query free/busy information
|
|
154
|
+
*/
|
|
155
|
+
async queryFreeBusy(query) {
|
|
156
|
+
const response = await this.calendar.freebusy.query({
|
|
157
|
+
requestBody: query,
|
|
158
|
+
});
|
|
159
|
+
return {
|
|
160
|
+
calendars: Object.entries(response.data.calendars ?? {}).reduce((acc, [id, data]) => {
|
|
161
|
+
acc[id] = {
|
|
162
|
+
busy: data.busy?.map((b) => ({
|
|
163
|
+
start: b.start ?? '',
|
|
164
|
+
end: b.end ?? '',
|
|
165
|
+
})) ?? [],
|
|
166
|
+
errors: data.errors,
|
|
167
|
+
};
|
|
168
|
+
return acc;
|
|
169
|
+
}, {}),
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Create a calendar
|
|
174
|
+
*/
|
|
175
|
+
async createCalendar(summary, options) {
|
|
176
|
+
const response = await this.calendar.calendars.insert({
|
|
177
|
+
requestBody: {
|
|
178
|
+
summary,
|
|
179
|
+
description: options?.description,
|
|
180
|
+
location: options?.location,
|
|
181
|
+
timeZone: options?.timeZone,
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
return {
|
|
185
|
+
id: response.data.id ?? '',
|
|
186
|
+
summary: response.data.summary ?? '',
|
|
187
|
+
description: response.data.description ?? undefined,
|
|
188
|
+
location: response.data.location ?? undefined,
|
|
189
|
+
timeZone: response.data.timeZone ?? undefined,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Delete a calendar
|
|
194
|
+
*/
|
|
195
|
+
async deleteCalendar(calendarId) {
|
|
196
|
+
await this.calendar.calendars.delete({ calendarId });
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Watch for changes to a calendar
|
|
200
|
+
*/
|
|
201
|
+
async watchEvents(calendarId, webhookUrl, options) {
|
|
202
|
+
const response = await this.calendar.events.watch({
|
|
203
|
+
calendarId,
|
|
204
|
+
requestBody: {
|
|
205
|
+
id: options?.token ?? `watch-${Date.now()}`,
|
|
206
|
+
type: 'web_hook',
|
|
207
|
+
address: webhookUrl,
|
|
208
|
+
expiration: options?.expiration?.toString(),
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
return {
|
|
212
|
+
id: response.data.id ?? '',
|
|
213
|
+
resourceId: response.data.resourceId ?? '',
|
|
214
|
+
expiration: response.data.expiration ?? '',
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Stop watching for changes
|
|
219
|
+
*/
|
|
220
|
+
async stopWatching(channelId, resourceId) {
|
|
221
|
+
await this.calendar.channels.stop({
|
|
222
|
+
requestBody: {
|
|
223
|
+
id: channelId,
|
|
224
|
+
resourceId,
|
|
225
|
+
},
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Parse calendar event from API response
|
|
230
|
+
*/
|
|
231
|
+
parseEvent(event) {
|
|
232
|
+
return {
|
|
233
|
+
id: event.id ?? '',
|
|
234
|
+
summary: event.summary ?? '',
|
|
235
|
+
description: event.description ?? undefined,
|
|
236
|
+
location: event.location ?? undefined,
|
|
237
|
+
start: {
|
|
238
|
+
dateTime: event.start?.dateTime ?? undefined,
|
|
239
|
+
date: event.start?.date ?? undefined,
|
|
240
|
+
timeZone: event.start?.timeZone ?? undefined,
|
|
241
|
+
},
|
|
242
|
+
end: {
|
|
243
|
+
dateTime: event.end?.dateTime ?? undefined,
|
|
244
|
+
date: event.end?.date ?? undefined,
|
|
245
|
+
timeZone: event.end?.timeZone ?? undefined,
|
|
246
|
+
},
|
|
247
|
+
attendees: event.attendees?.map((a) => ({
|
|
248
|
+
email: a.email ?? '',
|
|
249
|
+
displayName: a.displayName ?? undefined,
|
|
250
|
+
responseStatus: a.responseStatus ?? undefined,
|
|
251
|
+
})),
|
|
252
|
+
creator: event.creator
|
|
253
|
+
? {
|
|
254
|
+
email: event.creator.email ?? '',
|
|
255
|
+
displayName: event.creator.displayName ?? undefined,
|
|
256
|
+
}
|
|
257
|
+
: undefined,
|
|
258
|
+
organizer: event.organizer
|
|
259
|
+
? {
|
|
260
|
+
email: event.organizer.email ?? '',
|
|
261
|
+
displayName: event.organizer.displayName ?? undefined,
|
|
262
|
+
}
|
|
263
|
+
: undefined,
|
|
264
|
+
status: event.status ?? undefined,
|
|
265
|
+
htmlLink: event.htmlLink ?? undefined,
|
|
266
|
+
recurringEventId: event.recurringEventId ?? undefined,
|
|
267
|
+
recurrence: event.recurrence ?? undefined,
|
|
268
|
+
reminders: event.reminders
|
|
269
|
+
? {
|
|
270
|
+
useDefault: event.reminders.useDefault ?? false,
|
|
271
|
+
overrides: event.reminders.overrides?.map((o) => ({
|
|
272
|
+
method: o.method ?? '',
|
|
273
|
+
minutes: o.minutes ?? 0,
|
|
274
|
+
})),
|
|
275
|
+
}
|
|
276
|
+
: undefined,
|
|
277
|
+
conferenceData: event.conferenceData
|
|
278
|
+
? {
|
|
279
|
+
conferenceId: event.conferenceData.conferenceId ?? undefined,
|
|
280
|
+
conferenceSolution: event.conferenceData.conferenceSolution
|
|
281
|
+
? {
|
|
282
|
+
name: event.conferenceData.conferenceSolution.name ?? '',
|
|
283
|
+
iconUri: event.conferenceData.conferenceSolution.iconUri ?? undefined,
|
|
284
|
+
}
|
|
285
|
+
: undefined,
|
|
286
|
+
entryPoints: event.conferenceData.entryPoints?.map((ep) => ({
|
|
287
|
+
entryPointType: ep.entryPointType ?? '',
|
|
288
|
+
uri: ep.uri ?? '',
|
|
289
|
+
label: ep.label ?? undefined,
|
|
290
|
+
})),
|
|
291
|
+
}
|
|
292
|
+
: undefined,
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
export const GoogleCalendarInitializer = {
|
|
297
|
+
async initialize(_module, config) {
|
|
298
|
+
const clientId = config.auth?.['client_id'];
|
|
299
|
+
const clientSecret = config.auth?.['client_secret'];
|
|
300
|
+
const redirectUri = config.auth?.['redirect_uri'];
|
|
301
|
+
const refreshToken = config.auth?.['refresh_token'];
|
|
302
|
+
const accessToken = config.auth?.['access_token'];
|
|
303
|
+
if (!clientId || !clientSecret || !redirectUri) {
|
|
304
|
+
throw new Error('Google Calendar SDK requires auth.client_id, auth.client_secret, auth.redirect_uri');
|
|
305
|
+
}
|
|
306
|
+
const oauth2Client = new google.auth.OAuth2(clientId, clientSecret, redirectUri);
|
|
307
|
+
oauth2Client.setCredentials({
|
|
308
|
+
refresh_token: refreshToken,
|
|
309
|
+
access_token: accessToken,
|
|
310
|
+
});
|
|
311
|
+
const calendar = google.calendar({ version: 'v3', auth: oauth2Client });
|
|
312
|
+
return {
|
|
313
|
+
client: calendar,
|
|
314
|
+
actions: new GoogleCalendarActions(calendar),
|
|
315
|
+
};
|
|
316
|
+
},
|
|
317
|
+
};
|
|
318
|
+
//# sourceMappingURL=google-calendar.js.map
|