@guidelytech/sdk-core 0.10.0 → 0.12.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.
Files changed (46) hide show
  1. package/dist/{capture-DVJyQ2JZ.d.cts → capture-4EgpjK6Z.d.cts} +2 -2
  2. package/dist/{capture-369s4YYT.d.ts → capture-C-4R56G0.d.ts} +2 -2
  3. package/dist/capture-CgN69Lxq.d.cts +100 -0
  4. package/dist/capture-Csz721-A.d.ts +100 -0
  5. package/dist/capture.cjs +5 -1
  6. package/dist/capture.cjs.map +1 -1
  7. package/dist/capture.d.cts +3 -3
  8. package/dist/capture.d.ts +3 -3
  9. package/dist/capture.js +1 -1
  10. package/dist/{chunk-GDJB466J.js → chunk-2E2YUQAG.js} +29 -6
  11. package/dist/chunk-2E2YUQAG.js.map +1 -0
  12. package/dist/{chunk-C4WWSF67.js → chunk-JUSM7J5N.js} +3 -1
  13. package/dist/{chunk-C4WWSF67.js.map → chunk-JUSM7J5N.js.map} +1 -1
  14. package/dist/chunk-XML74K2P.js +378 -0
  15. package/dist/chunk-XML74K2P.js.map +1 -0
  16. package/dist/chunk-ZAF2KRJA.js +334 -0
  17. package/dist/chunk-ZAF2KRJA.js.map +1 -0
  18. package/dist/headless.cjs +35 -5
  19. package/dist/headless.cjs.map +1 -1
  20. package/dist/headless.d.cts +6 -5
  21. package/dist/headless.d.ts +6 -5
  22. package/dist/headless.js +9 -3
  23. package/dist/health-DjZ2gwYa.d.cts +92 -0
  24. package/dist/health-DjZ2gwYa.d.ts +92 -0
  25. package/dist/{health-DFHUstWd.d.cts → health-sbP9JwTE.d.cts} +2 -0
  26. package/dist/{health-DFHUstWd.d.ts → health-sbP9JwTE.d.ts} +2 -0
  27. package/dist/{http-DJd8jRhK.d.ts → http-BXys2d-j.d.ts} +1 -1
  28. package/dist/{http-D0dCcpLN.d.cts → http-Cb6KYYFv.d.cts} +1 -1
  29. package/dist/http-D047Ngxk.d.ts +61 -0
  30. package/dist/http-zOI8d2c2.d.cts +61 -0
  31. package/dist/index.cjs +1638 -1047
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.cts +77 -9
  34. package/dist/index.d.ts +77 -9
  35. package/dist/index.js +763 -202
  36. package/dist/index.js.map +1 -1
  37. package/dist/recorder.cjs.map +1 -1
  38. package/dist/recorder.d.cts +1 -1
  39. package/dist/recorder.d.ts +1 -1
  40. package/dist/recorder.js +1 -1
  41. package/dist/{types-B5ecgHUV.d.cts → types-BDlebXrm.d.ts} +59 -5
  42. package/dist/types-Bkw8ErmO.d.cts +314 -0
  43. package/dist/{types-BtPovimB.d.ts → types-Dy_uPu6S.d.ts} +59 -5
  44. package/dist/types-Mtlmlj5C.d.cts +314 -0
  45. package/package.json +4 -4
  46. package/dist/chunk-GDJB466J.js.map +0 -1
@@ -0,0 +1,61 @@
1
+ import { S as ServerHealth } from './health-DjZ2gwYa.cjs';
2
+
3
+ interface ApiResponse<T> {
4
+ status: number;
5
+ ok: boolean;
6
+ data: T | null;
7
+ etag: string | null;
8
+ }
9
+ type FetchLike = typeof fetch;
10
+ /** Thin HTTP client for the public SDK API. Adds the public key as query + header. */
11
+ declare class Api {
12
+ private readonly baseUrl;
13
+ private readonly key;
14
+ private readonly fetchImpl?;
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;
20
+ url(path: string, params?: Record<string, string | undefined>): string;
21
+ private get fetcher();
22
+ request<T>(method: "GET" | "POST", path: string, options?: {
23
+ body?: unknown;
24
+ etag?: string | null;
25
+ params?: Record<string, string | undefined>;
26
+ keepalive?: boolean;
27
+ timeoutMs?: number;
28
+ headers?: Record<string, string>;
29
+ }): Promise<ApiResponse<T>>;
30
+ get<T>(path: string, options?: {
31
+ etag?: string | null;
32
+ params?: Record<string, string | undefined>;
33
+ headers?: Record<string, string>;
34
+ }): Promise<ApiResponse<T>>;
35
+ post<T>(path: string, body: unknown, options?: {
36
+ params?: Record<string, string | undefined>;
37
+ keepalive?: boolean;
38
+ headers?: Record<string, string>;
39
+ }): Promise<ApiResponse<T>>;
40
+ /** Multipart POST (file uploads). No Content-Type header: the browser adds it with the boundary. */
41
+ postForm<T>(path: string, form: FormData, options?: {
42
+ params?: Record<string, string | undefined>;
43
+ timeoutMs?: number;
44
+ }): Promise<ApiResponse<T>>;
45
+ /**
46
+ * POST that may answer with server-sent events. Each event is passed to `onEvent`; a JSON answer is
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.
50
+ */
51
+ stream<T>(path: string, body: unknown, onEvent: (event: string, data: unknown) => void, headers?: Record<string, string>): Promise<ApiResponse<T>>;
52
+ /** `navigator.sendBeacon` when available (page unload); returns false when it could not be queued. */
53
+ beacon(path: string, body: unknown): boolean;
54
+ }
55
+ declare const sleep: (ms: number) => Promise<void>;
56
+ /** Exponential backoff helper: 1s → 2s → 4s … capped. */
57
+ declare function backoffMs(attempt: number, baseMs?: number, maxMs?: number): number;
58
+ /** Fire-and-forget POST with bounded retries (used for state sync; never blocks UI). */
59
+ declare function postWithRetry<T>(api: Api, path: string, body: unknown, attempts?: number, baseMs?: number): Promise<ApiResponse<T> | null>;
60
+
61
+ export { Api as A, type FetchLike as F, type ApiResponse as a, backoffMs as b, postWithRetry as p, sleep as s };