@cxxi-lab/hubbyware-sdk 3.1.0 → 3.2.1
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/package.json +1 -1
- package/types/index.d.ts +48 -51
- package/version.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cxxi-lab/hubbyware-sdk",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "The contract of Hubbyware's hubbies: the SDK a hubby builds on (provided by the host app at run time), and the SDK of the hubbies running isolated in their frame. Formerly @cxxi-lab/hub-sdk.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/types/index.d.ts
CHANGED
|
@@ -1,7 +1,37 @@
|
|
|
1
|
-
// @cxxi-lab/hubbyware-sdk 3.1
|
|
1
|
+
// @cxxi-lab/hubbyware-sdk 3.2.1: generated by app/scripts/emit-sdk-types.mjs from app/src/sdk — do not edit.
|
|
2
2
|
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
3
3
|
import { ComponentType, HTMLInputTypeAttribute, MouseEventHandler, ReactNode, TdHTMLAttributes, ThHTMLAttributes } from 'react';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Non-2xx response. `message` stays `HTTP <status>` (callers match on it); `detail`
|
|
7
|
+
* carries the server's problem+json explanation when there is one.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ApiError extends Error {
|
|
10
|
+
readonly status: number;
|
|
11
|
+
readonly detail: string | null;
|
|
12
|
+
constructor(status: number, detail: string | null);
|
|
13
|
+
}
|
|
14
|
+
/** Best human-readable message for a caught error: server detail first. */
|
|
15
|
+
export declare function errorMessage(err: unknown, fallback?: string): string;
|
|
16
|
+
export type StreamEventHandler = (event: string, data: unknown) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Parses a text/event-stream body, calling onEvent with each event name and its
|
|
19
|
+
* JSON-decoded data. Comments, empty blocks and undecodable data are skipped.
|
|
20
|
+
*/
|
|
21
|
+
export declare function readEventStream(body: ReadableStream<Uint8Array>, onEvent: StreamEventHandler): Promise<void>;
|
|
22
|
+
/** A site's player scripts, served by the back (the web socle, Resources/<host>/). */
|
|
23
|
+
export interface PlayerScripts {
|
|
24
|
+
/** run on the video page (page mode) to isolate the player */
|
|
25
|
+
page: string | null;
|
|
26
|
+
/** run on a bare embed player (embed mode) */
|
|
27
|
+
embed: string | null;
|
|
28
|
+
pause: string | null;
|
|
29
|
+
}
|
|
30
|
+
export interface PlayerConfig {
|
|
31
|
+
/** the host whose scripts apply to the requested domain */
|
|
32
|
+
host: string;
|
|
33
|
+
scripts: PlayerScripts;
|
|
34
|
+
}
|
|
5
35
|
/**
|
|
6
36
|
* The platform contract: everything the shared UI needs from its host shell.
|
|
7
37
|
*
|
|
@@ -657,18 +687,6 @@ export declare function Amount({ hubby, children, className }: {
|
|
|
657
687
|
children: ReactNode;
|
|
658
688
|
className?: string;
|
|
659
689
|
}): import("react").JSX.Element;
|
|
660
|
-
/**
|
|
661
|
-
* Non-2xx response. `message` stays `HTTP <status>` (callers match on it); `detail`
|
|
662
|
-
* carries the server's problem+json explanation when there is one.
|
|
663
|
-
*/
|
|
664
|
-
export declare class ApiError extends Error {
|
|
665
|
-
readonly status: number;
|
|
666
|
-
readonly detail: string | null;
|
|
667
|
-
constructor(status: number, detail: string | null);
|
|
668
|
-
}
|
|
669
|
-
/** Best human-readable message for a caught error: server detail first. */
|
|
670
|
-
export declare function errorMessage(err: unknown, fallback?: string): string;
|
|
671
|
-
export declare function api<T>(path: string, options?: RequestInit, retry?: boolean): Promise<T>;
|
|
672
690
|
/**
|
|
673
691
|
* The server's base URL. Given the path called, the routes of the hubbies reached through the VPN
|
|
674
692
|
* (their data, their capabilities, their media: as they declare, core/hubby/declarations.ts) go to
|
|
@@ -676,18 +694,6 @@ export declare function api<T>(path: string, options?: RequestInit, retry?: bool
|
|
|
676
694
|
* phone routes everything through it in private mode. Development: one local server.
|
|
677
695
|
*/
|
|
678
696
|
export declare function getApiBaseUrl(path?: string): string;
|
|
679
|
-
export type StreamEventHandler = (event: string, data: unknown) => void;
|
|
680
|
-
/**
|
|
681
|
-
* Opens an authenticated server-sent event stream — over fetch, so it can POST a
|
|
682
|
-
* body and carry the token — and resolves once the server closes it. Like api(),
|
|
683
|
-
* a 401 refreshes the token once before giving up.
|
|
684
|
-
*/
|
|
685
|
-
export declare function apiStream(path: string, options: RequestInit, onEvent: StreamEventHandler, retry?: boolean): Promise<void>;
|
|
686
|
-
/**
|
|
687
|
-
* Parses a text/event-stream body, calling onEvent with each event name and its
|
|
688
|
-
* JSON-decoded data. Comments, empty blocks and undecodable data are skipped.
|
|
689
|
-
*/
|
|
690
|
-
export declare function readEventStream(body: ReadableStream<Uint8Array>, onEvent: StreamEventHandler): Promise<void>;
|
|
691
697
|
export declare function fetchSettings<T = Record<string, unknown>>(scope: string): Promise<T>;
|
|
692
698
|
export declare function updateSettings<T = Record<string, unknown>>(scope: string, values: Partial<T>): Promise<T>;
|
|
693
699
|
/** Standard JSON envelopes returned by the hub API. */
|
|
@@ -707,37 +713,11 @@ export interface PaginatedResponse<T> {
|
|
|
707
713
|
pages: number;
|
|
708
714
|
};
|
|
709
715
|
}
|
|
710
|
-
export declare function ensureIntegrationForUrl(rawUrl: string): Promise<void>;
|
|
711
716
|
/**
|
|
712
717
|
* Sync probe — true if the domain has already been checked (positive or
|
|
713
718
|
* negative). Lets call-sites skip the async await on hot paths.
|
|
714
719
|
*/
|
|
715
720
|
export declare function isIntegrationKnownSync(rawUrl: string): boolean;
|
|
716
|
-
/** A site's player scripts, served by the back (the web socle, Resources/<host>/). */
|
|
717
|
-
export interface PlayerScripts {
|
|
718
|
-
/** run on the video page (page mode) to isolate the player */
|
|
719
|
-
page: string | null;
|
|
720
|
-
/** run on a bare embed player (embed mode) */
|
|
721
|
-
embed: string | null;
|
|
722
|
-
pause: string | null;
|
|
723
|
-
}
|
|
724
|
-
export interface PlayerConfig {
|
|
725
|
-
/** the host whose scripts apply to the requested domain */
|
|
726
|
-
host: string;
|
|
727
|
-
scripts: PlayerScripts;
|
|
728
|
-
}
|
|
729
|
-
/**
|
|
730
|
-
* The player config for a domain, null when the back has no scripts for the
|
|
731
|
-
* site (it is then loaded as-is). A failed lookup resolves null too, and is
|
|
732
|
-
* retried next time.
|
|
733
|
-
*/
|
|
734
|
-
export declare function getPlayerConfig(domain: string): Promise<PlayerConfig | null>;
|
|
735
|
-
/**
|
|
736
|
-
* Makes sure the shell holds the back's current player blocklist before a
|
|
737
|
-
* player loads a site: once per session, a 304 when nothing changed. A failure
|
|
738
|
-
* leaves the shell's previous list in place and is retried next time.
|
|
739
|
-
*/
|
|
740
|
-
export declare function syncPlayerBlocklist(): Promise<void>;
|
|
741
721
|
export type ButtonColor = "primary" | "secondary" | "danger";
|
|
742
722
|
export interface ButtonProps {
|
|
743
723
|
label?: ReactNode;
|
|
@@ -1010,6 +990,23 @@ export declare function collection<T extends object>(hubby: string, name: string
|
|
|
1010
990
|
export declare function useVpnStatus(): VpnInfo;
|
|
1011
991
|
export declare function formatDuration(seconds: number | null): string;
|
|
1012
992
|
export declare function formatDate(iso: string | null): string;
|
|
993
|
+
/** A call to the server's API, as the hubby: its JSON (nothing on a 204), an ApiError otherwise. */
|
|
994
|
+
export declare function api<T>(path: string, options?: RequestInit, retry?: boolean): Promise<T>;
|
|
995
|
+
/**
|
|
996
|
+
* Opens an authenticated server-sent event stream, as the hubby — over fetch, so it can POST a
|
|
997
|
+
* body and carry the token — and resolves once the server closes it.
|
|
998
|
+
*/
|
|
999
|
+
export declare function apiStream(path: string, options: RequestInit, onEvent: StreamEventHandler, retry?: boolean): Promise<void>;
|
|
1000
|
+
/** Applies the website integration (cookies, CDN referer) of a URL's site before a webview or the native player loads it. */
|
|
1001
|
+
export declare function ensureIntegrationForUrl(rawUrl: string): Promise<void>;
|
|
1002
|
+
/**
|
|
1003
|
+
* The player config for a domain, null when the back has no scripts for the
|
|
1004
|
+
* site (it is then loaded as-is). A failed lookup resolves null too, and is
|
|
1005
|
+
* retried next time.
|
|
1006
|
+
*/
|
|
1007
|
+
export declare function getPlayerConfig(domain: string): Promise<PlayerConfig | null>;
|
|
1008
|
+
/** Makes sure the shell holds the back's current player blocklist before a player loads a site (once per session). */
|
|
1009
|
+
export declare function syncPlayerBlocklist(): Promise<void>;
|
|
1013
1010
|
|
|
1014
1011
|
export {
|
|
1015
1012
|
FormData$1 as FormData,
|
package/version.json
CHANGED