@cxxi-lab/hubbyware-sdk 3.1.0 → 3.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cxxi-lab/hubbyware-sdk",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
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,24 @@
1
- // @cxxi-lab/hubbyware-sdk 3.1.0: generated by app/scripts/emit-sdk-types.mjs from app/src/sdk — do not edit.
1
+ // @cxxi-lab/hubbyware-sdk 3.2.0: 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>;
5
22
  /**
6
23
  * The platform contract: everything the shared UI needs from its host shell.
7
24
  *
@@ -657,18 +674,6 @@ export declare function Amount({ hubby, children, className }: {
657
674
  children: ReactNode;
658
675
  className?: string;
659
676
  }): 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
677
  /**
673
678
  * The server's base URL. Given the path called, the routes of the hubbies reached through the VPN
674
679
  * (their data, their capabilities, their media: as they declare, core/hubby/declarations.ts) go to
@@ -676,18 +681,6 @@ export declare function api<T>(path: string, options?: RequestInit, retry?: bool
676
681
  * phone routes everything through it in private mode. Development: one local server.
677
682
  */
678
683
  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
684
  export declare function fetchSettings<T = Record<string, unknown>>(scope: string): Promise<T>;
692
685
  export declare function updateSettings<T = Record<string, unknown>>(scope: string, values: Partial<T>): Promise<T>;
693
686
  /** Standard JSON envelopes returned by the hub API. */
@@ -1010,6 +1003,13 @@ export declare function collection<T extends object>(hubby: string, name: string
1010
1003
  export declare function useVpnStatus(): VpnInfo;
1011
1004
  export declare function formatDuration(seconds: number | null): string;
1012
1005
  export declare function formatDate(iso: string | null): string;
1006
+ /** A call to the server's API, as the hubby: its JSON (nothing on a 204), an ApiError otherwise. */
1007
+ export declare function api<T>(path: string, options?: RequestInit, retry?: boolean): Promise<T>;
1008
+ /**
1009
+ * Opens an authenticated server-sent event stream, as the hubby — over fetch, so it can POST a
1010
+ * body and carry the token — and resolves once the server closes it.
1011
+ */
1012
+ export declare function apiStream(path: string, options: RequestInit, onEvent: StreamEventHandler, retry?: boolean): Promise<void>;
1013
1013
 
1014
1014
  export {
1015
1015
  FormData$1 as FormData,
package/version.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
- "version": "3.1.0",
2
+ "version": "3.2.0",
3
3
  "compatible": []
4
4
  }