@opentabs-dev/plugin-sdk 0.0.10 → 0.0.11
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/dist/dom.d.ts +38 -0
- package/dist/dom.d.ts.map +1 -0
- package/dist/dom.js +102 -0
- package/dist/dom.js.map +1 -0
- package/dist/errors.d.ts +12 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +18 -0
- package/dist/errors.js.map +1 -0
- package/dist/fetch.d.ts +21 -0
- package/dist/fetch.d.ts.map +1 -0
- package/dist/fetch.js +63 -0
- package/dist/fetch.js.map +1 -0
- package/dist/index.d.ts +9 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -14
- package/dist/index.js.map +1 -1
- package/dist/page-state.d.ts +18 -0
- package/dist/page-state.d.ts.map +1 -0
- package/dist/page-state.js +35 -0
- package/dist/page-state.js.map +1 -0
- package/dist/storage.d.ts +21 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +59 -0
- package/dist/storage.js.map +1 -0
- package/dist/timing.d.ts +32 -0
- package/dist/timing.d.ts.map +1 -0
- package/dist/timing.js +78 -0
- package/dist/timing.js.map +1 -0
- package/package.json +3 -2
package/dist/dom.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface WaitForSelectorOptions {
|
|
2
|
+
/** Timeout in milliseconds (default: 10000) */
|
|
3
|
+
timeout?: number;
|
|
4
|
+
}
|
|
5
|
+
export interface ObserveDOMOptions {
|
|
6
|
+
/** Watch for added/removed child nodes (default: true) */
|
|
7
|
+
childList?: boolean;
|
|
8
|
+
/** Watch for attribute changes (default: false) */
|
|
9
|
+
attributes?: boolean;
|
|
10
|
+
/** Watch the entire subtree (default: true) */
|
|
11
|
+
subtree?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Waits for an element matching `selector` to appear in the DOM.
|
|
15
|
+
* Uses MutationObserver for efficient detection, falls back to an
|
|
16
|
+
* initial querySelector check for elements already present.
|
|
17
|
+
*/
|
|
18
|
+
export declare const waitForSelector: (selector: string, opts?: WaitForSelectorOptions) => Promise<Element>;
|
|
19
|
+
/**
|
|
20
|
+
* Waits for an element matching `selector` to be removed from the DOM.
|
|
21
|
+
* Resolves immediately if no matching element exists.
|
|
22
|
+
*/
|
|
23
|
+
export declare const waitForSelectorRemoval: (selector: string, opts?: WaitForSelectorOptions) => Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Typed wrapper around `document.querySelectorAll` that returns a real array.
|
|
26
|
+
*/
|
|
27
|
+
export declare const querySelectorAll: <T extends Element = Element>(selector: string) => T[];
|
|
28
|
+
/**
|
|
29
|
+
* Returns the trimmed `textContent` of the first element matching `selector`,
|
|
30
|
+
* or `null` if no element is found.
|
|
31
|
+
*/
|
|
32
|
+
export declare const getTextContent: (selector: string) => string | null;
|
|
33
|
+
/**
|
|
34
|
+
* Sets up a MutationObserver on the element matching `selector`.
|
|
35
|
+
* Returns a cleanup function that disconnects the observer.
|
|
36
|
+
*/
|
|
37
|
+
export declare const observeDOM: (selector: string, callback: (mutations: MutationRecord[], observer: MutationObserver) => void, options?: ObserveDOMOptions) => (() => void);
|
|
38
|
+
//# sourceMappingURL=dom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,sBAAsB;IACrC,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,0DAA0D;IAC1D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mDAAmD;IACnD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,EAAE,OAAO,sBAAsB,KAAG,OAAO,CAAC,OAAO,CA+BhG,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GAAI,UAAU,MAAM,EAAE,OAAO,sBAAsB,KAAG,OAAO,CAAC,IAAI,CA6BpG,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,UAAU,MAAM,KAAG,CAAC,EAC9B,CAAC;AAErD;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU,MAAM,KAAG,MAAM,GAAG,IAI1D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,GACrB,UAAU,MAAM,EAChB,UAAU,CAAC,SAAS,EAAE,cAAc,EAAE,EAAE,QAAQ,EAAE,gBAAgB,KAAK,IAAI,EAC3E,UAAU,iBAAiB,KAC1B,CAAC,MAAM,IAAI,CAcb,CAAC"}
|
package/dist/dom.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// DOM utilities for plugin authors
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
/**
|
|
5
|
+
* Waits for an element matching `selector` to appear in the DOM.
|
|
6
|
+
* Uses MutationObserver for efficient detection, falls back to an
|
|
7
|
+
* initial querySelector check for elements already present.
|
|
8
|
+
*/
|
|
9
|
+
export const waitForSelector = (selector, opts) => {
|
|
10
|
+
const timeout = opts?.timeout ?? 10_000;
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
const existing = document.querySelector(selector);
|
|
13
|
+
if (existing) {
|
|
14
|
+
resolve(existing);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
let settled = false;
|
|
18
|
+
const timer = setTimeout(() => {
|
|
19
|
+
if (settled)
|
|
20
|
+
return;
|
|
21
|
+
settled = true;
|
|
22
|
+
observer.disconnect();
|
|
23
|
+
reject(new Error(`waitForSelector: timed out after ${timeout}ms waiting for "${selector}"`));
|
|
24
|
+
}, timeout);
|
|
25
|
+
const observer = new MutationObserver(() => {
|
|
26
|
+
const el = document.querySelector(selector);
|
|
27
|
+
if (el) {
|
|
28
|
+
if (settled)
|
|
29
|
+
return;
|
|
30
|
+
settled = true;
|
|
31
|
+
clearTimeout(timer);
|
|
32
|
+
observer.disconnect();
|
|
33
|
+
resolve(el);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Waits for an element matching `selector` to be removed from the DOM.
|
|
41
|
+
* Resolves immediately if no matching element exists.
|
|
42
|
+
*/
|
|
43
|
+
export const waitForSelectorRemoval = (selector, opts) => {
|
|
44
|
+
const timeout = opts?.timeout ?? 10_000;
|
|
45
|
+
return new Promise((resolve, reject) => {
|
|
46
|
+
if (!document.querySelector(selector)) {
|
|
47
|
+
resolve();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
let settled = false;
|
|
51
|
+
const timer = setTimeout(() => {
|
|
52
|
+
if (settled)
|
|
53
|
+
return;
|
|
54
|
+
settled = true;
|
|
55
|
+
observer.disconnect();
|
|
56
|
+
reject(new Error(`waitForSelectorRemoval: timed out after ${timeout}ms waiting for "${selector}" to be removed`));
|
|
57
|
+
}, timeout);
|
|
58
|
+
const observer = new MutationObserver(() => {
|
|
59
|
+
if (!document.querySelector(selector)) {
|
|
60
|
+
if (settled)
|
|
61
|
+
return;
|
|
62
|
+
settled = true;
|
|
63
|
+
clearTimeout(timer);
|
|
64
|
+
observer.disconnect();
|
|
65
|
+
resolve();
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Typed wrapper around `document.querySelectorAll` that returns a real array.
|
|
73
|
+
*/
|
|
74
|
+
export const querySelectorAll = (selector) => Array.from(document.querySelectorAll(selector));
|
|
75
|
+
/**
|
|
76
|
+
* Returns the trimmed `textContent` of the first element matching `selector`,
|
|
77
|
+
* or `null` if no element is found.
|
|
78
|
+
*/
|
|
79
|
+
export const getTextContent = (selector) => {
|
|
80
|
+
const el = document.querySelector(selector);
|
|
81
|
+
if (!el)
|
|
82
|
+
return null;
|
|
83
|
+
return el.textContent.trim();
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Sets up a MutationObserver on the element matching `selector`.
|
|
87
|
+
* Returns a cleanup function that disconnects the observer.
|
|
88
|
+
*/
|
|
89
|
+
export const observeDOM = (selector, callback, options) => {
|
|
90
|
+
const target = document.querySelector(selector);
|
|
91
|
+
if (!target) {
|
|
92
|
+
throw new Error(`observeDOM: no element found for selector "${selector}"`);
|
|
93
|
+
}
|
|
94
|
+
const observer = new MutationObserver(callback);
|
|
95
|
+
observer.observe(target, {
|
|
96
|
+
childList: options?.childList ?? true,
|
|
97
|
+
attributes: options?.attributes ?? false,
|
|
98
|
+
subtree: options?.subtree ?? true,
|
|
99
|
+
});
|
|
100
|
+
return () => observer.disconnect();
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=dom.js.map
|
package/dist/dom.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.js","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,mCAAmC;AACnC,8EAA8E;AAgB9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAgB,EAAE,IAA6B,EAAoB,EAAE;IACnG,MAAM,OAAO,GAAG,IAAI,EAAE,OAAO,IAAI,MAAM,CAAC;IAExC,OAAO,IAAI,OAAO,CAAU,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC9C,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAClD,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,CAAC,QAAQ,CA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MAAM,UAAU,GAAG,CACxB,QAAgB,EAChB,QAA2E,EAC3E,OAA2B,EACb,EAAE;IAChB,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,8CAA8C,QAAQ,GAAG,CAAC,CAAC;IAC7E,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAChD,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE;QACvB,SAAS,EAAE,OAAO,EAAE,SAAS,IAAI,IAAI;QACrC,UAAU,EAAE,OAAO,EAAE,UAAU,IAAI,KAAK;QACxC,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,IAAI;KAClC,CAAC,CAAC;IAEH,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;AACrC,CAAC,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed error for tool handlers — the platform catches these
|
|
3
|
+
* and returns structured MCP error responses.
|
|
4
|
+
*/
|
|
5
|
+
export declare class ToolError extends Error {
|
|
6
|
+
/** Machine-readable error code (e.g., 'CHANNEL_NOT_FOUND') */
|
|
7
|
+
readonly code: string;
|
|
8
|
+
constructor(message: string,
|
|
9
|
+
/** Machine-readable error code (e.g., 'CHANNEL_NOT_FOUND') */
|
|
10
|
+
code: string);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAGhC,8DAA8D;aAC9C,IAAI,EAAE,MAAM;gBAF5B,OAAO,EAAE,MAAM;IACf,8DAA8D;IAC9C,IAAI,EAAE,MAAM;CAK/B"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Shared error types for the SDK
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
/**
|
|
5
|
+
* Typed error for tool handlers — the platform catches these
|
|
6
|
+
* and returns structured MCP error responses.
|
|
7
|
+
*/
|
|
8
|
+
export class ToolError extends Error {
|
|
9
|
+
code;
|
|
10
|
+
constructor(message,
|
|
11
|
+
/** Machine-readable error code (e.g., 'CHANNEL_NOT_FOUND') */
|
|
12
|
+
code) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.code = code;
|
|
15
|
+
this.name = 'ToolError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,iCAAiC;AACjC,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAIhB;IAHlB,YACE,OAAe;IACf,8DAA8D;IAC9C,IAAY;QAE5B,KAAK,CAAC,OAAO,CAAC,CAAC;QAFC,SAAI,GAAJ,IAAI,CAAQ;QAG5B,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC1B,CAAC;CACF"}
|
package/dist/fetch.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface FetchFromPageOptions extends RequestInit {
|
|
2
|
+
/** Request timeout in milliseconds (default: 30000) */
|
|
3
|
+
timeout?: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Fetches a URL using the page's authenticated session (credentials: 'include').
|
|
7
|
+
* Provides built-in timeout via AbortSignal and throws a descriptive ToolError
|
|
8
|
+
* on non-ok HTTP status codes.
|
|
9
|
+
*/
|
|
10
|
+
export declare const fetchFromPage: (url: string, init?: FetchFromPageOptions) => Promise<Response>;
|
|
11
|
+
/**
|
|
12
|
+
* Fetches a URL and parses the response as JSON. Uses the page's session
|
|
13
|
+
* cookies (credentials: 'include') and provides timeout + error handling.
|
|
14
|
+
*/
|
|
15
|
+
export declare const fetchJSON: <T>(url: string, init?: FetchFromPageOptions) => Promise<T>;
|
|
16
|
+
/**
|
|
17
|
+
* Convenience wrapper for POST requests with a JSON body. Sets Content-Type,
|
|
18
|
+
* stringifies the body, and parses the JSON response.
|
|
19
|
+
*/
|
|
20
|
+
export declare const postJSON: <T>(url: string, body: unknown, init?: FetchFromPageOptions) => Promise<T>;
|
|
21
|
+
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACvD,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAU,KAAK,MAAM,EAAE,OAAO,oBAAoB,KAAG,OAAO,CAAC,QAAQ,CAgC9F,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAU,CAAC,EAAE,KAAK,MAAM,EAAE,OAAO,oBAAoB,KAAG,OAAO,CAAC,CAAC,CAQtF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAU,CAAC,EAAE,KAAK,MAAM,EAAE,MAAM,OAAO,EAAE,OAAO,oBAAoB,KAAG,OAAO,CAAC,CAAC,CAQpG,CAAC"}
|
package/dist/fetch.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Fetch utilities for plugin authors
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
import { ToolError } from './errors.js';
|
|
5
|
+
/**
|
|
6
|
+
* Fetches a URL using the page's authenticated session (credentials: 'include').
|
|
7
|
+
* Provides built-in timeout via AbortSignal and throws a descriptive ToolError
|
|
8
|
+
* on non-ok HTTP status codes.
|
|
9
|
+
*/
|
|
10
|
+
export const fetchFromPage = async (url, init) => {
|
|
11
|
+
const { timeout = 30_000, signal, ...rest } = init ?? {};
|
|
12
|
+
const timeoutSignal = AbortSignal.timeout(timeout);
|
|
13
|
+
const combinedSignal = signal ? AbortSignal.any([signal, timeoutSignal]) : timeoutSignal;
|
|
14
|
+
let response;
|
|
15
|
+
try {
|
|
16
|
+
response = await fetch(url, {
|
|
17
|
+
credentials: 'include',
|
|
18
|
+
...rest,
|
|
19
|
+
signal: combinedSignal,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
if (error instanceof DOMException && error.name === 'TimeoutError') {
|
|
24
|
+
throw new ToolError(`fetchFromPage: request timed out after ${timeout}ms for ${url}`, 'timeout');
|
|
25
|
+
}
|
|
26
|
+
if (error instanceof DOMException && error.name === 'AbortError') {
|
|
27
|
+
throw new ToolError(`fetchFromPage: request aborted for ${url}`, 'aborted');
|
|
28
|
+
}
|
|
29
|
+
throw new ToolError(`fetchFromPage: network error for ${url}: ${error instanceof Error ? error.message : String(error)}`, 'network_error');
|
|
30
|
+
}
|
|
31
|
+
if (!response.ok) {
|
|
32
|
+
const errorText = await response.text().catch(() => response.statusText);
|
|
33
|
+
throw new ToolError(`fetchFromPage: HTTP ${response.status} for ${url}: ${errorText}`, 'http_error');
|
|
34
|
+
}
|
|
35
|
+
return response;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Fetches a URL and parses the response as JSON. Uses the page's session
|
|
39
|
+
* cookies (credentials: 'include') and provides timeout + error handling.
|
|
40
|
+
*/
|
|
41
|
+
export const fetchJSON = async (url, init) => {
|
|
42
|
+
const response = await fetchFromPage(url, init);
|
|
43
|
+
try {
|
|
44
|
+
return (await response.json());
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
throw new ToolError(`fetchJSON: failed to parse JSON response from ${url}`, 'json_parse_error');
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Convenience wrapper for POST requests with a JSON body. Sets Content-Type,
|
|
52
|
+
* stringifies the body, and parses the JSON response.
|
|
53
|
+
*/
|
|
54
|
+
export const postJSON = async (url, body, init) => {
|
|
55
|
+
const extraHeaders = init?.headers ? Object.fromEntries(new Headers(init.headers).entries()) : {};
|
|
56
|
+
return fetchJSON(url, {
|
|
57
|
+
...init,
|
|
58
|
+
method: 'POST',
|
|
59
|
+
headers: { 'Content-Type': 'application/json', ...extraHeaders },
|
|
60
|
+
body: JSON.stringify(body),
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,qCAAqC;AACrC,8EAA8E;AAE9E,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAOxC;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,GAAW,EAAE,IAA2B,EAAqB,EAAE;IACjG,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC;IAEzD,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACnD,MAAM,cAAc,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;IAEzF,IAAI,QAAkB,CAAC;IACvB,IAAI,CAAC;QACH,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YAC1B,WAAW,EAAE,SAAS;YACtB,GAAG,IAAI;YAC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IAAI,SAAS,CAAC,iDAAiD,GAAG,EAAE,EAAE,kBAAkB,CAAC,CAAC;IAClG,CAAC;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EAAK,GAAW,EAAE,IAAa,EAAE,IAA2B,EAAc,EAAE;IACvG,MAAM,YAAY,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAClG,OAAO,SAAS,CAAI,GAAG,EAAE;QACvB,GAAG,IAAI;QACP,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,GAAG,YAAY,EAAE;QAChE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KAC3B,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -63,15 +63,13 @@ export declare abstract class OpenTabsPlugin {
|
|
|
63
63
|
*/
|
|
64
64
|
teardown?(): void;
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
export
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
code: string);
|
|
76
|
-
}
|
|
66
|
+
export { ToolError } from './errors.js';
|
|
67
|
+
export { waitForSelector, waitForSelectorRemoval, querySelectorAll, getTextContent, observeDOM } from './dom.js';
|
|
68
|
+
export type { WaitForSelectorOptions, ObserveDOMOptions } from './dom.js';
|
|
69
|
+
export { fetchFromPage, fetchJSON, postJSON } from './fetch.js';
|
|
70
|
+
export type { FetchFromPageOptions } from './fetch.js';
|
|
71
|
+
export { retry, sleep, waitUntil } from './timing.js';
|
|
72
|
+
export type { RetryOptions, WaitUntilOptions } from './timing.js';
|
|
73
|
+
export { getLocalStorage, setLocalStorage, getSessionStorage, getCookie } from './storage.js';
|
|
74
|
+
export { getPageGlobal, getCurrentUrl, getPageTitle } from './page-state.js';
|
|
77
75
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAM7B,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1G,YAAY,EAAE,YAAY,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrF,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAM3D,MAAM,WAAW,cAAc,CAC7B,MAAM,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,EACtE,OAAO,SAAS,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO;IAErC,+FAA+F;IAC/F,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,WAAW,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAC;IACpB,8FAA8F;IAC9F,IAAI,EAAE,cAAc,CAAC;IACrB,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd,2GAA2G;IAC3G,MAAM,EAAE,OAAO,CAAC;IAChB,kFAAkF;IAClF,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC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
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// Errors
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
export { ToolError } from './errors.js';
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
// SDK utilities — DOM
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
export { waitForSelector, waitForSelectorRemoval, querySelectorAll, getTextContent, observeDOM } from './dom.js';
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
// SDK utilities — Fetch
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
export { fetchFromPage, fetchJSON, postJSON } from './fetch.js';
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
// SDK utilities — Timing
|
|
28
|
+
// ---------------------------------------------------------------------------
|
|
29
|
+
export { retry, sleep, waitUntil } from './timing.js';
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
// SDK utilities — Storage
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
export { getLocalStorage, setLocalStorage, getSessionStorage, getCookie } from './storage.js';
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
// SDK utilities — Page State
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
export { getPageGlobal, getCurrentUrl, getPageTitle } from './page-state.js';
|
|
28
38
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,8EAA8E;AAC9E,gEAAgE;AAChE,8EAA8E;AAE9E,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AA0B3D,4E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AAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe deep property access on `globalThis` using dot-notation path.
|
|
3
|
+
* Returns `undefined` if any segment in the path is missing or if a getter
|
|
4
|
+
* throws. Callers can narrow the result with `as` at the call site.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const token = getPageGlobal('TS.boot_data.api_token') as string | undefined;
|
|
8
|
+
*/
|
|
9
|
+
export declare const getPageGlobal: (path: string) => unknown;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the current page URL (`window.location.href`).
|
|
12
|
+
*/
|
|
13
|
+
export declare const getCurrentUrl: () => string;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the current page title (`document.title`).
|
|
16
|
+
*/
|
|
17
|
+
export declare const getPageTitle: () => string;
|
|
18
|
+
//# sourceMappingURL=page-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-state.d.ts","sourceRoot":"","sources":["../src/page-state.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,OAY5C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,QAAO,MAA8B,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,YAAY,QAAO,MAAwB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Page state utilities for plugin authors
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
/**
|
|
5
|
+
* Safe deep property access on `globalThis` using dot-notation path.
|
|
6
|
+
* Returns `undefined` if any segment in the path is missing or if a getter
|
|
7
|
+
* throws. Callers can narrow the result with `as` at the call site.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const token = getPageGlobal('TS.boot_data.api_token') as string | undefined;
|
|
11
|
+
*/
|
|
12
|
+
export const getPageGlobal = (path) => {
|
|
13
|
+
try {
|
|
14
|
+
const segments = path.split('.');
|
|
15
|
+
let current = globalThis;
|
|
16
|
+
for (const segment of segments) {
|
|
17
|
+
if (current === null || current === undefined || typeof current !== 'object')
|
|
18
|
+
return undefined;
|
|
19
|
+
current = current[segment];
|
|
20
|
+
}
|
|
21
|
+
return current;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Returns the current page URL (`window.location.href`).
|
|
29
|
+
*/
|
|
30
|
+
export const getCurrentUrl = () => window.location.href;
|
|
31
|
+
/**
|
|
32
|
+
* Returns the current page title (`document.title`).
|
|
33
|
+
*/
|
|
34
|
+
export const getPageTitle = () => document.title;
|
|
35
|
+
//# sourceMappingURL=page-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-state.js","sourceRoot":"","sources":["../src/page-state.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,0CAA0C;AAC1C,8EAA8E;AAE9E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAY,EAAW,EAAE;IACrD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,OAAO,GAAY,UAAU,CAAC;QAClC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,OAAO,KAAK,QAAQ;gBAAE,OAAO,SAAS,CAAC;YAC/F,OAAO,GAAI,OAAmC,CAAC,OAAO,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAAW,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;AAEhE;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,GAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads a value from localStorage. Returns null if the key is not found or
|
|
3
|
+
* if storage access throws (e.g., SecurityError in sandboxed iframes).
|
|
4
|
+
*/
|
|
5
|
+
export declare const getLocalStorage: (key: string) => string | null;
|
|
6
|
+
/**
|
|
7
|
+
* Writes a value to localStorage. Silently fails if storage access throws
|
|
8
|
+
* (e.g., SecurityError in sandboxed iframes or when storage is full).
|
|
9
|
+
*/
|
|
10
|
+
export declare const setLocalStorage: (key: string, value: string) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Reads a value from sessionStorage. Returns null if the key is not found or
|
|
13
|
+
* if storage access throws (e.g., SecurityError in sandboxed iframes).
|
|
14
|
+
*/
|
|
15
|
+
export declare const getSessionStorage: (key: string) => string | null;
|
|
16
|
+
/**
|
|
17
|
+
* Reads a cookie by name from `document.cookie`. Handles URI-encoded values.
|
|
18
|
+
* Returns null if the cookie is not found.
|
|
19
|
+
*/
|
|
20
|
+
export declare const getCookie: (name: string) => string | null;
|
|
21
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,IAMtD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,MAAM,EAAE,OAAO,MAAM,KAAG,IAM5D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,IAMxD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,KAAG,MAAM,GAAG,IAajD,CAAC"}
|
package/dist/storage.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Storage utilities for plugin authors
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
/**
|
|
5
|
+
* Reads a value from localStorage. Returns null if the key is not found or
|
|
6
|
+
* if storage access throws (e.g., SecurityError in sandboxed iframes).
|
|
7
|
+
*/
|
|
8
|
+
export const getLocalStorage = (key) => {
|
|
9
|
+
try {
|
|
10
|
+
return localStorage.getItem(key);
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Writes a value to localStorage. Silently fails if storage access throws
|
|
18
|
+
* (e.g., SecurityError in sandboxed iframes or when storage is full).
|
|
19
|
+
*/
|
|
20
|
+
export const setLocalStorage = (key, value) => {
|
|
21
|
+
try {
|
|
22
|
+
localStorage.setItem(key, value);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
// Silently fail on SecurityError or QuotaExceededError
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Reads a value from sessionStorage. Returns null if the key is not found or
|
|
30
|
+
* if storage access throws (e.g., SecurityError in sandboxed iframes).
|
|
31
|
+
*/
|
|
32
|
+
export const getSessionStorage = (key) => {
|
|
33
|
+
try {
|
|
34
|
+
return sessionStorage.getItem(key);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Reads a cookie by name from `document.cookie`. Handles URI-encoded values.
|
|
42
|
+
* Returns null if the cookie is not found.
|
|
43
|
+
*/
|
|
44
|
+
export const getCookie = (name) => {
|
|
45
|
+
const prefix = `${name}=`;
|
|
46
|
+
const entries = document.cookie.split('; ');
|
|
47
|
+
for (const entry of entries) {
|
|
48
|
+
if (entry.startsWith(prefix)) {
|
|
49
|
+
try {
|
|
50
|
+
return decodeURIComponent(entry.slice(prefix.length));
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return entry.slice(prefix.length);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,uCAAuC;AACvC,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAW,EAAiB,EAAE;IAC5D,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAW,EAAE,KAAa,EAAQ,EAAE;IAClE,IAAI,CAAC;QACH,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,uDAAuD;IACzD,CAAC;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAiB,EAAE;IAC9D,IAAI,CAAC;QACH,OAAO,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAY,EAAiB,EAAE;IACvD,MAAM,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC;IAC1B,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5C,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7B,IAAI,CAAC;gBACH,OAAO,kBAAkB,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;YACxD,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
package/dist/timing.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface RetryOptions {
|
|
2
|
+
/** Maximum number of attempts (default: 3) */
|
|
3
|
+
maxAttempts?: number;
|
|
4
|
+
/** Delay between attempts in milliseconds (default: 1000) */
|
|
5
|
+
delay?: number;
|
|
6
|
+
/** Use exponential backoff — doubles the delay after each attempt (default: false) */
|
|
7
|
+
backoff?: boolean;
|
|
8
|
+
/** AbortSignal to cancel retries early */
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
}
|
|
11
|
+
export interface WaitUntilOptions {
|
|
12
|
+
/** Polling interval in milliseconds (default: 200) */
|
|
13
|
+
interval?: number;
|
|
14
|
+
/** Timeout in milliseconds (default: 10000) */
|
|
15
|
+
timeout?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Retries `fn` on failure up to `maxAttempts` times. Waits `delay` ms between
|
|
19
|
+
* attempts (doubled each time when `backoff` is true). Re-throws the last
|
|
20
|
+
* error after all attempts are exhausted. Supports cancellation via AbortSignal.
|
|
21
|
+
*/
|
|
22
|
+
export declare const retry: <T>(fn: () => Promise<T>, opts?: RetryOptions) => Promise<T>;
|
|
23
|
+
/**
|
|
24
|
+
* Returns a promise that resolves after `ms` milliseconds.
|
|
25
|
+
*/
|
|
26
|
+
export declare const sleep: (ms: number) => Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Polls `predicate` at `interval` ms until it returns `true`, or rejects on
|
|
29
|
+
* timeout with a descriptive error.
|
|
30
|
+
*/
|
|
31
|
+
export declare const waitUntil: (predicate: () => boolean | Promise<boolean>, opts?: WaitUntilOptions) => Promise<void>;
|
|
32
|
+
//# sourceMappingURL=timing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timing.d.ts","sourceRoot":"","sources":["../src/timing.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sFAAsF;IACtF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0CAA0C;IAC1C,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,eAAO,MAAM,KAAK,GAAU,CAAC,EAAE,IAAI,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,YAAY,KAAG,OAAO,CAAC,CAAC,CA6BnF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,KAAK,GAAI,IAAI,MAAM,KAAG,OAAO,CAAC,IAAI,CAAoD,CAAC;AAEpG;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,WAAW,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,gBAAgB,KAAG,OAAO,CAAC,IAAI,CAqC5G,CAAC"}
|
package/dist/timing.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Retry / timing utilities for plugin authors
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
/**
|
|
5
|
+
* Retries `fn` on failure up to `maxAttempts` times. Waits `delay` ms between
|
|
6
|
+
* attempts (doubled each time when `backoff` is true). Re-throws the last
|
|
7
|
+
* error after all attempts are exhausted. Supports cancellation via AbortSignal.
|
|
8
|
+
*/
|
|
9
|
+
export const retry = async (fn, opts) => {
|
|
10
|
+
const maxAttempts = opts?.maxAttempts ?? 3;
|
|
11
|
+
const baseDelay = opts?.delay ?? 1_000;
|
|
12
|
+
const backoff = opts?.backoff ?? false;
|
|
13
|
+
const signal = opts?.signal;
|
|
14
|
+
let lastError;
|
|
15
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
16
|
+
if (signal?.aborted) {
|
|
17
|
+
throw signal.reason instanceof Error ? signal.reason : new Error('retry: aborted');
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
return await fn();
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
lastError = error;
|
|
24
|
+
}
|
|
25
|
+
if (attempt < maxAttempts) {
|
|
26
|
+
if (signal?.aborted) {
|
|
27
|
+
throw signal.reason instanceof Error ? signal.reason : new Error('retry: aborted');
|
|
28
|
+
}
|
|
29
|
+
const currentDelay = backoff ? baseDelay * 2 ** (attempt - 1) : baseDelay;
|
|
30
|
+
await sleep(currentDelay);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
throw lastError;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Returns a promise that resolves after `ms` milliseconds.
|
|
37
|
+
*/
|
|
38
|
+
export const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
39
|
+
/**
|
|
40
|
+
* Polls `predicate` at `interval` ms until it returns `true`, or rejects on
|
|
41
|
+
* timeout with a descriptive error.
|
|
42
|
+
*/
|
|
43
|
+
export const waitUntil = (predicate, opts) => {
|
|
44
|
+
const interval = opts?.interval ?? 200;
|
|
45
|
+
const timeout = opts?.timeout ?? 10_000;
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
const state = { settled: false };
|
|
48
|
+
const cleanup = () => {
|
|
49
|
+
state.settled = true;
|
|
50
|
+
clearTimeout(timer);
|
|
51
|
+
clearInterval(poller);
|
|
52
|
+
};
|
|
53
|
+
const timer = setTimeout(() => {
|
|
54
|
+
if (state.settled)
|
|
55
|
+
return;
|
|
56
|
+
cleanup();
|
|
57
|
+
reject(new Error(`waitUntil: timed out after ${timeout}ms waiting for predicate to return true`));
|
|
58
|
+
}, timeout);
|
|
59
|
+
const check = async () => {
|
|
60
|
+
if (state.settled)
|
|
61
|
+
return;
|
|
62
|
+
try {
|
|
63
|
+
const result = await predicate();
|
|
64
|
+
if (result) {
|
|
65
|
+
cleanup();
|
|
66
|
+
resolve();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// Predicate threw — keep polling until timeout
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const poller = setInterval(() => void check(), interval);
|
|
74
|
+
// Check immediately on first call
|
|
75
|
+
void check();
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=timing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timing.js","sourceRoot":"","sources":["../src/timing.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,8CAA8C;AAC9C,8EAA8E;AAoB9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,EAAK,EAAoB,EAAE,IAAmB,EAAc,EAAE;IACtF,MAAM,WAAW,GAAG,IAAI,EAAE,WAAW,IAAI,CAAC,CAAC;IAC3C,MAAM,SAAS,GAAG,IAAI,EAAE,KAAK,IAAI,KAAK,CAAC;IACvC,MAAM,OAAO,GAAG,IAAI,EAAE,OAAO,I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"@opentabs-dev/plugin-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -20,13 +20,14 @@
|
|
|
20
20
|
"generate:icons": "bun scripts/generate-icon-names.ts"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@opentabs-dev/shared": "^0.0.
|
|
23
|
+
"@opentabs-dev/shared": "^0.0.11"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"zod": "^4.0.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"bun-types": "^1.3.9",
|
|
30
|
+
"happy-dom": "^20.7.0",
|
|
30
31
|
"lucide-react": "^0.574.0"
|
|
31
32
|
}
|
|
32
33
|
}
|