@camstack/core 0.1.33 → 0.1.35
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/auth/api-key-manager.d.ts +2 -2
- package/dist/auth/api-key-manager.d.ts.map +1 -1
- package/dist/auth/auth-manager.d.ts +70 -3
- package/dist/auth/auth-manager.d.ts.map +1 -1
- package/dist/auth/totp-manager.d.ts +53 -0
- package/dist/auth/totp-manager.d.ts.map +1 -0
- package/dist/auth/user-manager.d.ts +3 -3
- package/dist/auth/user-manager.d.ts.map +1 -1
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.d.ts.map +1 -1
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.js +29 -9
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.js.map +1 -1
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.mjs +29 -9
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.mjs.map +1 -1
- package/dist/builtins/local-auth/auth-schema.d.ts +14 -0
- package/dist/builtins/local-auth/auth-schema.d.ts.map +1 -1
- package/dist/builtins/local-auth/local-auth.addon.d.ts +1 -0
- package/dist/builtins/local-auth/local-auth.addon.d.ts.map +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +1014 -22
- package/dist/builtins/local-auth/local-auth.addon.js.map +1 -1
- package/dist/builtins/local-auth/local-auth.addon.mjs +1025 -33
- package/dist/builtins/local-auth/local-auth.addon.mjs.map +1 -1
- package/dist/builtins/platform-probe/hardware-encoder-probe.d.ts +14 -0
- package/dist/builtins/platform-probe/hardware-encoder-probe.d.ts.map +1 -0
- package/dist/builtins/platform-probe/index.d.ts +2 -0
- package/dist/builtins/platform-probe/index.d.ts.map +1 -1
- package/dist/builtins/platform-probe/index.js +198 -5
- package/dist/builtins/platform-probe/index.js.map +1 -1
- package/dist/builtins/platform-probe/index.mjs +198 -6
- package/dist/builtins/platform-probe/index.mjs.map +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +8 -0
- package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts.map +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +27 -21
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js.map +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +27 -21
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +558 -94
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +558 -94
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -31,7 +31,7 @@ import { promisify } from "node:util";
|
|
|
31
31
|
import { errMsg, parseJsonObject } from "@camstack/types";
|
|
32
32
|
import * as vm from "node:vm";
|
|
33
33
|
import * as os from "node:os";
|
|
34
|
-
//#region ../types/dist/index-
|
|
34
|
+
//#region ../types/dist/index-BBVUwOlZ.mjs
|
|
35
35
|
var MODEL_FORMATS = [
|
|
36
36
|
"onnx",
|
|
37
37
|
"coreml",
|
|
@@ -892,7 +892,7 @@ var DecodedFrameSchema = z.object({
|
|
|
892
892
|
]),
|
|
893
893
|
timestamp: z.number()
|
|
894
894
|
});
|
|
895
|
-
var BrokerStatusSchema = z.enum([
|
|
895
|
+
var BrokerStatusSchema$1 = z.enum([
|
|
896
896
|
"idle",
|
|
897
897
|
"connecting",
|
|
898
898
|
"streaming",
|
|
@@ -900,7 +900,7 @@ var BrokerStatusSchema = z.enum([
|
|
|
900
900
|
"stopped"
|
|
901
901
|
]);
|
|
902
902
|
var BrokerStatsSchema = z.object({
|
|
903
|
-
status: BrokerStatusSchema,
|
|
903
|
+
status: BrokerStatusSchema$1,
|
|
904
904
|
inputFps: z.number(),
|
|
905
905
|
decodeFps: z.number(),
|
|
906
906
|
encodedSubscribers: z.number(),
|
|
@@ -1000,6 +1000,37 @@ z.enum([
|
|
|
1000
1000
|
"disabled",
|
|
1001
1001
|
"waking"
|
|
1002
1002
|
]);
|
|
1003
|
+
var VideoCodecTargetSchema = z.enum([
|
|
1004
|
+
"H264",
|
|
1005
|
+
"H265",
|
|
1006
|
+
"auto"
|
|
1007
|
+
]);
|
|
1008
|
+
var AudioCodecTargetSchema = z.enum([
|
|
1009
|
+
"AAC",
|
|
1010
|
+
"Opus",
|
|
1011
|
+
"PCMU",
|
|
1012
|
+
"none"
|
|
1013
|
+
]);
|
|
1014
|
+
var MaxResolutionSchema = z.object({
|
|
1015
|
+
width: z.number().int().positive(),
|
|
1016
|
+
height: z.number().int().positive()
|
|
1017
|
+
});
|
|
1018
|
+
var GetStreamWithCodecInputSchema = z.object({
|
|
1019
|
+
deviceId: z.number().int().nonnegative(),
|
|
1020
|
+
videoCodec: VideoCodecTargetSchema,
|
|
1021
|
+
audioCodec: AudioCodecTargetSchema.optional(),
|
|
1022
|
+
maxResolution: MaxResolutionSchema.optional(),
|
|
1023
|
+
tag: z.string().optional()
|
|
1024
|
+
});
|
|
1025
|
+
var RtpSourceSchema = z.object({
|
|
1026
|
+
url: z.string(),
|
|
1027
|
+
videoCodec: z.enum(["H264", "H265"]),
|
|
1028
|
+
audioCodec: z.string(),
|
|
1029
|
+
resolution: MaxResolutionSchema,
|
|
1030
|
+
transcoded: z.boolean(),
|
|
1031
|
+
encoder: z.string(),
|
|
1032
|
+
pipelineKey: z.string()
|
|
1033
|
+
});
|
|
1003
1034
|
method(z.object({
|
|
1004
1035
|
deviceId: z.number().int().nonnegative(),
|
|
1005
1036
|
camStreamId: z.string().min(1),
|
|
@@ -1009,28 +1040,8 @@ method(z.object({
|
|
|
1009
1040
|
resolution: CamStreamResolutionSchema.optional(),
|
|
1010
1041
|
fps: z.number().positive().optional(),
|
|
1011
1042
|
label: z.string().optional(),
|
|
1012
|
-
/**
|
|
1013
|
-
* Device-level features that the broker / manager / snapshot
|
|
1014
|
-
* orchestrator consult to derive per-stream policy (e.g.
|
|
1015
|
-
* `BatteryOperated` → relax stall watchdog, default pre-buffer
|
|
1016
|
-
* to off, raise snapshot rate-limit). Single source of truth —
|
|
1017
|
-
* publishers no longer set per-stream flags like `allowStall`.
|
|
1018
|
-
*/
|
|
1019
1043
|
deviceFeatures: z.array(z.string()).optional(),
|
|
1020
|
-
/**
|
|
1021
|
-
* Whether this stream participates in the broker's automatic
|
|
1022
|
-
* profile assignment. Defaults `true`. Publishers set `false` for
|
|
1023
|
-
* streams that should be SELECTABLE but not auto-picked — e.g.
|
|
1024
|
-
* Reolink publishes native Baichuan as eligible and RTSP/RTMP
|
|
1025
|
-
* mirrors as ineligible (still assignable manually via
|
|
1026
|
-
* `assignProfile`).
|
|
1027
|
-
*/
|
|
1028
1044
|
autoEligible: z.boolean().optional(),
|
|
1029
|
-
/**
|
|
1030
|
-
* Transport-specific opaque metadata stashed alongside the stream
|
|
1031
|
-
* record. `pull-rfc4571` publishers put the SDP here so the broker
|
|
1032
|
-
* reader can route packets without an in-band DESCRIBE phase.
|
|
1033
|
-
*/
|
|
1034
1045
|
metadata: z.record(z.string(), z.unknown()).optional()
|
|
1035
1046
|
}), z.object({ success: z.literal(true) }), {
|
|
1036
1047
|
kind: "mutation",
|
|
@@ -1074,7 +1085,16 @@ method(z.object({
|
|
|
1074
1085
|
}), method(z.object({
|
|
1075
1086
|
streamId: z.string(),
|
|
1076
1087
|
format: StreamFormatSchema
|
|
1077
|
-
}), z.object({ url: z.string() })), method(
|
|
1088
|
+
}), z.object({ url: z.string() })), method(GetStreamWithCodecInputSchema, RtpSourceSchema, {
|
|
1089
|
+
kind: "mutation",
|
|
1090
|
+
auth: "admin"
|
|
1091
|
+
}), method(z.object({ pipelineKey: z.string() }), z.object({
|
|
1092
|
+
released: z.boolean(),
|
|
1093
|
+
refcount: z.number().int().nonnegative()
|
|
1094
|
+
}), {
|
|
1095
|
+
kind: "mutation",
|
|
1096
|
+
auth: "admin"
|
|
1097
|
+
}), method(z.object({ brokerId: z.string() }), z.custom()), method(z.object({
|
|
1078
1098
|
brokerId: z.string(),
|
|
1079
1099
|
seconds: z.number().min(0).max(30)
|
|
1080
1100
|
}), z.void(), {
|
|
@@ -2372,7 +2392,8 @@ var CollectionColumnSchema = z.object({
|
|
|
2372
2392
|
"TEXT",
|
|
2373
2393
|
"INTEGER",
|
|
2374
2394
|
"REAL",
|
|
2375
|
-
"JSON"
|
|
2395
|
+
"JSON",
|
|
2396
|
+
"BOOLEAN"
|
|
2376
2397
|
]),
|
|
2377
2398
|
primaryKey: z.boolean().optional(),
|
|
2378
2399
|
notNull: z.boolean().optional(),
|
|
@@ -2444,7 +2465,206 @@ method(LogEntrySchema, z.void(), { kind: "mutation" }), method(z.object({
|
|
|
2444
2465
|
limit: z.number().optional(),
|
|
2445
2466
|
tags: z.record(z.string(), z.string()).optional()
|
|
2446
2467
|
}), z.array(LogEntrySchema).readonly());
|
|
2447
|
-
|
|
2468
|
+
var StaticDirOutputSchema = z.object({ staticDir: z.string() });
|
|
2469
|
+
var VersionOutputSchema = z.object({ version: z.string() });
|
|
2470
|
+
method(z.void(), StaticDirOutputSchema), method(z.void(), VersionOutputSchema);
|
|
2471
|
+
var SsoBridgeClaimsSchema = z.object({
|
|
2472
|
+
userId: z.string(),
|
|
2473
|
+
username: z.string(),
|
|
2474
|
+
isAdmin: z.boolean(),
|
|
2475
|
+
provider: z.string(),
|
|
2476
|
+
email: z.string().optional(),
|
|
2477
|
+
displayName: z.string().optional(),
|
|
2478
|
+
/**
|
|
2479
|
+
* Public HTTPS URL of the hub that issued this token. Used by
|
|
2480
|
+
* cloud-mode OAuth proxies (Alexa Smart Home Lambda, future Google
|
|
2481
|
+
* Home Lambda) to route a request back to the originating hub
|
|
2482
|
+
* without holding routing state of their own. The Lambda decodes the
|
|
2483
|
+
* JWT WITHOUT verifying the signature — the hub re-verifies on every
|
|
2484
|
+
* inbound call so trust still rests with the signing hub.
|
|
2485
|
+
*/
|
|
2486
|
+
hubUrl: z.string().optional()
|
|
2487
|
+
});
|
|
2488
|
+
method(z.object({
|
|
2489
|
+
claims: SsoBridgeClaimsSchema,
|
|
2490
|
+
ttlSec: z.number().int().positive().optional()
|
|
2491
|
+
}), z.object({ token: z.string() })), method(z.object({ token: z.string() }), SsoBridgeClaimsSchema.nullable());
|
|
2492
|
+
var PasskeySummarySchema = z.object({
|
|
2493
|
+
credentialId: z.string(),
|
|
2494
|
+
label: z.string(),
|
|
2495
|
+
createdAt: z.number(),
|
|
2496
|
+
lastUsedAt: z.number().nullable(),
|
|
2497
|
+
transports: z.array(z.string()).default([])
|
|
2498
|
+
});
|
|
2499
|
+
method(z.object({
|
|
2500
|
+
userId: z.string(),
|
|
2501
|
+
username: z.string()
|
|
2502
|
+
}), z.object({ optionsJSON: z.record(z.string(), z.unknown()) }), {
|
|
2503
|
+
kind: "mutation",
|
|
2504
|
+
auth: "admin",
|
|
2505
|
+
access: "create"
|
|
2506
|
+
}), method(z.object({
|
|
2507
|
+
userId: z.string(),
|
|
2508
|
+
/** RegistrationResponseJSON from the browser. */
|
|
2509
|
+
response: z.record(z.string(), z.unknown()),
|
|
2510
|
+
/** Operator-visible label (e.g. "MacBook Touch ID"). */
|
|
2511
|
+
label: z.string()
|
|
2512
|
+
}), z.object({
|
|
2513
|
+
success: z.literal(true),
|
|
2514
|
+
credentialId: z.string()
|
|
2515
|
+
}), {
|
|
2516
|
+
kind: "mutation",
|
|
2517
|
+
auth: "admin",
|
|
2518
|
+
access: "create"
|
|
2519
|
+
}), method(z.object({ userId: z.string().optional() }), z.object({ optionsJSON: z.record(z.string(), z.unknown()) }), {
|
|
2520
|
+
kind: "mutation",
|
|
2521
|
+
access: "view"
|
|
2522
|
+
}), method(z.object({
|
|
2523
|
+
/** Required — the user the assertion belongs to (verified). */
|
|
2524
|
+
userId: z.string(),
|
|
2525
|
+
/** AuthenticationResponseJSON from the browser. */
|
|
2526
|
+
response: z.record(z.string(), z.unknown())
|
|
2527
|
+
}), z.object({ verified: z.boolean() }), {
|
|
2528
|
+
kind: "mutation",
|
|
2529
|
+
access: "view"
|
|
2530
|
+
}), method(z.object({ userId: z.string() }), z.array(PasskeySummarySchema), { auth: "admin" }), method(z.object({
|
|
2531
|
+
userId: z.string(),
|
|
2532
|
+
credentialId: z.string()
|
|
2533
|
+
}), z.object({ success: z.literal(true) }), {
|
|
2534
|
+
kind: "mutation",
|
|
2535
|
+
auth: "admin",
|
|
2536
|
+
access: "delete"
|
|
2537
|
+
});
|
|
2538
|
+
var EmailAddressSchema = z.email();
|
|
2539
|
+
var SendEmailInputSchema = z.object({
|
|
2540
|
+
to: z.union([EmailAddressSchema, z.array(EmailAddressSchema).min(1)]),
|
|
2541
|
+
cc: z.array(EmailAddressSchema).optional(),
|
|
2542
|
+
bcc: z.array(EmailAddressSchema).optional(),
|
|
2543
|
+
/** RFC 5322 `From` field. Most relays will reject if the domain
|
|
2544
|
+
* isn't authorised — the addon is responsible for substituting a
|
|
2545
|
+
* sane default when omitted. */
|
|
2546
|
+
from: z.string().optional(),
|
|
2547
|
+
/** Optional `Reply-To` override. */
|
|
2548
|
+
replyTo: z.string().optional(),
|
|
2549
|
+
subject: z.string(),
|
|
2550
|
+
/** Plain-text body. Required even when `html` is present (fallback
|
|
2551
|
+
* for clients that strip HTML — including most spam filters). */
|
|
2552
|
+
text: z.string(),
|
|
2553
|
+
/** Optional HTML body. Renders alongside `text` as multi-part. */
|
|
2554
|
+
html: z.string().optional()
|
|
2555
|
+
});
|
|
2556
|
+
var SendEmailResultSchema = z.object({
|
|
2557
|
+
messageId: z.string(),
|
|
2558
|
+
accepted: z.array(EmailAddressSchema).default([]),
|
|
2559
|
+
rejected: z.array(EmailAddressSchema).default([])
|
|
2560
|
+
});
|
|
2561
|
+
var SmtpStatusSchema = z.object({
|
|
2562
|
+
/** True iff the addon has successfully verified the relay. */
|
|
2563
|
+
ready: z.boolean(),
|
|
2564
|
+
/** Operator-visible host string (no credentials). */
|
|
2565
|
+
host: z.string(),
|
|
2566
|
+
/** Last error message reported by the relay, when not ready. */
|
|
2567
|
+
error: z.string().optional(),
|
|
2568
|
+
/** Last successful verify timestamp (unix ms). */
|
|
2569
|
+
lastVerifiedAt: z.number().optional()
|
|
2570
|
+
});
|
|
2571
|
+
method(SendEmailInputSchema, SendEmailResultSchema, {
|
|
2572
|
+
kind: "mutation",
|
|
2573
|
+
auth: "admin",
|
|
2574
|
+
access: "create"
|
|
2575
|
+
}), method(z.void(), SmtpStatusSchema, {
|
|
2576
|
+
kind: "mutation",
|
|
2577
|
+
auth: "admin",
|
|
2578
|
+
access: "view"
|
|
2579
|
+
}), method(z.void(), SmtpStatusSchema, { auth: "admin" });
|
|
2580
|
+
var BrokerKindSchema = z.enum(["external", "embedded"]);
|
|
2581
|
+
var BrokerStatusSchema = z.enum([
|
|
2582
|
+
"connected",
|
|
2583
|
+
"disconnected",
|
|
2584
|
+
"auth-failed",
|
|
2585
|
+
"unreachable",
|
|
2586
|
+
"tls-error"
|
|
2587
|
+
]);
|
|
2588
|
+
var BrokerInfoSchema = z.object({
|
|
2589
|
+
id: z.string(),
|
|
2590
|
+
name: z.string(),
|
|
2591
|
+
url: z.string(),
|
|
2592
|
+
kind: BrokerKindSchema,
|
|
2593
|
+
status: BrokerStatusSchema,
|
|
2594
|
+
latencyMs: z.number().nullable(),
|
|
2595
|
+
error: z.string().optional(),
|
|
2596
|
+
/** Embedded brokers only: number of MQTT clients currently connected. */
|
|
2597
|
+
connectedClients: z.number().int().nonnegative().optional(),
|
|
2598
|
+
/** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
|
|
2599
|
+
lastCheckedAt: z.number().optional()
|
|
2600
|
+
});
|
|
2601
|
+
var BrokerConnectionDetailsSchema = z.object({
|
|
2602
|
+
url: z.string(),
|
|
2603
|
+
username: z.string().optional(),
|
|
2604
|
+
password: z.string().optional(),
|
|
2605
|
+
/**
|
|
2606
|
+
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
2607
|
+
* with its own discriminator (addon id, instance id) so reconnects
|
|
2608
|
+
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
2609
|
+
* broker).
|
|
2610
|
+
*/
|
|
2611
|
+
clientIdPrefix: z.string().optional()
|
|
2612
|
+
});
|
|
2613
|
+
var AddBrokerInputSchema = z.object({
|
|
2614
|
+
name: z.string().min(1),
|
|
2615
|
+
url: z.string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
|
|
2616
|
+
username: z.string().optional(),
|
|
2617
|
+
password: z.string().optional(),
|
|
2618
|
+
clientIdPrefix: z.string().optional()
|
|
2619
|
+
});
|
|
2620
|
+
var AddBrokerResultSchema = z.object({ id: z.string() });
|
|
2621
|
+
var IdInputSchema = z.object({ id: z.string() });
|
|
2622
|
+
var TestResultSchema = z.discriminatedUnion("ok", [z.object({
|
|
2623
|
+
ok: z.literal(true),
|
|
2624
|
+
latencyMs: z.number()
|
|
2625
|
+
}), z.object({
|
|
2626
|
+
ok: z.literal(false),
|
|
2627
|
+
error: z.string()
|
|
2628
|
+
})]);
|
|
2629
|
+
var StartEmbeddedInputSchema = z.object({
|
|
2630
|
+
port: z.number().int().min(1).max(65535).default(1883),
|
|
2631
|
+
/** Allow anonymous connect (no username/password). Default: false. */
|
|
2632
|
+
allowAnonymous: z.boolean().default(false),
|
|
2633
|
+
/** Optional shared username/password for clients. */
|
|
2634
|
+
username: z.string().optional(),
|
|
2635
|
+
password: z.string().optional()
|
|
2636
|
+
});
|
|
2637
|
+
var StartEmbeddedResultSchema = z.object({
|
|
2638
|
+
id: z.string(),
|
|
2639
|
+
url: z.string()
|
|
2640
|
+
});
|
|
2641
|
+
var StatusSchema = z.object({
|
|
2642
|
+
brokerCount: z.number(),
|
|
2643
|
+
embeddedRunning: z.boolean()
|
|
2644
|
+
});
|
|
2645
|
+
method(z.void(), z.array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema), method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }), method(IdInputSchema, z.void(), { kind: "mutation" }), method(IdInputSchema, TestResultSchema, { kind: "mutation" }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }), method(IdInputSchema, z.void(), { kind: "mutation" }), method(z.void(), StatusSchema);
|
|
2646
|
+
var LinkStateSchema = z.enum([
|
|
2647
|
+
"unlinked",
|
|
2648
|
+
"linked",
|
|
2649
|
+
"error"
|
|
2650
|
+
]);
|
|
2651
|
+
var DeviceExportStatusSchema = z.object({
|
|
2652
|
+
linkState: LinkStateSchema,
|
|
2653
|
+
exposedDeviceCount: z.number(),
|
|
2654
|
+
error: z.string().optional()
|
|
2655
|
+
});
|
|
2656
|
+
var DeviceKindSchema = z.string();
|
|
2657
|
+
var ExposedDeviceSchema = z.object({
|
|
2658
|
+
deviceId: z.string(),
|
|
2659
|
+
exposedAs: z.string().optional(),
|
|
2660
|
+
capabilities: z.array(z.string()).optional()
|
|
2661
|
+
});
|
|
2662
|
+
var ExposeInputSchema = z.object({
|
|
2663
|
+
deviceId: z.string(),
|
|
2664
|
+
capabilities: z.array(z.string()).optional()
|
|
2665
|
+
});
|
|
2666
|
+
var UnexposeInputSchema = z.object({ deviceId: z.string() });
|
|
2667
|
+
method(z.void(), DeviceExportStatusSchema), method(z.void(), z.array(DeviceKindSchema)), method(z.void(), z.array(ExposedDeviceSchema)), method(ExposeInputSchema, z.void(), { kind: "mutation" }), method(UnexposeInputSchema, z.void(), { kind: "mutation" });
|
|
2448
2668
|
var AddonPageDeclarationSchema$1 = z.object({
|
|
2449
2669
|
id: z.string(),
|
|
2450
2670
|
label: z.string(),
|
|
@@ -2548,9 +2768,41 @@ var AddonHttpRouteSchema = z.object({
|
|
|
2548
2768
|
"DELETE",
|
|
2549
2769
|
"PATCH"
|
|
2550
2770
|
]),
|
|
2551
|
-
path: z.string()
|
|
2771
|
+
path: z.string(),
|
|
2772
|
+
access: z.enum([
|
|
2773
|
+
"public",
|
|
2774
|
+
"authenticated",
|
|
2775
|
+
"admin"
|
|
2776
|
+
]).optional(),
|
|
2777
|
+
description: z.string().optional()
|
|
2552
2778
|
});
|
|
2553
|
-
|
|
2779
|
+
var InvokeRequestSchema = z.object({
|
|
2780
|
+
method: z.string(),
|
|
2781
|
+
path: z.string(),
|
|
2782
|
+
params: z.record(z.string(), z.string()),
|
|
2783
|
+
query: z.record(z.string(), z.string()),
|
|
2784
|
+
body: z.unknown(),
|
|
2785
|
+
headers: z.record(z.string(), z.string()),
|
|
2786
|
+
user: z.object({
|
|
2787
|
+
id: z.string(),
|
|
2788
|
+
username: z.string(),
|
|
2789
|
+
isAdmin: z.boolean()
|
|
2790
|
+
}).optional(),
|
|
2791
|
+
scopedToken: z.unknown().optional()
|
|
2792
|
+
});
|
|
2793
|
+
var InvokeReplyEnvelopeSchema = z.object({
|
|
2794
|
+
status: z.number().int(),
|
|
2795
|
+
headers: z.record(z.string(), z.string()),
|
|
2796
|
+
/** When set, the hub MUST `reply.redirect(redirectUrl)` instead of
|
|
2797
|
+
* sending `body`. Status defaults to 302 when this is set unless
|
|
2798
|
+
* the handler called `reply.code(...)` explicitly. */
|
|
2799
|
+
redirectUrl: z.string().nullable(),
|
|
2800
|
+
/** JSON-serializable body. `undefined` is treated as "no body". */
|
|
2801
|
+
body: z.unknown().optional(),
|
|
2802
|
+
/** Set when the handler called `reply.type(mime)`. */
|
|
2803
|
+
contentType: z.string().optional()
|
|
2804
|
+
});
|
|
2805
|
+
method(z.void(), z.array(AddonHttpRouteSchema)), method(InvokeRequestSchema, InvokeReplyEnvelopeSchema, { kind: "mutation" });
|
|
2554
2806
|
method(z.object({ codec: z.string() }), z.boolean()), method(z.void(), z.object({
|
|
2555
2807
|
id: z.string(),
|
|
2556
2808
|
name: z.string(),
|
|
@@ -2668,6 +2920,14 @@ DeviceType$1.Camera, method(z.object({ deviceId: z.number().int().nonnegative()
|
|
|
2668
2920
|
}), z.object({
|
|
2669
2921
|
sessionId: z.string(),
|
|
2670
2922
|
sdpOffer: z.string()
|
|
2923
|
+
}), { kind: "mutation" }), method(z.object({
|
|
2924
|
+
deviceId: z.number().int().nonnegative(),
|
|
2925
|
+
target: WebrtcStreamTargetSchema.optional(),
|
|
2926
|
+
sdpOffer: z.string(),
|
|
2927
|
+
sessionId: z.string().optional()
|
|
2928
|
+
}), z.object({
|
|
2929
|
+
sessionId: z.string(),
|
|
2930
|
+
sdpAnswer: z.string()
|
|
2671
2931
|
}), { kind: "mutation" }), method(z.object({
|
|
2672
2932
|
deviceId: z.number().int().nonnegative(),
|
|
2673
2933
|
sessionId: z.string(),
|
|
@@ -3006,12 +3266,12 @@ method(z.void(), z.array(AudioCodecInfoSchema).readonly()), method(z.object({
|
|
|
3006
3266
|
}), z.array(AudioEncodedChunkSchema), { kind: "mutation" }), method(z.void(), z.array(SessionInventoryEntrySchema).readonly());
|
|
3007
3267
|
var EmbeddingResultSchema = z.object({
|
|
3008
3268
|
embedding: z.array(z.number()),
|
|
3009
|
-
|
|
3269
|
+
inferenceMs: z.number()
|
|
3010
3270
|
});
|
|
3011
3271
|
var EmbeddingInfoSchema = z.object({
|
|
3012
3272
|
modelId: z.string(),
|
|
3013
|
-
|
|
3014
|
-
|
|
3273
|
+
embeddingDim: z.number(),
|
|
3274
|
+
ready: z.boolean()
|
|
3015
3275
|
});
|
|
3016
3276
|
method(z.object({
|
|
3017
3277
|
crop: z.instanceof(Uint8Array),
|
|
@@ -3292,7 +3552,14 @@ var AuthResultSchema = z.object({
|
|
|
3292
3552
|
username: z.string(),
|
|
3293
3553
|
email: z.string().optional(),
|
|
3294
3554
|
displayName: z.string().optional(),
|
|
3295
|
-
|
|
3555
|
+
/**
|
|
3556
|
+
* Whether the authenticating user is an admin. The auth-provider
|
|
3557
|
+
* surface returns this so the server's login flow can mint a JWT
|
|
3558
|
+
* with the correct bypass flag. Non-admin users authenticated via
|
|
3559
|
+
* an external IdP still need their scopes assigned by an admin via
|
|
3560
|
+
* `setUserScopes` — the SSO flow doesn't carry permissions.
|
|
3561
|
+
*/
|
|
3562
|
+
isAdmin: z.boolean().default(false)
|
|
3296
3563
|
});
|
|
3297
3564
|
method(z.object({
|
|
3298
3565
|
username: z.string(),
|
|
@@ -3301,6 +3568,14 @@ method(z.object({
|
|
|
3301
3568
|
var AuthProviderInfoSchema = z.object({
|
|
3302
3569
|
/** Stable id matching the addon id (used for `getLoginUrl({addonId,…})`). */
|
|
3303
3570
|
addonId: z.string(),
|
|
3571
|
+
/**
|
|
3572
|
+
* Per-instance id when one addon registers multiple "logical"
|
|
3573
|
+
* providers (e.g. OIDC with Google + Microsoft + custom). The login
|
|
3574
|
+
* URL becomes `/addon/${addonId}/${instanceId}/start` — handler reads
|
|
3575
|
+
* `:instanceId` from the route. Empty/unset means the addon is a
|
|
3576
|
+
* single-instance provider; the URL is `/addon/${addonId}/start`.
|
|
3577
|
+
*/
|
|
3578
|
+
instanceId: z.string().optional(),
|
|
3304
3579
|
/** Display label shown on the login button + admin row. */
|
|
3305
3580
|
displayName: z.string(),
|
|
3306
3581
|
/** Optional iconography hint (lucide-react icon name OR emoji). */
|
|
@@ -3311,6 +3586,8 @@ var AuthProviderInfoSchema = z.object({
|
|
|
3311
3586
|
/** When true, the provider exposes a credential-form login flow
|
|
3312
3587
|
* (`validateCredentials` accepts username + password). */
|
|
3313
3588
|
hasCredentialFlow: z.boolean(),
|
|
3589
|
+
/** Provider kind, drives admin-UI hint dispatch (oidc / saml / totp / …). */
|
|
3590
|
+
kind: z.string().optional(),
|
|
3314
3591
|
/** Operator-facing status string (e.g. "Connected to https://login.acme.com"). */
|
|
3315
3592
|
status: z.string().optional(),
|
|
3316
3593
|
/** When false, the provider is registered but disabled by config; the
|
|
@@ -3335,7 +3612,20 @@ var NetworkAccessStatusSchema = z.object({
|
|
|
3335
3612
|
endpoint: NetworkEndpointSchema.nullable(),
|
|
3336
3613
|
error: z.string().optional()
|
|
3337
3614
|
});
|
|
3338
|
-
|
|
3615
|
+
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
3616
|
+
/**
|
|
3617
|
+
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
3618
|
+
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
3619
|
+
*/
|
|
3620
|
+
id: z.string(),
|
|
3621
|
+
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
3622
|
+
label: z.string(),
|
|
3623
|
+
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
3624
|
+
mode: z.string().optional(),
|
|
3625
|
+
/** Originating local port the ingress fronts (informational). */
|
|
3626
|
+
sourcePort: z.number().optional()
|
|
3627
|
+
});
|
|
3628
|
+
method(z.void(), NetworkEndpointSchema, { kind: "mutation" }), method(z.void(), z.void(), { kind: "mutation" }), method(z.void(), NetworkEndpointSchema.nullable()), method(z.void(), NetworkAccessStatusSchema), method(z.void(), z.array(NetworkEndpointEntrySchema).readonly());
|
|
3339
3629
|
var RemoteAccessEndpointSchema = z.object({
|
|
3340
3630
|
url: z.string(),
|
|
3341
3631
|
hostname: z.string(),
|
|
@@ -3448,28 +3738,78 @@ method(z.object({
|
|
|
3448
3738
|
success: z.boolean(),
|
|
3449
3739
|
error: z.string().optional()
|
|
3450
3740
|
}), { kind: "mutation" });
|
|
3741
|
+
var NotificationRuleConditionsSchema = z.object({
|
|
3742
|
+
deviceIds: z.array(z.number()).readonly().optional(),
|
|
3743
|
+
classNames: z.array(z.string()).readonly().optional(),
|
|
3744
|
+
zoneIds: z.array(z.string()).readonly().optional(),
|
|
3745
|
+
minConfidence: z.number().optional(),
|
|
3746
|
+
source: z.enum([
|
|
3747
|
+
"pipeline",
|
|
3748
|
+
"onboard",
|
|
3749
|
+
"any"
|
|
3750
|
+
]).optional(),
|
|
3751
|
+
schedule: z.object({
|
|
3752
|
+
days: z.array(z.number()).readonly(),
|
|
3753
|
+
startHour: z.number(),
|
|
3754
|
+
endHour: z.number()
|
|
3755
|
+
}).optional(),
|
|
3756
|
+
cooldownSeconds: z.number().optional(),
|
|
3757
|
+
minDwellSeconds: z.number().optional()
|
|
3758
|
+
});
|
|
3759
|
+
var NotificationRuleTemplateSchema = z.object({
|
|
3760
|
+
title: z.string(),
|
|
3761
|
+
body: z.string(),
|
|
3762
|
+
imageMode: z.enum([
|
|
3763
|
+
"crop",
|
|
3764
|
+
"annotated",
|
|
3765
|
+
"full",
|
|
3766
|
+
"none"
|
|
3767
|
+
])
|
|
3768
|
+
});
|
|
3451
3769
|
var NotificationRuleSchema = z.object({
|
|
3452
3770
|
id: z.string(),
|
|
3453
3771
|
name: z.string(),
|
|
3454
3772
|
enabled: z.boolean(),
|
|
3455
|
-
|
|
3456
|
-
|
|
3773
|
+
eventTypes: z.array(z.string()).readonly(),
|
|
3774
|
+
conditions: NotificationRuleConditionsSchema,
|
|
3775
|
+
outputs: z.array(z.string()).readonly(),
|
|
3776
|
+
template: NotificationRuleTemplateSchema.optional(),
|
|
3777
|
+
priority: z.enum([
|
|
3778
|
+
"low",
|
|
3779
|
+
"normal",
|
|
3780
|
+
"high",
|
|
3781
|
+
"critical"
|
|
3782
|
+
])
|
|
3783
|
+
});
|
|
3784
|
+
var NotificationTestResultSchema = z.object({
|
|
3785
|
+
ruleId: z.string(),
|
|
3786
|
+
eventId: z.string(),
|
|
3787
|
+
timestamp: z.number(),
|
|
3788
|
+
wouldFire: z.boolean(),
|
|
3789
|
+
reason: z.string().optional()
|
|
3457
3790
|
});
|
|
3458
3791
|
var NotificationHistoryEntrySchema = z.object({
|
|
3459
3792
|
id: z.string(),
|
|
3460
3793
|
ruleId: z.string(),
|
|
3794
|
+
ruleName: z.string(),
|
|
3795
|
+
eventId: z.string(),
|
|
3461
3796
|
timestamp: z.number(),
|
|
3462
|
-
|
|
3797
|
+
outputs: z.array(z.string()).readonly(),
|
|
3463
3798
|
success: z.boolean(),
|
|
3464
|
-
error: z.string().optional()
|
|
3799
|
+
error: z.string().optional(),
|
|
3800
|
+
deviceId: z.number().optional()
|
|
3465
3801
|
});
|
|
3466
|
-
|
|
3467
|
-
ruleId: z.string(),
|
|
3468
|
-
lookbackMinutes: z.number()
|
|
3469
|
-
}), z.array(z.record(z.string(), z.unknown())), { kind: "mutation" }), method(z.object({
|
|
3802
|
+
var NotificationHistoryFilterSchema = z.object({
|
|
3470
3803
|
ruleId: z.string().optional(),
|
|
3804
|
+
deviceId: z.number().optional(),
|
|
3805
|
+
from: z.number().optional(),
|
|
3806
|
+
to: z.number().optional(),
|
|
3471
3807
|
limit: z.number().optional()
|
|
3472
|
-
})
|
|
3808
|
+
});
|
|
3809
|
+
method(z.void(), z.object({ rules: z.array(NotificationRuleSchema).readonly() })), method(z.object({ rule: NotificationRuleSchema }), z.object({ success: z.literal(true) }), { kind: "mutation" }), method(z.object({ ruleId: z.string() }), z.object({ success: z.literal(true) }), { kind: "mutation" }), method(z.object({
|
|
3810
|
+
ruleId: z.string(),
|
|
3811
|
+
lookbackMinutes: z.number()
|
|
3812
|
+
}), z.object({ results: z.array(NotificationTestResultSchema).readonly() }), { kind: "mutation" }), method(z.object({ filter: NotificationHistoryFilterSchema.optional() }), z.object({ entries: z.array(NotificationHistoryEntrySchema).readonly() }));
|
|
3473
3813
|
var RecordingModeSchema = z.enum([
|
|
3474
3814
|
"continuous",
|
|
3475
3815
|
"motion",
|
|
@@ -4157,6 +4497,22 @@ DeviceType$1.Camera, method(z.object({ deviceId: z.number() }), z.object({
|
|
|
4157
4497
|
}), z.void(), {
|
|
4158
4498
|
kind: "mutation",
|
|
4159
4499
|
auth: "admin"
|
|
4500
|
+
}), method(z.object({ deviceId: z.number() }), z.object({ sessionId: z.string() }), {
|
|
4501
|
+
kind: "mutation",
|
|
4502
|
+
auth: "admin"
|
|
4503
|
+
}), method(z.object({
|
|
4504
|
+
deviceId: z.number(),
|
|
4505
|
+
/** PCM frames as little-endian s16, mono. Base64-encoded so
|
|
4506
|
+
* the payload survives tRPC JSON serialization. */
|
|
4507
|
+
pcmBase64: z.string(),
|
|
4508
|
+
/** Sequence number for ordering / dropping out-of-order frames. */
|
|
4509
|
+
sequenceNumber: z.number().int()
|
|
4510
|
+
}), z.object({ accepted: z.boolean() }), {
|
|
4511
|
+
kind: "mutation",
|
|
4512
|
+
auth: "admin"
|
|
4513
|
+
}), method(z.object({ deviceId: z.number() }), z.void(), {
|
|
4514
|
+
kind: "mutation",
|
|
4515
|
+
auth: "admin"
|
|
4160
4516
|
}), z.object({
|
|
4161
4517
|
deviceId: z.number(),
|
|
4162
4518
|
status: IntercomStatusSchema
|
|
@@ -4208,6 +4564,40 @@ var HwAccelBackendInputSchema = z.enum([
|
|
|
4208
4564
|
"none"
|
|
4209
4565
|
]).nullable().optional();
|
|
4210
4566
|
var HwAccelResolutionSchema = z.object({ preferred: z.array(z.string()).readonly() });
|
|
4567
|
+
var HardwareEncoderIdSchema = z.enum([
|
|
4568
|
+
"h264_videotoolbox",
|
|
4569
|
+
"hevc_videotoolbox",
|
|
4570
|
+
"h264_vaapi",
|
|
4571
|
+
"hevc_vaapi",
|
|
4572
|
+
"h264_nvenc",
|
|
4573
|
+
"hevc_nvenc",
|
|
4574
|
+
"h264_qsv",
|
|
4575
|
+
"hevc_qsv",
|
|
4576
|
+
"h264_amf",
|
|
4577
|
+
"hevc_amf",
|
|
4578
|
+
"libx264",
|
|
4579
|
+
"libx265"
|
|
4580
|
+
]);
|
|
4581
|
+
var HardwareEncoderProbeSchema = z.object({
|
|
4582
|
+
encoder: HardwareEncoderIdSchema,
|
|
4583
|
+
codec: z.enum(["H264", "H265"]),
|
|
4584
|
+
family: z.enum([
|
|
4585
|
+
"videotoolbox",
|
|
4586
|
+
"vaapi",
|
|
4587
|
+
"nvenc",
|
|
4588
|
+
"qsv",
|
|
4589
|
+
"amf",
|
|
4590
|
+
"software"
|
|
4591
|
+
]),
|
|
4592
|
+
available: z.boolean(),
|
|
4593
|
+
reason: z.string().optional()
|
|
4594
|
+
});
|
|
4595
|
+
var HardwareEncodersSchema = z.object({
|
|
4596
|
+
encoders: z.array(HardwareEncoderProbeSchema).readonly(),
|
|
4597
|
+
defaultH264: HardwareEncoderIdSchema,
|
|
4598
|
+
defaultH265: HardwareEncoderIdSchema,
|
|
4599
|
+
probedAt: z.number()
|
|
4600
|
+
});
|
|
4211
4601
|
var HardwarePlatformSchema = z.enum([
|
|
4212
4602
|
"darwin",
|
|
4213
4603
|
"linux",
|
|
@@ -4270,7 +4660,10 @@ var ResolvedInferenceConfigSchema = z.object({
|
|
|
4270
4660
|
method(z.void(), PlatformCapabilitiesSchema), method(z.void(), HardwareInfoSchema), method(z.object({ requirements: z.array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(z.object({
|
|
4271
4661
|
prefer: HwAccelBackendInputSchema,
|
|
4272
4662
|
nodeId: z.string().optional()
|
|
4273
|
-
}), HwAccelResolutionSchema)
|
|
4663
|
+
}), HwAccelResolutionSchema), method(z.void(), HardwareEncodersSchema), method(z.void(), HardwareEncodersSchema, {
|
|
4664
|
+
kind: "mutation",
|
|
4665
|
+
auth: "admin"
|
|
4666
|
+
});
|
|
4274
4667
|
var InterfaceKindEnum = z.enum([
|
|
4275
4668
|
"lan",
|
|
4276
4669
|
"wifi",
|
|
@@ -4440,28 +4833,30 @@ var MeshStatusSchema = z.object({
|
|
|
4440
4833
|
/** Last error from the daemon, when not joined. */
|
|
4441
4834
|
error: z.string().optional()
|
|
4442
4835
|
});
|
|
4443
|
-
var PublicIngressConfigSchema = z.object({
|
|
4444
|
-
/** Whether the provider should expose CamStack via its public
|
|
4445
|
-
* ingress (Tailscale Funnel, etc.). */
|
|
4446
|
-
enabled: z.boolean(),
|
|
4447
|
-
/** Local port to forward. Auto-detected from the hub HTTP port
|
|
4448
|
-
* when omitted. */
|
|
4449
|
-
port: z.number().int().min(1).max(65535).optional()
|
|
4450
|
-
});
|
|
4451
|
-
var MeshIngressConfigSchema = z.object({
|
|
4452
|
-
/** Whether the provider should expose CamStack inside the mesh
|
|
4453
|
-
* via HTTPS (Tailscale Serve, etc.) instead of just raw IP. */
|
|
4454
|
-
enabled: z.boolean(),
|
|
4455
|
-
/** Local port to forward. Auto-detected when omitted. */
|
|
4456
|
-
port: z.number().int().min(1).max(65535).optional()
|
|
4457
|
-
});
|
|
4458
4836
|
method(z.void(), MeshStatusSchema), method(z.object({
|
|
4459
4837
|
/** Provider-specific auth key. For Tailscale this is the
|
|
4460
4838
|
* `tskey-auth-*` token from admin.tailscale.com. */
|
|
4461
4839
|
authKey: z.string().min(8),
|
|
4462
4840
|
/** Optional hostname override the host should advertise. */
|
|
4463
4841
|
hostname: z.string().optional()
|
|
4464
|
-
}), z.object({ joined: z.literal(true) }), { kind: "mutation" }), method(z.
|
|
4842
|
+
}), z.object({ joined: z.literal(true) }), { kind: "mutation" }), method(z.object({
|
|
4843
|
+
/** Optional hostname override the host should advertise once joined. */
|
|
4844
|
+
hostname: z.string().optional() }), z.object({
|
|
4845
|
+
/** Authentication URL the operator should open in a browser. */
|
|
4846
|
+
loginUrl: z.string() }), { kind: "mutation" }), method(z.void(), z.object({ left: z.literal(true) }), { kind: "mutation" }), method(z.void(), z.object({ peers: z.array(MeshPeerSchema).readonly() })), method(z.object({
|
|
4847
|
+
/** Optional auth key — when provided, probes the key validity
|
|
4848
|
+
* against the provider's API. Omit when already joined to
|
|
4849
|
+
* just ping the daemon. */
|
|
4850
|
+
authKey: z.string().optional() }), z.object({
|
|
4851
|
+
ok: z.boolean(),
|
|
4852
|
+
/** Provider-side identifier resolved by the probe (tailnet
|
|
4853
|
+
* name for Tailscale, network id for ZeroTier, etc.). */
|
|
4854
|
+
tenant: z.string().optional(),
|
|
4855
|
+
/** Daemon binary version, when reachable. */
|
|
4856
|
+
daemonVersion: z.string().optional(),
|
|
4857
|
+
/** Human-readable error when `ok: false`. */
|
|
4858
|
+
error: z.string().optional()
|
|
4859
|
+
}), { kind: "mutation" });
|
|
4465
4860
|
var MeshEndpointSchema = z.object({
|
|
4466
4861
|
id: z.string(),
|
|
4467
4862
|
label: z.string(),
|
|
@@ -4494,35 +4889,58 @@ method(z.void(), z.array(MeshProviderInfoSchema).readonly()), method(z.object({
|
|
|
4494
4889
|
authKey: z.string().min(8),
|
|
4495
4890
|
hostname: z.string().optional()
|
|
4496
4891
|
}), z.object({ joined: z.literal(true) }), { kind: "mutation" }), method(z.object({ addonId: z.string() }), z.object({ success: z.literal(true) }), { kind: "mutation" });
|
|
4497
|
-
var UserRoleSchema = z.enum([
|
|
4498
|
-
"admin",
|
|
4499
|
-
"viewer",
|
|
4500
|
-
"agent",
|
|
4501
|
-
"scoped"
|
|
4502
|
-
]);
|
|
4503
|
-
var AllowedProviderSchema = z.union([z.literal("*"), z.array(z.string())]);
|
|
4504
|
-
var AllowedDevicesSchema = z.record(z.string(), z.union([z.literal("*"), z.array(z.string())]));
|
|
4505
4892
|
var MethodAccessSchema = z.enum([
|
|
4506
4893
|
"view",
|
|
4507
4894
|
"create",
|
|
4508
4895
|
"delete"
|
|
4509
4896
|
]);
|
|
4510
|
-
var
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4897
|
+
var AllowedProviderSchema = z.union([z.literal("*"), z.array(z.string())]);
|
|
4898
|
+
var AllowedDevicesSchema = z.record(z.string(), z.union([z.literal("*"), z.array(z.string())]));
|
|
4899
|
+
var CapScopeSchema = z.enum(["device", "system"]);
|
|
4900
|
+
var TokenScopeSchema = z.discriminatedUnion("type", [
|
|
4901
|
+
z.object({
|
|
4902
|
+
type: z.literal("category"),
|
|
4903
|
+
target: CapScopeSchema,
|
|
4904
|
+
access: z.array(MethodAccessSchema).min(1)
|
|
4905
|
+
}),
|
|
4906
|
+
z.object({
|
|
4907
|
+
type: z.literal("capability"),
|
|
4908
|
+
target: z.string(),
|
|
4909
|
+
access: z.array(MethodAccessSchema).min(1)
|
|
4910
|
+
}),
|
|
4911
|
+
z.object({
|
|
4912
|
+
type: z.literal("addon"),
|
|
4913
|
+
target: z.string(),
|
|
4914
|
+
access: z.array(MethodAccessSchema).min(1)
|
|
4915
|
+
}),
|
|
4916
|
+
z.object({
|
|
4917
|
+
type: z.literal("device"),
|
|
4918
|
+
/**
|
|
4919
|
+
* One or more deviceIds (serialised as strings for wire-format
|
|
4920
|
+
* consistency with the rest of the union). Matcher accepts if
|
|
4921
|
+
* `input.deviceId` ∈ `targets`. Array shape avoids the row-explosion
|
|
4922
|
+
* of one scope-per-device when granting access to a set of cameras.
|
|
4923
|
+
*/
|
|
4924
|
+
targets: z.array(z.string()).min(1),
|
|
4925
|
+
access: z.array(MethodAccessSchema).min(1)
|
|
4926
|
+
})
|
|
4927
|
+
]);
|
|
4515
4928
|
z.object({
|
|
4516
4929
|
id: z.string(),
|
|
4517
4930
|
username: z.string(),
|
|
4518
4931
|
passwordHash: z.string(),
|
|
4519
|
-
|
|
4932
|
+
/**
|
|
4933
|
+
* Admin bypass. When true, the middleware skips the scope-access
|
|
4934
|
+
* check entirely. There is no other axis of privilege; the legacy
|
|
4935
|
+
* role enum collapsed onto this boolean in v2.
|
|
4936
|
+
*/
|
|
4937
|
+
isAdmin: z.boolean().default(false),
|
|
4520
4938
|
allowedProviders: AllowedProviderSchema,
|
|
4521
4939
|
allowedDevices: AllowedDevicesSchema,
|
|
4522
4940
|
/**
|
|
4523
|
-
* Scopes granted to this user. Admins bypass; their `scopes` is
|
|
4524
|
-
* Non-admins
|
|
4525
|
-
*
|
|
4941
|
+
* Scopes granted to this user. Admins bypass; their `scopes` is
|
|
4942
|
+
* ignored. Non-admins without scopes are locked out of every
|
|
4943
|
+
* protected call.
|
|
4526
4944
|
*/
|
|
4527
4945
|
scopes: z.array(TokenScopeSchema).default([]),
|
|
4528
4946
|
createdAt: z.number(),
|
|
@@ -4531,7 +4949,7 @@ z.object({
|
|
|
4531
4949
|
z.object({
|
|
4532
4950
|
id: z.string(),
|
|
4533
4951
|
label: z.string(),
|
|
4534
|
-
|
|
4952
|
+
isAdmin: z.boolean().default(false),
|
|
4535
4953
|
allowedProviders: AllowedProviderSchema,
|
|
4536
4954
|
allowedDevices: AllowedDevicesSchema,
|
|
4537
4955
|
tokenHash: z.string(),
|
|
@@ -4553,7 +4971,7 @@ z.object({
|
|
|
4553
4971
|
var UserSummarySchema = z.object({
|
|
4554
4972
|
id: z.string(),
|
|
4555
4973
|
username: z.string(),
|
|
4556
|
-
|
|
4974
|
+
isAdmin: z.boolean().default(false),
|
|
4557
4975
|
allowedProviders: z.union([z.array(z.string()), z.literal("*")]),
|
|
4558
4976
|
allowedDevices: z.record(z.string(), z.union([z.array(z.string()), z.literal("*")])),
|
|
4559
4977
|
scopes: z.array(TokenScopeSchema).default([]),
|
|
@@ -4563,14 +4981,14 @@ var UserSummarySchema = z.object({
|
|
|
4563
4981
|
var CreateUserInputSchema = z.object({
|
|
4564
4982
|
username: z.string(),
|
|
4565
4983
|
password: z.string().min(6),
|
|
4566
|
-
|
|
4984
|
+
isAdmin: z.boolean().default(false),
|
|
4567
4985
|
allowedProviders: z.union([z.array(z.string()), z.literal("*")]).optional(),
|
|
4568
4986
|
allowedDevices: z.record(z.string(), z.union([z.array(z.string()), z.literal("*")])).optional(),
|
|
4569
4987
|
scopes: z.array(TokenScopeSchema).optional()
|
|
4570
4988
|
});
|
|
4571
4989
|
var UpdateUserInputSchema = z.object({
|
|
4572
4990
|
id: z.string(),
|
|
4573
|
-
|
|
4991
|
+
isAdmin: z.boolean().optional(),
|
|
4574
4992
|
allowedProviders: z.union([z.array(z.string()), z.literal("*")]).optional(),
|
|
4575
4993
|
allowedDevices: z.record(z.string(), z.union([z.array(z.string()), z.literal("*")])).optional(),
|
|
4576
4994
|
scopes: z.array(TokenScopeSchema).optional()
|
|
@@ -4578,7 +4996,7 @@ var UpdateUserInputSchema = z.object({
|
|
|
4578
4996
|
var ApiKeySummarySchema = z.object({
|
|
4579
4997
|
id: z.string(),
|
|
4580
4998
|
label: z.string(),
|
|
4581
|
-
|
|
4999
|
+
isAdmin: z.boolean().default(false),
|
|
4582
5000
|
allowedProviders: z.union([z.array(z.string()), z.literal("*")]).optional(),
|
|
4583
5001
|
allowedDevices: z.record(z.string(), z.union([z.array(z.string()), z.literal("*")])).optional(),
|
|
4584
5002
|
tokenPrefix: z.string(),
|
|
@@ -4587,7 +5005,7 @@ var ApiKeySummarySchema = z.object({
|
|
|
4587
5005
|
});
|
|
4588
5006
|
var CreateApiKeyInputSchema = z.object({
|
|
4589
5007
|
label: z.string(),
|
|
4590
|
-
|
|
5008
|
+
isAdmin: z.boolean().default(false),
|
|
4591
5009
|
allowedProviders: z.union([z.array(z.string()), z.literal("*")]).optional(),
|
|
4592
5010
|
allowedDevices: z.record(z.string(), z.union([z.array(z.string()), z.literal("*")])).optional()
|
|
4593
5011
|
});
|
|
@@ -4615,43 +5033,89 @@ var CreateScopedTokenResultSchema = z.object({
|
|
|
4615
5033
|
token: z.string(),
|
|
4616
5034
|
record: ScopedTokenSummarySchema
|
|
4617
5035
|
});
|
|
5036
|
+
var TotpSetupResultSchema = z.object({
|
|
5037
|
+
secret: z.string(),
|
|
5038
|
+
otpauthUrl: z.string()
|
|
5039
|
+
});
|
|
5040
|
+
var TotpStatusSchema = z.object({
|
|
5041
|
+
/** True iff `confirmedAt != null` — a pending half-enrollment is reported as `enabled: false`. */
|
|
5042
|
+
enabled: z.boolean(),
|
|
5043
|
+
/** Null when no row exists OR the row is still pending confirmation. */
|
|
5044
|
+
confirmedAt: z.number().nullable()
|
|
5045
|
+
});
|
|
4618
5046
|
method(z.void(), z.array(UserSummarySchema), { auth: "admin" }), method(CreateUserInputSchema, UserSummarySchema, {
|
|
4619
5047
|
kind: "mutation",
|
|
4620
|
-
auth: "admin"
|
|
5048
|
+
auth: "admin",
|
|
5049
|
+
access: "create"
|
|
4621
5050
|
}), method(UpdateUserInputSchema, z.object({ success: z.literal(true) }), {
|
|
4622
5051
|
kind: "mutation",
|
|
4623
|
-
auth: "admin"
|
|
5052
|
+
auth: "admin",
|
|
5053
|
+
access: "create"
|
|
4624
5054
|
}), method(z.object({ id: z.string() }), z.object({ success: z.literal(true) }), {
|
|
4625
5055
|
kind: "mutation",
|
|
4626
|
-
auth: "admin"
|
|
5056
|
+
auth: "admin",
|
|
5057
|
+
access: "delete"
|
|
4627
5058
|
}), method(z.object({
|
|
4628
5059
|
id: z.string(),
|
|
4629
5060
|
newPassword: z.string().min(6)
|
|
4630
5061
|
}), z.object({ success: z.literal(true) }), {
|
|
4631
5062
|
kind: "mutation",
|
|
4632
|
-
auth: "admin"
|
|
5063
|
+
auth: "admin",
|
|
5064
|
+
access: "create"
|
|
4633
5065
|
}), method(z.object({
|
|
4634
5066
|
userId: z.string(),
|
|
4635
5067
|
scopes: z.array(TokenScopeSchema)
|
|
4636
5068
|
}), z.object({ success: z.literal(true) }), {
|
|
4637
5069
|
kind: "mutation",
|
|
4638
|
-
auth: "admin"
|
|
5070
|
+
auth: "admin",
|
|
5071
|
+
access: "create"
|
|
4639
5072
|
}), method(z.object({
|
|
4640
5073
|
username: z.string(),
|
|
4641
5074
|
password: z.string()
|
|
4642
|
-
}), UserSummarySchema.extend({ passwordHash: z.string() }).nullable(), {
|
|
5075
|
+
}), UserSummarySchema.extend({ passwordHash: z.string() }).nullable(), {
|
|
4643
5076
|
kind: "mutation",
|
|
4644
|
-
|
|
5077
|
+
access: "view"
|
|
5078
|
+
}), method(z.void(), z.array(ApiKeySummarySchema), { auth: "admin" }), method(CreateApiKeyInputSchema, CreateApiKeyResultSchema, {
|
|
5079
|
+
kind: "mutation",
|
|
5080
|
+
auth: "admin",
|
|
5081
|
+
access: "create"
|
|
4645
5082
|
}), method(z.object({ id: z.string() }), z.object({ success: z.literal(true) }), {
|
|
4646
5083
|
kind: "mutation",
|
|
4647
|
-
auth: "admin"
|
|
4648
|
-
|
|
5084
|
+
auth: "admin",
|
|
5085
|
+
access: "delete"
|
|
5086
|
+
}), method(z.object({ token: z.string() }), ApiKeySummarySchema.nullable(), {
|
|
4649
5087
|
kind: "mutation",
|
|
4650
|
-
|
|
5088
|
+
access: "view"
|
|
5089
|
+
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
5090
|
+
kind: "mutation",
|
|
5091
|
+
auth: "admin",
|
|
5092
|
+
access: "create"
|
|
4651
5093
|
}), method(z.object({ id: z.string() }), z.object({ success: z.literal(true) }), {
|
|
4652
5094
|
kind: "mutation",
|
|
4653
|
-
auth: "admin"
|
|
4654
|
-
|
|
5095
|
+
auth: "admin",
|
|
5096
|
+
access: "delete"
|
|
5097
|
+
}), method(z.object({ token: z.string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(z.object({ userId: z.string() }), z.array(ScopedTokenSummarySchema), { auth: "admin" }), method(z.object({ userId: z.string() }), TotpSetupResultSchema, {
|
|
5098
|
+
kind: "mutation",
|
|
5099
|
+
auth: "admin",
|
|
5100
|
+
access: "create"
|
|
5101
|
+
}), method(z.object({
|
|
5102
|
+
userId: z.string(),
|
|
5103
|
+
code: z.string()
|
|
5104
|
+
}), z.object({ success: z.literal(true) }), {
|
|
5105
|
+
kind: "mutation",
|
|
5106
|
+
auth: "admin",
|
|
5107
|
+
access: "create"
|
|
5108
|
+
}), method(z.object({ userId: z.string() }), z.object({ success: z.literal(true) }), {
|
|
5109
|
+
kind: "mutation",
|
|
5110
|
+
auth: "admin",
|
|
5111
|
+
access: "delete"
|
|
5112
|
+
}), method(z.object({ userId: z.string() }), TotpStatusSchema, { auth: "admin" }), method(z.object({
|
|
5113
|
+
userId: z.string(),
|
|
5114
|
+
code: z.string()
|
|
5115
|
+
}), z.object({ valid: z.boolean() }), {
|
|
5116
|
+
kind: "mutation",
|
|
5117
|
+
access: "view"
|
|
5118
|
+
});
|
|
4655
5119
|
var FeatureManifestSchema = z.object({
|
|
4656
5120
|
streaming: z.boolean(),
|
|
4657
5121
|
notifications: z.boolean(),
|