ask-marcel-office-cli 0.5.5 → 1.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/CHANGELOG.md +92 -0
- package/README.md +275 -74
- package/dist/cli.js +96882 -14770
- package/dist/commands.json +5365 -489
- package/dist/composition/build-deps.d.ts +1 -0
- package/dist/composition/cli.d.ts +2 -0
- package/dist/index.js +94720 -13245
- package/dist/infra/auth.d.ts +31 -3
- package/dist/infra/browser-auth.d.ts +98 -1
- package/dist/infra/graph-client.d.ts +61 -2
- package/dist/infra/mammoth-adapter.d.ts +4 -0
- package/dist/infra/sheetjs-adapter.d.ts +9 -0
- package/dist/infra/turndown-adapter.d.ts +4 -0
- package/dist/presenter/output-text.d.ts +2 -0
- package/dist/presenter/output.d.ts +4 -2
- package/dist/use-cases/commands/build-command.d.ts +45 -1
- package/dist/use-cases/commands/command-types.d.ts +97 -3
- package/dist/use-cases/commands/convert-mail-attachment-to-markdown.d.ts +11 -0
- package/dist/use-cases/commands/convert-mail-attachment-to-pdf.d.ts +11 -0
- package/dist/use-cases/commands/convert-mail-to-markdown.d.ts +10 -0
- package/dist/use-cases/commands/docs-render.d.ts +7 -0
- package/dist/use-cases/commands/docx-to-markdown.d.ts +11 -0
- package/dist/use-cases/commands/download-drive-item-as-markdown.d.ts +11 -0
- package/dist/use-cases/commands/download-drive-item-as-pdf.d.ts +11 -0
- package/dist/use-cases/commands/download-drive-item-version-as-markdown.d.ts +12 -0
- package/dist/use-cases/commands/download-drive-item-version-as-pdf.d.ts +12 -0
- package/dist/use-cases/commands/download-onedrive-file-content.d.ts +2 -2
- package/dist/use-cases/commands/embedded-item-to-markdown.d.ts +59 -0
- package/dist/use-cases/commands/excel-error.d.ts +6 -0
- package/dist/use-cases/commands/extract-sharepoint-links-in-mail.d.ts +26 -0
- package/dist/use-cases/commands/fetch-raw-bytes.d.ts +56 -0
- package/dist/use-cases/commands/format-zod-error.d.ts +14 -0
- package/dist/use-cases/commands/get-calendar-event.d.ts +1 -5
- package/dist/use-cases/commands/get-calendar-view.d.ts +1 -6
- package/dist/use-cases/commands/get-channel-files-folder.d.ts +4 -0
- package/dist/use-cases/commands/get-chat.d.ts +8 -0
- package/dist/use-cases/commands/get-current-user.d.ts +1 -3
- package/dist/use-cases/commands/get-drive-delta.d.ts +1 -6
- package/dist/use-cases/commands/get-drive-item-analytics.d.ts +9 -0
- package/dist/use-cases/commands/get-drive-item-created-by-user.d.ts +4 -0
- package/dist/use-cases/commands/get-drive-item-last-modified-by-user.d.ts +4 -0
- package/dist/use-cases/commands/get-drive-item-list-item.d.ts +4 -0
- package/dist/use-cases/commands/get-drive-item.d.ts +1 -6
- package/dist/use-cases/commands/get-drive-root-delta.d.ts +4 -0
- package/dist/use-cases/commands/get-drive-root-item.d.ts +1 -5
- package/dist/use-cases/commands/get-drive-special-folder.d.ts +4 -0
- package/dist/use-cases/commands/get-excel-range.d.ts +1 -1
- package/dist/use-cases/commands/get-excel-table.d.ts +1 -1
- package/dist/use-cases/commands/get-excel-used-range.d.ts +10 -0
- package/dist/use-cases/commands/get-group-calendar-view.d.ts +4 -0
- package/dist/use-cases/commands/get-group.d.ts +4 -0
- package/dist/use-cases/commands/get-mail-attachment.d.ts +4 -2
- package/dist/use-cases/commands/get-mail-message-mime.d.ts +8 -0
- package/dist/use-cases/commands/get-mail-message.d.ts +1 -5
- package/dist/use-cases/commands/get-mail-rule.d.ts +9 -0
- package/dist/use-cases/commands/get-mailbox-settings.d.ts +1 -1
- package/dist/use-cases/commands/get-my-calendar.d.ts +4 -0
- package/dist/use-cases/commands/get-my-manager.d.ts +9 -0
- package/dist/use-cases/commands/get-onenote-page-as-markdown.d.ts +10 -0
- package/dist/use-cases/commands/get-organization.d.ts +4 -0
- package/dist/use-cases/commands/get-shared-calendar-view.d.ts +4 -0
- package/dist/use-cases/commands/get-shared-mailbox-message.d.ts +4 -0
- package/dist/use-cases/commands/get-sharepoint-list-column.d.ts +4 -0
- package/dist/use-cases/commands/get-sharepoint-site-drive-by-id.d.ts +1 -6
- package/dist/use-cases/commands/get-sharepoint-site-list-item.d.ts +1 -7
- package/dist/use-cases/commands/get-sharepoint-site-list.d.ts +1 -6
- package/dist/use-cases/commands/get-sharepoint-site-onenote-page-content.d.ts +9 -0
- package/dist/use-cases/commands/get-sharepoint-site.d.ts +1 -5
- package/dist/use-cases/commands/get-site-analytics.d.ts +8 -0
- package/dist/use-cases/commands/get-specific-calendar-event.d.ts +1 -6
- package/dist/use-cases/commands/get-specific-calendar-view.d.ts +1 -7
- package/dist/use-cases/commands/get-team-channel.d.ts +3 -7
- package/dist/use-cases/commands/get-team-primary-channel.d.ts +4 -0
- package/dist/use-cases/commands/get-team.d.ts +1 -5
- package/dist/use-cases/commands/get-todo-task.d.ts +1 -6
- package/dist/use-cases/commands/get-user-manager.d.ts +10 -0
- package/dist/use-cases/commands/graph-scopes.d.ts +29 -0
- package/dist/use-cases/commands/inline-image-embedder.d.ts +20 -0
- package/dist/use-cases/commands/list-all-onenote-sections.d.ts +1 -3
- package/dist/use-cases/commands/list-calendar-event-instances.d.ts +3 -9
- package/dist/use-cases/commands/list-calendar-events-delta.d.ts +5 -3
- package/dist/use-cases/commands/list-calendar-events.d.ts +1 -3
- package/dist/use-cases/commands/list-calendar-group-calendars.d.ts +4 -0
- package/dist/use-cases/commands/list-calendar-groups.d.ts +4 -0
- package/dist/use-cases/commands/list-calendar-view-delta.d.ts +3 -2
- package/dist/use-cases/commands/list-calendars.d.ts +1 -3
- package/dist/use-cases/commands/list-chat-members.d.ts +3 -6
- package/dist/use-cases/commands/list-chats.d.ts +4 -0
- package/dist/use-cases/commands/list-conversation-messages.d.ts +12 -0
- package/dist/use-cases/commands/list-drive-item-permissions.d.ts +1 -6
- package/dist/use-cases/commands/list-drive-item-thumbnails.d.ts +4 -0
- package/dist/use-cases/commands/list-drive-item-versions.d.ts +1 -6
- package/dist/use-cases/commands/list-drives.d.ts +1 -3
- package/dist/use-cases/commands/list-excel-comments.d.ts +5 -0
- package/dist/use-cases/commands/list-excel-defined-names.d.ts +5 -0
- package/dist/use-cases/commands/list-excel-table-rows.d.ts +2 -7
- package/dist/use-cases/commands/list-excel-tables.d.ts +2 -6
- package/dist/use-cases/commands/list-excel-worksheet-charts.d.ts +5 -0
- package/dist/use-cases/commands/list-excel-worksheet-pivot-tables.d.ts +5 -0
- package/dist/use-cases/commands/list-excel-worksheets.d.ts +2 -6
- package/dist/use-cases/commands/list-focused-inbox-overrides.d.ts +4 -0
- package/dist/use-cases/commands/list-folder-files.d.ts +1 -6
- package/dist/use-cases/commands/list-followed-drive-items.d.ts +4 -0
- package/dist/use-cases/commands/list-group-conversations.d.ts +4 -0
- package/dist/use-cases/commands/list-group-events.d.ts +4 -0
- package/dist/use-cases/commands/list-group-members.d.ts +4 -0
- package/dist/use-cases/commands/list-group-owners.d.ts +4 -0
- package/dist/use-cases/commands/list-group-threads.d.ts +4 -0
- package/dist/use-cases/commands/list-groups.d.ts +4 -0
- package/dist/use-cases/commands/list-incomplete-planner-tasks.d.ts +10 -3
- package/dist/use-cases/commands/list-incomplete-todo-tasks.d.ts +8 -2
- package/dist/use-cases/commands/list-mail-attachments.d.ts +8 -2
- package/dist/use-cases/commands/list-mail-child-folders.d.ts +1 -5
- package/dist/use-cases/commands/list-mail-folder-messages-delta.d.ts +4 -0
- package/dist/use-cases/commands/list-mail-folder-messages.d.ts +1 -5
- package/dist/use-cases/commands/list-mail-folders.d.ts +1 -3
- package/dist/use-cases/commands/list-mail-messages.d.ts +1 -3
- package/dist/use-cases/commands/list-mail-rules.d.ts +1 -1
- package/dist/use-cases/commands/list-my-direct-reports.d.ts +13 -0
- package/dist/use-cases/commands/list-my-memberships.d.ts +4 -0
- package/dist/use-cases/commands/list-my-transitive-memberships.d.ts +4 -0
- package/dist/use-cases/commands/list-onenote-notebook-sections.d.ts +1 -5
- package/dist/use-cases/commands/list-onenote-notebooks.d.ts +1 -3
- package/dist/use-cases/commands/list-onenote-section-pages.d.ts +1 -5
- package/dist/use-cases/commands/list-outlook-categories.d.ts +6 -0
- package/dist/use-cases/commands/list-plan-buckets.d.ts +1 -5
- package/dist/use-cases/commands/list-planner-plans.d.ts +1 -3
- package/dist/use-cases/commands/list-planner-tasks.d.ts +1 -3
- package/dist/use-cases/commands/list-recent-files.d.ts +4 -0
- package/dist/use-cases/commands/list-recently-used-insights.d.ts +4 -0
- package/dist/use-cases/commands/list-relevant-people.d.ts +4 -0
- package/dist/use-cases/commands/list-room-lists.d.ts +4 -0
- package/dist/use-cases/commands/list-rooms.d.ts +4 -0
- package/dist/use-cases/commands/list-sensitivity-labels.d.ts +4 -0
- package/dist/use-cases/commands/list-shared-calendar-events.d.ts +4 -0
- package/dist/use-cases/commands/list-shared-insights.d.ts +4 -0
- package/dist/use-cases/commands/list-shared-mailbox-folder-messages.d.ts +4 -0
- package/dist/use-cases/commands/list-shared-mailbox-messages.d.ts +4 -0
- package/dist/use-cases/commands/list-shared-with-me.d.ts +6 -0
- package/dist/use-cases/commands/list-sharepoint-list-columns.d.ts +4 -0
- package/dist/use-cases/commands/list-sharepoint-list-item-versions.d.ts +4 -0
- package/dist/use-cases/commands/list-sharepoint-site-drives.d.ts +1 -5
- package/dist/use-cases/commands/list-sharepoint-site-list-items.d.ts +1 -6
- package/dist/use-cases/commands/list-sharepoint-site-lists.d.ts +7 -2
- package/dist/use-cases/commands/list-sharepoint-site-onenote-notebook-sections.d.ts +5 -0
- package/dist/use-cases/commands/list-sharepoint-site-onenote-notebooks.d.ts +5 -0
- package/dist/use-cases/commands/list-sharepoint-site-onenote-section-pages.d.ts +5 -0
- package/dist/use-cases/commands/list-sharepoint-site-pages.d.ts +4 -0
- package/dist/use-cases/commands/list-site-columns.d.ts +4 -0
- package/dist/use-cases/commands/list-site-content-types.d.ts +4 -0
- package/dist/use-cases/commands/list-specific-calendar-events.d.ts +1 -5
- package/dist/use-cases/commands/list-team-channels.d.ts +1 -5
- package/dist/use-cases/commands/list-team-installed-apps.d.ts +8 -0
- package/dist/use-cases/commands/list-todo-linked-resources.d.ts +1 -6
- package/dist/use-cases/commands/list-todo-task-lists.d.ts +1 -3
- package/dist/use-cases/commands/list-todo-tasks-delta.d.ts +8 -0
- package/dist/use-cases/commands/list-todo-tasks.d.ts +8 -2
- package/dist/use-cases/commands/list-trending-insights.d.ts +4 -0
- package/dist/use-cases/commands/list-user-direct-reports.d.ts +4 -0
- package/dist/use-cases/commands/markdown-pipeline.d.ts +23 -0
- package/dist/use-cases/commands/microsoft-search-query.d.ts +8 -0
- package/dist/use-cases/commands/my-quick-context.d.ts +6 -0
- package/dist/use-cases/commands/next-page.d.ts +2 -2
- package/dist/use-cases/commands/odata-query.d.ts +90 -0
- package/dist/use-cases/commands/office-to-markdown.d.ts +6 -0
- package/dist/use-cases/commands/onenote-5k-limit.d.ts +3 -0
- package/dist/use-cases/commands/output-path.d.ts +37 -0
- package/dist/use-cases/commands/scopes-check.d.ts +6 -0
- package/dist/use-cases/commands/search-mail-messages.d.ts +3 -6
- package/dist/use-cases/commands/search-my-documents.d.ts +1 -5
- package/dist/use-cases/commands/search-onedrive-files.d.ts +1 -8
- package/dist/use-cases/commands/search-onenote-pages.d.ts +7 -2
- package/dist/use-cases/commands/search-sharepoint-sites-by-name.d.ts +1 -5
- package/dist/use-cases/commands/sharepoint-link-extractor.d.ts +14 -0
- package/dist/use-cases/commands/text-passthrough.d.ts +24 -0
- package/dist/use-cases/commands/version-id.d.ts +18 -0
- package/dist/use-cases/commands/xlsx-to-markdown.d.ts +6 -0
- package/dist/use-cases/ports/filesystem.d.ts +8 -0
- package/docs/commands.json +5365 -489
- package/package.json +9 -2
- /package/dist/use-cases/commands/{search-sharepoint-sites.d.ts → list-mail-folders-delta.d.ts} +0 -0
package/dist/infra/auth.d.ts
CHANGED
|
@@ -2,22 +2,50 @@ import type { AccessToken } from '../domain/access-token.js';
|
|
|
2
2
|
import type { Result } from '../domain/result.js';
|
|
3
3
|
import type { FileSystem } from '../use-cases/ports/filesystem.js';
|
|
4
4
|
import type { Logger } from '../use-cases/ports/logger.js';
|
|
5
|
-
import type { BrowserAuth } from './browser-auth.js';
|
|
5
|
+
import type { BrowserAuth, ElevatedFailureReason } from './browser-auth.js';
|
|
6
6
|
type AuthError = {
|
|
7
7
|
type: 'auth_failed';
|
|
8
8
|
message: string;
|
|
9
9
|
} | {
|
|
10
10
|
type: 'auth_cancelled';
|
|
11
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* Outcome of the elevated-token capture leg of the most recent
|
|
14
|
+
* browser-acquired session. Read by `login.execute` to surface a
|
|
15
|
+
* `{ elevated: 'captured' | 'failed', elevatedReason?: ... }` field on
|
|
16
|
+
* the login response so an LLM consumer can predict whether the
|
|
17
|
+
* elevated-dependent commands (chat metadata, historical-version
|
|
18
|
+
* downloads) will work without invoking them. Login-fix round-1 Wave D.
|
|
19
|
+
*/
|
|
20
|
+
type ElevatedOutcome = {
|
|
21
|
+
captured: true;
|
|
22
|
+
} | {
|
|
23
|
+
captured: false;
|
|
24
|
+
reason: ElevatedFailureReason | 'unknown_error';
|
|
25
|
+
};
|
|
12
26
|
type AuthManager = {
|
|
13
27
|
getAccessToken: () => Promise<Result<AccessToken, AuthError>>;
|
|
28
|
+
/**
|
|
29
|
+
* Returns a Graph token issued for an app on Microsoft's ODSP
|
|
30
|
+
* `logicalPermissions` allow-list. Falls through cache → re-capture
|
|
31
|
+
* via headless Playwright. Used by the 3 historical-version commands.
|
|
32
|
+
*/
|
|
33
|
+
getElevatedAccessToken: () => Promise<Result<AccessToken, AuthError>>;
|
|
14
34
|
logout: () => Promise<Result<void, AuthError>>;
|
|
35
|
+
/**
|
|
36
|
+
* Inspect the elevated-capture outcome from the most recent
|
|
37
|
+
* `acquireViaBrowser` invocation. Returns null if no browser-acquired
|
|
38
|
+
* session has happened in this process (cache hit / refresh-only).
|
|
39
|
+
* Login-fix round-1 Wave D.
|
|
40
|
+
*/
|
|
41
|
+
getLastElevatedOutcome: () => ElevatedOutcome | null;
|
|
15
42
|
};
|
|
16
|
-
declare const createAuthManagerFromApi: (browserAuth: BrowserAuth, cachePath: string, logger: Logger, fs: FileSystem) => AuthManager;
|
|
43
|
+
declare const createAuthManagerFromApi: (browserAuth: BrowserAuth, cachePath: string, browserProfileDir: string, logger: Logger, fs: FileSystem) => AuthManager;
|
|
17
44
|
declare const createAuthManager: (deps: {
|
|
18
45
|
cachePath: string;
|
|
19
46
|
logger: Logger;
|
|
20
47
|
fs?: FileSystem;
|
|
48
|
+
browserProfileDir?: string;
|
|
21
49
|
}) => AuthManager;
|
|
22
50
|
export { createAuthManager, createAuthManagerFromApi };
|
|
23
|
-
export type { AuthError, AuthManager };
|
|
51
|
+
export type { AuthError, AuthManager, ElevatedOutcome };
|
|
@@ -5,8 +5,78 @@ type BrowserTokenResult = {
|
|
|
5
5
|
accessToken: AccessToken;
|
|
6
6
|
refreshToken: string | null;
|
|
7
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* Discriminated outcome of an elevated-token capture attempt. Distinct
|
|
10
|
+
* failure variants let the caller pick the right error message AND let
|
|
11
|
+
* the auto-heal in auth.ts decide whether a retry is worthwhile (a
|
|
12
|
+
* recoverable failure like `launch_timeout` or `sso_timeout` is worth
|
|
13
|
+
* one retry after wiping the profile; `navigation_failed` is a network
|
|
14
|
+
* issue, not worth retrying).
|
|
15
|
+
*
|
|
16
|
+
* Login-fix round-1: was previously `AccessToken | null`, which conflated
|
|
17
|
+
* "browser launch hung", "navigation broke", and "silent-SSO polling
|
|
18
|
+
* timed out" into a single null and made the error message inaccurate.
|
|
19
|
+
*/
|
|
20
|
+
type ElevatedFailureReason = 'launch_timeout' | 'navigation_failed' | 'sso_timeout';
|
|
21
|
+
type ElevatedTokenResult = {
|
|
22
|
+
readonly ok: true;
|
|
23
|
+
readonly token: AccessToken;
|
|
24
|
+
} | {
|
|
25
|
+
readonly ok: false;
|
|
26
|
+
readonly reason: ElevatedFailureReason;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Combined outcome of capturing BOTH the Teams web client token AND the
|
|
30
|
+
* elevated M365ChatClient token inside one browser session. Login-fix
|
|
31
|
+
* round-2 introduced this to fix the user-visible "second browser asks
|
|
32
|
+
* me to log in again" symptom on federated tenants (LVMH / Okta): the
|
|
33
|
+
* old flow opened two separate browser sessions, and silent SSO for the
|
|
34
|
+
* elevated identity wouldn't pick up the cookies just freshly written
|
|
35
|
+
* by the first session. Capturing both in one context means cookies are
|
|
36
|
+
* live in memory — no disk-commit-vs-read race, no separate sign-in
|
|
37
|
+
* prompt for the elevated identity.
|
|
38
|
+
*/
|
|
39
|
+
type BothTokensResult = {
|
|
40
|
+
readonly teams: BrowserTokenResult | null;
|
|
41
|
+
readonly elevated: ElevatedTokenResult;
|
|
42
|
+
};
|
|
8
43
|
type BrowserAuth = {
|
|
9
44
|
acquireToken: (scopes: string[], startUrl: string) => Promise<BrowserTokenResult | null>;
|
|
45
|
+
/**
|
|
46
|
+
* Capture an "elevated" Graph access token by navigating to a
|
|
47
|
+
* different Microsoft web app whose first-party app identity is on
|
|
48
|
+
* Microsoft's allow-list for ODSP `logicalPermissions` (the scope our
|
|
49
|
+
* Teams web client token lacks for historical-version stream
|
|
50
|
+
* content). Reuses the persistent profile cookies — no second
|
|
51
|
+
* sign-in. Headless by default.
|
|
52
|
+
*
|
|
53
|
+
* Returns a discriminated union so the caller can distinguish the three
|
|
54
|
+
* failure modes (browser-launch hang, navigation failure, silent-SSO
|
|
55
|
+
* polling timeout). The caller decides whether the failure is fatal
|
|
56
|
+
* (it isn't for most commands; only the version + chat commands need
|
|
57
|
+
* this).
|
|
58
|
+
*
|
|
59
|
+
* Standalone fallback path: used by `getElevatedAccessToken` when the
|
|
60
|
+
* cached elevated token expires and the Teams session is already in
|
|
61
|
+
* the cache (no fresh sign-in needed). On `login`, use
|
|
62
|
+
* `acquireBothTokens` instead so the user sees only one browser.
|
|
63
|
+
*/
|
|
64
|
+
acquireElevatedToken: () => Promise<ElevatedTokenResult>;
|
|
65
|
+
/**
|
|
66
|
+
* Login-fix round-2: capture BOTH tokens inside ONE browser session.
|
|
67
|
+
* After the Teams response listener intercepts the Teams token,
|
|
68
|
+
* navigate the SAME page to the elevated URL and harvest the
|
|
69
|
+
* M365ChatClient bearer from outgoing request headers. Cookies are
|
|
70
|
+
* live in memory, so federated SSO chains (e.g. Okta-fronted
|
|
71
|
+
* tenants) work without a second visible sign-in.
|
|
72
|
+
*
|
|
73
|
+
* Returns `teams: null` if no Teams token came back within the full
|
|
74
|
+
* `pollDeadlineMs` (5 min). Returns
|
|
75
|
+
* `elevated: { ok: false, reason: ... }` if the elevated capture
|
|
76
|
+
* failed inside the same session — caller decides whether to surface
|
|
77
|
+
* the partial success.
|
|
78
|
+
*/
|
|
79
|
+
acquireBothTokens: (scopes: string[], teamsUrl: string) => Promise<BothTokensResult>;
|
|
10
80
|
close: () => Promise<void>;
|
|
11
81
|
};
|
|
12
82
|
type ResponseLike = {
|
|
@@ -17,6 +87,7 @@ type ResponseLike = {
|
|
|
17
87
|
type ResponseHandler = (response: ResponseLike) => void;
|
|
18
88
|
type PageLike = {
|
|
19
89
|
on(event: 'response', handler: ResponseHandler): void;
|
|
90
|
+
on(event: 'request', handler: RequestHandler): void;
|
|
20
91
|
goto(url: string, options: {
|
|
21
92
|
waitUntil: 'domcontentloaded';
|
|
22
93
|
timeout: number;
|
|
@@ -35,6 +106,11 @@ type LaunchOptions = {
|
|
|
35
106
|
channel?: 'msedge' | 'chrome';
|
|
36
107
|
args: string[];
|
|
37
108
|
};
|
|
109
|
+
type RequestLike = {
|
|
110
|
+
url(): string;
|
|
111
|
+
headers(): Record<string, string>;
|
|
112
|
+
};
|
|
113
|
+
type RequestHandler = (request: RequestLike) => void;
|
|
38
114
|
type BrowserAuthApi = {
|
|
39
115
|
launchPersistentContext(profileDir: string, options: LaunchOptions): Promise<ContextLike>;
|
|
40
116
|
};
|
|
@@ -55,6 +131,27 @@ type BrowserAuthConfig = {
|
|
|
55
131
|
readonly pollIntervalMs?: number;
|
|
56
132
|
readonly pollDeadlineMs?: number;
|
|
57
133
|
readonly navigationTimeoutMs?: number;
|
|
134
|
+
/**
|
|
135
|
+
* Deadline for the SILENT elevated-token recapture flow (no user
|
|
136
|
+
* interaction expected — persistent profile cookies do the SSO).
|
|
137
|
+
* Defaults to 20s. The audit (v1.0.0 §1.1) flagged that reusing the
|
|
138
|
+
* 5-minute interactive `pollDeadlineMs` for this silent path made
|
|
139
|
+
* `list-chats` etc. hang for minutes when cookies were stale, blowing
|
|
140
|
+
* the LLM tool-call window. With a tight cap, the flow either yields
|
|
141
|
+
* a token quickly or fails with `auth_failed: elevated token capture
|
|
142
|
+
* timed out — run `ask-marcel login` to refresh.`
|
|
143
|
+
*/
|
|
144
|
+
readonly elevatedRecaptureTimeoutMs?: number;
|
|
145
|
+
/**
|
|
146
|
+
* Hard deadline on `launchPersistentContext` + `newPage` for the
|
|
147
|
+
* elevated capture path. Defaults to 15s. Distinct from
|
|
148
|
+
* `elevatedRecaptureTimeoutMs` so the error message can name which
|
|
149
|
+
* step hung — launch vs polling. Audit login-fix round-1: previously
|
|
150
|
+
* unguarded, so a hung Playwright launch (corrupt persistent profile
|
|
151
|
+
* with stale `Singleton*` locks, or a slow browser binary) would
|
|
152
|
+
* block the whole command indefinitely.
|
|
153
|
+
*/
|
|
154
|
+
readonly elevatedLaunchTimeoutMs?: number;
|
|
58
155
|
};
|
|
59
156
|
declare const createPlaywrightApi: (loader: PlaywrightLoader) => BrowserAuthApi;
|
|
60
157
|
declare const createBrowserAuthFromApi: (api: BrowserAuthApi, config: BrowserAuthConfig) => BrowserAuth;
|
|
@@ -63,4 +160,4 @@ declare const createBrowserAuth: (deps: {
|
|
|
63
160
|
fs?: FileSystem;
|
|
64
161
|
}) => BrowserAuth;
|
|
65
162
|
export { createBrowserAuth, createBrowserAuthFromApi, createPlaywrightApi };
|
|
66
|
-
export type { BrowserAuth, BrowserAuthApi, BrowserAuthConfig, BrowserTokenResult, ChromiumLike, ContextLike, PageLike, PlaywrightLoader, ResponseLike };
|
|
163
|
+
export type { BothTokensResult, BrowserAuth, BrowserAuthApi, BrowserAuthConfig, BrowserTokenResult, ChromiumLike, ContextLike, ElevatedFailureReason, ElevatedTokenResult, PageLike, PlaywrightLoader, RequestLike, ResponseLike, };
|
|
@@ -4,19 +4,78 @@ type GraphError = {
|
|
|
4
4
|
type: 'api_error';
|
|
5
5
|
status: number;
|
|
6
6
|
message: string;
|
|
7
|
+
code?: string;
|
|
7
8
|
} | {
|
|
8
9
|
type: 'auth_failed';
|
|
9
10
|
message: string;
|
|
11
|
+
code?: string;
|
|
10
12
|
} | {
|
|
11
13
|
type: 'network_error';
|
|
12
14
|
message: string;
|
|
15
|
+
code?: string;
|
|
16
|
+
} | {
|
|
17
|
+
type: 'validation_error';
|
|
18
|
+
message: string;
|
|
19
|
+
code?: string;
|
|
13
20
|
};
|
|
14
21
|
type GraphClient = {
|
|
15
|
-
|
|
22
|
+
/**
|
|
23
|
+
* `extraHeaders` lets a caller add request headers Graph requires on
|
|
24
|
+
* specific endpoints — currently the only documented use is
|
|
25
|
+
* `Prefer: odata.maxpagesize=N` on the calendar/mail delta endpoints,
|
|
26
|
+
* which reject `$top` as a query parameter. Auth + content-type are
|
|
27
|
+
* always set internally.
|
|
28
|
+
*/
|
|
29
|
+
get: (path: string, extraHeaders?: Record<string, string>) => Promise<Result<unknown, GraphError>>;
|
|
30
|
+
/**
|
|
31
|
+
* Same JSON-GET shape as `get`, but signs the request with the
|
|
32
|
+
* elevated Graph token (M365ChatClient). Used by commands the Teams
|
|
33
|
+
* web client token cannot reach — currently `list-chats` and
|
|
34
|
+
* `get-chat`, which need `Chat.ReadBasic` (only present on the
|
|
35
|
+
* elevated token).
|
|
36
|
+
*/
|
|
37
|
+
getElevated: (path: string) => Promise<Result<unknown, GraphError>>;
|
|
16
38
|
post: (path: string, body: unknown) => Promise<Result<unknown, GraphError>>;
|
|
17
39
|
getBinary: (path: string) => Promise<Result<unknown, GraphError>>;
|
|
40
|
+
/**
|
|
41
|
+
* Same shape as `getBinary` but signs the request with an "elevated"
|
|
42
|
+
* Graph token (issued for an app on Microsoft's ODSP
|
|
43
|
+
* `logicalPermissions` allow-list — e.g., M365ChatClient). Used by
|
|
44
|
+
* the historical-version commands which the Teams web client token
|
|
45
|
+
* cannot fetch (403 logicalPermissionAccessDenied).
|
|
46
|
+
*/
|
|
47
|
+
getBinaryElevated: (path: string) => Promise<Result<unknown, GraphError>>;
|
|
48
|
+
/**
|
|
49
|
+
* Auth-less fetch of an arbitrary URL whose host MUST be on the
|
|
50
|
+
* Microsoft allow-list. Used to follow `@microsoft.graph.downloadUrl`
|
|
51
|
+
* 302 redirects (CDN-signed URLs) that the format-conversion
|
|
52
|
+
* commands sometimes get back from Graph instead of inline bytes.
|
|
53
|
+
*/
|
|
54
|
+
fetchUrl: (url: string) => Promise<Result<unknown, GraphError>>;
|
|
55
|
+
/**
|
|
56
|
+
* Upload bytes to a drive item. `basePath` is the bare driveItem
|
|
57
|
+
* path (e.g. `/me/drive/root:/.ask-marcel-temp/abc.rtf`) — `put()`
|
|
58
|
+
* appends `:/content` for the simple ≤4 MiB sync path or
|
|
59
|
+
* `:/createUploadSession` for the chunked-session path internally
|
|
60
|
+
* based on `body.byteLength`. No upper file-size limit beyond the
|
|
61
|
+
* user's OneDrive quota.
|
|
62
|
+
*/
|
|
63
|
+
put: (basePath: string, body: Uint8Array, contentType?: string) => Promise<Result<unknown, GraphError>>;
|
|
64
|
+
delete: (path: string) => Promise<Result<unknown, GraphError>>;
|
|
65
|
+
/**
|
|
66
|
+
* Decode the cached basic Teams token's JWT and return its scopes /
|
|
67
|
+
* audience / expiry. Used by the `scopes-check` self-test command so the
|
|
68
|
+
* LLM can predict `accessDenied` instead of discovering it on the next
|
|
69
|
+
* Graph call. No network IO — operates on the cached token only.
|
|
70
|
+
*/
|
|
71
|
+
getCachedTokenInfo: () => Promise<Result<TokenInfo, GraphError>>;
|
|
72
|
+
};
|
|
73
|
+
type TokenInfo = {
|
|
74
|
+
readonly scopes: ReadonlyArray<string>;
|
|
75
|
+
readonly audience: string | undefined;
|
|
76
|
+
readonly expiresAt: string | undefined;
|
|
18
77
|
};
|
|
19
78
|
type FetchFn = (url: string, init?: RequestInit) => Promise<Response>;
|
|
20
79
|
declare const createGraphClient: (auth: AuthManager, fetchFn?: FetchFn) => GraphClient;
|
|
21
80
|
export { createGraphClient };
|
|
22
|
-
export type { FetchFn, GraphClient, GraphError };
|
|
81
|
+
export type { FetchFn, GraphClient, GraphError, TokenInfo };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Result } from '../domain/result.js';
|
|
2
|
+
import type { GraphError } from './graph-client.js';
|
|
3
|
+
type SheetCsv = {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly csv: string;
|
|
6
|
+
};
|
|
7
|
+
declare const readSheetsAsCsv: (bytes: Uint8Array) => Result<ReadonlyArray<SheetCsv>, GraphError>;
|
|
8
|
+
export { readSheetsAsCsv };
|
|
9
|
+
export type { SheetCsv };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Logger } from '../use-cases/ports/logger.js';
|
|
2
|
-
|
|
3
|
-
declare const
|
|
2
|
+
type OutputFormat = 'text' | 'json';
|
|
3
|
+
declare const render: (data: unknown, logger: Logger, format: OutputFormat) => void;
|
|
4
|
+
declare const renderError: (message: string, format: OutputFormat, errorCode?: string) => void;
|
|
4
5
|
export { render, renderError };
|
|
6
|
+
export type { OutputFormat };
|
|
@@ -1,4 +1,48 @@
|
|
|
1
1
|
import type { z } from 'zod';
|
|
2
2
|
import type { Command } from './command-types.js';
|
|
3
|
+
import { type ODataKey } from './odata-query.js';
|
|
3
4
|
declare const buildCommand: (pathFn: (params: Record<string, string>) => string, schema: z.ZodType) => Pick<Command, "schema" | "execute">;
|
|
4
|
-
|
|
5
|
+
declare const buildElevatedCommand: (pathFn: (params: Record<string, string>) => string, schema: z.ZodType) => Pick<Command, "schema" | "execute">;
|
|
6
|
+
declare const buildListCommand: <Shape extends z.ZodRawShape>(pathFn: (params: z.infer<z.ZodObject<Shape>>) => string, schema: z.ZodObject<Shape>) => Pick<Command, "schema" | "execute">;
|
|
7
|
+
declare const buildElevatedListCommand: <Shape extends z.ZodRawShape>(pathFn: (params: z.infer<z.ZodObject<Shape>>) => string, schema: z.ZodObject<Shape>) => Pick<Command, "schema" | "execute">;
|
|
8
|
+
/**
|
|
9
|
+
* Single-resource GET that supports the OData `$select` and `$expand` query
|
|
10
|
+
* parameters. Mirrors `buildListCommand` but exposes only the two flags that
|
|
11
|
+
* make sense on a non-paginated resource — no `$top`/`$skip`/`$filter`/
|
|
12
|
+
* `$orderby` since there's no collection to slice. Lets an LLM ask only for
|
|
13
|
+
* the fields it needs (e.g. `--select id,subject`) instead of swallowing a
|
|
14
|
+
* 50 KB resource just to read a subject line.
|
|
15
|
+
*/
|
|
16
|
+
declare const buildSelectableCommand: <Shape extends z.ZodRawShape>(pathFn: (params: z.infer<z.ZodObject<Shape>>) => string, schema: z.ZodObject<Shape>) => Pick<Command, "schema" | "execute">;
|
|
17
|
+
/**
|
|
18
|
+
* Collection GET that supports ONLY `$filter` and `$select` — for endpoints
|
|
19
|
+
* Microsoft documents as rejecting the other OData passthroughs (`/teams/{id}/channels`
|
|
20
|
+
* is the canonical case: Graph returns BadRequest on `$top`, `$skip`, `$orderby`,
|
|
21
|
+
* `$expand`). Advertising the unsupported flags would be a usability lie.
|
|
22
|
+
*/
|
|
23
|
+
declare const buildFilterSelectListCommand: <Shape extends z.ZodRawShape>(pathFn: (params: z.infer<z.ZodObject<Shape>>) => string, schema: z.ZodObject<Shape>) => Pick<Command, "schema" | "execute">;
|
|
24
|
+
/**
|
|
25
|
+
* Collection GET on an endpoint that supports the usual OData passthroughs
|
|
26
|
+
* EXCEPT `$skip` (e.g. `/me/drive/recent`, `/sites/{id}/lists`,
|
|
27
|
+
* `/me/drive/search`). Graph rejects `$skip` with
|
|
28
|
+
* `invalidRequest: $skip is not supported on this API.`; the CLI mirrors
|
|
29
|
+
* by dropping `--skip` from the advertised flag set.
|
|
30
|
+
*/
|
|
31
|
+
declare const buildNoSkipListCommand: <Shape extends z.ZodRawShape>(pathFn: (params: z.infer<z.ZodObject<Shape>>) => string, schema: z.ZodObject<Shape>) => Pick<Command, "schema" | "execute">;
|
|
32
|
+
/**
|
|
33
|
+
* Collection GET that supports an EXPLICIT subset of OData passthroughs.
|
|
34
|
+
* Use for endpoints where Graph silently drops some flags — passing
|
|
35
|
+
* `keys: ['top', 'select']` advertises only `--top` and `--select` and
|
|
36
|
+
* keeps the manifest honest. The other narrower builders
|
|
37
|
+
* (`buildNoSkipListCommand`, `buildFilterSelectListCommand`) are
|
|
38
|
+
* specializations; this is the generic escape hatch.
|
|
39
|
+
*/
|
|
40
|
+
declare const buildPickODataListCommand: <Shape extends z.ZodRawShape, K extends ODataKey>(pathFn: (params: z.infer<z.ZodObject<Shape>>) => string, schema: z.ZodObject<Shape>, keys: ReadonlyArray<K>) => Pick<Command, "schema" | "execute">;
|
|
41
|
+
/**
|
|
42
|
+
* Elevated-token twin of `buildPickODataListCommand`. Use for endpoints that
|
|
43
|
+
* require the M365ChatClient identity (e.g. `/me/chats`, `/chats/{}/members`)
|
|
44
|
+
* AND honour only a subset of OData passthroughs — the chats family rejects
|
|
45
|
+
* `$orderby` / `$expand` with `BadRequest`, so the picker is the right tool.
|
|
46
|
+
*/
|
|
47
|
+
declare const buildElevatedPickODataListCommand: <Shape extends z.ZodRawShape, K extends ODataKey>(pathFn: (params: z.infer<z.ZodObject<Shape>>) => string, schema: z.ZodObject<Shape>, keys: ReadonlyArray<K>) => Pick<Command, "schema" | "execute">;
|
|
48
|
+
export { buildCommand, buildElevatedCommand, buildElevatedListCommand, buildElevatedPickODataListCommand, buildFilterSelectListCommand, buildListCommand, buildNoSkipListCommand, buildPickODataListCommand, buildSelectableCommand, };
|
|
@@ -3,14 +3,80 @@ import type { Result } from '../../domain/result.js';
|
|
|
3
3
|
import type { GraphClient } from '../../infra/graph-client.js';
|
|
4
4
|
type CommandSchema = z.ZodType;
|
|
5
5
|
type CommandExecute = (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, import('../../infra/graph-client.js').GraphError>>;
|
|
6
|
-
type CommandCategory = 'auth' | 'drive' | 'excel' | 'sharepoint' | 'tasks' | 'mail' | 'notes' | 'user' | 'calendar' | 'contacts' | 'chats' | 'teams' | 'meta';
|
|
6
|
+
type CommandCategory = 'auth' | 'drive' | 'excel' | 'sharepoint' | 'tasks' | 'mail' | 'notes' | 'user' | 'calendar' | 'contacts' | 'chats' | 'teams' | 'meta' | 'lifecycle';
|
|
7
7
|
type CommandHttpMethod = 'GET' | 'POST' | 'PATCH' | 'DELETE';
|
|
8
|
+
type CommandOptionAlias = {
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly key: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Structured type-hint for a CLI flag value. Surfaces in `help-json` so an
|
|
14
|
+
* LLM can avoid the trial-and-error of "is this an ID or a name?" prose
|
|
15
|
+
* reading. Optional — populate only where the hint is non-obvious from the
|
|
16
|
+
* flag name itself.
|
|
17
|
+
*/
|
|
18
|
+
type ArgumentHint = {
|
|
19
|
+
readonly kind: 'idOrName';
|
|
20
|
+
} | {
|
|
21
|
+
readonly kind: 'magicValue';
|
|
22
|
+
readonly values: ReadonlyArray<string>;
|
|
23
|
+
} | {
|
|
24
|
+
readonly kind: 'a1Address';
|
|
25
|
+
} | {
|
|
26
|
+
readonly kind: 'iso8601';
|
|
27
|
+
} | {
|
|
28
|
+
readonly kind: 'graphSubpath';
|
|
29
|
+
};
|
|
8
30
|
type CommandOptionMeta = {
|
|
9
31
|
readonly name: string;
|
|
10
32
|
readonly key: string;
|
|
11
33
|
readonly description: string;
|
|
12
|
-
|
|
34
|
+
/**
|
|
35
|
+
* `true` for required flags (the historical default; commander rejects the
|
|
36
|
+
* invocation if the flag is missing). `false` for optional flags such as the
|
|
37
|
+
* OData passthrough query parameters (`--top`, `--filter`, …) which
|
|
38
|
+
* commands accept but do not demand.
|
|
39
|
+
*/
|
|
40
|
+
readonly required: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Optional secondary spellings of the same flag. Both the canonical
|
|
43
|
+
* `name` and every alias name are accepted on the command line; values
|
|
44
|
+
* passed under an alias are normalized to the canonical `key` before
|
|
45
|
+
* the schema runs. The canonical name is what `--help` shows first.
|
|
46
|
+
*/
|
|
47
|
+
readonly aliases?: ReadonlyArray<CommandOptionAlias>;
|
|
48
|
+
/**
|
|
49
|
+
* Structured value-type hint for LLM consumers. Optional.
|
|
50
|
+
*/
|
|
51
|
+
readonly argumentHint?: ArgumentHint;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* A positional argument (i.e. NOT a `--flag`). Used today only for the
|
|
55
|
+
* `docs` lifecycle command (`ask-marcel docs <command>`) but kept as its
|
|
56
|
+
* own field so the manifest never claims a positional is a flag. An LLM
|
|
57
|
+
* consumer reading `help-json` can branch on the presence of
|
|
58
|
+
* `positionalArguments` to know to skip the `--` prefix.
|
|
59
|
+
*/
|
|
60
|
+
type CommandPositionalArgumentMeta = {
|
|
61
|
+
readonly name: string;
|
|
62
|
+
readonly required: boolean;
|
|
63
|
+
readonly description: string;
|
|
13
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* How a paginated command produces subsequent pages. Optional — populate
|
|
67
|
+
* for any command that has `pagination: true`. Lets an LLM tell which
|
|
68
|
+
* cursor field to feed back to `next-page` (or whether `next-page` is even
|
|
69
|
+
* applicable, vs `deltaLink`, vs the header-translation case).
|
|
70
|
+
*/
|
|
71
|
+
type PaginationStrategy =
|
|
72
|
+
/** Standard: `?$top=N&$skip=K` + `@odata.nextLink` cursor. */
|
|
73
|
+
'nextLink'
|
|
74
|
+
/** `?$top=N` + `nextLink` (Graph rejects `$skip` on this endpoint). */
|
|
75
|
+
| 'nextLinkNoSkip'
|
|
76
|
+
/** Delta endpoints — `nextLink` while paging, `deltaLink` on final page. */
|
|
77
|
+
| 'deltaLink'
|
|
78
|
+
/** `--top` translated to `Prefer: odata.maxpagesize` header; `$top` rejected as query. */
|
|
79
|
+
| 'preferMaxPageSize';
|
|
14
80
|
type CommandMeta = {
|
|
15
81
|
readonly summary: string;
|
|
16
82
|
readonly category: CommandCategory;
|
|
@@ -18,13 +84,41 @@ type CommandMeta = {
|
|
|
18
84
|
readonly graphPathTemplate: string;
|
|
19
85
|
readonly graphDocsUrl: string;
|
|
20
86
|
readonly options: ReadonlyArray<CommandOptionMeta>;
|
|
87
|
+
readonly positionalArguments?: ReadonlyArray<CommandPositionalArgumentMeta>;
|
|
21
88
|
readonly example: string;
|
|
22
89
|
readonly responseShape?: string;
|
|
23
90
|
readonly bodyTemplate?: string;
|
|
91
|
+
readonly pagination?: true;
|
|
92
|
+
readonly paginationStrategy?: PaginationStrategy;
|
|
93
|
+
/**
|
|
94
|
+
* Graph permission scopes the endpoint requires. The basic Teams web-client
|
|
95
|
+
* token grants ~30 scopes (run `ask-marcel scopes-check` to see). Commands
|
|
96
|
+
* with unmet scopes return `403 Forbidden: Missing scope` at the wire. Use
|
|
97
|
+
* this for pre-flight checks rather than failing on-the-wire. Optional —
|
|
98
|
+
* populated only on commands where the audit confirmed a scope-failure
|
|
99
|
+
* path; absent means "should work with the basic Teams token".
|
|
100
|
+
*/
|
|
101
|
+
readonly scopesRequired?: ReadonlyArray<string>;
|
|
102
|
+
/**
|
|
103
|
+
* `true` if the command needs the M365ChatClient elevated token (captured
|
|
104
|
+
* at login from `m365.cloud.microsoft`, ODSP allow-list). Only 3 commands
|
|
105
|
+
* today — the historical-version downloads. An LLM should check this
|
|
106
|
+
* field before invoking; if the elevated capture failed at login, these
|
|
107
|
+
* commands will time out.
|
|
108
|
+
*/
|
|
109
|
+
readonly needsElevatedToken?: true;
|
|
110
|
+
/**
|
|
111
|
+
* `true` if the command returns inlined bytes (`{contentType, size, base64}`
|
|
112
|
+
* or `{contentType, size, text}`) and is therefore a valid target for the
|
|
113
|
+
* global `--output-path` flag. Used by the CLI composition to derive the
|
|
114
|
+
* rejection-message whitelist from the manifest rather than hand-keeping it
|
|
115
|
+
* as a string literal. Audit round-8 Wave E2.
|
|
116
|
+
*/
|
|
117
|
+
readonly producesBytes?: true;
|
|
24
118
|
};
|
|
25
119
|
type Command = {
|
|
26
120
|
readonly schema: CommandSchema;
|
|
27
121
|
readonly execute: CommandExecute;
|
|
28
122
|
readonly meta: CommandMeta;
|
|
29
123
|
};
|
|
30
|
-
export type { Command, CommandCategory, CommandExecute, CommandHttpMethod, CommandMeta, CommandOptionMeta, CommandSchema };
|
|
124
|
+
export type { ArgumentHint, Command, CommandCategory, CommandExecute, CommandHttpMethod, CommandMeta, CommandOptionAlias, CommandOptionMeta, CommandPositionalArgumentMeta, CommandSchema, PaginationStrategy, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Result } from '../../domain/result.js';
|
|
3
|
+
import type { GraphClient, GraphError } from '../../infra/graph-client.js';
|
|
4
|
+
import type { CommandMeta } from './command-types.js';
|
|
5
|
+
declare const schema: z.ZodObject<{
|
|
6
|
+
messageId: z.ZodString;
|
|
7
|
+
attachmentId: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
|
|
10
|
+
declare const meta: CommandMeta;
|
|
11
|
+
export { execute, meta, schema };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Result } from '../../domain/result.js';
|
|
3
|
+
import type { GraphClient, GraphError } from '../../infra/graph-client.js';
|
|
4
|
+
import type { CommandMeta } from './command-types.js';
|
|
5
|
+
declare const schema: z.ZodObject<{
|
|
6
|
+
messageId: z.ZodString;
|
|
7
|
+
attachmentId: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
|
|
10
|
+
declare const meta: CommandMeta;
|
|
11
|
+
export { execute, meta, schema };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Result } from '../../domain/result.js';
|
|
3
|
+
import type { GraphClient, GraphError } from '../../infra/graph-client.js';
|
|
4
|
+
import type { CommandMeta } from './command-types.js';
|
|
5
|
+
declare const schema: z.ZodObject<{
|
|
6
|
+
messageId: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
|
|
9
|
+
declare const meta: CommandMeta;
|
|
10
|
+
export { execute, meta, schema };
|
|
@@ -7,10 +7,17 @@ export type CommandManifestEntry = {
|
|
|
7
7
|
readonly graphPathTemplate: string;
|
|
8
8
|
readonly graphDocsUrl: string;
|
|
9
9
|
readonly options: CommandMeta['options'];
|
|
10
|
+
readonly positionalArguments?: CommandMeta['positionalArguments'];
|
|
10
11
|
readonly example: string;
|
|
11
12
|
readonly responseShape?: string;
|
|
12
13
|
readonly bodyTemplate?: string;
|
|
14
|
+
readonly pagination?: true;
|
|
15
|
+
readonly paginationStrategy?: CommandMeta['paginationStrategy'];
|
|
16
|
+
readonly scopesRequired?: CommandMeta['scopesRequired'];
|
|
17
|
+
readonly needsElevatedToken?: CommandMeta['needsElevatedToken'];
|
|
18
|
+
readonly producesBytes?: CommandMeta['producesBytes'];
|
|
13
19
|
};
|
|
20
|
+
export declare const PAGINATION_HINT = "Paginated by Microsoft Graph. The CLI hoists `@odata.nextLink` out of `data` to the **top-level `nextLink`** field of the response envelope (and `@odata.deltaLink` to top-level `deltaLink` for delta commands). Pass that URL to `next-page --url <link>` and repeat until the field is absent. Do NOT look for `data[\"@odata.nextLink\"]` \u2014 the presenter strips it from `data` so the cursor is always at envelope level.";
|
|
14
21
|
export type CommandManifest = {
|
|
15
22
|
readonly package: string;
|
|
16
23
|
readonly version: string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Result } from '../../domain/result.js';
|
|
2
|
+
import type { GraphError } from '../../infra/graph-client.js';
|
|
3
|
+
type MarkdownEnvelope = {
|
|
4
|
+
readonly contentType: 'text/markdown';
|
|
5
|
+
readonly size: number;
|
|
6
|
+
readonly text: string;
|
|
7
|
+
};
|
|
8
|
+
declare const promoteFirstRowToThead: (html: string) => string;
|
|
9
|
+
declare const docxToMarkdown: (bytes: Uint8Array) => Promise<Result<MarkdownEnvelope, GraphError>>;
|
|
10
|
+
export { docxToMarkdown, promoteFirstRowToThead };
|
|
11
|
+
export type { MarkdownEnvelope };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Result } from '../../domain/result.js';
|
|
3
|
+
import type { GraphClient, GraphError } from '../../infra/graph-client.js';
|
|
4
|
+
import type { CommandMeta } from './command-types.js';
|
|
5
|
+
declare const schema: z.ZodObject<{
|
|
6
|
+
driveId: z.ZodString;
|
|
7
|
+
itemId: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
|
|
10
|
+
declare const meta: CommandMeta;
|
|
11
|
+
export { execute, meta, schema };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Result } from '../../domain/result.js';
|
|
3
|
+
import type { GraphClient, GraphError } from '../../infra/graph-client.js';
|
|
4
|
+
import type { CommandMeta } from './command-types.js';
|
|
5
|
+
declare const schema: z.ZodObject<{
|
|
6
|
+
driveId: z.ZodString;
|
|
7
|
+
itemId: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
|
|
10
|
+
declare const meta: CommandMeta;
|
|
11
|
+
export { execute, meta, schema };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Result } from '../../domain/result.js';
|
|
3
|
+
import type { GraphClient, GraphError } from '../../infra/graph-client.js';
|
|
4
|
+
import type { CommandMeta } from './command-types.js';
|
|
5
|
+
declare const schema: z.ZodObject<{
|
|
6
|
+
driveId: z.ZodString;
|
|
7
|
+
itemId: z.ZodString;
|
|
8
|
+
versionId: z.ZodString;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
|
|
11
|
+
declare const meta: CommandMeta;
|
|
12
|
+
export { execute, meta, schema };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Result } from '../../domain/result.js';
|
|
3
|
+
import type { GraphClient, GraphError } from '../../infra/graph-client.js';
|
|
4
|
+
import type { CommandMeta } from './command-types.js';
|
|
5
|
+
declare const schema: z.ZodObject<{
|
|
6
|
+
driveId: z.ZodString;
|
|
7
|
+
itemId: z.ZodString;
|
|
8
|
+
versionId: z.ZodString;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
|
|
11
|
+
declare const meta: CommandMeta;
|
|
12
|
+
export { execute, meta, schema };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { Result } from '../../domain/result.js';
|
|
3
|
-
import type { GraphClient } from '../../infra/graph-client.js';
|
|
3
|
+
import type { GraphClient, GraphError } from '../../infra/graph-client.js';
|
|
4
4
|
import type { CommandMeta } from './command-types.js';
|
|
5
5
|
declare const schema: z.ZodObject<{
|
|
6
6
|
driveId: z.ZodString;
|
|
7
7
|
itemId: z.ZodString;
|
|
8
8
|
}, z.core.$strip>;
|
|
9
|
-
declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown,
|
|
9
|
+
declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
|
|
10
10
|
declare const meta: CommandMeta;
|
|
11
11
|
export { execute, meta, schema };
|