ask-marcel-office-cli 0.1.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/LICENSE +21 -0
- package/README.md +267 -0
- package/dist/cli.js +27084 -0
- package/dist/composition/build-deps.d.ts +15 -0
- package/dist/composition/cli.d.ts +11 -0
- package/dist/composition/env.d.ts +2 -0
- package/dist/domain/access-token.d.ts +13 -0
- package/dist/domain/env-var.d.ts +10 -0
- package/dist/domain/jwt-utils.d.ts +3 -0
- package/dist/domain/result.d.ts +19 -0
- package/dist/domain/utilities/format-error.d.ts +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +24823 -0
- package/dist/infra/auth.d.ts +23 -0
- package/dist/infra/browser-auth.d.ts +59 -0
- package/dist/infra/filesystem-bun.d.ts +2 -0
- package/dist/infra/filesystem-node.d.ts +2 -0
- package/dist/infra/graph-client.d.ts +20 -0
- package/dist/infra/logger.d.ts +5 -0
- package/dist/main.d.ts +1 -0
- package/dist/presenter/output.d.ts +4 -0
- package/dist/use-cases/commands/build-command.d.ts +4 -0
- package/dist/use-cases/commands/command-types.d.ts +10 -0
- package/dist/use-cases/commands/download-onedrive-file-content.d.ts +9 -0
- package/dist/use-cases/commands/get-calendar-event.d.ts +6 -0
- package/dist/use-cases/commands/get-calendar-view.d.ts +4 -0
- package/dist/use-cases/commands/get-channel-files-folder.d.ts +7 -0
- package/dist/use-cases/commands/get-channel-message-hosted-content.d.ts +9 -0
- package/dist/use-cases/commands/get-channel-message.d.ts +8 -0
- package/dist/use-cases/commands/get-chat-message-hosted-content.d.ts +8 -0
- package/dist/use-cases/commands/get-chat-message.d.ts +7 -0
- package/dist/use-cases/commands/get-chat.d.ts +6 -0
- package/dist/use-cases/commands/get-current-user.d.ts +4 -0
- package/dist/use-cases/commands/get-drive-delta.d.ts +7 -0
- package/dist/use-cases/commands/get-drive-item.d.ts +7 -0
- package/dist/use-cases/commands/get-drive-root-item.d.ts +6 -0
- package/dist/use-cases/commands/get-excel-range.d.ts +9 -0
- package/dist/use-cases/commands/get-excel-table.d.ts +8 -0
- package/dist/use-cases/commands/get-mail-attachment.d.ts +7 -0
- package/dist/use-cases/commands/get-mail-message.d.ts +6 -0
- package/dist/use-cases/commands/get-mailbox-settings.d.ts +4 -0
- package/dist/use-cases/commands/get-my-profile-photo.d.ts +4 -0
- package/dist/use-cases/commands/get-onenote-page-content.d.ts +6 -0
- package/dist/use-cases/commands/get-outlook-contact.d.ts +6 -0
- package/dist/use-cases/commands/get-planner-bucket.d.ts +6 -0
- package/dist/use-cases/commands/get-planner-plan.d.ts +6 -0
- package/dist/use-cases/commands/get-planner-task-details.d.ts +6 -0
- package/dist/use-cases/commands/get-planner-task.d.ts +6 -0
- package/dist/use-cases/commands/get-sharepoint-site-by-path.d.ts +7 -0
- package/dist/use-cases/commands/get-sharepoint-site-drive-by-id.d.ts +7 -0
- package/dist/use-cases/commands/get-sharepoint-site-item.d.ts +7 -0
- package/dist/use-cases/commands/get-sharepoint-site-list-item.d.ts +8 -0
- package/dist/use-cases/commands/get-sharepoint-site-list.d.ts +7 -0
- package/dist/use-cases/commands/get-sharepoint-site.d.ts +6 -0
- package/dist/use-cases/commands/get-sharepoint-sites-delta.d.ts +4 -0
- package/dist/use-cases/commands/get-specific-calendar-event.d.ts +7 -0
- package/dist/use-cases/commands/get-specific-calendar-view.d.ts +6 -0
- package/dist/use-cases/commands/get-team-channel.d.ts +7 -0
- package/dist/use-cases/commands/get-team.d.ts +6 -0
- package/dist/use-cases/commands/get-todo-task.d.ts +7 -0
- package/dist/use-cases/commands/index.d.ts +3 -0
- package/dist/use-cases/commands/list-all-onenote-sections.d.ts +4 -0
- package/dist/use-cases/commands/list-calendar-event-instances.d.ts +7 -0
- package/dist/use-cases/commands/list-calendar-events-delta.d.ts +4 -0
- package/dist/use-cases/commands/list-calendar-events.d.ts +4 -0
- package/dist/use-cases/commands/list-calendar-view-delta.d.ts +4 -0
- package/dist/use-cases/commands/list-calendars.d.ts +4 -0
- package/dist/use-cases/commands/list-channel-message-hosted-contents.d.ts +8 -0
- package/dist/use-cases/commands/list-channel-message-replies.d.ts +8 -0
- package/dist/use-cases/commands/list-channel-messages.d.ts +7 -0
- package/dist/use-cases/commands/list-channel-tabs.d.ts +7 -0
- package/dist/use-cases/commands/list-chat-members.d.ts +6 -0
- package/dist/use-cases/commands/list-chat-message-hosted-contents.d.ts +7 -0
- package/dist/use-cases/commands/list-chat-message-replies.d.ts +7 -0
- package/dist/use-cases/commands/list-chat-messages.d.ts +6 -0
- package/dist/use-cases/commands/list-chats.d.ts +4 -0
- package/dist/use-cases/commands/list-drive-item-permissions.d.ts +7 -0
- package/dist/use-cases/commands/list-drive-item-versions.d.ts +7 -0
- package/dist/use-cases/commands/list-drives.d.ts +4 -0
- package/dist/use-cases/commands/list-excel-table-rows.d.ts +8 -0
- package/dist/use-cases/commands/list-excel-tables.d.ts +7 -0
- package/dist/use-cases/commands/list-excel-worksheets.d.ts +7 -0
- package/dist/use-cases/commands/list-folder-files.d.ts +7 -0
- package/dist/use-cases/commands/list-joined-teams.d.ts +4 -0
- package/dist/use-cases/commands/list-mail-attachments.d.ts +6 -0
- package/dist/use-cases/commands/list-mail-child-folders.d.ts +6 -0
- package/dist/use-cases/commands/list-mail-folder-messages.d.ts +6 -0
- package/dist/use-cases/commands/list-mail-folders.d.ts +4 -0
- package/dist/use-cases/commands/list-mail-messages.d.ts +4 -0
- package/dist/use-cases/commands/list-mail-rules.d.ts +6 -0
- package/dist/use-cases/commands/list-onenote-notebook-sections.d.ts +6 -0
- package/dist/use-cases/commands/list-onenote-notebooks.d.ts +4 -0
- package/dist/use-cases/commands/list-onenote-section-pages.d.ts +6 -0
- package/dist/use-cases/commands/list-outlook-contacts.d.ts +4 -0
- package/dist/use-cases/commands/list-pinned-chat-messages.d.ts +6 -0
- package/dist/use-cases/commands/list-plan-buckets.d.ts +6 -0
- package/dist/use-cases/commands/list-plan-tasks.d.ts +6 -0
- package/dist/use-cases/commands/list-planner-tasks.d.ts +4 -0
- package/dist/use-cases/commands/list-sharepoint-site-drives.d.ts +6 -0
- package/dist/use-cases/commands/list-sharepoint-site-items.d.ts +6 -0
- package/dist/use-cases/commands/list-sharepoint-site-list-items.d.ts +7 -0
- package/dist/use-cases/commands/list-sharepoint-site-lists.d.ts +6 -0
- package/dist/use-cases/commands/list-specific-calendar-events.d.ts +6 -0
- package/dist/use-cases/commands/list-team-channels.d.ts +6 -0
- package/dist/use-cases/commands/list-team-members.d.ts +6 -0
- package/dist/use-cases/commands/list-todo-linked-resources.d.ts +7 -0
- package/dist/use-cases/commands/list-todo-task-lists.d.ts +4 -0
- package/dist/use-cases/commands/list-todo-tasks.d.ts +6 -0
- package/dist/use-cases/commands/login.d.ts +6 -0
- package/dist/use-cases/commands/logout.d.ts +6 -0
- package/dist/use-cases/commands/search-onedrive-files.d.ts +9 -0
- package/dist/use-cases/commands/search-sharepoint-sites.d.ts +4 -0
- package/dist/use-cases/ports/filesystem.d.ts +15 -0
- package/dist/use-cases/ports/logger.d.ts +6 -0
- package/package.json +87 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AccessToken } from '../domain/access-token.js';
|
|
2
|
+
import type { Result } from '../domain/result.js';
|
|
3
|
+
import type { FileSystem } from '../use-cases/ports/filesystem.js';
|
|
4
|
+
import type { Logger } from '../use-cases/ports/logger.js';
|
|
5
|
+
import type { BrowserAuth } from './browser-auth.js';
|
|
6
|
+
type AuthError = {
|
|
7
|
+
type: 'auth_failed';
|
|
8
|
+
message: string;
|
|
9
|
+
} | {
|
|
10
|
+
type: 'auth_cancelled';
|
|
11
|
+
};
|
|
12
|
+
type AuthManager = {
|
|
13
|
+
getAccessToken: () => Promise<Result<AccessToken, AuthError>>;
|
|
14
|
+
logout: () => Promise<Result<void, AuthError>>;
|
|
15
|
+
};
|
|
16
|
+
declare const createAuthManagerFromApi: (browserAuth: BrowserAuth, cachePath: string, logger: Logger, fs: FileSystem) => AuthManager;
|
|
17
|
+
declare const createAuthManager: (deps: {
|
|
18
|
+
cachePath: string;
|
|
19
|
+
logger: Logger;
|
|
20
|
+
fs?: FileSystem;
|
|
21
|
+
}) => AuthManager;
|
|
22
|
+
export { createAuthManager, createAuthManagerFromApi };
|
|
23
|
+
export type { AuthError, AuthManager };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { AccessToken } from '../domain/access-token.js';
|
|
2
|
+
import type { FileSystem } from '../use-cases/ports/filesystem.js';
|
|
3
|
+
import type { Logger } from '../use-cases/ports/logger.js';
|
|
4
|
+
type BrowserTokenResult = {
|
|
5
|
+
accessToken: AccessToken;
|
|
6
|
+
refreshToken: string | null;
|
|
7
|
+
};
|
|
8
|
+
type BrowserAuth = {
|
|
9
|
+
acquireToken: (scopes: string[], startUrl: string) => Promise<BrowserTokenResult | null>;
|
|
10
|
+
close: () => Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
type ResponseLike = {
|
|
13
|
+
url(): string;
|
|
14
|
+
headers(): Record<string, string>;
|
|
15
|
+
text(): Promise<string>;
|
|
16
|
+
};
|
|
17
|
+
type ResponseHandler = (response: ResponseLike) => void;
|
|
18
|
+
type PageLike = {
|
|
19
|
+
on(event: 'response', handler: ResponseHandler): void;
|
|
20
|
+
goto(url: string, options: {
|
|
21
|
+
waitUntil: 'domcontentloaded';
|
|
22
|
+
timeout: number;
|
|
23
|
+
}): Promise<unknown>;
|
|
24
|
+
url(): string;
|
|
25
|
+
evaluate(fn: () => void): Promise<unknown>;
|
|
26
|
+
close(): Promise<void>;
|
|
27
|
+
};
|
|
28
|
+
type ContextLike = {
|
|
29
|
+
newPage(): Promise<PageLike>;
|
|
30
|
+
clearCookies(): Promise<void>;
|
|
31
|
+
close(): Promise<void>;
|
|
32
|
+
};
|
|
33
|
+
type LaunchOptions = {
|
|
34
|
+
headless: boolean;
|
|
35
|
+
channel?: 'msedge' | 'chrome';
|
|
36
|
+
args: string[];
|
|
37
|
+
};
|
|
38
|
+
type BrowserAuthApi = {
|
|
39
|
+
launchPersistentContext(profileDir: string, options: LaunchOptions): Promise<ContextLike>;
|
|
40
|
+
};
|
|
41
|
+
type TraceFn = (message: string) => void;
|
|
42
|
+
type BrowserAuthConfig = {
|
|
43
|
+
readonly logger: Logger;
|
|
44
|
+
readonly fs: FileSystem;
|
|
45
|
+
readonly trace?: TraceFn;
|
|
46
|
+
readonly profileDir?: string;
|
|
47
|
+
readonly initialSettleMs?: number;
|
|
48
|
+
readonly postReloginSettleMs?: number;
|
|
49
|
+
readonly pollIntervalMs?: number;
|
|
50
|
+
readonly pollDeadlineMs?: number;
|
|
51
|
+
readonly navigationTimeoutMs?: number;
|
|
52
|
+
};
|
|
53
|
+
declare const createBrowserAuthFromApi: (api: BrowserAuthApi, config: BrowserAuthConfig) => BrowserAuth;
|
|
54
|
+
declare const createBrowserAuth: (deps: {
|
|
55
|
+
logger: Logger;
|
|
56
|
+
fs?: FileSystem;
|
|
57
|
+
}) => BrowserAuth;
|
|
58
|
+
export { createBrowserAuth, createBrowserAuthFromApi };
|
|
59
|
+
export type { BrowserAuth, BrowserAuthApi, BrowserAuthConfig, BrowserTokenResult, ContextLike, PageLike, ResponseLike };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Result } from '../domain/result.js';
|
|
2
|
+
import type { AuthManager } from '../infra/auth.js';
|
|
3
|
+
type GraphError = {
|
|
4
|
+
type: 'api_error';
|
|
5
|
+
status: number;
|
|
6
|
+
message: string;
|
|
7
|
+
} | {
|
|
8
|
+
type: 'auth_failed';
|
|
9
|
+
message: string;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'network_error';
|
|
12
|
+
message: string;
|
|
13
|
+
};
|
|
14
|
+
type GraphClient = {
|
|
15
|
+
get: (path: string) => Promise<Result<unknown, GraphError>>;
|
|
16
|
+
};
|
|
17
|
+
type FetchFn = (url: string, init?: RequestInit) => Promise<Response>;
|
|
18
|
+
declare const createGraphClient: (auth: AuthManager, fetchFn?: FetchFn) => GraphClient;
|
|
19
|
+
export { createGraphClient };
|
|
20
|
+
export type { FetchFn, GraphClient, GraphError };
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { Result } from '../../domain/result.js';
|
|
3
|
+
import type { GraphClient } from '../../infra/graph-client.js';
|
|
4
|
+
type CommandSchema = z.ZodType;
|
|
5
|
+
type CommandExecute = (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, import('../../infra/graph-client.js').GraphError>>;
|
|
6
|
+
type Command = {
|
|
7
|
+
readonly schema: CommandSchema;
|
|
8
|
+
readonly execute: CommandExecute;
|
|
9
|
+
};
|
|
10
|
+
export type { Command, CommandExecute, CommandSchema };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Result } from '../../domain/result.js';
|
|
3
|
+
import type { GraphClient } from '../../infra/graph-client.js';
|
|
4
|
+
declare const schema: z.ZodObject<{
|
|
5
|
+
driveId: z.ZodString;
|
|
6
|
+
itemId: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, import("../../infra/graph-client.js").GraphError>>;
|
|
9
|
+
export { execute, schema };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const schema: z.ZodObject<{
|
|
3
|
+
teamId: z.ZodString;
|
|
4
|
+
channelId: z.ZodString;
|
|
5
|
+
chatMessageId: z.ZodString;
|
|
6
|
+
chatMessageHostedContentId: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
declare const execute: import("./command-types.js").CommandExecute;
|
|
9
|
+
export { execute, schema };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const schema: z.ZodObject<{
|
|
3
|
+
chatId: z.ZodString;
|
|
4
|
+
chatMessageId: z.ZodString;
|
|
5
|
+
chatMessageHostedContentId: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
declare const execute: import("./command-types.js").CommandExecute;
|
|
8
|
+
export { execute, schema };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const schema: z.ZodObject<{
|
|
3
|
+
driveId: z.ZodString;
|
|
4
|
+
itemId: z.ZodString;
|
|
5
|
+
worksheetId: z.ZodString;
|
|
6
|
+
address: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
declare const execute: import("./command-types.js").CommandExecute;
|
|
9
|
+
export { execute, schema };
|