@camstack/sdk 0.1.35 → 0.1.37
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/dist/__tests__/base-device.spec.d.ts +1 -0
- package/dist/__tests__/race-endpoints.spec.d.ts +1 -0
- package/dist/base-device.d.ts +5 -0
- package/dist/index.cjs +1343 -2264
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +1297 -2136
- package/dist/index.js.map +1 -1
- package/dist/nvr.d.ts +4 -17
- package/dist/system.d.ts +297 -0
- package/dist/timeline.d.ts +0 -8
- package/dist/types.d.ts +1 -8
- package/package.json +4 -3
- package/dist/backend-client.d.ts +0 -315
package/dist/backend-client.d.ts
DELETED
|
@@ -1,315 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Backend client — connects directly to the CamStack NestJS backend via tRPC.
|
|
3
|
-
*
|
|
4
|
-
* Use this when the client needs to talk to the backend server directly
|
|
5
|
-
* (admin UI, local agent, embedded mode) rather than going through the proxy.
|
|
6
|
-
*
|
|
7
|
-
* Features: full typed access to all backend tRPC routes (auth, devices, providers,
|
|
8
|
-
* pipeline, agents, addons, bridge pipeline, recording, events, live subscriptions).
|
|
9
|
-
*/
|
|
10
|
-
import { createTRPCClient } from "@trpc/client";
|
|
11
|
-
import type { BackendAppRouter } from "./backend-router.js";
|
|
12
|
-
export type SettingsSection = 'server' | 'auth' | 'features' | 'storage' | 'logging' | 'addons' | 'recording' | 'streaming' | 'ffmpeg' | 'detection' | 'backup' | 'retention';
|
|
13
|
-
export interface BackendClientConfig {
|
|
14
|
-
/** Backend server URL (e.g. "http://localhost:4443") */
|
|
15
|
-
readonly serverUrl: string;
|
|
16
|
-
/** JWT token for authentication */
|
|
17
|
-
readonly token?: string;
|
|
18
|
-
/** Connection timeout in ms (default: 10000) */
|
|
19
|
-
readonly connectTimeoutMs?: number;
|
|
20
|
-
/** Use WebSocket for all queries/mutations (default: true in browser, false in Node) */
|
|
21
|
-
readonly useWebSocket?: boolean;
|
|
22
|
-
}
|
|
23
|
-
export declare class BackendClient {
|
|
24
|
-
/** Raw tRPC client — for advanced usage / direct path access */
|
|
25
|
-
readonly trpc: ReturnType<typeof createTRPCClient<BackendAppRouter>>;
|
|
26
|
-
readonly serverUrl: string;
|
|
27
|
-
private token;
|
|
28
|
-
private wsClient;
|
|
29
|
-
constructor(config: BackendClientConfig);
|
|
30
|
-
/** Update the auth token (e.g. after login) */
|
|
31
|
-
setToken(token: string): void;
|
|
32
|
-
/** Close the WebSocket connection (if using WS transport) */
|
|
33
|
-
close(): void;
|
|
34
|
-
login(username: string, password: string): Promise<{
|
|
35
|
-
token: string;
|
|
36
|
-
user: {
|
|
37
|
-
id: string;
|
|
38
|
-
username: string;
|
|
39
|
-
role: import("@camstack/types").UserRole;
|
|
40
|
-
};
|
|
41
|
-
}>;
|
|
42
|
-
getMe(): Promise<import("@camstack/types").AuthenticatedUser>;
|
|
43
|
-
logout(): Promise<{
|
|
44
|
-
success: boolean;
|
|
45
|
-
}>;
|
|
46
|
-
getSystemInfo(): Promise<{
|
|
47
|
-
version: string;
|
|
48
|
-
uptime: number;
|
|
49
|
-
nodeVersion: string;
|
|
50
|
-
platform: NodeJS.Platform;
|
|
51
|
-
features: import("@camstack/types").FeatureManifest;
|
|
52
|
-
}>;
|
|
53
|
-
getFeatureFlags(): Promise<import("@camstack/types").FeatureManifest>;
|
|
54
|
-
listProviders(): Promise<readonly import("@camstack/types").ProviderListItem[]>;
|
|
55
|
-
getProvider(providerId: string): Promise<{
|
|
56
|
-
id: string;
|
|
57
|
-
type: string;
|
|
58
|
-
name: string;
|
|
59
|
-
discoveryMode: "auto" | "manual" | "both";
|
|
60
|
-
status: import("@camstack/types").ProviderStatus;
|
|
61
|
-
deviceCount: number;
|
|
62
|
-
}>;
|
|
63
|
-
startProvider(providerId: string): Promise<{
|
|
64
|
-
success: boolean;
|
|
65
|
-
}>;
|
|
66
|
-
stopProvider(providerId: string): Promise<{
|
|
67
|
-
success: boolean;
|
|
68
|
-
}>;
|
|
69
|
-
listProviderTypes(): Promise<{
|
|
70
|
-
addonId: string;
|
|
71
|
-
name: string;
|
|
72
|
-
description: string;
|
|
73
|
-
iconUrl: string | null;
|
|
74
|
-
color: string;
|
|
75
|
-
instanceMode: "unique" | "multiple";
|
|
76
|
-
discoveryMode: "auto" | "manual" | "both";
|
|
77
|
-
existingInstances: {
|
|
78
|
-
id: string;
|
|
79
|
-
name: string;
|
|
80
|
-
}[];
|
|
81
|
-
canAdd: boolean;
|
|
82
|
-
}[]>;
|
|
83
|
-
listDevices(): Promise<{
|
|
84
|
-
id: string;
|
|
85
|
-
name: string;
|
|
86
|
-
providerId: string;
|
|
87
|
-
type: import("@camstack/types").DeviceType;
|
|
88
|
-
capabilities: import("@camstack/types").DeviceCapabilityName[];
|
|
89
|
-
state: import("@camstack/types").DeviceState;
|
|
90
|
-
}[]>;
|
|
91
|
-
getDevice(deviceId: string): Promise<{
|
|
92
|
-
id: string;
|
|
93
|
-
name: string;
|
|
94
|
-
providerId: string;
|
|
95
|
-
type: import("@camstack/types").DeviceType;
|
|
96
|
-
capabilities: import("@camstack/types").DeviceCapabilityName[];
|
|
97
|
-
state: import("@camstack/types").DeviceState;
|
|
98
|
-
metadata: import("@camstack/types").DeviceMetadata;
|
|
99
|
-
}>;
|
|
100
|
-
discoverDevices(providerId: string): Promise<import("@camstack/types").DiscoveredDevice[]>;
|
|
101
|
-
adoptDevice(providerId: string, externalId: string): Promise<import("@camstack/types").IDevice>;
|
|
102
|
-
createDevice(providerId: string, config: Record<string, unknown>): Promise<import("@camstack/types").IDevice>;
|
|
103
|
-
/** Returns the URL path for a static asset served by an addon. */
|
|
104
|
-
getAddonAssetUrl(addonId: string, assetPath: string): string;
|
|
105
|
-
listAddons(): Promise<{
|
|
106
|
-
manifest: import("@camstack/types").AddonManifest & {
|
|
107
|
-
packageName: string;
|
|
108
|
-
packageVersion: string;
|
|
109
|
-
packageDisplayName?: string;
|
|
110
|
-
protected?: boolean;
|
|
111
|
-
removable?: boolean;
|
|
112
|
-
};
|
|
113
|
-
declaration?: import("@camstack/types").AddonDeclaration;
|
|
114
|
-
hasConfigSchema: boolean;
|
|
115
|
-
source: "core" | "installed" | "workspace";
|
|
116
|
-
installSource?: "npm" | "workspace";
|
|
117
|
-
}[]>;
|
|
118
|
-
getAddonConfigSchema(addonId: string): Promise<import("@camstack/types").ConfigUISchema | null>;
|
|
119
|
-
getAddonConfig(addonId: string): Promise<Record<string, unknown>>;
|
|
120
|
-
updateAddonConfig(addonId: string, config: Record<string, unknown>): Promise<{
|
|
121
|
-
success: boolean;
|
|
122
|
-
}>;
|
|
123
|
-
getAddonLogs(addonId: string, options?: {
|
|
124
|
-
limit?: number;
|
|
125
|
-
level?: 'debug' | 'info' | 'warn' | 'error';
|
|
126
|
-
}): Promise<import("@camstack/types").LogEntry[]>;
|
|
127
|
-
listKnownFaces(): Promise<{
|
|
128
|
-
id: string;
|
|
129
|
-
label: string;
|
|
130
|
-
group?: string;
|
|
131
|
-
cropBase64: string;
|
|
132
|
-
createdAt: number;
|
|
133
|
-
updatedAt: number;
|
|
134
|
-
source?: string;
|
|
135
|
-
metadata?: Readonly<Record<string, unknown>>;
|
|
136
|
-
}[]>;
|
|
137
|
-
registerFace(label: string, cropBase64: string, group?: string): Promise<never>;
|
|
138
|
-
listPipelines(): Promise<{
|
|
139
|
-
id: string;
|
|
140
|
-
packageName: string;
|
|
141
|
-
slot: import("@camstack/types").PipelineSlot | null;
|
|
142
|
-
}[]>;
|
|
143
|
-
getPipelineStatus(deviceId: string): Promise<import("@camstack/types").PipelineConfig | null>;
|
|
144
|
-
listAgents(): Promise<readonly import("@camstack/types").AgentListItem[]>;
|
|
145
|
-
dispatchTask(agentId: string, task: Record<string, unknown>): Promise<import("@camstack/types").AgentTaskResult>;
|
|
146
|
-
getProcessTree(): Promise<{
|
|
147
|
-
id: string;
|
|
148
|
-
name: string;
|
|
149
|
-
pid: number;
|
|
150
|
-
state: "running";
|
|
151
|
-
cpuPercent: number;
|
|
152
|
-
memoryPercent: number;
|
|
153
|
-
memoryMB: number;
|
|
154
|
-
isHub: boolean;
|
|
155
|
-
platform: string;
|
|
156
|
-
arch: string;
|
|
157
|
-
host: string;
|
|
158
|
-
capabilities: string[];
|
|
159
|
-
installedAddons: string[];
|
|
160
|
-
pythonRuntimes: string[];
|
|
161
|
-
connectedSince: number;
|
|
162
|
-
subProcesses: unknown[];
|
|
163
|
-
}[]>;
|
|
164
|
-
bridgeListAddons(): Promise<{
|
|
165
|
-
id: string;
|
|
166
|
-
packageName: string;
|
|
167
|
-
slot: import("@camstack/types").PipelineSlot | null;
|
|
168
|
-
}[]>;
|
|
169
|
-
bridgeGetPipeline(deviceId: string): Promise<import("@camstack/types").PipelineConfig | null>;
|
|
170
|
-
bridgeSetPipeline(deviceId: string, config: {
|
|
171
|
-
video: unknown[];
|
|
172
|
-
audio?: unknown;
|
|
173
|
-
}): Promise<{
|
|
174
|
-
success: boolean;
|
|
175
|
-
}>;
|
|
176
|
-
bridgeValidatePipeline(config: {
|
|
177
|
-
video: unknown[];
|
|
178
|
-
audio?: unknown;
|
|
179
|
-
}): Promise<import("@camstack/types").ValidationResult>;
|
|
180
|
-
bridgeGetAddonConfig(addonId: string): Promise<Record<string, unknown>>;
|
|
181
|
-
bridgeSetAddonConfig(addonId: string, config: Record<string, unknown>): Promise<{
|
|
182
|
-
success: boolean;
|
|
183
|
-
}>;
|
|
184
|
-
bridgeListPackages(): Promise<import("@camstack/types").InstalledPackage[]>;
|
|
185
|
-
bridgeListAddonsPackages(): Promise<{
|
|
186
|
-
manifest: import("@camstack/types").AddonManifest & {
|
|
187
|
-
packageName: string;
|
|
188
|
-
packageVersion: string;
|
|
189
|
-
packageDisplayName?: string;
|
|
190
|
-
protected?: boolean;
|
|
191
|
-
removable?: boolean;
|
|
192
|
-
};
|
|
193
|
-
declaration?: import("@camstack/types").AddonDeclaration;
|
|
194
|
-
hasConfigSchema: boolean;
|
|
195
|
-
source: "core" | "installed" | "workspace";
|
|
196
|
-
installSource?: "npm" | "workspace";
|
|
197
|
-
}[]>;
|
|
198
|
-
bridgeInstallPackage(packageName: string, version?: string): Promise<{
|
|
199
|
-
success: boolean;
|
|
200
|
-
loaded: string[];
|
|
201
|
-
failed: string[];
|
|
202
|
-
}>;
|
|
203
|
-
bridgeUninstallPackage(packageName: string): Promise<{
|
|
204
|
-
success: boolean;
|
|
205
|
-
}>;
|
|
206
|
-
getRecordingConfig(deviceId: string): Promise<unknown>;
|
|
207
|
-
getRecordingPolicy(deviceId: string): Promise<unknown>;
|
|
208
|
-
getRecordingPolicyStatus(deviceId: string): Promise<{
|
|
209
|
-
deviceId: string;
|
|
210
|
-
policyExists: boolean;
|
|
211
|
-
enabled: any;
|
|
212
|
-
mode: any;
|
|
213
|
-
isRecording: boolean;
|
|
214
|
-
}>;
|
|
215
|
-
getRecordingSegments(deviceId: string, streamId: string, startTime: number, endTime: number): Promise<unknown>;
|
|
216
|
-
getEvents(deviceId: string, options?: {
|
|
217
|
-
limit?: number;
|
|
218
|
-
offset?: number;
|
|
219
|
-
}): Promise<import("@camstack/types").EventQueryResult>;
|
|
220
|
-
getLogs(options?: {
|
|
221
|
-
level?: 'debug' | 'info' | 'warn' | 'error';
|
|
222
|
-
limit?: number;
|
|
223
|
-
since?: number;
|
|
224
|
-
until?: number;
|
|
225
|
-
scope?: string[];
|
|
226
|
-
}): Promise<import("@camstack/types").LogEntry[]>;
|
|
227
|
-
replEval(code: string, scope?: {
|
|
228
|
-
type: 'system';
|
|
229
|
-
} | {
|
|
230
|
-
type: 'device';
|
|
231
|
-
deviceId: string;
|
|
232
|
-
} | {
|
|
233
|
-
type: 'provider';
|
|
234
|
-
providerId: string;
|
|
235
|
-
} | {
|
|
236
|
-
type: 'addon';
|
|
237
|
-
addonId: string;
|
|
238
|
-
}): Promise<import("@camstack/types").ReplResult>;
|
|
239
|
-
listUsers(): Promise<Omit<import("@camstack/types").UserRecord, "passwordHash">[]>;
|
|
240
|
-
createUser(username: string, password: string, role: 'super_admin' | 'admin' | 'viewer'): Promise<{
|
|
241
|
-
id: string;
|
|
242
|
-
username: string;
|
|
243
|
-
role: import("@camstack/types").UserRole;
|
|
244
|
-
allowedProviders: string[] | "*";
|
|
245
|
-
allowedDevices: Record<string, string[] | "*">;
|
|
246
|
-
createdAt: number;
|
|
247
|
-
updatedAt: number;
|
|
248
|
-
}>;
|
|
249
|
-
getTrackingSessions(deviceId?: string): Promise<{
|
|
250
|
-
trackId: string;
|
|
251
|
-
deviceId: string;
|
|
252
|
-
className: string;
|
|
253
|
-
label: string | undefined;
|
|
254
|
-
firstSeen: number;
|
|
255
|
-
lastSeen: number;
|
|
256
|
-
totalFrames: number;
|
|
257
|
-
state: string;
|
|
258
|
-
globalId: string | undefined;
|
|
259
|
-
positions: readonly {
|
|
260
|
-
readonly x: number;
|
|
261
|
-
readonly y: number;
|
|
262
|
-
readonly t: number;
|
|
263
|
-
}[];
|
|
264
|
-
hasEmbedding: boolean;
|
|
265
|
-
hasCrop: boolean;
|
|
266
|
-
}[]>;
|
|
267
|
-
listProcesses(): Promise<(import("@camstack/types").ManagedProcessStatus | {
|
|
268
|
-
id: string;
|
|
269
|
-
label: string;
|
|
270
|
-
state: "running" | "stopped" | "crashed" | "starting";
|
|
271
|
-
pid?: number;
|
|
272
|
-
stats?: {
|
|
273
|
-
pid: number;
|
|
274
|
-
cpu: number;
|
|
275
|
-
memory: number;
|
|
276
|
-
uptime: number;
|
|
277
|
-
restartCount: number;
|
|
278
|
-
};
|
|
279
|
-
restartCount: number;
|
|
280
|
-
mode: "forked" | "in-process";
|
|
281
|
-
})[]>;
|
|
282
|
-
enableProvider(providerId: string): Promise<{
|
|
283
|
-
success: boolean;
|
|
284
|
-
}>;
|
|
285
|
-
disableProvider(providerId: string): Promise<{
|
|
286
|
-
success: boolean;
|
|
287
|
-
}>;
|
|
288
|
-
/** Fetch the UI schema for a single section, or all sections if omitted. */
|
|
289
|
-
getSettingsSchema(section?: SettingsSection): Promise<{
|
|
290
|
-
section: "auth" | "features" | "server" | "storage" | "logging" | "addons" | "recording" | "streaming" | "ffmpeg" | "detection" | "backup" | "retention";
|
|
291
|
-
schema: import("@camstack/types").ConfigUISchema | null;
|
|
292
|
-
readOnly: boolean;
|
|
293
|
-
tabs?: undefined;
|
|
294
|
-
schemas?: undefined;
|
|
295
|
-
} | {
|
|
296
|
-
tabs: readonly import("@camstack/types").SettingsTabDef[];
|
|
297
|
-
schemas: Record<string, unknown>;
|
|
298
|
-
section?: undefined;
|
|
299
|
-
schema?: undefined;
|
|
300
|
-
readOnly?: undefined;
|
|
301
|
-
}>;
|
|
302
|
-
getSettings(section: SettingsSection): Promise<{
|
|
303
|
-
section: "auth" | "features" | "server" | "storage" | "logging" | "addons" | "recording" | "streaming" | "ffmpeg" | "detection" | "backup" | "retention";
|
|
304
|
-
data: Record<string, unknown>;
|
|
305
|
-
}>;
|
|
306
|
-
updateSettings(section: SettingsSection, data: Record<string, unknown>): Promise<{
|
|
307
|
-
success: boolean;
|
|
308
|
-
section: "auth" | "features" | "server" | "storage" | "logging" | "addons" | "recording" | "streaming" | "ffmpeg" | "detection" | "backup" | "retention";
|
|
309
|
-
}>;
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Create a BackendClient instance with the given config.
|
|
313
|
-
* Convenience factory function.
|
|
314
|
-
*/
|
|
315
|
-
export declare function createBackendClient(config: BackendClientConfig): BackendClient;
|