@smarthome.exchange/api 0.1.0 → 1.0.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/changelog.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026-10-12 - 1.0.1
4
+
5
+ ### Fixes
6
+
7
+ - Consume interfaces 2.1.0 so authenticated inventory and snapshot return types include native TCP devices.
8
+
9
+ ### Maintenance
10
+
11
+ - release tooling: pnpm 12.9.1
12
+
13
+ ## 2026-10-06 - 1.0.0
14
+
15
+ ### Features
16
+
17
+ - Expose cancellable snapshot watcher lifetimes and deadlines, abort and drain active polls on stop, and suppress late credentials after request cancellation.
18
+
19
+ - Authenticate each HTTP request and physical Node socket connection, preserve cancellation and stop ownership, and reject unsupported browser socket headers explicitly.
20
+
21
+ ### Maintenance
22
+
23
+ - Update the release test runner to tstest 7.2.0 and strengthen generated integrity records while retaining eligible pnpm and Node type pins.
24
+
25
+ ### Breaking Changes
26
+
27
+ - Require an explicit home and asynchronous authorization provider; consume the matching TypedRequest 9 and TypedSocket 9 graph.
28
+
29
+ ### Fixes
30
+
31
+ - Track a root-only pnpm workspace policy that approves esbuild and denies unused Puppeteer and sharp dependency builds.
32
+
33
+ - update development tooling and release preflight configuration (tooling)
34
+ - Upgrade GitZone development tools, TypeScript test/build tooling, and Node typings
35
+ - Update package manager to pnpm 12.8.1
36
+ - Remove clean tree requirement from release preflight checks
37
+
3
38
  ## 2026-08-10 - 0.1.0
4
39
 
5
40
  ### Features
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@smarthome.exchange/api',
6
- version: '0.1.0',
6
+ version: '1.0.1',
7
7
  description: 'Typed API client for smarthome.exchange hubs.'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx5QkFBeUI7SUFDL0IsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLCtDQUErQztDQUM3RCxDQUFBIn0=
@@ -1,8 +1,38 @@
1
1
  import * as plugins from './plugins.js';
2
2
  export interface IShxApiClientOptions {
3
3
  hubUrl?: string;
4
+ homeId: string;
5
+ authorizationHeaderProvider: TShxAuthorizationHeaderProvider;
6
+ socketConnectionPreparationTimeoutMs?: number;
4
7
  }
8
+ export interface IShxAuthorizationContext {
9
+ readonly homeId: string;
10
+ readonly endpoint: string;
11
+ readonly transport: 'http';
12
+ readonly method: plugins.shxInterfaces.request.IReq_ListDevices['method'] | plugins.shxInterfaces.request.IReq_ListAgents['method'] | plugins.shxInterfaces.request.IReq_ListTools['method'] | plugins.shxInterfaces.request.IReq_GetHomeSnapshot['method'] | plugins.shxInterfaces.request.IReq_ExecuteToolPlan['method'] | plugins.shxInterfaces.request.IReq_ListApprovals['method'] | plugins.shxInterfaces.request.IReq_SubmitApproval['method'];
13
+ readonly abortSignal?: AbortSignal;
14
+ }
15
+ export interface IShxSocketAuthorizationContext extends Omit<IShxAuthorizationContext, 'method' | 'transport' | 'abortSignal'> {
16
+ readonly method: 'connect';
17
+ readonly transport: 'websocket';
18
+ readonly abortSignal: AbortSignal;
19
+ readonly attempt: number;
20
+ readonly deadline: number;
21
+ }
22
+ export type TShxAuthorizationContext = IShxAuthorizationContext | IShxSocketAuthorizationContext;
23
+ export type TShxAuthorizationHeaderProvider = (contextArg: TShxAuthorizationContext) => Promise<string>;
24
+ export interface IShxApiRequestOptions {
25
+ abortSignal?: AbortSignal;
26
+ timeoutMs?: number;
27
+ useCache?: boolean;
28
+ }
29
+ export type TListDevicesRequest = Omit<plugins.shxInterfaces.request.IReq_ListDevices['request'], 'context'>;
30
+ export type TListToolsRequest = Omit<plugins.shxInterfaces.request.IReq_ListTools['request'], 'context'>;
31
+ export type TListApprovalsRequest = Omit<plugins.shxInterfaces.request.IReq_ListApprovals['request'], 'context'>;
32
+ export type TSubmitApprovalRequest = Omit<plugins.shxInterfaces.request.IReq_SubmitApproval['request'], 'context'>;
5
33
  export interface IHomeSnapshotWatchOptions {
34
+ abortSignal?: AbortSignal;
35
+ timeoutMs?: number;
6
36
  intervalMs?: number;
7
37
  immediate?: boolean;
8
38
  onError?: (errorArg: unknown) => void | Promise<void>;
@@ -10,36 +40,49 @@ export interface IHomeSnapshotWatchOptions {
10
40
  export type THomeSnapshotWatchCallback = (snapshotResponseArg: plugins.shxInterfaces.request.IReq_GetHomeSnapshot['response']) => void | Promise<void>;
11
41
  export type THomeSnapshotWatchStop = () => Promise<void>;
12
42
  export declare class SmarthomeExchangeApiClient {
13
- private hubUrl;
14
- typedrouter: plugins.typedrequest.TypedRouter<plugins.typedRequestInterfaces.ITypedRequest>;
15
- typedsocketClient?: plugins.typedsocket.TypedSocket;
16
- constructor(optionsArg?: IShxApiClientOptions);
17
- private get httpEndpoint();
18
- private createWsRequest;
43
+ #private;
44
+ private lifecycleTail;
45
+ private lifecycleOperationCount;
46
+ private queuedLifecycleOperation?;
47
+ private stopIntentGeneration;
48
+ private pendingStartAbortController?;
49
+ private socketPendingStop?;
50
+ private socketNeedsCleanup;
51
+ readonly typedrouter: plugins.typedrequest.TypedRouter<plugins.typedRequestInterfaces.ITypedRequest>;
52
+ constructor(optionsArg: IShxApiClientOptions);
53
+ get homeId(): string;
54
+ get typedsocketClient(): plugins.typedsocket.TypedSocket | undefined;
19
55
  private createHttpRequest;
56
+ private captureRequestOptions;
20
57
  private fire;
58
+ private getAuthorization;
59
+ private prepareSocketConnection;
60
+ private prepareRequest;
61
+ private assertJsonData;
62
+ private assertKnownProperties;
63
+ private queueLifecycleOperation;
21
64
  start(): Promise<void>;
22
65
  stop(): Promise<void>;
23
- listDevices(requestArg?: plugins.shxInterfaces.request.IReq_ListDevices['request']): Promise<{
66
+ listDevices(requestArg?: TListDevicesRequest, optionsArg?: IShxApiRequestOptions): Promise<{
24
67
  devices: plugins.shxInterfaces.data.IDeviceDefinition[];
25
68
  }>;
26
- listAgents(): Promise<{
69
+ listAgents(optionsArg?: IShxApiRequestOptions): Promise<{
27
70
  agents: plugins.shxInterfaces.data.IAgentDefinition[];
28
71
  statuses: plugins.shxInterfaces.data.IAgentStatus[];
29
72
  }>;
30
- listTools(requestArg?: plugins.shxInterfaces.request.IReq_ListTools['request']): Promise<{
73
+ listTools(requestArg?: TListToolsRequest, optionsArg?: IShxApiRequestOptions): Promise<{
31
74
  tools: plugins.shxInterfaces.data.IToolDefinition[];
32
75
  }>;
33
- getHomeSnapshot(): Promise<{
76
+ getHomeSnapshot(optionsArg?: IShxApiRequestOptions): Promise<{
34
77
  availability: plugins.shxInterfaces.data.THomeSnapshotAvailability;
35
78
  snapshot: plugins.shxInterfaces.data.IHomeSnapshot;
36
79
  }>;
37
80
  watchHomeSnapshot(callbackArg: THomeSnapshotWatchCallback, optionsArg?: IHomeSnapshotWatchOptions): THomeSnapshotWatchStop;
38
- executeToolPlan(planArg: plugins.shxInterfaces.data.IToolPlan): Promise<plugins.shxInterfaces.data.IToolPlanResult>;
39
- listApprovals(requestArg?: plugins.shxInterfaces.request.IReq_ListApprovals['request']): Promise<{
81
+ executeToolPlan(planArg: plugins.shxInterfaces.data.IToolPlan, optionsArg?: IShxApiRequestOptions): Promise<plugins.shxInterfaces.data.IToolPlanResult>;
82
+ listApprovals(requestArg?: TListApprovalsRequest, optionsArg?: IShxApiRequestOptions): Promise<{
40
83
  approvals: plugins.shxInterfaces.data.IApprovalRequest[];
41
84
  }>;
42
- submitApproval(requestArg: plugins.shxInterfaces.request.IReq_SubmitApproval['request']): Promise<{
85
+ submitApproval(requestArg: TSubmitApprovalRequest, optionsArg?: IShxApiRequestOptions): Promise<{
43
86
  approval: plugins.shxInterfaces.data.IApprovalRequest;
44
87
  receipt: plugins.shxInterfaces.data.IAuditReceipt;
45
88
  }>;