@aaronsb/google-workspace-mcp 2.0.0-alpha.4 → 2.0.0-alpha.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/build/__tests__/accounts/credentials.test.js +28 -30
- package/build/__tests__/accounts/credentials.test.js.map +1 -1
- package/build/__tests__/accounts/oauth.test.d.ts +1 -0
- package/build/__tests__/accounts/oauth.test.js +71 -0
- package/build/__tests__/accounts/oauth.test.js.map +1 -0
- package/build/__tests__/accounts/token-service.test.d.ts +1 -0
- package/build/__tests__/accounts/token-service.test.js +126 -0
- package/build/__tests__/accounts/token-service.test.js.map +1 -0
- package/build/__tests__/executor/gws.test.js +15 -6
- package/build/__tests__/executor/gws.test.js.map +1 -1
- package/build/__tests__/factory/generator.test.js +2 -1
- package/build/__tests__/factory/generator.test.js.map +1 -1
- package/build/__tests__/factory/patch-coverage.test.js +14 -0
- package/build/__tests__/factory/patch-coverage.test.js.map +1 -1
- package/build/__tests__/integration/executor.test.js +4 -12
- package/build/__tests__/integration/executor.test.js.map +1 -1
- package/build/__tests__/server/formatting/markdown.test.js +59 -4
- package/build/__tests__/server/formatting/markdown.test.js.map +1 -1
- package/build/__tests__/server/handlers/accounts.test.js +9 -7
- package/build/__tests__/server/handlers/accounts.test.js.map +1 -1
- package/build/__tests__/server/handlers/email.test.js +1 -1
- package/build/__tests__/server/handlers/email.test.js.map +1 -1
- package/build/__tests__/services/gmail/mime.test.d.ts +1 -0
- package/build/__tests__/services/gmail/mime.test.js +183 -0
- package/build/__tests__/services/gmail/mime.test.js.map +1 -0
- package/build/__tests__/services/meet/patch.test.d.ts +4 -0
- package/build/__tests__/services/meet/patch.test.js +374 -0
- package/build/__tests__/services/meet/patch.test.js.map +1 -0
- package/build/accounts/auth.d.ts +13 -7
- package/build/accounts/auth.js +48 -84
- package/build/accounts/auth.js.map +1 -1
- package/build/accounts/credentials.d.ts +2 -1
- package/build/accounts/credentials.js +13 -7
- package/build/accounts/credentials.js.map +1 -1
- package/build/accounts/index.d.ts +3 -1
- package/build/accounts/index.js +3 -1
- package/build/accounts/index.js.map +1 -1
- package/build/accounts/oauth.d.ts +26 -0
- package/build/accounts/oauth.js +175 -0
- package/build/accounts/oauth.js.map +1 -0
- package/build/accounts/registry.js.map +1 -1
- package/build/accounts/token-service.d.ts +18 -0
- package/build/accounts/token-service.js +90 -0
- package/build/accounts/token-service.js.map +1 -0
- package/build/executor/gws.js +4 -3
- package/build/executor/gws.js.map +1 -1
- package/build/executor/paths.js +3 -2
- package/build/executor/paths.js.map +1 -1
- package/build/executor/workspace.js +1 -0
- package/build/executor/workspace.js.map +1 -1
- package/build/factory/generator.js.map +1 -1
- package/build/factory/manifest.yaml +176 -6
- package/build/factory/patches.js +2 -0
- package/build/factory/patches.js.map +1 -1
- package/build/index.js +0 -0
- package/build/server/formatting/markdown.d.ts +5 -0
- package/build/server/formatting/markdown.js +102 -3
- package/build/server/formatting/markdown.js.map +1 -1
- package/build/server/formatting/next-steps.js +30 -0
- package/build/server/formatting/next-steps.js.map +1 -1
- package/build/server/handlers/accounts.js +5 -4
- package/build/server/handlers/accounts.js.map +1 -1
- package/build/server/handlers/email.js +5 -1
- package/build/server/handlers/email.js.map +1 -1
- package/build/server/server.js +13 -15
- package/build/server/server.js.map +1 -1
- package/build/services/gmail/mime.d.ts +29 -0
- package/build/services/gmail/mime.js +138 -0
- package/build/services/gmail/mime.js.map +1 -0
- package/build/services/gmail/patch.js +66 -13
- package/build/services/gmail/patch.js.map +1 -1
- package/build/services/meet/patch.d.ts +12 -0
- package/build/services/meet/patch.js +461 -0
- package/build/services/meet/patch.js.map +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meet patch tests — formatters and custom handlers.
|
|
3
|
+
*/
|
|
4
|
+
jest.mock('../../../executor/gws.js');
|
|
5
|
+
import { execute } from '../../../executor/gws.js';
|
|
6
|
+
const mockExecute = execute;
|
|
7
|
+
import { meetPatch } from '../../../services/meet/patch.js';
|
|
8
|
+
function ctx(operation, params = {}) {
|
|
9
|
+
return { operation, params, account: 'user@test.com' };
|
|
10
|
+
}
|
|
11
|
+
describe('Meet patch formatters', () => {
|
|
12
|
+
describe('formatList', () => {
|
|
13
|
+
it('formats conference list with meeting codes and times', () => {
|
|
14
|
+
const data = {
|
|
15
|
+
conferenceRecords: [
|
|
16
|
+
{
|
|
17
|
+
name: 'conferenceRecords/abc123',
|
|
18
|
+
space: { meetingCode: 'abc-mnop-xyz' },
|
|
19
|
+
startTime: '2026-03-18T14:00:00Z',
|
|
20
|
+
endTime: '2026-03-18T15:00:00Z',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'conferenceRecords/def456',
|
|
24
|
+
space: { meetingCode: 'def-ghij-klm' },
|
|
25
|
+
startTime: '2026-03-17T10:00:00Z',
|
|
26
|
+
endTime: '2026-03-17T10:30:00Z',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
const result = meetPatch.formatList(data, ctx('listConferences'));
|
|
31
|
+
expect(result.text).toContain('Conferences (2)');
|
|
32
|
+
expect(result.text).toContain('abc-mnop-xyz');
|
|
33
|
+
expect(result.text).toContain('def-ghij-klm');
|
|
34
|
+
expect(result.text).toContain('1h');
|
|
35
|
+
expect(result.text).toContain('30m');
|
|
36
|
+
expect(result.refs.count).toBe(2);
|
|
37
|
+
expect(result.refs.conferenceId).toBe('abc123');
|
|
38
|
+
});
|
|
39
|
+
it('handles empty conference list', () => {
|
|
40
|
+
const result = meetPatch.formatList({ conferenceRecords: [] }, ctx('listConferences'));
|
|
41
|
+
expect(result.text).toContain('No conferences found');
|
|
42
|
+
expect(result.refs.count).toBe(0);
|
|
43
|
+
});
|
|
44
|
+
it('formats participant list with display names', () => {
|
|
45
|
+
const data = {
|
|
46
|
+
participants: [
|
|
47
|
+
{
|
|
48
|
+
signedinUser: { displayName: 'Alice Smith', user: 'users/alice@test.com' },
|
|
49
|
+
earliestStartTime: '2026-03-18T14:00:00Z',
|
|
50
|
+
latestEndTime: '2026-03-18T15:00:00Z',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
anonymousUser: { displayName: 'Anonymous Panda' },
|
|
54
|
+
earliestStartTime: '2026-03-18T14:05:00Z',
|
|
55
|
+
latestEndTime: '2026-03-18T14:45:00Z',
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
const result = meetPatch.formatList(data, ctx('listParticipants'));
|
|
60
|
+
expect(result.text).toContain('Participants (2)');
|
|
61
|
+
expect(result.text).toContain('Alice Smith');
|
|
62
|
+
expect(result.text).toContain('Anonymous Panda');
|
|
63
|
+
expect(result.refs.count).toBe(2);
|
|
64
|
+
});
|
|
65
|
+
it('handles empty participant list', () => {
|
|
66
|
+
const result = meetPatch.formatList({ participants: [] }, ctx('listParticipants'));
|
|
67
|
+
expect(result.text).toContain('No participants found');
|
|
68
|
+
});
|
|
69
|
+
it('formats transcript list', () => {
|
|
70
|
+
const data = {
|
|
71
|
+
transcripts: [
|
|
72
|
+
{
|
|
73
|
+
name: 'conferenceRecords/abc123/transcripts/t1',
|
|
74
|
+
state: 'ENDED',
|
|
75
|
+
startTime: '2026-03-18T14:00:00Z',
|
|
76
|
+
endTime: '2026-03-18T15:00:00Z',
|
|
77
|
+
docsDestination: { exportUri: 'https://docs.google.com/doc/abc' },
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
};
|
|
81
|
+
const result = meetPatch.formatList(data, ctx('listTranscripts'));
|
|
82
|
+
expect(result.text).toContain('Transcripts (1)');
|
|
83
|
+
expect(result.text).toContain('ENDED');
|
|
84
|
+
expect(result.text).toContain('Docs');
|
|
85
|
+
expect(result.refs.transcriptName).toContain('transcripts/t1');
|
|
86
|
+
});
|
|
87
|
+
it('formats transcript entries with who-said-what collapsed by speaker', () => {
|
|
88
|
+
const data = {
|
|
89
|
+
transcriptEntries: [
|
|
90
|
+
{ participantDisplayName: 'Alice Smith', text: 'Hello everyone', startTime: '2026-03-18T14:01:00Z' },
|
|
91
|
+
{ participantDisplayName: 'Alice Smith', text: 'Lets get started', startTime: '2026-03-18T14:01:05Z' },
|
|
92
|
+
{ participantDisplayName: 'Bob Jones', text: 'Hi Alice', startTime: '2026-03-18T14:01:30Z' },
|
|
93
|
+
],
|
|
94
|
+
};
|
|
95
|
+
const result = meetPatch.formatList(data, ctx('listTranscriptEntries'));
|
|
96
|
+
expect(result.text).toContain('Transcript (3 entries)');
|
|
97
|
+
// Alice's lines should be collapsed into one block
|
|
98
|
+
expect(result.text).toContain('**Alice Smith**');
|
|
99
|
+
expect(result.text).toContain('Hello everyone\nLets get started');
|
|
100
|
+
expect(result.text).toContain('**Bob Jones**');
|
|
101
|
+
expect(result.refs.count).toBe(3);
|
|
102
|
+
});
|
|
103
|
+
it('formats recording list', () => {
|
|
104
|
+
const data = {
|
|
105
|
+
recordings: [
|
|
106
|
+
{
|
|
107
|
+
name: 'conferenceRecords/abc123/recordings/r1',
|
|
108
|
+
state: 'FILE_GENERATED',
|
|
109
|
+
startTime: '2026-03-18T14:00:00Z',
|
|
110
|
+
endTime: '2026-03-18T15:00:00Z',
|
|
111
|
+
driveDestination: { exportUri: 'https://drive.google.com/file/abc' },
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
};
|
|
115
|
+
const result = meetPatch.formatList(data, ctx('listRecordings'));
|
|
116
|
+
expect(result.text).toContain('Recordings (1)');
|
|
117
|
+
expect(result.text).toContain('FILE_GENERATED');
|
|
118
|
+
expect(result.text).toContain('Drive');
|
|
119
|
+
expect(result.refs.recordingName).toContain('recordings/r1');
|
|
120
|
+
});
|
|
121
|
+
it('formats smart notes list', () => {
|
|
122
|
+
const data = {
|
|
123
|
+
smartNotes: [
|
|
124
|
+
{
|
|
125
|
+
name: 'conferenceRecords/abc123/smartNotes/sn1',
|
|
126
|
+
state: 'ENDED',
|
|
127
|
+
docsDestination: { exportUri: 'https://docs.google.com/doc/sn1' },
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
};
|
|
131
|
+
const result = meetPatch.formatList(data, ctx('listSmartNotes'));
|
|
132
|
+
expect(result.text).toContain('Smart Notes (1)');
|
|
133
|
+
expect(result.text).toContain('Docs');
|
|
134
|
+
expect(result.refs.smartNoteName).toContain('smartNotes/sn1');
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
describe('formatDetail', () => {
|
|
138
|
+
it('formats conference detail with meeting code and duration', () => {
|
|
139
|
+
const data = {
|
|
140
|
+
name: 'conferenceRecords/abc123',
|
|
141
|
+
space: { meetingCode: 'abc-mnop-xyz' },
|
|
142
|
+
startTime: '2026-03-18T14:00:00Z',
|
|
143
|
+
endTime: '2026-03-18T15:30:00Z',
|
|
144
|
+
expireTime: '2026-03-25T15:30:00Z',
|
|
145
|
+
};
|
|
146
|
+
const result = meetPatch.formatDetail(data, ctx('getConference'));
|
|
147
|
+
expect(result.text).toContain('Conference abc123');
|
|
148
|
+
expect(result.text).toContain('abc-mnop-xyz');
|
|
149
|
+
expect(result.text).toContain('1h 30m');
|
|
150
|
+
expect(result.refs.conferenceId).toBe('abc123');
|
|
151
|
+
expect(result.refs.meetingCode).toBe('abc-mnop-xyz');
|
|
152
|
+
});
|
|
153
|
+
it('formats other detail types with generic key/value', () => {
|
|
154
|
+
const data = {
|
|
155
|
+
name: 'conferenceRecords/abc123/recordings/r1',
|
|
156
|
+
state: 'FILE_GENERATED',
|
|
157
|
+
};
|
|
158
|
+
const result = meetPatch.formatDetail(data, ctx('getRecording'));
|
|
159
|
+
expect(result.text).toContain('Recording');
|
|
160
|
+
expect(result.text).toContain('FILE_GENERATED');
|
|
161
|
+
expect(result.refs.name).toContain('recordings/r1');
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
describe('Meet beforeExecute hooks', () => {
|
|
166
|
+
it('prefixes conferenceRecords/ on bare parent IDs', async () => {
|
|
167
|
+
const hook = meetPatch.beforeExecute.listParticipants;
|
|
168
|
+
const args = ['meet', 'conferenceRecords', 'participants', 'list', '--params', '{"parent":"abc123","pageSize":100}'];
|
|
169
|
+
const result = await hook(args, ctx('listParticipants', { conferenceId: 'abc123' }));
|
|
170
|
+
const params = JSON.parse(result[result.indexOf('--params') + 1]);
|
|
171
|
+
expect(params.parent).toBe('conferenceRecords/abc123');
|
|
172
|
+
});
|
|
173
|
+
it('does not double-prefix already-prefixed parent IDs', async () => {
|
|
174
|
+
const hook = meetPatch.beforeExecute.listTranscripts;
|
|
175
|
+
const args = ['meet', 'conferenceRecords', 'transcripts', 'list', '--params', '{"parent":"conferenceRecords/abc123"}'];
|
|
176
|
+
const result = await hook(args, ctx('listTranscripts', { conferenceId: 'conferenceRecords/abc123' }));
|
|
177
|
+
const params = JSON.parse(result[result.indexOf('--params') + 1]);
|
|
178
|
+
expect(params.parent).toBe('conferenceRecords/abc123');
|
|
179
|
+
});
|
|
180
|
+
it('prefixes conferenceRecords/ on bare name IDs for getConference', async () => {
|
|
181
|
+
const hook = meetPatch.beforeExecute.getConference;
|
|
182
|
+
const args = ['meet', 'conferenceRecords', 'get', '--params', '{"name":"abc123"}'];
|
|
183
|
+
const result = await hook(args, ctx('getConference', { conferenceId: 'abc123' }));
|
|
184
|
+
const params = JSON.parse(result[result.indexOf('--params') + 1]);
|
|
185
|
+
expect(params.name).toBe('conferenceRecords/abc123');
|
|
186
|
+
});
|
|
187
|
+
it('returns args unchanged when --params is missing', async () => {
|
|
188
|
+
const hook = meetPatch.beforeExecute.listParticipants;
|
|
189
|
+
const args = ['meet', 'conferenceRecords', 'participants', 'list'];
|
|
190
|
+
const result = await hook(args, ctx('listParticipants'));
|
|
191
|
+
expect(result).toEqual(args);
|
|
192
|
+
});
|
|
193
|
+
it('returns args unchanged when --params has no following value', async () => {
|
|
194
|
+
const hook = meetPatch.beforeExecute.listRecordings;
|
|
195
|
+
const args = ['meet', 'conferenceRecords', 'recordings', 'list', '--params'];
|
|
196
|
+
const result = await hook(args, ctx('listRecordings'));
|
|
197
|
+
expect(result).toEqual(args);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
describe('Meet custom handlers', () => {
|
|
201
|
+
beforeEach(() => mockExecute.mockReset());
|
|
202
|
+
describe('getFullTranscript', () => {
|
|
203
|
+
it('chains transcripts.list, entries.list, and participants.list to resolve names', async () => {
|
|
204
|
+
// Step 1: transcripts.list
|
|
205
|
+
mockExecute.mockResolvedValueOnce({
|
|
206
|
+
success: true,
|
|
207
|
+
stderr: '',
|
|
208
|
+
data: {
|
|
209
|
+
transcripts: [{
|
|
210
|
+
name: 'conferenceRecords/abc123/transcripts/t1',
|
|
211
|
+
docsDestination: { exportUri: 'https://docs.google.com/doc/abc' },
|
|
212
|
+
}],
|
|
213
|
+
},
|
|
214
|
+
});
|
|
215
|
+
// Step 2 (parallel): entries.list
|
|
216
|
+
mockExecute.mockResolvedValueOnce({
|
|
217
|
+
success: true,
|
|
218
|
+
stderr: '',
|
|
219
|
+
data: {
|
|
220
|
+
transcriptEntries: [
|
|
221
|
+
{ participant: 'conferenceRecords/abc123/participants/111', text: 'Hello', startTime: '2026-03-18T14:01:00Z' },
|
|
222
|
+
{ participant: 'conferenceRecords/abc123/participants/222', text: 'Hi there', startTime: '2026-03-18T14:01:30Z' },
|
|
223
|
+
],
|
|
224
|
+
},
|
|
225
|
+
});
|
|
226
|
+
// Step 2 (parallel): participants.list
|
|
227
|
+
mockExecute.mockResolvedValueOnce({
|
|
228
|
+
success: true,
|
|
229
|
+
stderr: '',
|
|
230
|
+
data: {
|
|
231
|
+
participants: [
|
|
232
|
+
{ name: 'conferenceRecords/abc123/participants/111', signedinUser: { displayName: 'Alice Smith' } },
|
|
233
|
+
{ name: 'conferenceRecords/abc123/participants/222', signedinUser: { displayName: 'Bob Jones' } },
|
|
234
|
+
],
|
|
235
|
+
},
|
|
236
|
+
});
|
|
237
|
+
const handler = meetPatch.customHandlers.getFullTranscript;
|
|
238
|
+
const result = await handler({ conferenceId: 'abc123', email: 'user@test.com' }, 'user@test.com');
|
|
239
|
+
expect(result.text).toContain('Transcript (2 entries)');
|
|
240
|
+
expect(result.text).toContain('**Alice Smith**');
|
|
241
|
+
expect(result.text).toContain('Hello');
|
|
242
|
+
expect(result.text).toContain('**Bob Jones**');
|
|
243
|
+
expect(result.text).toContain('Hi there');
|
|
244
|
+
expect(result.text).toContain('Google Docs');
|
|
245
|
+
expect(result.refs.conferenceId).toBe('abc123');
|
|
246
|
+
expect(result.refs.count).toBe(2);
|
|
247
|
+
// No nextPageToken = last page, so Docs link shown
|
|
248
|
+
expect(result.refs.nextPageToken).toBeNull();
|
|
249
|
+
// Verify the chained calls (3 total: transcripts, then entries + participants in parallel)
|
|
250
|
+
expect(mockExecute).toHaveBeenCalledTimes(3);
|
|
251
|
+
});
|
|
252
|
+
it('paginates with nextPageToken and shows continue prompt', async () => {
|
|
253
|
+
mockExecute.mockResolvedValueOnce({
|
|
254
|
+
success: true, stderr: '',
|
|
255
|
+
data: {
|
|
256
|
+
transcripts: [{
|
|
257
|
+
name: 'conferenceRecords/abc123/transcripts/t1',
|
|
258
|
+
docsDestination: { exportUri: 'https://docs.google.com/doc/abc' },
|
|
259
|
+
}],
|
|
260
|
+
},
|
|
261
|
+
});
|
|
262
|
+
mockExecute.mockResolvedValueOnce({
|
|
263
|
+
success: true, stderr: '',
|
|
264
|
+
data: {
|
|
265
|
+
transcriptEntries: [
|
|
266
|
+
{ participant: 'conferenceRecords/abc123/participants/111', text: 'Page one', startTime: '2026-03-18T14:01:00Z' },
|
|
267
|
+
],
|
|
268
|
+
nextPageToken: 'tok_page2',
|
|
269
|
+
},
|
|
270
|
+
});
|
|
271
|
+
mockExecute.mockResolvedValueOnce({
|
|
272
|
+
success: true, stderr: '',
|
|
273
|
+
data: { participants: [
|
|
274
|
+
{ name: 'conferenceRecords/abc123/participants/111', signedinUser: { displayName: 'Alice' } },
|
|
275
|
+
] },
|
|
276
|
+
});
|
|
277
|
+
const handler = meetPatch.customHandlers.getFullTranscript;
|
|
278
|
+
const result = await handler({ conferenceId: 'abc123', email: 'user@test.com' }, 'user@test.com');
|
|
279
|
+
// First page: shows Docs link + continue prompt
|
|
280
|
+
expect(result.text).toContain('Google Docs');
|
|
281
|
+
expect(result.text).toContain('More entries available');
|
|
282
|
+
expect(result.text).toContain('tok_page2');
|
|
283
|
+
expect(result.refs.nextPageToken).toBe('tok_page2');
|
|
284
|
+
});
|
|
285
|
+
it('passes pageToken to entries API when continuing', async () => {
|
|
286
|
+
mockExecute.mockResolvedValueOnce({
|
|
287
|
+
success: true, stderr: '',
|
|
288
|
+
data: {
|
|
289
|
+
transcripts: [{
|
|
290
|
+
name: 'conferenceRecords/abc123/transcripts/t1',
|
|
291
|
+
docsDestination: { exportUri: 'https://docs.google.com/doc/abc' },
|
|
292
|
+
}],
|
|
293
|
+
},
|
|
294
|
+
});
|
|
295
|
+
mockExecute.mockResolvedValueOnce({
|
|
296
|
+
success: true, stderr: '',
|
|
297
|
+
data: {
|
|
298
|
+
transcriptEntries: [
|
|
299
|
+
{ participant: 'conferenceRecords/abc123/participants/111', text: 'Last page', startTime: '2026-03-18T14:10:00Z' },
|
|
300
|
+
],
|
|
301
|
+
},
|
|
302
|
+
});
|
|
303
|
+
mockExecute.mockResolvedValueOnce({
|
|
304
|
+
success: true, stderr: '',
|
|
305
|
+
data: { participants: [
|
|
306
|
+
{ name: 'conferenceRecords/abc123/participants/111', signedinUser: { displayName: 'Alice' } },
|
|
307
|
+
] },
|
|
308
|
+
});
|
|
309
|
+
const handler = meetPatch.customHandlers.getFullTranscript;
|
|
310
|
+
const result = await handler({ conferenceId: 'abc123', email: 'user@test.com', pageToken: 'tok_page2' }, 'user@test.com');
|
|
311
|
+
// Verify pageToken was passed to entries call
|
|
312
|
+
const entriesArgs = mockExecute.mock.calls[1][0];
|
|
313
|
+
const entriesParams = JSON.parse(entriesArgs[entriesArgs.indexOf('--params') + 1]);
|
|
314
|
+
expect(entriesParams.pageToken).toBe('tok_page2');
|
|
315
|
+
// Last page (no nextPageToken): shows Docs link, no continue prompt
|
|
316
|
+
expect(result.text).toContain('Google Docs');
|
|
317
|
+
expect(result.text).not.toContain('More entries available');
|
|
318
|
+
expect(result.refs.nextPageToken).toBeNull();
|
|
319
|
+
});
|
|
320
|
+
it('returns helpful message when no transcripts exist', async () => {
|
|
321
|
+
mockExecute.mockResolvedValueOnce({
|
|
322
|
+
success: true,
|
|
323
|
+
stderr: '',
|
|
324
|
+
data: { transcripts: [] },
|
|
325
|
+
});
|
|
326
|
+
const handler = meetPatch.customHandlers.getFullTranscript;
|
|
327
|
+
const result = await handler({ conferenceId: 'abc123', email: 'user@test.com' }, 'user@test.com');
|
|
328
|
+
expect(result.text).toContain('No transcripts found');
|
|
329
|
+
expect(result.text).toContain('Business Standard');
|
|
330
|
+
expect(result.refs.count).toBe(0);
|
|
331
|
+
});
|
|
332
|
+
it('handles transcript with no entries yet', async () => {
|
|
333
|
+
mockExecute.mockResolvedValueOnce({
|
|
334
|
+
success: true,
|
|
335
|
+
stderr: '',
|
|
336
|
+
data: {
|
|
337
|
+
transcripts: [{ name: 'conferenceRecords/abc123/transcripts/t1' }],
|
|
338
|
+
},
|
|
339
|
+
});
|
|
340
|
+
// entries.list (parallel)
|
|
341
|
+
mockExecute.mockResolvedValueOnce({
|
|
342
|
+
success: true,
|
|
343
|
+
stderr: '',
|
|
344
|
+
data: { transcriptEntries: [] },
|
|
345
|
+
});
|
|
346
|
+
// participants.list (parallel)
|
|
347
|
+
mockExecute.mockResolvedValueOnce({
|
|
348
|
+
success: true,
|
|
349
|
+
stderr: '',
|
|
350
|
+
data: { participants: [] },
|
|
351
|
+
});
|
|
352
|
+
const handler = meetPatch.customHandlers.getFullTranscript;
|
|
353
|
+
const result = await handler({ conferenceId: 'abc123', email: 'user@test.com' }, 'user@test.com');
|
|
354
|
+
expect(result.text).toContain('no entries available');
|
|
355
|
+
expect(result.text).toContain('processing');
|
|
356
|
+
});
|
|
357
|
+
it('throws when conferenceId is missing', async () => {
|
|
358
|
+
const handler = meetPatch.customHandlers.getFullTranscript;
|
|
359
|
+
await expect(handler({}, 'user@test.com')).rejects.toThrow('conferenceId is required');
|
|
360
|
+
});
|
|
361
|
+
it('handles conferenceId with or without prefix', async () => {
|
|
362
|
+
// With prefix
|
|
363
|
+
mockExecute.mockResolvedValueOnce({
|
|
364
|
+
success: true, stderr: '',
|
|
365
|
+
data: { transcripts: [] },
|
|
366
|
+
});
|
|
367
|
+
const handler = meetPatch.customHandlers.getFullTranscript;
|
|
368
|
+
await handler({ conferenceId: 'conferenceRecords/abc123', email: 'user@test.com' }, 'user@test.com');
|
|
369
|
+
const params = JSON.parse(mockExecute.mock.calls[0][0][mockExecute.mock.calls[0][0].indexOf('--params') + 1]);
|
|
370
|
+
expect(params.parent).toBe('conferenceRecords/abc123');
|
|
371
|
+
});
|
|
372
|
+
});
|
|
373
|
+
});
|
|
374
|
+
//# sourceMappingURL=patch.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch.test.js","sourceRoot":"","sources":["../../../../src/__tests__/services/meet/patch.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,MAAM,WAAW,GAAG,OAA8C,CAAC;AAEnE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAG5D,SAAS,GAAG,CAAC,SAAiB,EAAE,SAAkC,EAAE;IAClE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;AACzD,CAAC;AAED,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;QAC1B,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;YAC9D,MAAM,IAAI,GAAG;gBACX,iBAAiB,EAAE;oBACjB;wBACE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accounts/auth.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export interface AuthResult {
|
|
|
3
3
|
account?: string;
|
|
4
4
|
credentialPath?: string;
|
|
5
5
|
error?: string;
|
|
6
|
+
errorType?: string;
|
|
6
7
|
}
|
|
7
8
|
export interface AccountStatus {
|
|
8
9
|
email: string;
|
|
@@ -12,13 +13,18 @@ export interface AccountStatus {
|
|
|
12
13
|
hasRefreshToken: boolean;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* Note: `gws auth status` is single-account (keyring-based) and ignores
|
|
19
|
-
* GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE. We bypass it entirely and
|
|
20
|
-
* validate against our own per-account credential files.
|
|
16
|
+
* Authenticate a new account via our own OAuth2 flow.
|
|
17
|
+
* Requests all service scopes by default.
|
|
21
18
|
*/
|
|
22
|
-
export declare function checkAccountStatus(email: string): Promise<AccountStatus>;
|
|
23
19
|
export declare function authenticateAccount(clientId: string, clientSecret: string): Promise<AuthResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Re-authenticate with a specific set of services.
|
|
22
|
+
* Used by the `scopes` operation as an escape hatch.
|
|
23
|
+
*/
|
|
24
24
|
export declare function reauthWithServices(clientId: string, clientSecret: string, services: string): Promise<AuthResult>;
|
|
25
|
+
/**
|
|
26
|
+
* Check account status: token validity and granted scopes.
|
|
27
|
+
* Reads scopes from the credential file (per-account, not from gws keyring).
|
|
28
|
+
* Validates token by attempting a refresh via the token service.
|
|
29
|
+
*/
|
|
30
|
+
export declare function checkAccountStatus(email: string): Promise<AccountStatus>;
|
package/build/accounts/auth.js
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { readCredential, saveCredential, hasCredential } from './credentials.js';
|
|
2
|
+
import { credentialPath } from '../executor/paths.js';
|
|
3
|
+
import { runOAuthFlow, scopesForServices, ALL_SERVICES } from './oauth.js';
|
|
4
|
+
import { getAccessToken, invalidateToken } from './token-service.js';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
* Authenticate a new account via our own OAuth2 flow.
|
|
7
|
+
* Requests all service scopes by default.
|
|
8
|
+
*/
|
|
9
|
+
export async function authenticateAccount(clientId, clientSecret) {
|
|
10
|
+
const scopes = scopesForServices(ALL_SERVICES);
|
|
11
|
+
return runOAuth(clientId, clientSecret, scopes);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Re-authenticate with a specific set of services.
|
|
15
|
+
* Used by the `scopes` operation as an escape hatch.
|
|
16
|
+
*/
|
|
17
|
+
export async function reauthWithServices(clientId, clientSecret, services) {
|
|
18
|
+
const scopes = scopesForServices(services);
|
|
19
|
+
return runOAuth(clientId, clientSecret, scopes);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Check account status: token validity and granted scopes.
|
|
23
|
+
* Reads scopes from the credential file (per-account, not from gws keyring).
|
|
24
|
+
* Validates token by attempting a refresh via the token service.
|
|
12
25
|
*/
|
|
13
26
|
export async function checkAccountStatus(email) {
|
|
14
27
|
const hasCred = await hasCredential(email);
|
|
@@ -23,29 +36,15 @@ export async function checkAccountStatus(email) {
|
|
|
23
36
|
}
|
|
24
37
|
const cred = await readCredential(email);
|
|
25
38
|
const hasRefreshToken = Boolean(cred.refresh_token);
|
|
26
|
-
|
|
39
|
+
const scopes = cred.scopes ?? [];
|
|
27
40
|
let tokenValid = false;
|
|
28
41
|
try {
|
|
29
|
-
await
|
|
42
|
+
await getAccessToken(email);
|
|
30
43
|
tokenValid = true;
|
|
31
44
|
}
|
|
32
45
|
catch {
|
|
33
46
|
tokenValid = false;
|
|
34
47
|
}
|
|
35
|
-
// Get scopes from gws auth status. These are the scopes granted to the
|
|
36
|
-
// OAuth app, not per-account — gws is single-account so we can't get
|
|
37
|
-
// per-account scopes. But they're useful for showing what services are enabled.
|
|
38
|
-
let scopes = [];
|
|
39
|
-
if (tokenValid) {
|
|
40
|
-
try {
|
|
41
|
-
const statusResult = await execute(['auth', 'status']);
|
|
42
|
-
const statusData = statusResult.data;
|
|
43
|
-
scopes = Array.isArray(statusData.scopes) ? statusData.scopes : [];
|
|
44
|
-
}
|
|
45
|
-
catch {
|
|
46
|
-
// Non-critical — scopes are informational
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
48
|
return {
|
|
50
49
|
email,
|
|
51
50
|
tokenValid,
|
|
@@ -54,65 +53,30 @@ export async function checkAccountStatus(email) {
|
|
|
54
53
|
hasRefreshToken,
|
|
55
54
|
};
|
|
56
55
|
}
|
|
57
|
-
export async function authenticateAccount(clientId, clientSecret) {
|
|
58
|
-
return runAuthLogin(clientId, clientSecret, ['auth', 'login']);
|
|
59
|
-
}
|
|
60
|
-
export async function reauthWithServices(clientId, clientSecret, services) {
|
|
61
|
-
return runAuthLogin(clientId, clientSecret, ['auth', 'login', '-s', services]);
|
|
62
|
-
}
|
|
63
56
|
// --- Internal ---
|
|
64
|
-
function
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const proc = spawn(gwsBinary, args, {
|
|
74
|
-
env,
|
|
75
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
76
|
-
});
|
|
77
|
-
let stdout = '';
|
|
78
|
-
proc.stderr.on('data', (chunk) => {
|
|
79
|
-
const text = chunk.toString();
|
|
80
|
-
const match = text.match(/https:\/\/accounts\.google\.com\S+/);
|
|
81
|
-
if (match)
|
|
82
|
-
openBrowser(match[0]);
|
|
83
|
-
});
|
|
84
|
-
proc.stdout.on('data', (chunk) => { stdout += chunk.toString(); });
|
|
85
|
-
proc.on('error', (err) => {
|
|
86
|
-
reject(new Error(`Failed to spawn gws auth login: ${err.message}`));
|
|
87
|
-
});
|
|
88
|
-
proc.on('close', async (code) => {
|
|
89
|
-
if (code !== 0) {
|
|
90
|
-
resolve({ status: 'error', error: `gws auth login exited with code ${code}` });
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
try {
|
|
94
|
-
const result = JSON.parse(stdout);
|
|
95
|
-
const email = result.account;
|
|
96
|
-
if (!email) {
|
|
97
|
-
resolve({ status: 'error', error: 'No account email in gws auth login response' });
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
const credPath = await exportAndSaveCredential(email);
|
|
101
|
-
resolve({ status: 'success', account: email, credentialPath: credPath });
|
|
102
|
-
}
|
|
103
|
-
catch (err) {
|
|
104
|
-
resolve({ status: 'error', error: `Failed to process auth result: ${err.message}` });
|
|
105
|
-
}
|
|
57
|
+
async function runOAuth(clientId, clientSecret, scopes) {
|
|
58
|
+
try {
|
|
59
|
+
const result = await runOAuthFlow(clientId, clientSecret, scopes);
|
|
60
|
+
await saveCredential(result.email, {
|
|
61
|
+
type: 'authorized_user',
|
|
62
|
+
client_id: clientId,
|
|
63
|
+
client_secret: clientSecret,
|
|
64
|
+
refresh_token: result.refreshToken,
|
|
65
|
+
scopes: result.scopes,
|
|
106
66
|
});
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
67
|
+
invalidateToken(result.email);
|
|
68
|
+
return {
|
|
69
|
+
status: 'success',
|
|
70
|
+
account: result.email,
|
|
71
|
+
credentialPath: credentialPath(result.email),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
return {
|
|
76
|
+
status: 'error',
|
|
77
|
+
error: err.message,
|
|
78
|
+
errorType: err.name,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
117
81
|
}
|
|
118
82
|
//# sourceMappingURL=auth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/accounts/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/accounts/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAkBrE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,QAAgB,EAChB,YAAoB;IAEpB,MAAM,MAAM,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAC/C,OAAO,QAAQ,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;AAClD,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,QAAgB,EAChB,YAAoB,EACpB,QAAgB;IAEhB,MAAM,MAAM,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAC3C,OAAO,QAAQ,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;AAClD,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,KAAa;IACpD,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,KAAK,CAAC,CAAC;IAC3C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO;YACL,KAAK;YACL,UAAU,EAAE,KAAK;YACjB,MAAM,EAAE,EAAE;YACV,UAAU,EAAE,CAAC;YACb,eAAe,EAAE,KAAK;SACvB,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,cAAc,CAAC,KA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@@ -3,9 +3,10 @@ export interface AuthorizedUserCredential {
|
|
|
3
3
|
client_id: string;
|
|
4
4
|
client_secret: string;
|
|
5
5
|
refresh_token: string;
|
|
6
|
+
scopes?: string[];
|
|
6
7
|
}
|
|
7
8
|
export declare function hasCredential(email: string): Promise<boolean>;
|
|
8
|
-
export declare function
|
|
9
|
+
export declare function saveCredential(email: string, credential: AuthorizedUserCredential): Promise<string>;
|
|
9
10
|
export declare function readCredential(email: string): Promise<AuthorizedUserCredential>;
|
|
10
11
|
export declare function removeCredential(email: string): Promise<void>;
|
|
11
12
|
export declare function listCredentials(): Promise<string[]>;
|