@jbctechsolutions/mcp-office365 2.5.1 → 3.0.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 +32 -0
- package/dist/approval/token-manager.d.ts +28 -16
- package/dist/approval/token-manager.d.ts.map +1 -1
- package/dist/approval/token-manager.js +125 -37
- package/dist/approval/token-manager.js.map +1 -1
- package/dist/cli.d.ts +17 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +85 -2
- package/dist/cli.js.map +1 -1
- package/dist/graph/auth/config.d.ts +1 -1
- package/dist/graph/auth/config.d.ts.map +1 -1
- package/dist/graph/auth/config.js +5 -1
- package/dist/graph/auth/config.js.map +1 -1
- package/dist/graph/auth/device-code-flow.d.ts +3 -1
- package/dist/graph/auth/device-code-flow.d.ts.map +1 -1
- package/dist/graph/auth/device-code-flow.js +42 -14
- package/dist/graph/auth/device-code-flow.js.map +1 -1
- package/dist/graph/auth/token-cache.js +2 -2
- package/dist/graph/auth/token-cache.js.map +1 -1
- package/dist/graph/client/graph-client.d.ts +36 -8
- package/dist/graph/client/graph-client.d.ts.map +1 -1
- package/dist/graph/client/graph-client.js +128 -36
- package/dist/graph/client/graph-client.js.map +1 -1
- package/dist/graph/repository.d.ts +9 -6
- package/dist/graph/repository.d.ts.map +1 -1
- package/dist/graph/repository.js +63 -66
- package/dist/graph/repository.js.map +1 -1
- package/dist/ids/mint.d.ts +31 -0
- package/dist/ids/mint.d.ts.map +1 -0
- package/dist/ids/mint.js +36 -0
- package/dist/ids/mint.js.map +1 -0
- package/dist/ids/resolver.d.ts +30 -0
- package/dist/ids/resolver.d.ts.map +1 -0
- package/dist/ids/resolver.js +37 -0
- package/dist/ids/resolver.js.map +1 -0
- package/dist/ids/token.d.ts +56 -0
- package/dist/ids/token.d.ts.map +1 -0
- package/dist/ids/token.js +186 -0
- package/dist/ids/token.js.map +1 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +226 -5859
- package/dist/index.js.map +1 -1
- package/dist/registry/all-tools.d.ts +14 -0
- package/dist/registry/all-tools.d.ts.map +1 -0
- package/dist/registry/all-tools.js +64 -0
- package/dist/registry/all-tools.js.map +1 -0
- package/dist/registry/context.d.ts +25 -0
- package/dist/registry/context.d.ts.map +1 -0
- package/dist/registry/context.js +31 -0
- package/dist/registry/context.js.map +1 -0
- package/dist/registry/define-tool.d.ts +15 -0
- package/dist/registry/define-tool.d.ts.map +1 -0
- package/dist/registry/define-tool.js +8 -0
- package/dist/registry/define-tool.js.map +1 -0
- package/dist/registry/index.d.ts +13 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +8 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/registry.d.ts +62 -0
- package/dist/registry/registry.d.ts.map +1 -0
- package/dist/registry/registry.js +134 -0
- package/dist/registry/registry.js.map +1 -0
- package/dist/registry/types.d.ts +98 -0
- package/dist/registry/types.d.ts.map +1 -0
- package/dist/registry/types.js +6 -0
- package/dist/registry/types.js.map +1 -0
- package/dist/search/compiler.d.ts +49 -0
- package/dist/search/compiler.d.ts.map +1 -0
- package/dist/search/compiler.js +168 -0
- package/dist/search/compiler.js.map +1 -0
- package/dist/signature.js +2 -2
- package/dist/signature.js.map +1 -1
- package/dist/state/migrate.d.ts +23 -0
- package/dist/state/migrate.d.ts.map +1 -0
- package/dist/state/migrate.js +81 -0
- package/dist/state/migrate.js.map +1 -0
- package/dist/state/schema.d.ts +27 -0
- package/dist/state/schema.d.ts.map +1 -0
- package/dist/state/schema.js +54 -0
- package/dist/state/schema.js.map +1 -0
- package/dist/state/store.d.ts +152 -0
- package/dist/state/store.d.ts.map +1 -0
- package/dist/state/store.js +317 -0
- package/dist/state/store.js.map +1 -0
- package/dist/tools/accounts.d.ts +37 -0
- package/dist/tools/accounts.d.ts.map +1 -0
- package/dist/tools/accounts.js +68 -0
- package/dist/tools/accounts.js.map +1 -0
- package/dist/tools/calendar-apple.d.ts +39 -0
- package/dist/tools/calendar-apple.d.ts.map +1 -0
- package/dist/tools/calendar-apple.js +159 -0
- package/dist/tools/calendar-apple.js.map +1 -0
- package/dist/tools/calendar-graph.d.ts +41 -0
- package/dist/tools/calendar-graph.d.ts.map +1 -0
- package/dist/tools/calendar-graph.js +298 -0
- package/dist/tools/calendar-graph.js.map +1 -0
- package/dist/tools/calendar-permissions.d.ts +10 -0
- package/dist/tools/calendar-permissions.d.ts.map +1 -1
- package/dist/tools/calendar-permissions.js +53 -0
- package/dist/tools/calendar-permissions.js.map +1 -1
- package/dist/tools/calendar.d.ts +151 -0
- package/dist/tools/calendar.d.ts.map +1 -1
- package/dist/tools/calendar.js +274 -0
- package/dist/tools/calendar.js.map +1 -1
- package/dist/tools/categories.d.ts +10 -0
- package/dist/tools/categories.d.ts.map +1 -1
- package/dist/tools/categories.js +54 -0
- package/dist/tools/categories.js.map +1 -1
- package/dist/tools/checklist-items.d.ts +10 -0
- package/dist/tools/checklist-items.d.ts.map +1 -1
- package/dist/tools/checklist-items.js +63 -0
- package/dist/tools/checklist-items.js.map +1 -1
- package/dist/tools/contact-folders.d.ts +50 -0
- package/dist/tools/contact-folders.d.ts.map +1 -0
- package/dist/tools/contact-folders.js +133 -0
- package/dist/tools/contact-folders.js.map +1 -0
- package/dist/tools/contacts-graph.d.ts +45 -0
- package/dist/tools/contacts-graph.d.ts.map +1 -0
- package/dist/tools/contacts-graph.js +172 -0
- package/dist/tools/contacts-graph.js.map +1 -0
- package/dist/tools/contacts.d.ts +66 -0
- package/dist/tools/contacts.d.ts.map +1 -1
- package/dist/tools/contacts.js +165 -0
- package/dist/tools/contacts.js.map +1 -1
- package/dist/tools/excel.d.ts +10 -0
- package/dist/tools/excel.d.ts.map +1 -1
- package/dist/tools/excel.js +73 -0
- package/dist/tools/excel.js.map +1 -1
- package/dist/tools/focused-overrides.d.ts +10 -0
- package/dist/tools/focused-overrides.d.ts.map +1 -1
- package/dist/tools/focused-overrides.js +54 -0
- package/dist/tools/focused-overrides.js.map +1 -1
- package/dist/tools/linked-resources.d.ts +10 -0
- package/dist/tools/linked-resources.d.ts.map +1 -1
- package/dist/tools/linked-resources.js +53 -0
- package/dist/tools/linked-resources.js.map +1 -1
- package/dist/tools/mail-apple.d.ts +40 -0
- package/dist/tools/mail-apple.d.ts.map +1 -0
- package/dist/tools/mail-apple.js +146 -0
- package/dist/tools/mail-apple.js.map +1 -0
- package/dist/tools/mail-graph.d.ts +38 -0
- package/dist/tools/mail-graph.d.ts.map +1 -0
- package/dist/tools/mail-graph.js +178 -0
- package/dist/tools/mail-graph.js.map +1 -0
- package/dist/tools/mail-rules.d.ts +12 -0
- package/dist/tools/mail-rules.d.ts.map +1 -1
- package/dist/tools/mail-rules.js +56 -0
- package/dist/tools/mail-rules.js.map +1 -1
- package/dist/tools/mail-send.d.ts +12 -0
- package/dist/tools/mail-send.d.ts.map +1 -1
- package/dist/tools/mail-send.js +219 -5
- package/dist/tools/mail-send.js.map +1 -1
- package/dist/tools/mail.d.ts +82 -2
- package/dist/tools/mail.d.ts.map +1 -1
- package/dist/tools/mail.js +239 -2
- package/dist/tools/mail.js.map +1 -1
- package/dist/tools/mailbox-organization.d.ts +20 -0
- package/dist/tools/mailbox-organization.d.ts.map +1 -1
- package/dist/tools/mailbox-organization.js +275 -0
- package/dist/tools/mailbox-organization.js.map +1 -1
- package/dist/tools/mailbox-settings.d.ts +59 -0
- package/dist/tools/mailbox-settings.d.ts.map +1 -0
- package/dist/tools/mailbox-settings.js +136 -0
- package/dist/tools/mailbox-settings.js.map +1 -0
- package/dist/tools/meetings.d.ts +10 -0
- package/dist/tools/meetings.d.ts.map +1 -1
- package/dist/tools/meetings.js +74 -0
- package/dist/tools/meetings.js.map +1 -1
- package/dist/tools/notes.d.ts +12 -0
- package/dist/tools/notes.d.ts.map +1 -1
- package/dist/tools/notes.js +66 -0
- package/dist/tools/notes.js.map +1 -1
- package/dist/tools/onedrive.d.ts +10 -0
- package/dist/tools/onedrive.d.ts.map +1 -1
- package/dist/tools/onedrive.js +124 -0
- package/dist/tools/onedrive.js.map +1 -1
- package/dist/tools/people.d.ts +10 -0
- package/dist/tools/people.d.ts.map +1 -1
- package/dist/tools/people.js +94 -0
- package/dist/tools/people.js.map +1 -1
- package/dist/tools/planner-visualization.d.ts +10 -0
- package/dist/tools/planner-visualization.d.ts.map +1 -1
- package/dist/tools/planner-visualization.js +53 -0
- package/dist/tools/planner-visualization.js.map +1 -1
- package/dist/tools/planner.d.ts +10 -0
- package/dist/tools/planner.d.ts.map +1 -1
- package/dist/tools/planner.js +183 -0
- package/dist/tools/planner.js.map +1 -1
- package/dist/tools/scheduling.d.ts +12 -0
- package/dist/tools/scheduling.d.ts.map +1 -1
- package/dist/tools/scheduling.js +38 -0
- package/dist/tools/scheduling.js.map +1 -1
- package/dist/tools/sharepoint.d.ts +10 -0
- package/dist/tools/sharepoint.d.ts.map +1 -1
- package/dist/tools/sharepoint.js +74 -0
- package/dist/tools/sharepoint.js.map +1 -1
- package/dist/tools/task-attachments.d.ts +10 -0
- package/dist/tools/task-attachments.d.ts.map +1 -1
- package/dist/tools/task-attachments.js +53 -0
- package/dist/tools/task-attachments.js.map +1 -1
- package/dist/tools/task-lists.d.ts +56 -0
- package/dist/tools/task-lists.d.ts.map +1 -0
- package/dist/tools/task-lists.js +151 -0
- package/dist/tools/task-lists.js.map +1 -0
- package/dist/tools/tasks-graph.d.ts +49 -0
- package/dist/tools/tasks-graph.d.ts.map +1 -0
- package/dist/tools/tasks-graph.js +191 -0
- package/dist/tools/tasks-graph.js.map +1 -0
- package/dist/tools/tasks.d.ts +127 -0
- package/dist/tools/tasks.d.ts.map +1 -1
- package/dist/tools/tasks.js +155 -0
- package/dist/tools/tasks.js.map +1 -1
- package/dist/tools/teams.d.ts +11 -0
- package/dist/tools/teams.d.ts.map +1 -1
- package/dist/tools/teams.js +254 -0
- package/dist/tools/teams.js.map +1 -1
- package/dist/utils/errors.d.ts +96 -5
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +227 -8
- package/dist/utils/errors.js.map +1 -1
- package/package.json +1 -1
package/dist/graph/repository.js
CHANGED
|
@@ -55,6 +55,39 @@ export class GraphRepository {
|
|
|
55
55
|
this.client = new GraphClient(deviceCodeCallback);
|
|
56
56
|
}
|
|
57
57
|
// ===========================================================================
|
|
58
|
+
// Cache Resolvers (auto-fetch parent on cache miss)
|
|
59
|
+
// ===========================================================================
|
|
60
|
+
async resolveTeamId(teamId) {
|
|
61
|
+
let graphId = this.idCache.teams.get(teamId);
|
|
62
|
+
if (graphId != null)
|
|
63
|
+
return graphId;
|
|
64
|
+
await this.listTeamsAsync();
|
|
65
|
+
graphId = this.idCache.teams.get(teamId);
|
|
66
|
+
if (graphId != null)
|
|
67
|
+
return graphId;
|
|
68
|
+
throw new Error(`Team ID ${teamId} not found. Verify the ID is correct by calling list_teams.`);
|
|
69
|
+
}
|
|
70
|
+
async resolvePlanId(planId) {
|
|
71
|
+
let cached = this.idCache.plans.get(planId);
|
|
72
|
+
if (cached != null)
|
|
73
|
+
return cached;
|
|
74
|
+
await this.listPlansAsync();
|
|
75
|
+
cached = this.idCache.plans.get(planId);
|
|
76
|
+
if (cached != null)
|
|
77
|
+
return cached;
|
|
78
|
+
throw new Error(`Plan ID ${planId} not found. Verify the ID is correct by calling list_plans.`);
|
|
79
|
+
}
|
|
80
|
+
async resolveChatId(chatId) {
|
|
81
|
+
let graphId = this.idCache.chats.get(chatId);
|
|
82
|
+
if (graphId != null)
|
|
83
|
+
return graphId;
|
|
84
|
+
await this.listChatsAsync();
|
|
85
|
+
graphId = this.idCache.chats.get(chatId);
|
|
86
|
+
if (graphId != null)
|
|
87
|
+
return graphId;
|
|
88
|
+
throw new Error(`Chat ID ${chatId} not found. Verify the ID is correct by calling list_chats.`);
|
|
89
|
+
}
|
|
90
|
+
// ===========================================================================
|
|
58
91
|
// Folders
|
|
59
92
|
// ===========================================================================
|
|
60
93
|
listFolders() {
|
|
@@ -198,10 +231,12 @@ export class GraphRepository {
|
|
|
198
231
|
return messages.map((m) => mapMessageToEmailRow(m, folderId));
|
|
199
232
|
}
|
|
200
233
|
/**
|
|
201
|
-
*
|
|
234
|
+
* Structured advanced search (U7 / D9). Runs a compiled query on the correct
|
|
235
|
+
* Graph mechanism ($filter / quoted $search / /search/query), then caches IDs
|
|
236
|
+
* and maps to EmailRow[] exactly like the raw-KQL path it replaces.
|
|
202
237
|
*/
|
|
203
|
-
async
|
|
204
|
-
const messages = await this.
|
|
238
|
+
async searchEmailsStructuredAsync(compiled, limit) {
|
|
239
|
+
const messages = await this.runStructuredSearch(compiled, limit);
|
|
205
240
|
for (const msg of messages) {
|
|
206
241
|
if (msg.id != null) {
|
|
207
242
|
this.idCache.messages.set(hashStringToNumber(msg.id), msg.id);
|
|
@@ -212,24 +247,15 @@ export class GraphRepository {
|
|
|
212
247
|
}
|
|
213
248
|
return messages.map((m) => mapMessageToEmailRow(m));
|
|
214
249
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
250
|
+
runStructuredSearch(compiled, limit) {
|
|
251
|
+
switch (compiled.mechanism) {
|
|
252
|
+
case 'filter':
|
|
253
|
+
return this.client.searchMessagesFilter(compiled.filter, limit);
|
|
254
|
+
case 'search':
|
|
255
|
+
return this.client.searchMessagesSearchValue(compiled.search, limit);
|
|
256
|
+
case 'searchQuery':
|
|
257
|
+
return this.client.searchMessagesQuery(compiled.kql, limit);
|
|
222
258
|
}
|
|
223
|
-
const messages = await this.client.searchMessagesKqlInFolder(graphFolderId, query, limit);
|
|
224
|
-
for (const msg of messages) {
|
|
225
|
-
if (msg.id != null) {
|
|
226
|
-
this.idCache.messages.set(hashStringToNumber(msg.id), msg.id);
|
|
227
|
-
}
|
|
228
|
-
if (msg.conversationId != null) {
|
|
229
|
-
this.idCache.conversations.set(hashStringToNumber(msg.conversationId), msg.conversationId);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
return messages.map((m) => mapMessageToEmailRow(m));
|
|
233
259
|
}
|
|
234
260
|
async checkNewEmailsAsync(folderId) {
|
|
235
261
|
const graphFolderId = this.idCache.folders.get(folderId);
|
|
@@ -993,17 +1019,14 @@ export class GraphRepository {
|
|
|
993
1019
|
const graphMessageId = this.idCache.messages.get(messageId);
|
|
994
1020
|
if (graphMessageId == null)
|
|
995
1021
|
throw new Error(`Message ID ${messageId} not found in cache. Try searching for or listing the item first to refresh the cache.`);
|
|
1022
|
+
// Pass comment/body through createReply so the quoted thread is preserved
|
|
1023
|
+
const body = comment != null ? { contentType: bodyType, content: comment } : undefined;
|
|
996
1024
|
const draft = replyAll
|
|
997
|
-
? await this.client.createReplyAllDraft(graphMessageId)
|
|
998
|
-
: await this.client.createReplyDraft(graphMessageId);
|
|
1025
|
+
? await this.client.createReplyAllDraft(graphMessageId, undefined, body)
|
|
1026
|
+
: await this.client.createReplyDraft(graphMessageId, undefined, body);
|
|
999
1027
|
const graphId = draft.id;
|
|
1000
1028
|
const numericId = hashStringToNumber(graphId);
|
|
1001
1029
|
this.idCache.messages.set(numericId, graphId);
|
|
1002
|
-
if (comment != null) {
|
|
1003
|
-
await this.client.updateDraft(graphId, {
|
|
1004
|
-
body: { contentType: bodyType, content: comment },
|
|
1005
|
-
});
|
|
1006
|
-
}
|
|
1007
1030
|
return { numericId, graphId };
|
|
1008
1031
|
}
|
|
1009
1032
|
/**
|
|
@@ -1901,9 +1924,7 @@ export class GraphRepository {
|
|
|
1901
1924
|
* Lists all channels in a team with cached numeric IDs.
|
|
1902
1925
|
*/
|
|
1903
1926
|
async listChannelsAsync(teamId) {
|
|
1904
|
-
const graphTeamId = this.
|
|
1905
|
-
if (graphTeamId == null)
|
|
1906
|
-
throw new Error(`Team ID ${teamId} not found in cache. Try listing teams first.`);
|
|
1927
|
+
const graphTeamId = await this.resolveTeamId(teamId);
|
|
1907
1928
|
const channels = await this.client.listChannels(graphTeamId);
|
|
1908
1929
|
return channels.map((ch) => {
|
|
1909
1930
|
const graphId = ch.id;
|
|
@@ -1926,9 +1947,7 @@ export class GraphRepository {
|
|
|
1926
1947
|
* Creates a new channel in a team.
|
|
1927
1948
|
*/
|
|
1928
1949
|
async createChannelAsync(teamId, name, description) {
|
|
1929
|
-
const graphTeamId = this.
|
|
1930
|
-
if (graphTeamId == null)
|
|
1931
|
-
throw new Error(`Team ID ${teamId} not found in cache. Try listing teams first.`);
|
|
1950
|
+
const graphTeamId = await this.resolveTeamId(teamId);
|
|
1932
1951
|
const ch = await this.client.createChannel(graphTeamId, name, description);
|
|
1933
1952
|
const graphId = ch.id;
|
|
1934
1953
|
const numericId = hashStringToNumber(graphId);
|
|
@@ -1963,9 +1982,7 @@ export class GraphRepository {
|
|
|
1963
1982
|
* Lists members of a team.
|
|
1964
1983
|
*/
|
|
1965
1984
|
async listTeamMembersAsync(teamId) {
|
|
1966
|
-
const graphTeamId = this.
|
|
1967
|
-
if (graphTeamId == null)
|
|
1968
|
-
throw new Error(`Team ID ${teamId} not found in cache. Try listing teams first.`);
|
|
1985
|
+
const graphTeamId = await this.resolveTeamId(teamId);
|
|
1969
1986
|
const members = await this.client.listTeamMembers(graphTeamId);
|
|
1970
1987
|
return members.map((m) => ({
|
|
1971
1988
|
id: m.id ?? '',
|
|
@@ -2082,9 +2099,7 @@ export class GraphRepository {
|
|
|
2082
2099
|
});
|
|
2083
2100
|
}
|
|
2084
2101
|
async getChatAsync(chatId) {
|
|
2085
|
-
const graphId = this.
|
|
2086
|
-
if (graphId == null)
|
|
2087
|
-
throw new Error(`Chat ID ${chatId} not found in cache. Try listing chats first.`);
|
|
2102
|
+
const graphId = await this.resolveChatId(chatId);
|
|
2088
2103
|
const chat = await this.client.getChat(graphId);
|
|
2089
2104
|
return {
|
|
2090
2105
|
id: chatId,
|
|
@@ -2095,9 +2110,7 @@ export class GraphRepository {
|
|
|
2095
2110
|
};
|
|
2096
2111
|
}
|
|
2097
2112
|
async listChatMessagesAsync(chatId, limit = 25) {
|
|
2098
|
-
const graphChatId = this.
|
|
2099
|
-
if (graphChatId == null)
|
|
2100
|
-
throw new Error(`Chat ID ${chatId} not found in cache. Try listing chats first.`);
|
|
2113
|
+
const graphChatId = await this.resolveChatId(chatId);
|
|
2101
2114
|
const messages = await this.client.listChatMessages(graphChatId, limit);
|
|
2102
2115
|
return messages.map((msg) => {
|
|
2103
2116
|
const graphId = msg.id;
|
|
@@ -2115,9 +2128,7 @@ export class GraphRepository {
|
|
|
2115
2128
|
});
|
|
2116
2129
|
}
|
|
2117
2130
|
async sendChatMessageAsync(chatId, body, contentType = 'html') {
|
|
2118
|
-
const graphChatId = this.
|
|
2119
|
-
if (graphChatId == null)
|
|
2120
|
-
throw new Error(`Chat ID ${chatId} not found in cache. Try listing chats first.`);
|
|
2131
|
+
const graphChatId = await this.resolveChatId(chatId);
|
|
2121
2132
|
const msg = await this.client.sendChatMessage(graphChatId, body, contentType);
|
|
2122
2133
|
const graphId = msg.id;
|
|
2123
2134
|
const numericId = hashStringToNumber(graphId);
|
|
@@ -2184,9 +2195,7 @@ export class GraphRepository {
|
|
|
2184
2195
|
}
|
|
2185
2196
|
}
|
|
2186
2197
|
async listChatMembersAsync(chatId) {
|
|
2187
|
-
const graphChatId = this.
|
|
2188
|
-
if (graphChatId == null)
|
|
2189
|
-
throw new Error(`Chat ID ${chatId} not found in cache. Try listing chats first.`);
|
|
2198
|
+
const graphChatId = await this.resolveChatId(chatId);
|
|
2190
2199
|
const members = await this.client.listChatMembers(graphChatId);
|
|
2191
2200
|
return members.map((m) => ({
|
|
2192
2201
|
displayName: m.displayName ?? '',
|
|
@@ -2219,9 +2228,7 @@ export class GraphRepository {
|
|
|
2219
2228
|
* Gets a specific plan by cached numeric ID.
|
|
2220
2229
|
*/
|
|
2221
2230
|
async getPlanAsync(planId) {
|
|
2222
|
-
const cached = this.
|
|
2223
|
-
if (cached == null)
|
|
2224
|
-
throw new Error(`Plan ID ${planId} not found in cache. Try listing plans first.`);
|
|
2231
|
+
const cached = await this.resolvePlanId(planId);
|
|
2225
2232
|
const plan = await this.client.getPlan(cached.planId);
|
|
2226
2233
|
const etag = plan['@odata.etag'] ?? '';
|
|
2227
2234
|
this.idCache.plans.set(planId, { planId: cached.planId, etag });
|
|
@@ -2248,9 +2255,7 @@ export class GraphRepository {
|
|
|
2248
2255
|
* Updates a plan (requires cached ETag).
|
|
2249
2256
|
*/
|
|
2250
2257
|
async updatePlanAsync(planId, updates) {
|
|
2251
|
-
const cached = this.
|
|
2252
|
-
if (cached == null)
|
|
2253
|
-
throw new Error(`Plan ID ${planId} not found in cache. Try listing plans first.`);
|
|
2258
|
+
const cached = await this.resolvePlanId(planId);
|
|
2254
2259
|
const graphUpdates = {};
|
|
2255
2260
|
if (updates.title != null)
|
|
2256
2261
|
graphUpdates['title'] = updates.title;
|
|
@@ -2265,9 +2270,7 @@ export class GraphRepository {
|
|
|
2265
2270
|
* Lists all buckets in a plan.
|
|
2266
2271
|
*/
|
|
2267
2272
|
async listBucketsAsync(planId) {
|
|
2268
|
-
const cached = this.
|
|
2269
|
-
if (cached == null)
|
|
2270
|
-
throw new Error(`Plan ID ${planId} not found in cache. Try listing plans first.`);
|
|
2273
|
+
const cached = await this.resolvePlanId(planId);
|
|
2271
2274
|
const buckets = await this.client.listBuckets(cached.planId);
|
|
2272
2275
|
return buckets.map((bucket) => {
|
|
2273
2276
|
const graphId = bucket.id;
|
|
@@ -2286,9 +2289,7 @@ export class GraphRepository {
|
|
|
2286
2289
|
* Creates a new bucket in a plan.
|
|
2287
2290
|
*/
|
|
2288
2291
|
async createBucketAsync(planId, name) {
|
|
2289
|
-
const cached = this.
|
|
2290
|
-
if (cached == null)
|
|
2291
|
-
throw new Error(`Plan ID ${planId} not found in cache. Try listing plans first.`);
|
|
2292
|
+
const cached = await this.resolvePlanId(planId);
|
|
2292
2293
|
const bucket = await this.client.createBucket(cached.planId, name);
|
|
2293
2294
|
const graphId = bucket.id;
|
|
2294
2295
|
const numericId = hashStringToNumber(graphId);
|
|
@@ -2327,9 +2328,7 @@ export class GraphRepository {
|
|
|
2327
2328
|
* Lists all tasks in a plan.
|
|
2328
2329
|
*/
|
|
2329
2330
|
async listPlannerTasksAsync(planId) {
|
|
2330
|
-
const cached = this.
|
|
2331
|
-
if (cached == null)
|
|
2332
|
-
throw new Error(`Plan ID ${planId} not found in cache. Try listing plans first.`);
|
|
2331
|
+
const cached = await this.resolvePlanId(planId);
|
|
2333
2332
|
const tasks = await this.client.listPlannerTasks(cached.planId);
|
|
2334
2333
|
return tasks.map((task) => {
|
|
2335
2334
|
const graphId = task.id;
|
|
@@ -2387,9 +2386,7 @@ export class GraphRepository {
|
|
|
2387
2386
|
* Creates a new planner task.
|
|
2388
2387
|
*/
|
|
2389
2388
|
async createPlannerTaskAsync(planId, title, bucketId, assignments, priority, startDate, dueDate) {
|
|
2390
|
-
const cachedPlan = this.
|
|
2391
|
-
if (cachedPlan == null)
|
|
2392
|
-
throw new Error(`Plan ID ${planId} not found in cache. Try listing plans first.`);
|
|
2389
|
+
const cachedPlan = await this.resolvePlanId(planId);
|
|
2393
2390
|
const body = { planId: cachedPlan.planId, title };
|
|
2394
2391
|
if (bucketId != null) {
|
|
2395
2392
|
const cachedBucket = this.idCache.plannerBuckets.get(bucketId);
|