@pi-oxide/extension-js 0.13.0 → 0.13.3

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.
Files changed (145) hide show
  1. package/content-script.js +3 -3
  2. package/extension_js.d.ts +51 -48
  3. package/extension_js.js +104029 -26174
  4. package/index.js +1260 -1115
  5. package/package.json +2 -5
  6. package/worker.js +483 -474
  7. package/content-script/action-result.d.ts +0 -4
  8. package/content-script/dom-tree.d.ts +0 -28
  9. package/content-script/dom-utils.d.ts +0 -37
  10. package/content-script/file-resolution.d.ts +0 -22
  11. package/content-script/form-validation.d.ts +0 -12
  12. package/content-script/handlers.d.ts +0 -3
  13. package/content-script/index.d.ts +0 -6
  14. package/content-script/listbox.d.ts +0 -7
  15. package/content-script/logger.d.ts +0 -12
  16. package/content-script/message-router.d.ts +0 -1
  17. package/content-script/observation-lease.d.ts +0 -55
  18. package/content-script/registry.d.ts +0 -24
  19. package/content-script/schemas.d.ts +0 -5
  20. package/content-script/snapshot.d.ts +0 -3
  21. package/main/index.d.ts +0 -8
  22. package/main/runner/chrome/internals.d.ts +0 -9
  23. package/main/runner/chrome/native.d.ts +0 -6
  24. package/main/runner/command.d.ts +0 -3
  25. package/main/runner/dom/snapshot.d.ts +0 -8
  26. package/main/runner/fetch.d.ts +0 -4
  27. package/main/runner/host.d.ts +0 -3
  28. package/main/runner/index.d.ts +0 -2
  29. package/main/runner/lib/constants.d.ts +0 -14
  30. package/main/runner/lib/host-registry.d.ts +0 -6
  31. package/main/runner/lib/network-tracker.d.ts +0 -16
  32. package/main/runner/lib/params-helpers.d.ts +0 -2
  33. package/main/runner/lib/params.d.ts +0 -5
  34. package/main/runner/lib/types.d.ts +0 -116
  35. package/main/runner/runtime.d.ts +0 -15
  36. package/main/runner/sidepanel/dom.d.ts +0 -6
  37. package/main/runner/snapshot-merge.d.ts +0 -8
  38. package/main/runner/tab/execute.d.ts +0 -24
  39. package/main/runner/tools/aliases.d.ts +0 -1
  40. package/main/runner/tools/chrome/action.d.ts +0 -1
  41. package/main/runner/tools/chrome/alarms.d.ts +0 -1
  42. package/main/runner/tools/chrome/bookmarks.d.ts +0 -1
  43. package/main/runner/tools/chrome/browsing-data.d.ts +0 -1
  44. package/main/runner/tools/chrome/capability.d.ts +0 -30
  45. package/main/runner/tools/chrome/context-menus.d.ts +0 -1
  46. package/main/runner/tools/chrome/cookies.d.ts +0 -1
  47. package/main/runner/tools/chrome/declarative-net-request.d.ts +0 -1
  48. package/main/runner/tools/chrome/desktop-capture.d.ts +0 -1
  49. package/main/runner/tools/chrome/downloads.d.ts +0 -1
  50. package/main/runner/tools/chrome/history.d.ts +0 -1
  51. package/main/runner/tools/chrome/identity.d.ts +0 -1
  52. package/main/runner/tools/chrome/idle.d.ts +0 -1
  53. package/main/runner/tools/chrome/index.d.ts +0 -1
  54. package/main/runner/tools/chrome/management.d.ts +0 -1
  55. package/main/runner/tools/chrome/notifications.d.ts +0 -1
  56. package/main/runner/tools/chrome/offscreen.d.ts +0 -1
  57. package/main/runner/tools/chrome/page-capture.d.ts +0 -1
  58. package/main/runner/tools/chrome/permissions.d.ts +0 -1
  59. package/main/runner/tools/chrome/register-helpers.d.ts +0 -9
  60. package/main/runner/tools/chrome/runtime.d.ts +0 -1
  61. package/main/runner/tools/chrome/scripting.d.ts +0 -1
  62. package/main/runner/tools/chrome/sessions.d.ts +0 -1
  63. package/main/runner/tools/chrome/side-panel.d.ts +0 -1
  64. package/main/runner/tools/chrome/system.d.ts +0 -1
  65. package/main/runner/tools/chrome/tab-groups.d.ts +0 -1
  66. package/main/runner/tools/chrome/tabs.d.ts +0 -1
  67. package/main/runner/tools/chrome/top-sites.d.ts +0 -1
  68. package/main/runner/tools/chrome/windows.d.ts +0 -1
  69. package/main/runner/tools/chrome-storage.d.ts +0 -1
  70. package/main/runner/tools/clipboard.d.ts +0 -1
  71. package/main/runner/tools/dom.d.ts +0 -1
  72. package/main/runner/tools/host-call.d.ts +0 -1
  73. package/main/runner/tools/network.d.ts +0 -1
  74. package/main/runner/tools/page.d.ts +0 -1
  75. package/main/runner/tools/sidepanel.d.ts +0 -1
  76. package/main/runner/tools/storage.d.ts +0 -1
  77. package/main/runner/tools/tab.d.ts +0 -1
  78. package/main/session/extension-session.d.ts +0 -106
  79. package/main/tab-context.d.ts +0 -12
  80. package/shared/array-buffer.d.ts +0 -4
  81. package/shared/collect-inline-snapshot.d.ts +0 -50
  82. package/shared/cross/agent-errors.d.ts +0 -28
  83. package/shared/cross/array-buffer.d.ts +0 -4
  84. package/shared/cross/collect-inline-snapshot.d.ts +0 -58
  85. package/shared/cross/content-script-actions.d.ts +0 -7
  86. package/shared/cross/content-script-tools.d.ts +0 -3
  87. package/shared/cross/dispatch.d.ts +0 -5
  88. package/shared/cross/fetch-response.d.ts +0 -12
  89. package/shared/cross/format-types.d.ts +0 -43
  90. package/shared/cross/fs-types.d.ts +0 -81
  91. package/shared/cross/generated.d.ts +0 -328
  92. package/shared/cross/manifest.d.ts +0 -130
  93. package/shared/cross/normalize-agent-error.d.ts +0 -17
  94. package/shared/cross/page-specs.d.ts +0 -7
  95. package/shared/cross/schemas/chrome.d.ts +0 -56
  96. package/shared/cross/schemas/clipboard.d.ts +0 -19
  97. package/shared/cross/schemas/fs.d.ts +0 -65
  98. package/shared/cross/schemas/helpers.d.ts +0 -71
  99. package/shared/cross/schemas/host.d.ts +0 -15
  100. package/shared/cross/schemas/network.d.ts +0 -34
  101. package/shared/cross/schemas/page.d.ts +0 -494
  102. package/shared/cross/schemas/returns.d.ts +0 -8791
  103. package/shared/cross/schemas/sidepanel.d.ts +0 -284
  104. package/shared/cross/schemas/snapshot.d.ts +0 -272
  105. package/shared/cross/schemas/storage.d.ts +0 -60
  106. package/shared/cross/schemas/tab.d.ts +0 -597
  107. package/shared/cross/schemas.d.ts +0 -12
  108. package/shared/cross/snapshot-filter.d.ts +0 -15
  109. package/shared/cross/tab-specs.d.ts +0 -3
  110. package/shared/cross/types.d.ts +0 -12
  111. package/shared/cross/zod-to-docs.d.ts +0 -28
  112. package/shared/cs/ref-id.d.ts +0 -5
  113. package/shared/cs/snapshot-dom.d.ts +0 -47
  114. package/shared/fetch-response.d.ts +0 -12
  115. package/shared/fs-types.d.ts +0 -81
  116. package/shared/generated.d.ts +0 -241
  117. package/shared/log-levels.d.ts +0 -5
  118. package/shared/logger.d.ts +0 -18
  119. package/shared/main/content-script-response.d.ts +0 -5
  120. package/shared/main/define-content-script-tool.d.ts +0 -7
  121. package/shared/main/log-levels.d.ts +0 -5
  122. package/shared/main/logger.d.ts +0 -18
  123. package/shared/main/routes.d.ts +0 -14
  124. package/shared/main/tool-registry.d.ts +0 -19
  125. package/shared/ref-id.d.ts +0 -5
  126. package/shared/registry/agent-errors.d.ts +0 -27
  127. package/shared/registry/content-script-actions.d.ts +0 -7
  128. package/shared/registry/content-script-response.d.ts +0 -5
  129. package/shared/registry/content-script-tools.d.ts +0 -13
  130. package/shared/registry/define-content-script-tool.d.ts +0 -7
  131. package/shared/registry/dispatch.d.ts +0 -5
  132. package/shared/registry/manifest.d.ts +0 -130
  133. package/shared/registry/normalize-agent-error.d.ts +0 -17
  134. package/shared/registry/routes.d.ts +0 -14
  135. package/shared/registry/types.d.ts +0 -12
  136. package/shared/registry/zod-to-docs.d.ts +0 -28
  137. package/shared/schemas.d.ts +0 -10663
  138. package/shared/snapshot-dom.d.ts +0 -47
  139. package/shared/snapshot-filter.d.ts +0 -15
  140. package/shared/tool-registry.d.ts +0 -19
  141. package/worker/binary-blob-store.d.ts +0 -12
  142. package/worker/fetch-store.d.ts +0 -1
  143. package/worker/resolve-set-files.d.ts +0 -22
  144. package/worker/vfs-write-cache.d.ts +0 -3
  145. package/worker/worker.d.ts +0 -84
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,106 +0,0 @@
1
- import { CellResult, FsCopyParams, FsHashParams, FsPathParams, FsReadRangeDataParams, FsReadRangeParams, FsWriteParams, WasmGlobalsSnapshot } from '../../../pkg/extension_js.js';
2
- import { InlineSnapshotResult } from '../../shared/cross/collect-inline-snapshot.js';
3
- import { SnapshotFilter } from '../../shared/cross/snapshot-filter.js';
4
- import { LogLevel } from '../../shared/main/logger.js';
5
-
6
- export declare class ExtensionSession {
7
- private worker;
8
- private pendingCalls;
9
- private inFlightRelays;
10
- private disposed;
11
- private onCleanupComplete;
12
- private abortController;
13
- private runQueue;
14
- private constructor();
15
- /**
16
- * Initialize the extension-js runtime.
17
- * Automatically detects extension context, spawns the Worker,
18
- * starts the main-thread runner loop, and returns [session, runner].
19
- *
20
- * The spawned Worker uses `new Worker(..., { type: "module" })`. Your bundler
21
- * must support emitting module Workers as separate chunks.
22
- *
23
- * AbortController is module-global: only one active session per extension
24
- * page is fully safe. Concurrent sessions race on the same abort signal.
25
- */
26
- static init(): Promise<[ExtensionSession, Promise<void>]>;
27
- private startWorker;
28
- private handleWorkerMessage;
29
- private executeContextCommand;
30
- /**
31
- * Race a main-thread command against a hard timeout. If the handler hangs
32
- * (e.g. waitForTabLoad on a page that never reaches `complete`, or a content
33
- * script that never reconnects), this converts the hang into a structured
34
- * E_TIMEOUT error that the relay posts back to the worker — instead of
35
- * leaving the cell's join_all awaiting forever.
36
- */
37
- private withMainThreadTimeout;
38
- registerWorkerRelayPort(owner: string, port: MessagePort): void;
39
- private executeContentScriptCommand;
40
- /** Send a registryCall to a specific frame and unwrap the response. */
41
- private sendToFrame;
42
- private postAndWait;
43
- runCellAsync(code: string, stdin?: string, traceId?: string): Promise<CellResult>;
44
- setLogLevel(level: LogLevel): void;
45
- reset(): Promise<void>;
46
- inspectGlobals(): Promise<WasmGlobalsSnapshot>;
47
- apiDocs(format?: "json" | "markdown"): Promise<unknown[] | string>;
48
- setFuelLimit(limit: number): void;
49
- loadLibrary(source: string): Promise<CellResult>;
50
- private safePost;
51
- private safePostCsv;
52
- private safePostZip;
53
- private safePostXlsx;
54
- private safePostPdf;
55
- get fs(): {
56
- exists: (params: FsPathParams) => Promise<import('../../worker/extension_js.js').FsExistsResult>;
57
- stat: (params: FsPathParams) => Promise<import('../../worker/extension_js.js').FsStatResult>;
58
- read: (params: FsPathParams) => Promise<import('../../worker/extension_js.js').FsStringResult>;
59
- readText: (params: FsPathParams) => Promise<import('../../worker/extension_js.js').FsStringResult>;
60
- readBase64: (params: FsPathParams) => Promise<import('../../worker/extension_js.js').FsStringResult>;
61
- list: (params: FsPathParams) => Promise<import('../../worker/extension_js.js').FsListResult>;
62
- mkdir: (params: FsPathParams) => Promise<import('../../worker/extension_js.js').FsBoolResult>;
63
- delete: (params: FsPathParams) => Promise<import('../../worker/extension_js.js').FsBoolResult>;
64
- copy: (params: FsCopyParams) => Promise<import('../../worker/extension_js.js').FsBoolResult>;
65
- move: (params: FsCopyParams) => Promise<import('../../worker/extension_js.js').FsBoolResult>;
66
- write: (params: FsWriteParams) => Promise<import('../../worker/extension_js.js').FsWriteResult>;
67
- writeText: (params: FsWriteParams) => Promise<import('../../worker/extension_js.js').FsWriteResult>;
68
- writeBase64: (params: FsWriteParams) => Promise<import('../../worker/extension_js.js').FsWriteResult>;
69
- append: (params: FsWriteParams) => Promise<import('../../worker/extension_js.js').FsWriteResult>;
70
- appendText: (params: FsWriteParams) => Promise<import('../../worker/extension_js.js').FsWriteResult>;
71
- appendBase64: (params: FsWriteParams) => Promise<import('../../worker/extension_js.js').FsWriteResult>;
72
- readRange: (params: FsReadRangeParams) => Promise<import('../../worker/extension_js.js').FsStringResult>;
73
- update: (params: FsReadRangeDataParams) => Promise<import('../../worker/extension_js.js').FsBoolResult>;
74
- hash: (params: FsHashParams) => Promise<import('../../worker/extension_js.js').FsHashResult>;
75
- };
76
- get csv(): {
77
- parse: (params: FsPathParams) => Promise<import('../../worker/extension_js.js').FsStringResult>;
78
- };
79
- get zip(): {
80
- list: (params: FsPathParams) => Promise<import('../../worker/extension_js.js').FsStringResult>;
81
- };
82
- get xlsx(): {
83
- read: (params: FsPathParams) => Promise<import('../../worker/extension_js.js').FsStringResult>;
84
- };
85
- get pdf(): {
86
- text: (params: FsPathParams) => Promise<import('../../worker/extension_js.js').FsStringResult>;
87
- };
88
- get snapshot(): {
89
- query: (filter?: SnapshotFilter, options?: {
90
- maxNodes?: number;
91
- tabId?: number;
92
- }) => Promise<InlineSnapshotResult>;
93
- };
94
- /**
95
- * Clean up the session, terminate the Worker, and release resources.
96
- * Accepts the runner Promise returned by init() so it can be awaited
97
- * for graceful shutdown.
98
- *
99
- * Sends a reset message to the Worker, then waits only 50 ms before
100
- * forcefully calling worker.terminate(). If WASM cleanup takes longer,
101
- * the Worker is killed mid-operation. Pending async calls are rejected
102
- * with "ExtensionSession stopped".
103
- */
104
- stopWith(runner: Promise<void>): Promise<void>;
105
- private generateId;
106
- }
@@ -1,12 +0,0 @@
1
- import { TabPolicy } from '../shared/cross/types.js';
2
-
3
- export declare function getActiveTabId(): number | null;
4
- export declare function setActiveTabId(tabId: number | null): void;
5
- export declare function initTabContext(chromeApi: typeof chrome): void;
6
- export declare function removeTabContextListeners(): void;
7
- /** @deprecated Use initTabContext — kept for runner API compatibility */
8
- export declare function initExtensionListeners(): void;
9
- /** @deprecated Use removeTabContextListeners — kept for runner API compatibility */
10
- export declare function removeExtensionListeners(): void;
11
- export declare function resolveActiveTabId(): Promise<number | null>;
12
- export declare function resolveTabId(tabPolicy: TabPolicy, params: Record<string, unknown>): number;
@@ -1,4 +0,0 @@
1
- /** Decode a base64 string into bytes. Throws on invalid input. */
2
- export declare function base64ToUint8Array(base64: string): Uint8Array;
3
- /** Convert Uint8Array to base64 without spread-arg limits on large buffers. */
4
- export declare function arrayBufferToBase64(bytes: Uint8Array): string;
@@ -1,50 +0,0 @@
1
- export type InlineSnapshotNode = {
2
- refId: string;
3
- role: string;
4
- tag: string;
5
- controlType?: string;
6
- actionable?: boolean;
7
- forControl?: string;
8
- recommendedAction?: string;
9
- controls?: string;
10
- expanded?: boolean;
11
- name?: string;
12
- text?: string;
13
- value?: string;
14
- checked?: boolean;
15
- disabled?: boolean;
16
- readOnly?: boolean;
17
- selected?: boolean;
18
- required?: boolean;
19
- valid?: boolean;
20
- invalid?: boolean;
21
- validationMessage?: string;
22
- errorMessage?: string;
23
- href?: string;
24
- src?: string;
25
- alt?: string;
26
- title?: string;
27
- parentRefId?: string;
28
- postId?: string;
29
- permalink?: string;
30
- imageUrls?: string[];
31
- accept?: string;
32
- filesCount?: number;
33
- };
34
- export type FormErrorEntry = {
35
- field: string;
36
- error: string;
37
- refId: string;
38
- };
39
- export type InlineSnapshotResult = {
40
- text: string;
41
- nodes: InlineSnapshotNode[];
42
- formErrors: FormErrorEntry[];
43
- url: string;
44
- title: string;
45
- viewport: {
46
- width: number;
47
- height: number;
48
- };
49
- };
50
- export declare function collectInlineSnapshot(maxNodes: number): InlineSnapshotResult;
@@ -1,28 +0,0 @@
1
- import { AsyncError } from './manifest.js';
2
-
3
- export declare function contentScriptMissingError(tabId?: number, url?: string): AsyncError;
4
- export declare function noTabError(action: string): AsyncError;
5
- export type StaleRefCandidate = {
6
- refId: string;
7
- role?: string;
8
- name?: string;
9
- };
10
- export declare function staleRefError(refId: string, options?: {
11
- label?: string;
12
- candidates?: StaleRefCandidate[];
13
- snapshot?: unknown;
14
- }): AsyncError;
15
- export declare function notInteractableError(action: string, refId: string, details?: Record<string, unknown>): AsyncError;
16
- export declare function observationRequiredError(action: string): AsyncError;
17
- export declare function ambiguousTargetError(label: string): AsyncError;
18
- export declare function isContentScriptConnectionError(msg: string): boolean;
19
- export declare function throwStructuredAgentError(error: AsyncError): never;
20
- export declare function labelNotFoundError(label: string, candidates?: StaleRefCandidate[], extra?: {
21
- searchedIds?: string[];
22
- ignoredIds?: string[];
23
- targetRefId?: string;
24
- targetName?: string;
25
- ariaControlsBefore?: string | null;
26
- ariaControlsAfter?: string | null;
27
- isDropdown?: boolean;
28
- }): AsyncError;
@@ -1,4 +0,0 @@
1
- /** Decode a base64 string into bytes. Throws on invalid input. */
2
- export declare function base64ToUint8Array(base64: string): Uint8Array;
3
- /** Convert Uint8Array to base64 without spread-arg limits on large buffers. */
4
- export declare function arrayBufferToBase64(bytes: Uint8Array): string;
@@ -1,58 +0,0 @@
1
- export type InlineSnapshotNode = {
2
- refId: string;
3
- role: string;
4
- tag: string;
5
- controlType?: string;
6
- actionable?: boolean;
7
- forControl?: string;
8
- recommendedAction?: string;
9
- controls?: string;
10
- expanded?: boolean;
11
- name?: string;
12
- text?: string;
13
- value?: string;
14
- checked?: boolean;
15
- disabled?: boolean;
16
- readOnly?: boolean;
17
- selected?: boolean;
18
- required?: boolean;
19
- valid?: boolean;
20
- invalid?: boolean;
21
- validationMessage?: string;
22
- errorMessage?: string;
23
- href?: string;
24
- src?: string;
25
- alt?: string;
26
- title?: string;
27
- parentRefId?: string;
28
- postId?: string;
29
- permalink?: string;
30
- imageUrls?: string[];
31
- accept?: string;
32
- filesCount?: number;
33
- };
34
- export type FormErrorEntry = {
35
- field: string;
36
- error: string;
37
- refId: string;
38
- };
39
- export type InlineSnapshotResult = {
40
- text: string;
41
- nodes: InlineSnapshotNode[];
42
- formErrors: FormErrorEntry[];
43
- url: string;
44
- title: string;
45
- viewport: {
46
- width: number;
47
- height: number;
48
- };
49
- };
50
- export declare const enrichDropdown: (el: Element, node: {
51
- role?: string;
52
- tag: string;
53
- controlType?: string;
54
- recommendedAction?: string;
55
- controls?: string;
56
- expanded?: boolean;
57
- }) => void;
58
- export declare function collectInlineSnapshot(maxNodes: number): InlineSnapshotResult;
@@ -1,7 +0,0 @@
1
- export declare function addContentScriptAction(action: string): void;
2
- export declare function isContentScriptAction(action: string): boolean;
3
- export declare function getContentScriptActions(): string[];
4
- /** Test-only helper: clear the dynamic content-script action set. */
5
- export declare function clearContentScriptActions(): void;
6
- /** Map registry action (page_click) to content-script handler key (click). */
7
- export declare function toHandlerAction(action: string): string;
@@ -1,3 +0,0 @@
1
- export type { ContentScriptToolSpec } from './page-specs.js';
2
- export { AWAIT_PROMISE_NOTE } from './page-specs.js';
3
- export declare const CONTENT_SCRIPT_TOOL_SPECS: readonly (import('./page-specs.js').ContentScriptToolSpec<unknown, unknown> | import('./page-specs.js').ContentScriptToolSpec)[];
@@ -1,5 +0,0 @@
1
- import { z } from 'zod';
2
- import { AsyncResponse } from './manifest.js';
3
-
4
- export declare function formatValidationError(action: string, schema: z.ZodTypeAny, issues: z.ZodIssue[], params?: unknown): string;
5
- export declare function dispatchValidated<P, R>(paramsSchema: z.ZodSchema<P>, returnsSchema: z.ZodSchema<R>, handler: (params: P) => Promise<R> | R, params: unknown, action: string): Promise<AsyncResponse<R>>;
@@ -1,12 +0,0 @@
1
- export type FetchValue = {
2
- status: number;
3
- ok: boolean;
4
- headers: Record<string, string>;
5
- body: string;
6
- bodyEncoding: "text" | "base64";
7
- byteLength: number;
8
- contentType: string;
9
- finalUrl: string;
10
- };
11
- /** Encode a fetch Response for page.fetch / web.fetch with binary-safe handling. */
12
- export declare function encodeFetchResponse(resp: Response): Promise<FetchValue>;
@@ -1,43 +0,0 @@
1
- import { FsPathParams, FsStringResult } from '../../../pkg/extension_js.js';
2
-
3
- export type CsvAction = "parse";
4
- export type CsvActionMap = {
5
- parse: {
6
- params: FsPathParams;
7
- result: FsStringResult;
8
- };
9
- };
10
- export type ZipAction = "list";
11
- export type ZipActionMap = {
12
- list: {
13
- params: FsPathParams;
14
- result: FsStringResult;
15
- };
16
- };
17
- export type XlsxAction = "read";
18
- export type XlsxActionMap = {
19
- read: {
20
- params: FsPathParams;
21
- result: FsStringResult;
22
- };
23
- };
24
- export type PdfAction = "text";
25
- export type PdfActionMap = {
26
- text: {
27
- params: FsPathParams;
28
- result: FsStringResult;
29
- };
30
- };
31
- export type FormatCallMessage<TType extends string, TMap extends Record<string, {
32
- params: unknown;
33
- result: unknown;
34
- }>> = {
35
- type: TType;
36
- id: string;
37
- action: keyof TMap & string;
38
- params: TMap[keyof TMap]["params"];
39
- };
40
- export type CsvCallMessage = FormatCallMessage<"csvCall", CsvActionMap>;
41
- export type ZipCallMessage = FormatCallMessage<"zipCall", ZipActionMap>;
42
- export type XlsxCallMessage = FormatCallMessage<"xlsxCall", XlsxActionMap>;
43
- export type PdfCallMessage = FormatCallMessage<"pdfCall", PdfActionMap>;
@@ -1,81 +0,0 @@
1
- import { FsBoolResult, FsCopyParams, FsExistsResult, FsHashParams, FsHashResult, FsListResult, FsPathParams, FsReadRangeDataParams, FsReadRangeParams, FsStatResult, FsStringResult, FsWriteParams, FsWriteResult } from '../../../pkg/extension_js.js';
2
-
3
- export type FsActionMap = {
4
- exists: {
5
- params: FsPathParams;
6
- result: FsExistsResult;
7
- };
8
- stat: {
9
- params: FsPathParams;
10
- result: FsStatResult;
11
- };
12
- read: {
13
- params: FsPathParams;
14
- result: FsStringResult;
15
- };
16
- readText: {
17
- params: FsPathParams;
18
- result: FsStringResult;
19
- };
20
- readBase64: {
21
- params: FsPathParams;
22
- result: FsStringResult;
23
- };
24
- list: {
25
- params: FsPathParams;
26
- result: FsListResult;
27
- };
28
- mkdir: {
29
- params: FsPathParams;
30
- result: FsBoolResult;
31
- };
32
- delete: {
33
- params: FsPathParams;
34
- result: FsBoolResult;
35
- };
36
- copy: {
37
- params: FsCopyParams;
38
- result: FsBoolResult;
39
- };
40
- move: {
41
- params: FsCopyParams;
42
- result: FsBoolResult;
43
- };
44
- write: {
45
- params: FsWriteParams;
46
- result: FsWriteResult;
47
- };
48
- writeText: {
49
- params: FsWriteParams;
50
- result: FsWriteResult;
51
- };
52
- writeBase64: {
53
- params: FsWriteParams;
54
- result: FsWriteResult;
55
- };
56
- append: {
57
- params: FsWriteParams;
58
- result: FsWriteResult;
59
- };
60
- appendText: {
61
- params: FsWriteParams;
62
- result: FsWriteResult;
63
- };
64
- appendBase64: {
65
- params: FsWriteParams;
66
- result: FsWriteResult;
67
- };
68
- readRange: {
69
- params: FsReadRangeParams;
70
- result: FsStringResult;
71
- };
72
- update: {
73
- params: FsReadRangeDataParams;
74
- result: FsBoolResult;
75
- };
76
- hash: {
77
- params: FsHashParams;
78
- result: FsHashResult;
79
- };
80
- };
81
- export type FsAction = keyof FsActionMap;