@cxxi-lab/hubbyware-sdk 3.0.1 → 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/frame/hubby.tsx CHANGED
@@ -26,9 +26,6 @@ export function defineHubby(definition: HubbyDefinition): HubbyDefinition {
26
26
  return definition
27
27
  }
28
28
 
29
- /** @deprecated defineHubby: its SDK 2 name, kept for the hubbies built before the rename */
30
- export const defineModule = defineHubby
31
-
32
29
  /** The page matching a path, with its parameters (`:name` segments). */
33
30
  export function match(pages: HubbyPageDefinition[], path: string): { page: HubbyPageDefinition, params: Record<string, string> } | null {
34
31
  const parts = path.split('/').filter(Boolean)
package/frame/index.ts CHANGED
@@ -4,5 +4,5 @@
4
4
  import './runtime.css'
5
5
 
6
6
  export { call, collection, nav, notifications, settings, useInit, usePath, type Doc } from './sdk'
7
- export { defineHubby, defineModule, start, type HubbyDefinition, type HubbyPageDefinition } from './hubby'
7
+ export { defineHubby, start, type HubbyDefinition, type HubbyPageDefinition } from './hubby'
8
8
  export { useBackHandler, useMediaQuery } from '@cxxi-lab/hubbyware-ui'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cxxi-lab/hubbyware-sdk",
3
- "version": "3.0.1",
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/protocol.ts CHANGED
@@ -26,12 +26,8 @@ export type GuestMessage =
26
26
 
27
27
  /** Host → guest. */
28
28
  export type HostMessage =
29
- /**
30
- * `theme`, `accent`: the app's (a host from before themes sends none: dark, blue). `module`: the
31
- * hubby's id under its SDK 2 name, still sent for the hubbies built before the rename (a host from
32
- * before it sends `module` only).
33
- */
34
- | { type: 'init', hubby: string, module: string, path: string, phone: boolean, scopes: string[], theme?: 'light' | 'dark', accent?: string }
29
+ /** `theme`, `accent`: the app's (a host from before themes sends none: dark, blue) */
30
+ | { type: 'init', hubby: string, path: string, phone: boolean, scopes: string[], theme?: 'light' | 'dark', accent?: string }
35
31
  | { type: 'result', id: number, ok: true, value: unknown }
36
32
  | { type: 'result', id: number, ok: false, error: string }
37
33
  | { type: 'back' }
package/types/index.d.ts CHANGED
@@ -1,7 +1,24 @@
1
- // @cxxi-lab/hubbyware-sdk 3.0.1: 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
  *
@@ -421,8 +438,6 @@ export interface Platform {
421
438
  authorizeOAuth(url: string, redirectUri: string): Promise<string | null>;
422
439
  /** Opens a hubby's window (HubbyManifest.windows), registered beforehand. */
423
440
  openHubbyWindow(hubbyId: string, windowId: string): Promise<void>;
424
- /** @deprecated openHubbyWindow: its SDK 2 name, kept for the hubbies built before the rename */
425
- openModuleWindow(hubbyId: string, windowId: string): Promise<void>;
426
441
  /** The windows of the active hubbies: what the app menu offers (replaces the previous list). */
427
442
  registerHubbyWindows(windows: HubbyWindowInfo[]): Promise<void>;
428
443
  openAbout(): Promise<void>;
@@ -479,13 +494,8 @@ export interface TimelineItem {
479
494
  id: string;
480
495
  date: Date;
481
496
  title: string;
482
- /**
483
- * the hubby that produced it (for grouping / coloring). A hubby built before the rename (SDK 2)
484
- * sets `moduleId` instead: a consumer reads `hubbyId ?? moduleId`.
485
- */
497
+ /** the hubby that produced it (for grouping / coloring) */
486
498
  hubbyId: string;
487
- /** @deprecated hubbyId (SDK 2) */
488
- moduleId?: string;
489
499
  /** where a consumer can send the user for the full item (deep-link fallback) */
490
500
  href: string;
491
501
  /** optional presentation hint: a CSS color used as the chip accent (generic) */
@@ -521,8 +531,6 @@ export type ContributionPoint = keyof ContributionPoints;
521
531
  /** One hubby's contribution to a point. */
522
532
  export interface Contribution<P extends ContributionPoint> {
523
533
  hubbyId: string;
524
- /** @deprecated hubbyId: its SDK 2 name, still set for the hubbies built before the rename */
525
- moduleId: string;
526
534
  value: ContributionPoints[P];
527
535
  }
528
536
  export interface HubbyNavItem {
@@ -661,25 +669,11 @@ export declare function usePrivateMode(): boolean;
661
669
  * (`supports: ['amounts']`), a click shows that one until it is clicked again, the page is left or
662
670
  * Ctrl+Alt+Q. Not for an amount being typed (a field): only shown ones.
663
671
  */
664
- export declare function Amount({ hubby, module, children, className }: {
665
- hubby?: string;
666
- /** @deprecated hubby: its SDK 2 name, still read for the hubbies built before the rename */
667
- module?: string;
672
+ export declare function Amount({ hubby, children, className }: {
673
+ hubby: string;
668
674
  children: ReactNode;
669
675
  className?: string;
670
676
  }): import("react").JSX.Element;
671
- /**
672
- * Non-2xx response. `message` stays `HTTP <status>` (callers match on it); `detail`
673
- * carries the server's problem+json explanation when there is one.
674
- */
675
- export declare class ApiError extends Error {
676
- readonly status: number;
677
- readonly detail: string | null;
678
- constructor(status: number, detail: string | null);
679
- }
680
- /** Best human-readable message for a caught error: server detail first. */
681
- export declare function errorMessage(err: unknown, fallback?: string): string;
682
- export declare function api<T>(path: string, options?: RequestInit, retry?: boolean): Promise<T>;
683
677
  /**
684
678
  * The server's base URL. Given the path called, the routes of the hubbies reached through the VPN
685
679
  * (their data, their capabilities, their media: as they declare, core/hubby/declarations.ts) go to
@@ -687,18 +681,6 @@ export declare function api<T>(path: string, options?: RequestInit, retry?: bool
687
681
  * phone routes everything through it in private mode. Development: one local server.
688
682
  */
689
683
  export declare function getApiBaseUrl(path?: string): string;
690
- export type StreamEventHandler = (event: string, data: unknown) => void;
691
- /**
692
- * Opens an authenticated server-sent event stream — over fetch, so it can POST a
693
- * body and carry the token — and resolves once the server closes it. Like api(),
694
- * a 401 refreshes the token once before giving up.
695
- */
696
- export declare function apiStream(path: string, options: RequestInit, onEvent: StreamEventHandler, retry?: boolean): Promise<void>;
697
- /**
698
- * Parses a text/event-stream body, calling onEvent with each event name and its
699
- * JSON-decoded data. Comments, empty blocks and undecodable data are skipped.
700
- */
701
- export declare function readEventStream(body: ReadableStream<Uint8Array>, onEvent: StreamEventHandler): Promise<void>;
702
684
  export declare function fetchSettings<T = Record<string, unknown>>(scope: string): Promise<T>;
703
685
  export declare function updateSettings<T = Record<string, unknown>>(scope: string, values: Partial<T>): Promise<T>;
704
686
  /** Standard JSON envelopes returned by the hub API. */
@@ -1021,10 +1003,16 @@ export declare function collection<T extends object>(hubby: string, name: string
1021
1003
  export declare function useVpnStatus(): VpnInfo;
1022
1004
  export declare function formatDuration(seconds: number | null): string;
1023
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>;
1024
1013
 
1025
1014
  export {
1026
1015
  FormData$1 as FormData,
1027
- useHubbyVisible as useModuleVisible,
1028
1016
  };
1029
1017
 
1030
1018
  export {};
package/version.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
- "version": "3.0.1",
3
- "compatible": ["2.0.1"]
2
+ "version": "3.2.0",
3
+ "compatible": []
4
4
  }