@mindstone/mcp-server-google-workspace 0.1.5 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -9
- package/dist/modules/accounts/manager.js +20 -2
- package/dist/modules/accounts/token.d.ts +13 -0
- package/dist/modules/accounts/token.js +73 -58
- package/dist/modules/accounts/types.d.ts +1 -0
- package/dist/modules/calendar/service.js +9 -0
- package/dist/modules/chat/index.d.ts +12 -0
- package/dist/modules/chat/index.js +18 -0
- package/dist/modules/chat/scopes.d.ts +14 -0
- package/dist/modules/chat/scopes.js +32 -0
- package/dist/modules/chat/types.d.ts +88 -0
- package/dist/modules/chat/types.js +14 -0
- package/dist/modules/comments/service.js +26 -5
- package/dist/modules/contacts/scopes.d.ts +1 -0
- package/dist/modules/contacts/scopes.js +2 -2
- package/dist/modules/contacts/types.d.ts +34 -0
- package/dist/modules/docs/index.js +2 -1
- package/dist/modules/docs/service.js +36 -7
- package/dist/modules/drive/activity-service.d.ts +45 -0
- package/dist/modules/drive/activity-service.js +114 -0
- package/dist/modules/drive/index.d.ts +4 -0
- package/dist/modules/drive/index.js +12 -0
- package/dist/modules/drive/scopes.d.ts +1 -0
- package/dist/modules/drive/scopes.js +3 -0
- package/dist/modules/drive/service.d.ts +2 -1
- package/dist/modules/drive/service.js +29 -0
- package/dist/modules/drive/types.d.ts +8 -0
- package/dist/modules/forms/service.js +16 -3
- package/dist/modules/gmail/services/attachment.js +2 -1
- package/dist/modules/gmail/services/base.d.ts +5 -1
- package/dist/modules/gmail/services/base.js +10 -1
- package/dist/modules/gmail/services/draft.js +13 -7
- package/dist/modules/gmail/services/email.js +4 -3
- package/dist/modules/gmail/services/label.js +10 -9
- package/dist/modules/gmail/services/settings.d.ts +14 -1
- package/dist/modules/gmail/services/settings.js +96 -1
- package/dist/modules/gmail/types.d.ts +36 -0
- package/dist/modules/meet/index.d.ts +12 -0
- package/dist/modules/meet/index.js +18 -0
- package/dist/modules/meet/scopes.d.ts +9 -0
- package/dist/modules/meet/scopes.js +25 -0
- package/dist/modules/meet/types.d.ts +97 -0
- package/dist/modules/meet/types.js +14 -0
- package/dist/modules/sheets/service.js +49 -0
- package/dist/modules/slides/service.js +31 -6
- package/dist/modules/tasks/service.js +31 -6
- package/dist/resources/compose-email-template.d.ts +1 -1
- package/dist/resources/compose-email-template.js +388 -19
- package/dist/services/base/BaseGoogleService.d.ts +9 -1
- package/dist/services/base/BaseGoogleService.js +33 -1
- package/dist/services/chat/index.d.ts +34 -0
- package/dist/services/chat/index.js +120 -0
- package/dist/services/contacts/index.d.ts +19 -1
- package/dist/services/contacts/index.js +124 -0
- package/dist/services/meet/index.d.ts +35 -0
- package/dist/services/meet/index.js +116 -0
- package/dist/tools/calendar-handlers.js +28 -23
- package/dist/tools/chat-handlers.d.ts +14 -0
- package/dist/tools/chat-handlers.js +126 -0
- package/dist/tools/contacts-handlers.d.ts +31 -0
- package/dist/tools/contacts-handlers.js +96 -23
- package/dist/tools/definitions/account.js +8 -1
- package/dist/tools/definitions/chat.d.ts +3 -0
- package/dist/tools/definitions/chat.js +137 -0
- package/dist/tools/definitions/contacts.js +82 -0
- package/dist/tools/definitions/destructive-overrides.json +12 -0
- package/dist/tools/definitions/drive.js +132 -6
- package/dist/tools/definitions/gmail.js +94 -0
- package/dist/tools/definitions/index.d.ts +2 -0
- package/dist/tools/definitions/index.js +6 -0
- package/dist/tools/definitions/meet.d.ts +3 -0
- package/dist/tools/definitions/meet.js +149 -0
- package/dist/tools/definitions/open-world-overrides.json +12 -0
- package/dist/tools/drive-handlers.d.ts +27 -0
- package/dist/tools/drive-handlers.js +93 -2
- package/dist/tools/forms-handlers.js +5 -12
- package/dist/tools/gmail-handlers.d.ts +31 -1
- package/dist/tools/gmail-handlers.js +167 -35
- package/dist/tools/meet-handlers.d.ts +42 -0
- package/dist/tools/meet-handlers.js +144 -0
- package/dist/tools/server.js +67 -5
- package/dist/tools/tasks-handlers.js +7 -18
- package/dist/tools/type-guards.d.ts +3 -1
- package/dist/tools/type-guards.js +22 -2
- package/dist/tools/types.d.ts +13 -0
- package/dist/utils/apiError.d.ts +49 -0
- package/dist/utils/apiError.js +96 -0
- package/dist/utils/scope-hierarchy.js +10 -0
- package/dist/utils/service-initializer.js +9 -0
- package/dist/utils/untrusted-content.d.ts +37 -1
- package/dist/utils/untrusted-content.js +61 -6
- package/package.json +5 -1
- package/dist/services/calendar/index.d.ts +0 -27
- package/dist/services/calendar/index.js +0 -146
- package/dist/services/gmail/index.d.ts +0 -39
- package/dist/services/gmail/index.js +0 -337
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GmailError } from '../types.js';
|
|
2
2
|
import { buildMimeMessage } from './mime-builder.js';
|
|
3
|
+
import { describeApiError } from '../../../utils/apiError.js';
|
|
3
4
|
import logger from '../../../utils/logger.js';
|
|
4
5
|
export class DraftService {
|
|
5
6
|
attachmentService;
|
|
@@ -62,7 +63,9 @@ export class DraftService {
|
|
|
62
63
|
};
|
|
63
64
|
}
|
|
64
65
|
catch (error) {
|
|
65
|
-
|
|
66
|
+
const details = describeApiError(error);
|
|
67
|
+
logger.warn(`Failed to create draft: ${details}`);
|
|
68
|
+
throw new GmailError('Failed to create draft', 'CREATE_ERROR', details);
|
|
66
69
|
}
|
|
67
70
|
}
|
|
68
71
|
async listDrafts(email) {
|
|
@@ -93,7 +96,7 @@ export class DraftService {
|
|
|
93
96
|
};
|
|
94
97
|
}
|
|
95
98
|
catch (error) {
|
|
96
|
-
throw new GmailError('Failed to list drafts', 'LIST_ERROR', error
|
|
99
|
+
throw new GmailError('Failed to list drafts', 'LIST_ERROR', describeApiError(error));
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
102
|
async getDraft(email, draftId) {
|
|
@@ -118,7 +121,7 @@ export class DraftService {
|
|
|
118
121
|
};
|
|
119
122
|
}
|
|
120
123
|
catch (error) {
|
|
121
|
-
throw new GmailError('Failed to get draft', 'GET_ERROR', error
|
|
124
|
+
throw new GmailError('Failed to get draft', 'GET_ERROR', describeApiError(error));
|
|
122
125
|
}
|
|
123
126
|
}
|
|
124
127
|
async updateDraft(email, draftId, data) {
|
|
@@ -149,7 +152,8 @@ export class DraftService {
|
|
|
149
152
|
id: draftId,
|
|
150
153
|
requestBody: {
|
|
151
154
|
message: {
|
|
152
|
-
raw: encodedMessage
|
|
155
|
+
raw: encodedMessage,
|
|
156
|
+
threadId: data.threadId // Include threadId for replies
|
|
153
157
|
}
|
|
154
158
|
}
|
|
155
159
|
});
|
|
@@ -165,7 +169,9 @@ export class DraftService {
|
|
|
165
169
|
};
|
|
166
170
|
}
|
|
167
171
|
catch (error) {
|
|
168
|
-
|
|
172
|
+
const details = describeApiError(error);
|
|
173
|
+
logger.warn(`Failed to update draft ${draftId}: ${details}`);
|
|
174
|
+
throw new GmailError('Failed to update draft', 'UPDATE_ERROR', details);
|
|
169
175
|
}
|
|
170
176
|
}
|
|
171
177
|
async deleteDraft(email, draftId) {
|
|
@@ -178,7 +184,7 @@ export class DraftService {
|
|
|
178
184
|
return;
|
|
179
185
|
}
|
|
180
186
|
catch (error) {
|
|
181
|
-
throw new GmailError('Failed to delete draft', 'DELETE_ERROR', error
|
|
187
|
+
throw new GmailError('Failed to delete draft', 'DELETE_ERROR', describeApiError(error));
|
|
182
188
|
}
|
|
183
189
|
}
|
|
184
190
|
async manageDraft(params) {
|
|
@@ -232,7 +238,7 @@ export class DraftService {
|
|
|
232
238
|
};
|
|
233
239
|
}
|
|
234
240
|
catch (error) {
|
|
235
|
-
throw new GmailError('Failed to send draft', 'SEND_ERROR', error
|
|
241
|
+
throw new GmailError('Failed to send draft', 'SEND_ERROR', describeApiError(error));
|
|
236
242
|
}
|
|
237
243
|
}
|
|
238
244
|
}
|
|
@@ -3,6 +3,7 @@ import { buildMimeMessage } from './mime-builder.js';
|
|
|
3
3
|
import { AttachmentResponseTransformer } from '../../attachments/response-transformer.js';
|
|
4
4
|
import { AttachmentIndexService } from '../../attachments/index-service.js';
|
|
5
5
|
import logger from '../../../utils/logger.js';
|
|
6
|
+
import { describeApiError } from '../../../utils/apiError.js';
|
|
6
7
|
/**
|
|
7
8
|
* Google/Gaxios not-found shapes differ by call site and transport.
|
|
8
9
|
*/
|
|
@@ -251,7 +252,7 @@ export class EmailService {
|
|
|
251
252
|
};
|
|
252
253
|
}
|
|
253
254
|
catch (error) {
|
|
254
|
-
throw new GmailError(`Failed to get thread ${threadId}`, 'THREAD_ERROR', `Error: ${error
|
|
255
|
+
throw new GmailError(`Failed to get thread ${threadId}`, 'THREAD_ERROR', `Error: ${describeApiError(error)}`);
|
|
255
256
|
}
|
|
256
257
|
}
|
|
257
258
|
/**
|
|
@@ -388,7 +389,7 @@ export class EmailService {
|
|
|
388
389
|
if (error instanceof GmailError) {
|
|
389
390
|
throw error;
|
|
390
391
|
}
|
|
391
|
-
throw new GmailError('Failed to get emails', 'FETCH_ERROR', `Error: ${error
|
|
392
|
+
throw new GmailError('Failed to get emails', 'FETCH_ERROR', `Error: ${describeApiError(error)}`);
|
|
392
393
|
}
|
|
393
394
|
}
|
|
394
395
|
/**
|
|
@@ -455,7 +456,7 @@ export class EmailService {
|
|
|
455
456
|
if (error instanceof GmailError) {
|
|
456
457
|
throw error;
|
|
457
458
|
}
|
|
458
|
-
throw new GmailError('Failed to send email', 'SEND_ERROR', `Error: ${error
|
|
459
|
+
throw new GmailError('Failed to send email', 'SEND_ERROR', `Error: ${describeApiError(error)}`);
|
|
459
460
|
}
|
|
460
461
|
}
|
|
461
462
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { describeApiError } from '../../../utils/apiError.js';
|
|
1
2
|
import { GmailError } from '../types.js';
|
|
2
3
|
import { isValidGmailLabelColor, getNearestGmailLabelColor, LABEL_ERROR_MESSAGES } from '../constants.js';
|
|
3
4
|
export class LabelService {
|
|
@@ -225,7 +226,7 @@ export class LabelService {
|
|
|
225
226
|
if (error instanceof Error && error.message.includes('Invalid grant')) {
|
|
226
227
|
throw new GmailError('Authentication token expired', 'TOKEN_ERROR', 'Please re-authenticate your account');
|
|
227
228
|
}
|
|
228
|
-
throw new GmailError('Failed to create label', 'CREATE_ERROR', error
|
|
229
|
+
throw new GmailError('Failed to create label', 'CREATE_ERROR', describeApiError(error));
|
|
229
230
|
}
|
|
230
231
|
}
|
|
231
232
|
async getLabels(params) {
|
|
@@ -241,7 +242,7 @@ export class LabelService {
|
|
|
241
242
|
};
|
|
242
243
|
}
|
|
243
244
|
catch (error) {
|
|
244
|
-
throw new GmailError('Failed to fetch labels', 'FETCH_ERROR', error
|
|
245
|
+
throw new GmailError('Failed to fetch labels', 'FETCH_ERROR', describeApiError(error));
|
|
245
246
|
}
|
|
246
247
|
}
|
|
247
248
|
async updateLabel(params) {
|
|
@@ -281,7 +282,7 @@ export class LabelService {
|
|
|
281
282
|
if (error instanceof Error && error.message.includes('Invalid grant')) {
|
|
282
283
|
throw new GmailError('Authentication token expired', 'TOKEN_ERROR', 'Please re-authenticate your account');
|
|
283
284
|
}
|
|
284
|
-
throw new GmailError('Failed to update label', 'UPDATE_ERROR', error
|
|
285
|
+
throw new GmailError('Failed to update label', 'UPDATE_ERROR', describeApiError(error));
|
|
285
286
|
}
|
|
286
287
|
}
|
|
287
288
|
async deleteLabel(params) {
|
|
@@ -292,7 +293,7 @@ export class LabelService {
|
|
|
292
293
|
});
|
|
293
294
|
}
|
|
294
295
|
catch (error) {
|
|
295
|
-
throw new GmailError('Failed to delete label', 'DELETE_ERROR', error
|
|
296
|
+
throw new GmailError('Failed to delete label', 'DELETE_ERROR', describeApiError(error));
|
|
296
297
|
}
|
|
297
298
|
}
|
|
298
299
|
async modifyMessageLabels(params) {
|
|
@@ -307,7 +308,7 @@ export class LabelService {
|
|
|
307
308
|
});
|
|
308
309
|
}
|
|
309
310
|
catch (error) {
|
|
310
|
-
throw new GmailError('Failed to modify message labels', 'MODIFY_ERROR', error
|
|
311
|
+
throw new GmailError('Failed to modify message labels', 'MODIFY_ERROR', describeApiError(error));
|
|
311
312
|
}
|
|
312
313
|
}
|
|
313
314
|
async createLabelFilter(params) {
|
|
@@ -361,7 +362,7 @@ export class LabelService {
|
|
|
361
362
|
};
|
|
362
363
|
}
|
|
363
364
|
catch (error) {
|
|
364
|
-
throw new GmailError('Failed to create label filter', 'CREATE_ERROR', error
|
|
365
|
+
throw new GmailError('Failed to create label filter', 'CREATE_ERROR', describeApiError(error));
|
|
365
366
|
}
|
|
366
367
|
}
|
|
367
368
|
async getLabelFilters(params) {
|
|
@@ -408,7 +409,7 @@ export class LabelService {
|
|
|
408
409
|
return { filters };
|
|
409
410
|
}
|
|
410
411
|
catch (error) {
|
|
411
|
-
throw new GmailError('Failed to get label filters', 'FETCH_ERROR', error
|
|
412
|
+
throw new GmailError('Failed to get label filters', 'FETCH_ERROR', describeApiError(error));
|
|
412
413
|
}
|
|
413
414
|
}
|
|
414
415
|
async updateLabelFilter(params) {
|
|
@@ -467,7 +468,7 @@ export class LabelService {
|
|
|
467
468
|
};
|
|
468
469
|
}
|
|
469
470
|
catch (error) {
|
|
470
|
-
throw new GmailError('Failed to update label filter', 'UPDATE_ERROR', error
|
|
471
|
+
throw new GmailError('Failed to update label filter', 'UPDATE_ERROR', describeApiError(error));
|
|
471
472
|
}
|
|
472
473
|
}
|
|
473
474
|
async deleteLabelFilter(params) {
|
|
@@ -478,7 +479,7 @@ export class LabelService {
|
|
|
478
479
|
});
|
|
479
480
|
}
|
|
480
481
|
catch (error) {
|
|
481
|
-
throw new GmailError('Failed to delete label filter', 'DELETE_ERROR', error
|
|
482
|
+
throw new GmailError('Failed to delete label filter', 'DELETE_ERROR', describeApiError(error));
|
|
482
483
|
}
|
|
483
484
|
}
|
|
484
485
|
mapGmailLabel(label) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { google } from 'googleapis';
|
|
2
|
-
import { GetGmailSettingsParams, GetGmailSettingsResponse } from '../types.js';
|
|
2
|
+
import { GetGmailSettingsParams, GetGmailSettingsResponse, UpdateVacationResponderParams, VacationResponderState, SendAsAlias } from '../types.js';
|
|
3
3
|
export declare class SettingsService {
|
|
4
4
|
private gmailClient?;
|
|
5
5
|
constructor(gmailClient?: ReturnType<typeof google.gmail> | undefined);
|
|
@@ -10,5 +10,18 @@ export declare class SettingsService {
|
|
|
10
10
|
updateClient(client: ReturnType<typeof google.gmail>): void;
|
|
11
11
|
private ensureClient;
|
|
12
12
|
getWorkspaceGmailSettings({ email }: GetGmailSettingsParams): Promise<GetGmailSettingsResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Updates the vacation (out-of-office) auto-responder. The Gmail API replaces
|
|
15
|
+
* the whole vacation resource on update, so the current settings are fetched
|
|
16
|
+
* first and merged — passing only `enabled` would otherwise wipe the existing
|
|
17
|
+
* subject/body.
|
|
18
|
+
*/
|
|
19
|
+
updateVacationResponder(params: UpdateVacationResponderParams): Promise<VacationResponderState>;
|
|
20
|
+
/**
|
|
21
|
+
* Lists the account's send-as aliases, including each alias's signature.
|
|
22
|
+
*/
|
|
23
|
+
listSendAs({ email }: GetGmailSettingsParams): Promise<{
|
|
24
|
+
sendAs: SendAsAlias[];
|
|
25
|
+
}>;
|
|
13
26
|
}
|
|
14
27
|
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { describeApiError } from '../../../utils/apiError.js';
|
|
1
2
|
import { GmailError } from '../types.js';
|
|
2
3
|
export class SettingsService {
|
|
3
4
|
gmailClient;
|
|
@@ -97,7 +98,101 @@ export class SettingsService {
|
|
|
97
98
|
if (error instanceof GmailError) {
|
|
98
99
|
throw error;
|
|
99
100
|
}
|
|
100
|
-
throw new GmailError('Failed to get Gmail settings', 'SETTINGS_ERROR', `Error: ${error
|
|
101
|
+
throw new GmailError('Failed to get Gmail settings', 'SETTINGS_ERROR', `Error: ${describeApiError(error)}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Updates the vacation (out-of-office) auto-responder. The Gmail API replaces
|
|
106
|
+
* the whole vacation resource on update, so the current settings are fetched
|
|
107
|
+
* first and merged — passing only `enabled` would otherwise wipe the existing
|
|
108
|
+
* subject/body.
|
|
109
|
+
*/
|
|
110
|
+
async updateVacationResponder(params) {
|
|
111
|
+
try {
|
|
112
|
+
const client = this.ensureClient();
|
|
113
|
+
const { data: current } = await client.users.settings.getVacation({ userId: 'me' });
|
|
114
|
+
const responseSubject = params.responseSubject ?? current.responseSubject ?? undefined;
|
|
115
|
+
// A caller-supplied body is sent as plain text. When omitted, preserve the
|
|
116
|
+
// existing body in its own representation: an HTML body must go back as
|
|
117
|
+
// responseBodyHtml, not be flattened into responseBodyPlainText (that
|
|
118
|
+
// would turn the markup into literal visible text in the auto-reply).
|
|
119
|
+
const hasBody = params.responseBody !== undefined
|
|
120
|
+
|| Boolean(current.responseBodyPlainText)
|
|
121
|
+
|| Boolean(current.responseBodyHtml);
|
|
122
|
+
if (params.enabled && !hasBody) {
|
|
123
|
+
throw new GmailError('Vacation responder needs a message', 'INVALID_PARAMS', 'Provide response_body (the account has no existing auto-reply message to reuse)');
|
|
124
|
+
}
|
|
125
|
+
const bodyFields = params.responseBody !== undefined
|
|
126
|
+
? { responseBodyPlainText: params.responseBody }
|
|
127
|
+
: {
|
|
128
|
+
...(current.responseBodyPlainText && { responseBodyPlainText: current.responseBodyPlainText }),
|
|
129
|
+
...(current.responseBodyHtml && { responseBodyHtml: current.responseBodyHtml })
|
|
130
|
+
};
|
|
131
|
+
const { data: updated } = await client.users.settings.updateVacation({
|
|
132
|
+
userId: 'me',
|
|
133
|
+
requestBody: {
|
|
134
|
+
enableAutoReply: params.enabled,
|
|
135
|
+
...(responseSubject && { responseSubject }),
|
|
136
|
+
...bodyFields,
|
|
137
|
+
...(params.startTime !== undefined
|
|
138
|
+
? { startTime: String(params.startTime) }
|
|
139
|
+
: params.enabled && !current.startTime
|
|
140
|
+
? { startTime: String(Date.now()) }
|
|
141
|
+
: current.startTime ? { startTime: current.startTime } : {}),
|
|
142
|
+
// An omitted endTime preserves a still-pending scheduled end — the API
|
|
143
|
+
// replaces the whole resource, so omitting it would silently erase it.
|
|
144
|
+
// An already-past end is not inherited (Gmail requires start < end, and
|
|
145
|
+
// an expired end carries no meaning); clearEndTime drops one explicitly.
|
|
146
|
+
...(params.endTime !== undefined
|
|
147
|
+
? { endTime: String(params.endTime) }
|
|
148
|
+
: !params.clearEndTime && current.endTime && Number(current.endTime) > Date.now()
|
|
149
|
+
? { endTime: current.endTime } : {}),
|
|
150
|
+
restrictToContacts: params.contactsOnly ?? current.restrictToContacts ?? false,
|
|
151
|
+
restrictToDomain: params.domainOnly ?? current.restrictToDomain ?? false
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
return {
|
|
155
|
+
enabled: Boolean(updated.enableAutoReply),
|
|
156
|
+
...(updated.responseSubject && { responseSubject: updated.responseSubject }),
|
|
157
|
+
...((updated.responseBodyPlainText || updated.responseBodyHtml) && {
|
|
158
|
+
message: updated.responseBodyPlainText ?? updated.responseBodyHtml ?? ''
|
|
159
|
+
}),
|
|
160
|
+
...(updated.startTime && { startTime: updated.startTime }),
|
|
161
|
+
...(updated.endTime && { endTime: updated.endTime }),
|
|
162
|
+
contactsOnly: Boolean(updated.restrictToContacts),
|
|
163
|
+
domainOnly: Boolean(updated.restrictToDomain)
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
if (error instanceof GmailError) {
|
|
168
|
+
throw error;
|
|
169
|
+
}
|
|
170
|
+
throw new GmailError('Failed to update vacation responder', 'SETTINGS_ERROR', `Error: ${describeApiError(error)}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Lists the account's send-as aliases, including each alias's signature.
|
|
175
|
+
*/
|
|
176
|
+
async listSendAs({ email }) {
|
|
177
|
+
try {
|
|
178
|
+
const client = this.ensureClient();
|
|
179
|
+
const { data } = await client.users.settings.sendAs.list({ userId: 'me' });
|
|
180
|
+
const sendAs = (data.sendAs ?? []).map(alias => ({
|
|
181
|
+
sendAsEmail: alias.sendAsEmail ?? '',
|
|
182
|
+
...(alias.displayName && { displayName: alias.displayName }),
|
|
183
|
+
...(alias.replyToAddress && { replyToAddress: alias.replyToAddress }),
|
|
184
|
+
...(alias.signature && { signature: alias.signature }),
|
|
185
|
+
...(alias.isPrimary !== null && alias.isPrimary !== undefined && { isPrimary: alias.isPrimary }),
|
|
186
|
+
...(alias.isDefault !== null && alias.isDefault !== undefined && { isDefault: alias.isDefault }),
|
|
187
|
+
...(alias.verificationStatus && { verificationStatus: alias.verificationStatus })
|
|
188
|
+
}));
|
|
189
|
+
return { sendAs };
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
if (error instanceof GmailError) {
|
|
193
|
+
throw error;
|
|
194
|
+
}
|
|
195
|
+
throw new GmailError('Failed to list send-as aliases', 'SETTINGS_ERROR', `Error: ${describeApiError(error)}`);
|
|
101
196
|
}
|
|
102
197
|
}
|
|
103
198
|
}
|
|
@@ -150,6 +150,42 @@ export interface DeleteLabelFilterParams {
|
|
|
150
150
|
export interface GetGmailSettingsParams {
|
|
151
151
|
email: string;
|
|
152
152
|
}
|
|
153
|
+
export interface UpdateVacationResponderParams {
|
|
154
|
+
email: string;
|
|
155
|
+
/** Turn the auto-reply on or off. */
|
|
156
|
+
enabled: boolean;
|
|
157
|
+
responseSubject?: string;
|
|
158
|
+
/** Plain-text auto-reply body. */
|
|
159
|
+
responseBody?: string;
|
|
160
|
+
/** Epoch milliseconds; omit to start immediately when enabling. */
|
|
161
|
+
startTime?: number;
|
|
162
|
+
/** Epoch milliseconds; omit to keep the currently scheduled end (if any). */
|
|
163
|
+
endTime?: number;
|
|
164
|
+
/** Explicitly remove the scheduled end (open-ended auto-reply). */
|
|
165
|
+
clearEndTime?: boolean;
|
|
166
|
+
/** Only auto-reply to people in the user's contacts. */
|
|
167
|
+
contactsOnly?: boolean;
|
|
168
|
+
/** Only auto-reply to people in the user's Workspace domain. */
|
|
169
|
+
domainOnly?: boolean;
|
|
170
|
+
}
|
|
171
|
+
export interface VacationResponderState {
|
|
172
|
+
enabled: boolean;
|
|
173
|
+
responseSubject?: string;
|
|
174
|
+
message?: string;
|
|
175
|
+
startTime?: string;
|
|
176
|
+
endTime?: string;
|
|
177
|
+
contactsOnly?: boolean;
|
|
178
|
+
domainOnly?: boolean;
|
|
179
|
+
}
|
|
180
|
+
export interface SendAsAlias {
|
|
181
|
+
sendAsEmail: string;
|
|
182
|
+
displayName?: string;
|
|
183
|
+
replyToAddress?: string;
|
|
184
|
+
signature?: string;
|
|
185
|
+
isPrimary?: boolean;
|
|
186
|
+
isDefault?: boolean;
|
|
187
|
+
verificationStatus?: string;
|
|
188
|
+
}
|
|
153
189
|
export interface GetGmailSettingsResponse {
|
|
154
190
|
profile: {
|
|
155
191
|
emailAddress: string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meet module entry point.
|
|
3
|
+
* Exports types, scopes, and initialization functions for the Google Meet module.
|
|
4
|
+
*/
|
|
5
|
+
export * from './types.js';
|
|
6
|
+
export { MEET_SCOPES, registerMeetScopes } from './scopes.js';
|
|
7
|
+
/**
|
|
8
|
+
* Initialize the Meet module.
|
|
9
|
+
* This function is called during server startup to set up any required resources.
|
|
10
|
+
*/
|
|
11
|
+
export declare function initializeMeetModule(): Promise<void>;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meet module entry point.
|
|
3
|
+
* Exports types, scopes, and initialization functions for the Google Meet module.
|
|
4
|
+
*/
|
|
5
|
+
// Export types
|
|
6
|
+
export * from './types.js';
|
|
7
|
+
// Export scopes
|
|
8
|
+
export { MEET_SCOPES, registerMeetScopes } from './scopes.js';
|
|
9
|
+
/**
|
|
10
|
+
* Initialize the Meet module.
|
|
11
|
+
* This function is called during server startup to set up any required resources.
|
|
12
|
+
*/
|
|
13
|
+
export async function initializeMeetModule() {
|
|
14
|
+
// Currently no async initialization needed
|
|
15
|
+
// This function is a placeholder for future initialization logic
|
|
16
|
+
return Promise.resolve();
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const MEET_SCOPES: {
|
|
2
|
+
MEETINGS_SPACE_READONLY: string;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Register Google Meet OAuth scopes at startup.
|
|
6
|
+
* Auth issues will be handled via 401/403 responses rather than pre-validation.
|
|
7
|
+
*/
|
|
8
|
+
export declare function registerMeetScopes(): void;
|
|
9
|
+
//# sourceMappingURL=scopes.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { scopeRegistry } from "../tools/scope-registry.js";
|
|
2
|
+
// Define Google Meet scopes as constants for reuse and testing
|
|
3
|
+
// Reference: https://developers.google.com/workspace/meet/api/guides/authenticate-authorize
|
|
4
|
+
export const MEET_SCOPES = {
|
|
5
|
+
// Read-only access to conference records, transcripts, and transcript entries.
|
|
6
|
+
// This single scope covers every read method used by this module:
|
|
7
|
+
// conferenceRecords.list, conferenceRecords.transcripts.list, and
|
|
8
|
+
// conferenceRecords.transcripts.entries.list.
|
|
9
|
+
MEETINGS_SPACE_READONLY: "https://www.googleapis.com/auth/meetings.space.readonly",
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Register Google Meet OAuth scopes at startup.
|
|
13
|
+
* Auth issues will be handled via 401/403 responses rather than pre-validation.
|
|
14
|
+
*/
|
|
15
|
+
export function registerMeetScopes() {
|
|
16
|
+
scopeRegistry.registerScope("meet", MEET_SCOPES.MEETINGS_SPACE_READONLY);
|
|
17
|
+
// Verify all scopes are registered
|
|
18
|
+
const registeredScopes = scopeRegistry.getAllScopes();
|
|
19
|
+
const requiredScopes = Object.values(MEET_SCOPES);
|
|
20
|
+
const missingScopes = requiredScopes.filter((scope) => !registeredScopes.includes(scope));
|
|
21
|
+
if (missingScopes.length > 0) {
|
|
22
|
+
throw new Error(`Failed to register Meet scopes: ${missingScopes.join(", ")}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=scopes.js.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parameters for listing conference records.
|
|
3
|
+
*/
|
|
4
|
+
export interface ListConferenceRecordsParams {
|
|
5
|
+
email: string;
|
|
6
|
+
pageSize?: number;
|
|
7
|
+
pageToken?: string;
|
|
8
|
+
filter?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Parameters for listing transcripts of a conference record.
|
|
12
|
+
*/
|
|
13
|
+
export interface ListTranscriptsParams {
|
|
14
|
+
email: string;
|
|
15
|
+
parent: string;
|
|
16
|
+
pageSize?: number;
|
|
17
|
+
pageToken?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Parameters for listing the entries (speaker + text) of one transcript.
|
|
21
|
+
*/
|
|
22
|
+
export interface ListTranscriptEntriesParams {
|
|
23
|
+
email: string;
|
|
24
|
+
parent: string;
|
|
25
|
+
pageSize?: number;
|
|
26
|
+
pageToken?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A single instance of a meeting held in a space.
|
|
30
|
+
* Based on Meet API v2 ConferenceRecord resource.
|
|
31
|
+
* Reference: https://developers.google.com/workspace/meet/api/reference/rest/v2/conferenceRecords
|
|
32
|
+
*/
|
|
33
|
+
export interface ConferenceRecord {
|
|
34
|
+
name?: string;
|
|
35
|
+
space?: string;
|
|
36
|
+
startTime?: string;
|
|
37
|
+
endTime?: string;
|
|
38
|
+
expireTime?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Response structure for listing conference records.
|
|
42
|
+
*/
|
|
43
|
+
export interface ListConferenceRecordsResponse {
|
|
44
|
+
conferenceRecords?: ConferenceRecord[];
|
|
45
|
+
nextPageToken?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A transcript session of a conference.
|
|
49
|
+
* Based on Meet API v2 Transcript resource.
|
|
50
|
+
* Reference: https://developers.google.com/workspace/meet/api/reference/rest/v2/conferenceRecords.transcripts
|
|
51
|
+
*/
|
|
52
|
+
export interface Transcript {
|
|
53
|
+
name?: string;
|
|
54
|
+
state?: string;
|
|
55
|
+
startTime?: string;
|
|
56
|
+
endTime?: string;
|
|
57
|
+
docsDestination?: {
|
|
58
|
+
document?: string;
|
|
59
|
+
exportUri?: string;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Response structure for listing transcripts.
|
|
64
|
+
*/
|
|
65
|
+
export interface ListTranscriptsResponse {
|
|
66
|
+
transcripts?: Transcript[];
|
|
67
|
+
nextPageToken?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* A single entry (one speaker's utterance) of a transcript session.
|
|
71
|
+
* Based on Meet API v2 TranscriptEntry resource.
|
|
72
|
+
* Reference: https://developers.google.com/workspace/meet/api/reference/rest/v2/conferenceRecords.transcripts.entries
|
|
73
|
+
*/
|
|
74
|
+
export interface TranscriptEntry {
|
|
75
|
+
name?: string;
|
|
76
|
+
participant?: string;
|
|
77
|
+
text?: string;
|
|
78
|
+
languageCode?: string;
|
|
79
|
+
startTime?: string;
|
|
80
|
+
endTime?: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Response structure for listing transcript entries.
|
|
84
|
+
*/
|
|
85
|
+
export interface ListTranscriptEntriesResponse {
|
|
86
|
+
transcriptEntries?: TranscriptEntry[];
|
|
87
|
+
nextPageToken?: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Base error class for Meet service.
|
|
91
|
+
*/
|
|
92
|
+
export declare class MeetError extends Error {
|
|
93
|
+
code: string;
|
|
94
|
+
details?: string;
|
|
95
|
+
constructor(message: string, code: string, details?: string);
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base error class for Meet service.
|
|
3
|
+
*/
|
|
4
|
+
export class MeetError extends Error {
|
|
5
|
+
code;
|
|
6
|
+
details;
|
|
7
|
+
constructor(message, code, details) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = "MeetError";
|
|
10
|
+
this.code = code;
|
|
11
|
+
this.details = details;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=types.js.map
|