@mcp-consultant-tools/teams 27.0.0 → 28.0.0-beta.13
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/cli/commands/auth-commands.d.ts +7 -0
- package/build/cli/commands/auth-commands.d.ts.map +1 -0
- package/build/cli/commands/auth-commands.js +45 -0
- package/build/cli/commands/auth-commands.js.map +1 -0
- package/build/cli/commands/index.d.ts +9 -0
- package/build/cli/commands/index.d.ts.map +1 -0
- package/build/cli/commands/index.js +12 -0
- package/build/cli/commands/index.js.map +1 -0
- package/build/cli/commands/message-commands.d.ts +7 -0
- package/build/cli/commands/message-commands.d.ts.map +1 -0
- package/build/cli/commands/message-commands.js +157 -0
- package/build/cli/commands/message-commands.js.map +1 -0
- package/build/cli/output.d.ts +11 -0
- package/build/cli/output.d.ts.map +1 -0
- package/build/cli/output.js +10 -0
- package/build/cli/output.js.map +1 -0
- package/build/cli.d.ts +9 -0
- package/build/cli.d.ts.map +1 -0
- package/build/cli.js +27 -0
- package/build/cli.js.map +1 -0
- package/build/context-factory.d.ts +4 -0
- package/build/context-factory.d.ts.map +1 -0
- package/build/context-factory.js +40 -0
- package/build/context-factory.js.map +1 -0
- package/build/index.d.ts +9 -21
- package/build/index.d.ts.map +1 -1
- package/build/index.js +23 -53
- package/build/index.js.map +1 -1
- package/build/services/index.d.ts +6 -0
- package/build/services/index.d.ts.map +1 -0
- package/build/services/index.js +5 -0
- package/build/services/index.js.map +1 -0
- package/build/services/teams-service.d.ts +110 -0
- package/build/services/teams-service.d.ts.map +1 -0
- package/build/services/teams-service.js +598 -0
- package/build/services/teams-service.js.map +1 -0
- package/build/tool-examples.d.ts +26 -0
- package/build/tool-examples.d.ts.map +1 -0
- package/build/tool-examples.js +45 -0
- package/build/tool-examples.js.map +1 -0
- package/build/tools/authenticate.d.ts +4 -4
- package/build/tools/authenticate.d.ts.map +1 -1
- package/build/tools/authenticate.js +6 -9
- package/build/tools/authenticate.js.map +1 -1
- package/build/tools/index.d.ts +10 -0
- package/build/tools/index.d.ts.map +1 -0
- package/build/tools/index.js +21 -0
- package/build/tools/index.js.map +1 -0
- package/build/tools/list-channels.d.ts +3 -3
- package/build/tools/list-channels.d.ts.map +1 -1
- package/build/tools/list-channels.js +4 -4
- package/build/tools/list-channels.js.map +1 -1
- package/build/tools/send-card.d.ts +4 -4
- package/build/tools/send-card.d.ts.map +1 -1
- package/build/tools/send-card.js +5 -4
- package/build/tools/send-card.js.map +1 -1
- package/build/tools/send-message.d.ts +2 -2
- package/build/tools/send-message.d.ts.map +1 -1
- package/build/tools/send-message.js +6 -5
- package/build/tools/send-message.js.map +1 -1
- package/build/types.d.ts +8 -0
- package/build/types.d.ts.map +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth CLI Commands - 3 commands mapping to authentication MCP tools
|
|
3
|
+
*/
|
|
4
|
+
import type { Command } from 'commander';
|
|
5
|
+
import type { ServiceContext } from '../../context-factory.js';
|
|
6
|
+
export declare function registerAuthCommands(program: Command, ctx: ServiceContext): void;
|
|
7
|
+
//# sourceMappingURL=auth-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/auth-commands.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG/D,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,IAAI,CAyChF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth CLI Commands - 3 commands mapping to authentication MCP tools
|
|
3
|
+
*/
|
|
4
|
+
import { getGlobalFlags, handleCliError } from '@mcp-consultant-tools/core';
|
|
5
|
+
import { outputResult } from '../output.js';
|
|
6
|
+
export function registerAuthCommands(program, ctx) {
|
|
7
|
+
const auth = program.command('auth').description('Authentication operations');
|
|
8
|
+
auth
|
|
9
|
+
.command('login')
|
|
10
|
+
.description('Authenticate to Microsoft Teams (device-code or client-credentials)')
|
|
11
|
+
.action(async () => {
|
|
12
|
+
try {
|
|
13
|
+
const result = await ctx.teams.startAuthentication();
|
|
14
|
+
outputResult({ fileName: 'auth-login', data: result, summary: `Authentication status: ${result.status}` }, getGlobalFlags(program));
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
handleCliError(error, 'authenticate');
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
auth
|
|
21
|
+
.command('status')
|
|
22
|
+
.description('Check current Teams authentication status')
|
|
23
|
+
.action(async () => {
|
|
24
|
+
try {
|
|
25
|
+
const status = ctx.teams.getAuthStatus();
|
|
26
|
+
outputResult({ fileName: 'auth-status', data: status, summary: `Auth status: ${status.status} (${status.authMode}) - ${status.message}` }, getGlobalFlags(program));
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
handleCliError(error, 'check auth status');
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
auth
|
|
33
|
+
.command('logout')
|
|
34
|
+
.description('Clear cached Teams authentication tokens')
|
|
35
|
+
.action(async () => {
|
|
36
|
+
try {
|
|
37
|
+
ctx.teams.logout();
|
|
38
|
+
outputResult({ fileName: 'auth-logout', data: { status: 'logged_out' }, summary: 'Teams authentication cleared.' }, getGlobalFlags(program));
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
handleCliError(error, 'logout');
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=auth-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-commands.js","sourceRoot":"","sources":["../../../src/cli/commands/auth-commands.ts"],"names":[],"mappings":"AAAA;;GAEG;AA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,EAAE,mBAAmB,CAAC,CAAC;QAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEL,IAAI;SACD,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,0CAA0C,CAAC;SACvD,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAI,CAAC;YACH,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YACnB,YAAY,CACV,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,+BAA+B,EAAE,EACrG,cAAc,CAAC,OAAO,CAAC,CACxB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAAC,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Commands barrel export + combined registration
|
|
3
|
+
*/
|
|
4
|
+
import type { Command } from 'commander';
|
|
5
|
+
import type { ServiceContext } from '../../context-factory.js';
|
|
6
|
+
export declare function registerAllCommands(program: Command, ctx: ServiceContext): void;
|
|
7
|
+
export { registerAuthCommands } from './auth-commands.js';
|
|
8
|
+
export { registerMessageCommands } from './message-commands.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI/D,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,IAAI,CAG/E;AAED,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Commands barrel export + combined registration
|
|
3
|
+
*/
|
|
4
|
+
import { registerAuthCommands } from './auth-commands.js';
|
|
5
|
+
import { registerMessageCommands } from './message-commands.js';
|
|
6
|
+
export function registerAllCommands(program, ctx) {
|
|
7
|
+
registerAuthCommands(program, ctx);
|
|
8
|
+
registerMessageCommands(program, ctx);
|
|
9
|
+
}
|
|
10
|
+
export { registerAuthCommands } from './auth-commands.js';
|
|
11
|
+
export { registerMessageCommands } from './message-commands.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,MAAM,UAAU,mBAAmB,CAAC,OAAgB,EAAE,GAAmB;IACvE,oBAAoB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACnC,uBAAuB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACxC,CAAC;AAED,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message CLI Commands - 4 commands mapping to messaging and listing MCP tools
|
|
3
|
+
*/
|
|
4
|
+
import type { Command } from 'commander';
|
|
5
|
+
import type { ServiceContext } from '../../context-factory.js';
|
|
6
|
+
export declare function registerMessageCommands(program: Command, ctx: ServiceContext): void;
|
|
7
|
+
//# sourceMappingURL=message-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/message-commands.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAuB/D,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,IAAI,CA6InF"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message CLI Commands - 4 commands mapping to messaging and listing MCP tools
|
|
3
|
+
*/
|
|
4
|
+
import { readFileSync } from 'node:fs';
|
|
5
|
+
import { JSDOM } from 'jsdom';
|
|
6
|
+
import DOMPurify from 'dompurify';
|
|
7
|
+
import { marked } from 'marked';
|
|
8
|
+
import { getGlobalFlags, handleCliError } from '@mcp-consultant-tools/core';
|
|
9
|
+
import { getCardFromTemplate, AVAILABLE_TEMPLATES } from '../../cards/templates.js';
|
|
10
|
+
import { outputResult } from '../output.js';
|
|
11
|
+
/**
|
|
12
|
+
* Convert markdown to sanitized HTML for Teams (mirrors send-message tool logic)
|
|
13
|
+
*/
|
|
14
|
+
function markdownToHtml(markdown) {
|
|
15
|
+
const window = new JSDOM('').window;
|
|
16
|
+
const purify = DOMPurify(window);
|
|
17
|
+
const rawHtml = marked.parse(markdown, { async: false });
|
|
18
|
+
return purify.sanitize(rawHtml, {
|
|
19
|
+
ALLOWED_TAGS: [
|
|
20
|
+
'p', 'br', 'strong', 'b', 'em', 'i', 'u', 's', 'strike',
|
|
21
|
+
'code', 'pre', 'blockquote', 'ul', 'ol', 'li', 'a',
|
|
22
|
+
'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
|
|
23
|
+
'table', 'thead', 'tbody', 'tr', 'th', 'td',
|
|
24
|
+
],
|
|
25
|
+
ALLOWED_ATTR: ['href', 'target'],
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export function registerMessageCommands(program, ctx) {
|
|
29
|
+
// ── list-teams ──────────────────────────────────────────────
|
|
30
|
+
program
|
|
31
|
+
.command('list-teams')
|
|
32
|
+
.description('List Microsoft Teams the app/user has access to')
|
|
33
|
+
.action(async () => {
|
|
34
|
+
try {
|
|
35
|
+
const teams = await ctx.teams.listTeams();
|
|
36
|
+
const summary = teams.length === 0
|
|
37
|
+
? 'No teams found. Ensure the app has Group.Read.All permission and admin consent.'
|
|
38
|
+
: `Found ${teams.length} team(s): ${teams.map(t => t.displayName).join(', ')}`;
|
|
39
|
+
outputResult({ fileName: 'list-teams', data: teams, summary }, getGlobalFlags(program));
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
handleCliError(error, 'list teams');
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
// ── list-channels ───────────────────────────────────────────
|
|
46
|
+
program
|
|
47
|
+
.command('list-channels')
|
|
48
|
+
.description('List channels in a Microsoft Teams team')
|
|
49
|
+
.argument('<teamId>', 'Team ID to list channels for')
|
|
50
|
+
.action(async (teamId) => {
|
|
51
|
+
try {
|
|
52
|
+
const channels = await ctx.teams.listChannels(teamId);
|
|
53
|
+
const summary = channels.length === 0
|
|
54
|
+
? `No channels found in team ${teamId}.`
|
|
55
|
+
: `Found ${channels.length} channel(s): ${channels.map(c => c.displayName).join(', ')}`;
|
|
56
|
+
outputResult({ fileName: `list-channels-${teamId}`, data: channels, summary }, getGlobalFlags(program));
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
handleCliError(error, 'list channels');
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
// ── send-message ────────────────────────────────────────────
|
|
63
|
+
program
|
|
64
|
+
.command('send-message')
|
|
65
|
+
.description('Send a message to a Microsoft Teams channel')
|
|
66
|
+
.argument('<message>', 'Message content (text or markdown)')
|
|
67
|
+
.option('-t, --team-id <id>', 'Team ID (uses TEAMS_DEFAULT_TEAM_ID if not set)')
|
|
68
|
+
.option('-c, --channel-id <id>', 'Channel ID (uses TEAMS_DEFAULT_CHANNEL_ID if not set)')
|
|
69
|
+
.option('-f, --format <format>', 'Message format: text or markdown', 'markdown')
|
|
70
|
+
.option('-i, --importance <level>', 'Importance: normal, high, or urgent', 'normal')
|
|
71
|
+
.action(async (message, opts) => {
|
|
72
|
+
try {
|
|
73
|
+
let content;
|
|
74
|
+
let contentType;
|
|
75
|
+
if (opts.format === 'markdown') {
|
|
76
|
+
content = markdownToHtml(message);
|
|
77
|
+
contentType = 'html';
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
content = message;
|
|
81
|
+
contentType = 'text';
|
|
82
|
+
}
|
|
83
|
+
const result = await ctx.teams.sendChannelMessage(content, {
|
|
84
|
+
teamId: opts.teamId,
|
|
85
|
+
channelId: opts.channelId,
|
|
86
|
+
contentType,
|
|
87
|
+
importance: opts.importance,
|
|
88
|
+
});
|
|
89
|
+
outputResult({ fileName: 'send-message', data: result, summary: `Message sent. ID: ${result.messageId}` }, getGlobalFlags(program));
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
handleCliError(error, 'send message');
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
// ── send-card ───────────────────────────────────────────────
|
|
96
|
+
const sendCard = program
|
|
97
|
+
.command('send-card')
|
|
98
|
+
.description(`Send an Adaptive Card to a Teams channel. Templates: ${AVAILABLE_TEMPLATES.join(', ')}`)
|
|
99
|
+
.option('-t, --team-id <id>', 'Team ID (uses TEAMS_DEFAULT_TEAM_ID if not set)')
|
|
100
|
+
.option('-c, --channel-id <id>', 'Channel ID (uses TEAMS_DEFAULT_CHANNEL_ID if not set)')
|
|
101
|
+
.option('-i, --importance <level>', 'Importance: normal, high, or urgent', 'normal')
|
|
102
|
+
.option('--card-file <path>', 'Path to Adaptive Card JSON file (raw card mode)')
|
|
103
|
+
.option('--template <name>', `Template name: ${AVAILABLE_TEMPLATES.join(', ')}`)
|
|
104
|
+
.option('--package-name <name>', 'Package name (for template)')
|
|
105
|
+
.option('--version <ver>', 'Version string (for template)')
|
|
106
|
+
.option('--summary <text>', 'Release summary (for template)')
|
|
107
|
+
.option('--date <date>', 'Release date (for template)')
|
|
108
|
+
.option('--release-type <type>', 'Release type, e.g. "Minor Release" (for template)')
|
|
109
|
+
.option('--changes <text>', 'Markdown list of changes (for template)')
|
|
110
|
+
.option('--release-notes-url <url>', 'URL to release notes (for template)')
|
|
111
|
+
.option('--npm-url <url>', 'URL to npm package (for template, auto-generated if not provided)');
|
|
112
|
+
sendCard.action(async (opts) => {
|
|
113
|
+
try {
|
|
114
|
+
let cardToSend;
|
|
115
|
+
if (opts.cardFile) {
|
|
116
|
+
// Raw card from file
|
|
117
|
+
const fileContent = readFileSync(opts.cardFile, 'utf-8');
|
|
118
|
+
cardToSend = JSON.parse(fileContent);
|
|
119
|
+
}
|
|
120
|
+
else if (opts.template) {
|
|
121
|
+
// Template mode - validate required fields
|
|
122
|
+
const requiredFields = ['packageName', 'version', 'summary', 'date', 'releaseType', 'changes'];
|
|
123
|
+
const missing = requiredFields.filter(f => !opts[f]);
|
|
124
|
+
if (missing.length > 0) {
|
|
125
|
+
throw new Error(`Missing required template fields: ${missing.map(f => '--' + f.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase())).join(', ')}\n` +
|
|
126
|
+
`All of --package-name, --version, --summary, --date, --release-type, --changes are required when using --template.`);
|
|
127
|
+
}
|
|
128
|
+
const templateData = {
|
|
129
|
+
packageName: opts.packageName,
|
|
130
|
+
version: opts.version,
|
|
131
|
+
summary: opts.summary,
|
|
132
|
+
date: opts.date,
|
|
133
|
+
releaseType: opts.releaseType,
|
|
134
|
+
changes: opts.changes,
|
|
135
|
+
releaseNotesUrl: opts.releaseNotesUrl,
|
|
136
|
+
npmUrl: opts.npmUrl,
|
|
137
|
+
};
|
|
138
|
+
cardToSend = getCardFromTemplate(opts.template, templateData);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
throw new Error(`Provide either --card-file (raw Adaptive Card JSON) or --template + template data flags.\n` +
|
|
142
|
+
`Available templates: ${AVAILABLE_TEMPLATES.join(', ')}`);
|
|
143
|
+
}
|
|
144
|
+
const result = await ctx.teams.sendAdaptiveCard(cardToSend, {
|
|
145
|
+
teamId: opts.teamId,
|
|
146
|
+
channelId: opts.channelId,
|
|
147
|
+
importance: opts.importance,
|
|
148
|
+
});
|
|
149
|
+
const templateInfo = opts.template ? ` (template: ${opts.template})` : '';
|
|
150
|
+
outputResult({ fileName: 'send-card', data: result, summary: `Adaptive Card sent${templateInfo}. ID: ${result.messageId}` }, getGlobalFlags(program));
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
handleCliError(error, 'send adaptive card');
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=message-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-commands.js","sourceRoot":"","sources":["../../../src/cli/commands/message-commands.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG5E,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,SAAS,cAAc,CAAC,QAAgB;IACtC,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC;IACpC,MAAM,MAAM,GAAG,SAAS,CAAC,MAAa,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,MA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AE,qBAAqB,YAAY,SAAS,MAAM,CAAC,SAAS,EAAE,EAAE,EAC9G,cAAc,CAAC,OAAO,CAAC,CACxB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAAC,cAAc,CAAC,KAAK,EAAE,oBAAoB,CAAC,CAAC;QAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI output helper for teams package.
|
|
3
|
+
* Thin wrapper setting the package-specific cache directory.
|
|
4
|
+
*/
|
|
5
|
+
import { type GlobalFlags } from '@mcp-consultant-tools/core';
|
|
6
|
+
export declare function outputResult(opts: {
|
|
7
|
+
fileName: string;
|
|
8
|
+
data: unknown;
|
|
9
|
+
summary: string;
|
|
10
|
+
}, flags: GlobalFlags): void;
|
|
11
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/cli/output.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAoC,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAIhG,wBAAgB,YAAY,CAC1B,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAC1D,KAAK,EAAE,WAAW,GACjB,IAAI,CAEN"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI output helper for teams package.
|
|
3
|
+
* Thin wrapper setting the package-specific cache directory.
|
|
4
|
+
*/
|
|
5
|
+
import { outputResult as coreOutputResult } from '@mcp-consultant-tools/core';
|
|
6
|
+
const CACHE_DIR = '.mcp-teams-cache';
|
|
7
|
+
export function outputResult(opts, flags) {
|
|
8
|
+
coreOutputResult({ ...opts, cacheDir: CACHE_DIR }, flags);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/cli/output.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAoB,MAAM,4BAA4B,CAAC;AAEhG,MAAM,SAAS,GAAG,kBAAkB,CAAC;AAErC,MAAM,UAAU,YAAY,CAC1B,IAA0D,EAC1D,KAAkB;IAElB,gBAAgB,CAAC,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,KAAK,CAAC,CAAC;AAC5D,CAAC"}
|
package/build/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;GAKG"}
|
package/build/cli.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @mcp-consultant-tools/teams CLI
|
|
4
|
+
*
|
|
5
|
+
* Command-line interface for Microsoft Teams operations.
|
|
6
|
+
* Reuses the same ServiceContext and services as the MCP server.
|
|
7
|
+
*/
|
|
8
|
+
import { createCliProgram, loadEnvForCli } from '@mcp-consultant-tools/core';
|
|
9
|
+
import { createServiceContext } from './context-factory.js';
|
|
10
|
+
import { registerAllCommands } from './cli/commands/index.js';
|
|
11
|
+
const program = createCliProgram({
|
|
12
|
+
name: 'mcp-teams-cli',
|
|
13
|
+
description: 'Microsoft Teams CLI - send messages, adaptive cards, list teams and channels',
|
|
14
|
+
version: '27.0.0',
|
|
15
|
+
});
|
|
16
|
+
// Load env before parsing (--env-file handled by commander hook)
|
|
17
|
+
program.hook('preAction', (thisCommand) => {
|
|
18
|
+
const opts = thisCommand.opts();
|
|
19
|
+
loadEnvForCli(opts.envFile);
|
|
20
|
+
});
|
|
21
|
+
const ctx = createServiceContext();
|
|
22
|
+
registerAllCommands(program, ctx);
|
|
23
|
+
program.parseAsync(process.argv).catch((error) => {
|
|
24
|
+
console.error('CLI error:', error.message);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=cli.js.map
|
package/build/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,OAAO,GAAG,gBAAgB,CAAC;IAC/B,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,8EAA8E;IAC3F,OAAO,EAAE,QAAQ;CAClB,CAAC,CAAC;AAEH,iEAAiE;AACjE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,WAAgB,EAAE,EAAE;IAC7C,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;IAChC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC9B,CAAC,CAAC,CAAC;AAEH,MAAM,GAAG,GAAG,oBAAoB,EAAE,CAAC;AACnC,mBAAmB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AAElC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAU,EAAE,EAAE;IACpD,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-factory.d.ts","sourceRoot":"","sources":["../src/context-factory.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,wBAAgB,oBAAoB,IAAI,cAAc,CA8CrD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared service context factory - used by both MCP server and CLI.
|
|
3
|
+
*/
|
|
4
|
+
import { TeamsService } from './services/teams-service.js';
|
|
5
|
+
export function createServiceContext() {
|
|
6
|
+
let service = null;
|
|
7
|
+
function getService() {
|
|
8
|
+
if (!service) {
|
|
9
|
+
const authMode = process.env.TEAMS_AUTH_MODE === 'client-credentials'
|
|
10
|
+
? 'client-credentials'
|
|
11
|
+
: 'device-code';
|
|
12
|
+
const clientId = process.env.TEAMS_CLIENT_ID;
|
|
13
|
+
const tenantId = process.env.TEAMS_TENANT_ID;
|
|
14
|
+
if (!clientId) {
|
|
15
|
+
throw new Error('TEAMS_CLIENT_ID is required. Register an Azure AD app and set this variable.');
|
|
16
|
+
}
|
|
17
|
+
if (!tenantId) {
|
|
18
|
+
throw new Error('TEAMS_TENANT_ID is required. Set it to your Azure AD tenant ID.');
|
|
19
|
+
}
|
|
20
|
+
if (authMode === 'client-credentials' && !process.env.TEAMS_CLIENT_SECRET) {
|
|
21
|
+
throw new Error('TEAMS_CLIENT_SECRET is required for client-credentials auth mode.');
|
|
22
|
+
}
|
|
23
|
+
const config = {
|
|
24
|
+
authMode,
|
|
25
|
+
tenantId,
|
|
26
|
+
clientId,
|
|
27
|
+
clientSecret: process.env.TEAMS_CLIENT_SECRET,
|
|
28
|
+
defaultTeamId: process.env.TEAMS_DEFAULT_TEAM_ID,
|
|
29
|
+
defaultChannelId: process.env.TEAMS_DEFAULT_CHANNEL_ID,
|
|
30
|
+
};
|
|
31
|
+
service = new TeamsService(config);
|
|
32
|
+
console.error(`Teams service initialized (${authMode} mode)`);
|
|
33
|
+
}
|
|
34
|
+
return service;
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
get teams() { return getService(); },
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=context-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-factory.js","sourceRoot":"","sources":["../src/context-factory.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAM3D,MAAM,UAAU,oBAAoB;IAClC,IAAI,OAAO,GAAwB,IAAI,CAAC;IAExC,SAAS,UAAU;QACjB,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,KAAK,oBAAoB;gBACnE,CAAC,CAAC,oBAAoB;gBACtB,CAAC,CAAC,aAAa,CAAC;YAElB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;YAC7C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;YAE7C,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,MAAM,IAAI,KAAK,CACb,8EAA8E,CAC/E,CAAC;YACJ,CAAC;YACD,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;YACJ,CAAC;YACD,IAAI,QAAQ,KAAK,oBAAoB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,CAAC;gBAC1E,MAAM,IAAI,KAAK,CACb,mEAAmE,CACpE,CAAC;YACJ,CAAC;YAED,MAAM,MAAM,GAAgB;gBAC1B,QAAQ;gBACR,QAAQ;gBACR,QAAQ;gBACR,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB;gBAC7C,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB;gBAChD,gBAAgB,EAAE,OAAO,CAAC,GAAG,CAAC,wBAAwB;aACvD,CAAC;YAEF,OAAO,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;YACnC,OAAO,CAAC,KAAK,CAAC,8BAA8B,QAAQ,QAAQ,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,OAAO;QACL,IAAI,KAAK,KAAK,OAAO,UAAU,EAAE,CAAC,CAAC,CAAC;KACrC,CAAC;AACJ,CAAC"}
|
package/build/index.d.ts
CHANGED
|
@@ -3,28 +3,16 @@
|
|
|
3
3
|
* @mcp-consultant-tools/teams
|
|
4
4
|
*
|
|
5
5
|
* MCP server for Microsoft Teams integration.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Authentication: Client Credentials (app-only) - no user interaction required.
|
|
9
|
-
*/
|
|
10
|
-
import { TeamsService } from "./TeamsService.js";
|
|
11
|
-
/**
|
|
12
|
-
* Register Teams tools and prompts to an MCP server
|
|
13
|
-
* @param server - The MCP server instance
|
|
14
|
-
* @param teamsService - Optional pre-configured service (for testing)
|
|
15
|
-
*/
|
|
16
|
-
export declare function registerTeamsTools(server: any, teamsService?: TeamsService): void;
|
|
17
|
-
/**
|
|
18
|
-
* Export service class for direct usage
|
|
19
|
-
*/
|
|
20
|
-
export { TeamsService } from "./TeamsService.js";
|
|
21
|
-
export type { TeamsConfig } from "./TeamsService.js";
|
|
22
|
-
/**
|
|
23
|
-
* Export types
|
|
6
|
+
* Entry point: MCP server startup + backward-compatible registerTeamsTools().
|
|
24
7
|
*/
|
|
25
|
-
export * from "./types.js";
|
|
26
8
|
/**
|
|
27
|
-
*
|
|
9
|
+
* Register Teams tools to an MCP server.
|
|
10
|
+
* Backward-compatible API for the meta package.
|
|
28
11
|
*/
|
|
29
|
-
export
|
|
12
|
+
export declare function registerTeamsTools(server: any): void;
|
|
13
|
+
export { TeamsService } from './services/teams-service.js';
|
|
14
|
+
export type { TeamsConfig } from './types.js';
|
|
15
|
+
export type { ServiceContext } from './types.js';
|
|
16
|
+
export * from './types.js';
|
|
17
|
+
export { getCardFromTemplate, AVAILABLE_TEMPLATES } from './cards/templates.js';
|
|
30
18
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAwEH;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAGpD;AAGD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -3,41 +3,24 @@
|
|
|
3
3
|
* @mcp-consultant-tools/teams
|
|
4
4
|
*
|
|
5
5
|
* MCP server for Microsoft Teams integration.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Authentication: Client Credentials (app-only) - no user interaction required.
|
|
6
|
+
* Entry point: MCP server startup + backward-compatible registerTeamsTools().
|
|
9
7
|
*/
|
|
10
8
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
11
9
|
import { pathToFileURL } from "node:url";
|
|
12
10
|
import { realpathSync } from "node:fs";
|
|
13
11
|
import { createMcpServer, createEnvLoader } from "@mcp-consultant-tools/core";
|
|
14
|
-
import { TeamsService } from
|
|
15
|
-
import {
|
|
16
|
-
import { registerSendCardTool } from "./tools/send-card.js";
|
|
17
|
-
import { registerListChannelsTool, registerListTeamsTool } from "./tools/list-channels.js";
|
|
18
|
-
import { registerAuthenticateTool, registerAuthStatusTool, registerLogoutTool, } from "./tools/authenticate.js";
|
|
12
|
+
import { TeamsService } from './services/teams-service.js';
|
|
13
|
+
import { registerAllTools } from './tools/index.js';
|
|
19
14
|
/**
|
|
20
|
-
*
|
|
21
|
-
* @param server - The MCP server instance
|
|
22
|
-
* @param teamsService - Optional pre-configured service (for testing)
|
|
15
|
+
* Build a ServiceContext from environment variables (lazy service initialization).
|
|
23
16
|
*/
|
|
24
|
-
|
|
25
|
-
let service =
|
|
26
|
-
|
|
27
|
-
* Lazy initialization - service created on first use
|
|
28
|
-
* Supports two auth modes:
|
|
29
|
-
* - client-credentials: Requires TEAMS_CLIENT_SECRET (for automation)
|
|
30
|
-
* - device-code: No secret needed, authenticates via browser (default)
|
|
31
|
-
*/
|
|
32
|
-
function getTeamsService() {
|
|
17
|
+
function createServiceContext() {
|
|
18
|
+
let service = null;
|
|
19
|
+
function getService() {
|
|
33
20
|
if (!service) {
|
|
34
|
-
// Determine auth mode
|
|
35
21
|
const authMode = process.env.TEAMS_AUTH_MODE === "client-credentials"
|
|
36
22
|
? "client-credentials"
|
|
37
23
|
: "device-code";
|
|
38
|
-
// TEAMS_CLIENT_ID is required - must be a custom app registration
|
|
39
|
-
// The previously used "Microsoft Graph Command Line Tools" client ID was retired March 2025
|
|
40
|
-
// See: https://devblogs.microsoft.com/microsoft365dev/microsoft-graph-cli-retirement/
|
|
41
24
|
const clientId = process.env.TEAMS_CLIENT_ID;
|
|
42
25
|
const tenantId = process.env.TEAMS_TENANT_ID;
|
|
43
26
|
if (!clientId) {
|
|
@@ -52,11 +35,9 @@ export function registerTeamsTools(server, teamsService) {
|
|
|
52
35
|
throw new Error("TEAMS_TENANT_ID is required. Set it to your Azure AD tenant ID.\n" +
|
|
53
36
|
"Find it in Azure Portal → Azure Active Directory → Overview → Tenant ID");
|
|
54
37
|
}
|
|
55
|
-
if (authMode === "client-credentials") {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"For interactive authentication, use TEAMS_AUTH_MODE=device-code (default).");
|
|
59
|
-
}
|
|
38
|
+
if (authMode === "client-credentials" && !process.env.TEAMS_CLIENT_SECRET) {
|
|
39
|
+
throw new Error("TEAMS_CLIENT_SECRET is required for client-credentials auth mode. " +
|
|
40
|
+
"For interactive authentication, use TEAMS_AUTH_MODE=device-code (default).");
|
|
60
41
|
}
|
|
61
42
|
const config = {
|
|
62
43
|
authMode,
|
|
@@ -71,33 +52,22 @@ export function registerTeamsTools(server, teamsService) {
|
|
|
71
52
|
}
|
|
72
53
|
return service;
|
|
73
54
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
// Authentication tools (call these first for device-code mode)
|
|
78
|
-
registerAuthenticateTool(server, getTeamsService);
|
|
79
|
-
registerAuthStatusTool(server, getTeamsService);
|
|
80
|
-
registerLogoutTool(server, getTeamsService);
|
|
81
|
-
// Messaging tools
|
|
82
|
-
registerSendMessageTool(server, getTeamsService);
|
|
83
|
-
registerSendCardTool(server, getTeamsService);
|
|
84
|
-
registerListChannelsTool(server, getTeamsService);
|
|
85
|
-
registerListTeamsTool(server, getTeamsService);
|
|
86
|
-
console.error("Teams tools registered: authenticate, auth-status, logout, " +
|
|
87
|
-
"send-channel-message, send-adaptive-card, list-channels, list-teams");
|
|
55
|
+
return {
|
|
56
|
+
get teams() { return getService(); },
|
|
57
|
+
};
|
|
88
58
|
}
|
|
89
59
|
/**
|
|
90
|
-
*
|
|
91
|
-
|
|
92
|
-
export { TeamsService } from "./TeamsService.js";
|
|
93
|
-
/**
|
|
94
|
-
* Export types
|
|
60
|
+
* Register Teams tools to an MCP server.
|
|
61
|
+
* Backward-compatible API for the meta package.
|
|
95
62
|
*/
|
|
96
|
-
export
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
63
|
+
export function registerTeamsTools(server) {
|
|
64
|
+
const ctx = createServiceContext();
|
|
65
|
+
registerAllTools(server, ctx);
|
|
66
|
+
}
|
|
67
|
+
// Backward-compatible exports
|
|
68
|
+
export { TeamsService } from './services/teams-service.js';
|
|
69
|
+
export * from './types.js';
|
|
70
|
+
export { getCardFromTemplate, AVAILABLE_TEMPLATES } from './cards/templates.js';
|
|
101
71
|
/**
|
|
102
72
|
* Standalone CLI server (when run directly)
|
|
103
73
|
* Uses realpathSync to resolve symlinks created by npx
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;GAEG;AACH,SAAS,oBAAoB;IAC3B,IAAI,OAAO,GAAwB,IAAI,CAAC;IAExC,SAAS,UAAU;QACjB,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,KAAK,oBAAoB;gBACnE,CAAC,CAAC,oBAAoB;gBACtB,CAAC,CAAC,aAAa,CAAC;YAElB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;YAC7C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;YAE7C,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,MAAM,IAAI,KAAK,CACb,qEAAqE;oBACrE,+EAA+E;oBAC/E,oEAAoE;oBACpE,qHA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C,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1E,MAAM,OAAO,GAAG,eAAe,EAAE,CAAC;IAClC,OAAO,EAAE,CAAC;IAEV,MAAM,MAAM,GAAG,eAAe,CAAC;QAC7B,IAAI,EAAE,6BAA6B;QACnC,OAAO,EAAE,OAAO;QAChB,YAAY,EAAE;YACZ,KAAK,EAAE,EAAE;YACT,OAAO,EAAE,EAAE;SACZ;KACF,CAAC,CAAC;IAEH,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAE3B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,KAAY,EAAE,EAAE;QAC/C,OAAO,CAAC,KAAK,CAAC,yDAAyD,EAAE,KAAK,CAAC,CAAC;QAChF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
|