@guidelytech/sdk-core 0.9.0 → 0.11.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/README.md +15 -4
- package/dist/{capture-Dqd7up2n.d.ts → capture-CgN69Lxq.d.cts} +2 -1
- package/dist/{capture-C3faAYb7.d.cts → capture-Csz721-A.d.ts} +2 -1
- package/dist/capture.cjs +4 -0
- package/dist/capture.cjs.map +1 -1
- package/dist/capture.d.cts +3 -2
- package/dist/capture.d.ts +3 -2
- package/dist/capture.js +4 -6
- package/dist/capture.js.map +1 -1
- package/dist/chunk-JUSM7J5N.js +376 -0
- package/dist/chunk-JUSM7J5N.js.map +1 -0
- package/dist/{chunk-544KSOC3.js → chunk-ZAF2KRJA.js} +142 -22
- package/dist/chunk-ZAF2KRJA.js.map +1 -0
- package/dist/headless.cjs +307 -44
- package/dist/headless.cjs.map +1 -1
- package/dist/headless.d.cts +44 -3
- package/dist/headless.d.ts +44 -3
- package/dist/headless.js +21 -9
- package/dist/health-sbP9JwTE.d.cts +90 -0
- package/dist/health-sbP9JwTE.d.ts +90 -0
- package/dist/{http-47tiAlOM.d.ts → http-Cb6KYYFv.d.cts} +10 -35
- package/dist/{http-47tiAlOM.d.cts → http-D047Ngxk.d.ts} +10 -35
- package/dist/index.cjs +1352 -500
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +81 -8
- package/dist/index.d.ts +81 -8
- package/dist/index.js +809 -211
- package/dist/index.js.map +1 -1
- package/dist/recorder.cjs +70 -9
- package/dist/recorder.cjs.map +1 -1
- package/dist/recorder.d.cts +9 -0
- package/dist/recorder.d.ts +9 -0
- package/dist/recorder.js +57 -11
- package/dist/recorder.js.map +1 -1
- package/dist/{types-DnJW_4ck.d.ts → types-BDlebXrm.d.ts} +68 -7
- package/dist/{types-zM5e3loY.d.cts → types-Mtlmlj5C.d.cts} +68 -7
- package/package.json +4 -4
- package/dist/chunk-544KSOC3.js.map +0 -1
- package/dist/chunk-AKNE7D5M.js +0 -160
- package/dist/chunk-AKNE7D5M.js.map +0 -1
- package/dist/chunk-CYAG6ZYX.js +0 -85
- package/dist/chunk-CYAG6ZYX.js.map +0 -1
- package/dist/chunk-GDF6RCHQ.js +0 -209
- package/dist/chunk-GDF6RCHQ.js.map +0 -1
- package/dist/types-DbKQPvFt.d.cts +0 -238
- package/dist/types-DqhNl5Am.d.ts +0 -238
- package/dist/types-RyeRQd9f.d.ts +0 -226
- package/dist/types-d4eOerxi.d.cts +0 -226
|
@@ -1,35 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/** Minimal synchronous key/value store; never throws (private mode, quota, SSR). */
|
|
3
|
-
interface KeyValueStore {
|
|
4
|
-
get(key: string): string | null;
|
|
5
|
-
set(key: string, value: string): void;
|
|
6
|
-
remove(key: string): void;
|
|
7
|
-
}
|
|
8
|
-
declare function memoryStore(): KeyValueStore;
|
|
9
|
-
/** Creates a store of the requested kind, degrading to memory when unavailable. */
|
|
10
|
-
declare function createStorage(kind?: StorageKind): KeyValueStore;
|
|
11
|
-
declare function readJson<T>(store: KeyValueStore, key: string, fallback: T): T;
|
|
12
|
-
declare function writeJson(store: KeyValueStore, key: string, value: unknown): void;
|
|
13
|
-
/** Storage keys used by the SDK (documented for integrators). */
|
|
14
|
-
declare const KEYS: {
|
|
15
|
-
readonly anon: "guidely:anon";
|
|
16
|
-
readonly seen: "guidely:seen";
|
|
17
|
-
readonly config: (key: string) => string;
|
|
18
|
-
readonly etag: (key: string) => string;
|
|
19
|
-
readonly state: (key: string) => string;
|
|
20
|
-
readonly user: (key: string) => string;
|
|
21
|
-
readonly queue: (key: string) => string;
|
|
22
|
-
readonly session: "guidely:session";
|
|
23
|
-
readonly active: "guidely:active";
|
|
24
|
-
readonly authoring: "guidely:authoring";
|
|
25
|
-
/** How-to capture session marker ({ token, … }) and its not-yet-uploaded steps. */
|
|
26
|
-
readonly capture: "guidely:capture";
|
|
27
|
-
readonly capturePending: "guidely:capture:pending";
|
|
28
|
-
/** Messenger conversations this browser can read: [{ id, token }]. */
|
|
29
|
-
readonly conversations: (key: string) => string;
|
|
30
|
-
/** Announcement ids opened in the messenger's News tab. */
|
|
31
|
-
readonly newsSeen: (key: string) => string;
|
|
32
|
-
};
|
|
1
|
+
import { S as ServerHealth } from './health-sbP9JwTE.js';
|
|
33
2
|
|
|
34
3
|
interface ApiResponse<T> {
|
|
35
4
|
status: number;
|
|
@@ -43,7 +12,11 @@ declare class Api {
|
|
|
43
12
|
private readonly baseUrl;
|
|
44
13
|
private readonly key;
|
|
45
14
|
private readonly fetchImpl?;
|
|
46
|
-
|
|
15
|
+
/** Reachability of the API, fed by every answer (see {@link ServerHealth}). */
|
|
16
|
+
readonly health: ServerHealth;
|
|
17
|
+
constructor(baseUrl: string, key: string, fetchImpl?: FetchLike | undefined, health?: ServerHealth);
|
|
18
|
+
/** Feeds an answer (or a failed request, `null`) into {@link health}. */
|
|
19
|
+
private observe;
|
|
47
20
|
url(path: string, params?: Record<string, string | undefined>): string;
|
|
48
21
|
private get fetcher();
|
|
49
22
|
request<T>(method: "GET" | "POST", path: string, options?: {
|
|
@@ -71,7 +44,9 @@ declare class Api {
|
|
|
71
44
|
}): Promise<ApiResponse<T>>;
|
|
72
45
|
/**
|
|
73
46
|
* POST that may answer with server-sent events. Each event is passed to `onEvent`; a JSON answer is
|
|
74
|
-
* returned instead.
|
|
47
|
+
* returned instead. Scout replies can take a while, so there is no overall timeout: the response
|
|
48
|
+
* must start within 30 s and then never go quiet for more than 60 s (the server sends keepalives),
|
|
49
|
+
* otherwise the request is aborted and rejects.
|
|
75
50
|
*/
|
|
76
51
|
stream<T>(path: string, body: unknown, onEvent: (event: string, data: unknown) => void, headers?: Record<string, string>): Promise<ApiResponse<T>>;
|
|
77
52
|
/** `navigator.sendBeacon` when available (page unload); returns false when it could not be queued. */
|
|
@@ -83,4 +58,4 @@ declare function backoffMs(attempt: number, baseMs?: number, maxMs?: number): nu
|
|
|
83
58
|
/** Fire-and-forget POST with bounded retries (used for state sync; never blocks UI). */
|
|
84
59
|
declare function postWithRetry<T>(api: Api, path: string, body: unknown, attempts?: number, baseMs?: number): Promise<ApiResponse<T> | null>;
|
|
85
60
|
|
|
86
|
-
export { Api as A, type FetchLike as F,
|
|
61
|
+
export { Api as A, type FetchLike as F, type ApiResponse as a, backoffMs as b, postWithRetry as p, sleep as s };
|