@camstack/system 1.2.454 → 1.2.455
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/{agent-https-B7IjRRzT.js → agent-https-CCvlRQKV.js} +2 -2
- package/dist/{agent-https-oXsR24R2.mjs → agent-https-CLWrOO3o.mjs} +2 -2
- package/dist/auth/auth-audit-log.d.ts +1 -1
- package/dist/auth/auth-manager.d.ts +7 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.js +2 -2
- package/dist/builtins/alerts/alerts.addon.mjs +2 -2
- package/dist/builtins/autotrack/index.js +1 -1
- package/dist/builtins/autotrack/index.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
- package/dist/builtins/calendars/calendars.addon.js +1 -1
- package/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/dist/builtins/camera-grid/index.js +1 -1
- package/dist/builtins/camera-grid/index.mjs +1 -1
- package/dist/builtins/composer/composer.addon.js +2 -2
- package/dist/builtins/composer/composer.addon.mjs +2 -2
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
- package/dist/builtins/device-history/device-history.addon.js +1 -1
- package/dist/builtins/device-history/device-history.addon.mjs +1 -1
- package/dist/builtins/device-manager/device-manager.addon.js +1 -1
- package/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/keychain/index.js +4 -4
- package/dist/builtins/keychain/index.mjs +4 -4
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +14 -4
- package/dist/builtins/local-auth/local-auth.addon.mjs +14 -4
- package/dist/builtins/local-network/local-network.addon.js +2 -2
- package/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/dist/builtins/platform-probe/index.js +1 -1
- package/dist/builtins/platform-probe/index.mjs +1 -1
- package/dist/builtins/record-entries/index.js +1 -1
- package/dist/builtins/record-entries/index.mjs +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/index.js +1 -1
- package/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2 -2
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/dist/builtins/system-config/system-config.addon.js +3 -3
- package/dist/builtins/system-config/system-config.addon.mjs +3 -3
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{composition-sources-Cukc78eu.js → composition-sources-BxUkLNSo.js} +1 -1
- package/dist/{composition-sources-bt6IQDLu.mjs → composition-sources-CSzD5_qX.mjs} +1 -1
- package/dist/{constants-DQcVrhVI.mjs → constants-DOlYt1t1.mjs} +1 -1
- package/dist/{constants-DBGG6Zu5.js → constants-DruwCkfp.js} +1 -1
- package/dist/{device-ca-B3hUVfYk.js → device-ca-QPBgfqVY.js} +1 -1
- package/dist/{device-ca-Utfvsx5x.mjs → device-ca-uFbTyY_o.mjs} +1 -1
- package/dist/{dist-7ZciHCIp.mjs → dist-BpSENkRJ.mjs} +236 -197
- package/dist/{dist-Bi4Ioxop.js → dist-DjQ8C-ku.js} +241 -196
- package/dist/file-host-worker.js +1 -1
- package/dist/file-host-worker.mjs +1 -1
- package/dist/{hub-mdns-ciao-2FzLWfbD.js → hub-mdns-ciao-Bkrvgnma.js} +2 -2
- package/dist/{hub-mdns-ciao-BRs3DUT-.mjs → hub-mdns-ciao-DlgkFJVY.mjs} +2 -2
- package/dist/index.js +7 -7
- package/dist/index.mjs +7 -7
- package/dist/{phase6-declare-gate-DwYAep7y.js → phase6-declare-gate-DrmTtz7F.js} +1 -1
- package/dist/{phase6-declare-gate-D-2LMw9o.mjs → phase6-declare-gate-JQUqgQgq.mjs} +1 -1
- package/dist/{restore-archive-C0ymYQk7.js → restore-archive-4OP0EYg6.js} +1 -1
- package/dist/{restore-archive-UVZv_hmr.mjs → restore-archive-YFSJRtKy.mjs} +1 -1
- package/dist/{wal-maintenance-Bo_lo3Dh.js → wal-maintenance-Bl0ZKjVR.js} +0 -0
- package/dist/{wal-maintenance-Df89xxrK.mjs → wal-maintenance-TyuOEVy1.mjs} +0 -0
- package/package.json +1 -1
|
@@ -3257,6 +3257,12 @@ function normalizeAddonInitResult(result) {
|
|
|
3257
3257
|
* core proxy and the kernel listener) to keep both off a kernel↔core import.
|
|
3258
3258
|
*/
|
|
3259
3259
|
var DATAPLANE_SECRET_HEADER = "x-camstack-dataplane-secret";
|
|
3260
|
+
/**
|
|
3261
|
+
* The share-view scope kinds a `csv_*` share token can carry. The hub mints
|
|
3262
|
+
* and validates them (`share-token.service.ts` builds its enum from this
|
|
3263
|
+
* list); a data plane names the kinds it ACCEPTS in `share`.
|
|
3264
|
+
*/
|
|
3265
|
+
var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
|
|
3260
3266
|
/** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
|
|
3261
3267
|
var PeerBytesTicketSchema = z.object({
|
|
3262
3268
|
/** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
|
|
@@ -10392,6 +10398,235 @@ function scopesAllowDeviceCap(scopes, access) {
|
|
|
10392
10398
|
function scopesAllowAddon(scopes, addonId, access) {
|
|
10393
10399
|
return scopes.some((s) => s.type === "addon" && s.target === addonId && s.access.includes(access));
|
|
10394
10400
|
}
|
|
10401
|
+
/**
|
|
10402
|
+
* Zod schemas for persisted record types.
|
|
10403
|
+
*
|
|
10404
|
+
* These schemas serve as the single source of truth for types that are
|
|
10405
|
+
* stored in the settings-store backend and retrieved via tRPC. They
|
|
10406
|
+
* replace the manual TypeScript interfaces with schema-derived types,
|
|
10407
|
+
* enabling runtime validation when reading from the backend.
|
|
10408
|
+
*
|
|
10409
|
+
* Convention: each schema is named `<Type>Schema`, the inferred TS type
|
|
10410
|
+
* keeps the original name for backward compatibility.
|
|
10411
|
+
*/
|
|
10412
|
+
/**
|
|
10413
|
+
* Auth model (v2 — 2026-05-12 caps-only):
|
|
10414
|
+
*
|
|
10415
|
+
* Two principals:
|
|
10416
|
+
* - `isAdmin: true` — full bypass. Admin scope set is ignored.
|
|
10417
|
+
* - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
|
|
10418
|
+
*
|
|
10419
|
+
* No role enum. There used to be `viewer / agent / scoped` and earlier
|
|
10420
|
+
* `super_admin` — collapsed onto the single boolean because every
|
|
10421
|
+
* non-admin caller is governed by the same scope-check rules; the
|
|
10422
|
+
* distinction was only ever used to route role-specific procedures
|
|
10423
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
10424
|
+
* with `isAdmin: false` + an explicit scope list.
|
|
10425
|
+
*/
|
|
10426
|
+
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
10427
|
+
var MethodAccessSchema = z.enum([
|
|
10428
|
+
"view",
|
|
10429
|
+
"create",
|
|
10430
|
+
"delete"
|
|
10431
|
+
]);
|
|
10432
|
+
/**
|
|
10433
|
+
* A single scope grant. Three forms — checked in matcher with OR
|
|
10434
|
+
* semantics; the first match decides whether the call passes:
|
|
10435
|
+
*
|
|
10436
|
+
* - `category` — broadest. `target: 'device' | 'system'` selects every
|
|
10437
|
+
* cap with the matching `scope` declaration. New caps inherit grants
|
|
10438
|
+
* automatically — adding a device cap to the codebase makes it
|
|
10439
|
+
* reachable to every user with `category:device [...]` without a
|
|
10440
|
+
* re-grant. Use this for "family viewer" / "operator" tiers.
|
|
10441
|
+
*
|
|
10442
|
+
* - `addon` — every cap that ships inside a given addon id. Niche;
|
|
10443
|
+
* useful when an integration needs to interact with one specific
|
|
10444
|
+
* addon's surface regardless of how many caps it exports.
|
|
10445
|
+
*
|
|
10446
|
+
* - `capability` — the most precise form. Single cap name. Use for
|
|
10447
|
+
* integration tokens where you want to grant `addons.installPackage`
|
|
10448
|
+
* and nothing else.
|
|
10449
|
+
*
|
|
10450
|
+
* `access` is REQUIRED with min 1 element. `admin` bypass is the
|
|
10451
|
+
* "give me everything" escape; there is no wildcard scope.
|
|
10452
|
+
*/
|
|
10453
|
+
var AllowedProviderSchema = z.union([z.literal("*"), z.array(z.string())]);
|
|
10454
|
+
var AllowedDevicesSchema = z.record(z.string(), z.union([z.literal("*"), z.array(z.string())]));
|
|
10455
|
+
var CapScopeSchema = z.enum(["device", "system"]);
|
|
10456
|
+
/**
|
|
10457
|
+
* DeviceSelector (scope model v3 — 2026-08-12).
|
|
10458
|
+
*
|
|
10459
|
+
* A `device` grant no longer carries a frozen list of deviceIds. It carries
|
|
10460
|
+
* a SELECTOR the matcher resolves against the live fleet, so the grant can be
|
|
10461
|
+
* DYNAMIC: a `types:['camera']` selector automatically covers a camera added
|
|
10462
|
+
* AFTER the grant was minted — no re-grant, no re-login.
|
|
10463
|
+
*
|
|
10464
|
+
* - `all` — every device in the deployment. The broad viewer/operator
|
|
10465
|
+
* lever without a `category` grant (a `category` grant also covers device
|
|
10466
|
+
* caps that carry no deviceId; `all` is specifically the device set).
|
|
10467
|
+
* - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
|
|
10468
|
+
* grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
|
|
10469
|
+
* is NOT covered until the grant is edited.
|
|
10470
|
+
* - `types` — every device of a `DeviceType` (e.g. every `camera`).
|
|
10471
|
+
* DYNAMIC. A device that changes type, or a new device of the type,
|
|
10472
|
+
* re-resolves on the next request.
|
|
10473
|
+
* - `locations` — every device whose operator-assigned `location` label is
|
|
10474
|
+
* in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
|
|
10475
|
+
* null/unset location matches NO `locations` selector.
|
|
10476
|
+
*/
|
|
10477
|
+
var DeviceSelectorSchema = z.discriminatedUnion("kind", [
|
|
10478
|
+
z.object({ kind: z.literal("all") }),
|
|
10479
|
+
z.object({
|
|
10480
|
+
kind: z.literal("ids"),
|
|
10481
|
+
ids: z.array(z.number().int()).min(1)
|
|
10482
|
+
}),
|
|
10483
|
+
z.object({
|
|
10484
|
+
kind: z.literal("types"),
|
|
10485
|
+
types: z.array(z.enum(DeviceType)).min(1)
|
|
10486
|
+
}),
|
|
10487
|
+
z.object({
|
|
10488
|
+
kind: z.literal("locations"),
|
|
10489
|
+
locations: z.array(z.string().min(1)).min(1)
|
|
10490
|
+
})
|
|
10491
|
+
]);
|
|
10492
|
+
var DeviceTokenScopeSchema = z.object({
|
|
10493
|
+
type: z.literal("device"),
|
|
10494
|
+
/** The device SET this grant covers — resolved against the live fleet. */
|
|
10495
|
+
selector: DeviceSelectorSchema,
|
|
10496
|
+
access: z.array(MethodAccessSchema).min(1),
|
|
10497
|
+
/**
|
|
10498
|
+
* Whether a grant on a PARENT device transparently covers its accessory
|
|
10499
|
+
* CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
|
|
10500
|
+
* Direction is parent → children ONLY.
|
|
10501
|
+
*
|
|
10502
|
+
* Absent → the matcher DERIVES it from the access flavour: `view`
|
|
10503
|
+
* inherits (a camera viewer sees the camera's accessories), `create` /
|
|
10504
|
+
* `delete` do NOT (actuating/removing a child is an explicit act the
|
|
10505
|
+
* operator must grant on the child, not inherit from the parent). Set it
|
|
10506
|
+
* explicitly to override that default per grant.
|
|
10507
|
+
*/
|
|
10508
|
+
includeLinked: z.boolean().optional()
|
|
10509
|
+
});
|
|
10510
|
+
/**
|
|
10511
|
+
* v2 → v3 lazy migration. A pre-v3 `device` grant carried
|
|
10512
|
+
* `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
|
|
10513
|
+
* `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
|
|
10514
|
+
* EVERY parse path — stored records AND the JWT-carried scope arrays
|
|
10515
|
+
* normalised at the request boundary ({@link normalizeTokenScopes} in
|
|
10516
|
+
* `device-selector.ts`). Chosen over a one-time DB migration because a
|
|
10517
|
+
* migration cannot reach a JWT already in a client's hands; parse-time
|
|
10518
|
+
* migration covers both without a flag day. No cast — the raw object is read
|
|
10519
|
+
* through `Reflect.get` (its static type is `unknown`).
|
|
10520
|
+
*/
|
|
10521
|
+
function migrateLegacyTokenScope(raw) {
|
|
10522
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
|
|
10523
|
+
if (Reflect.get(raw, "type") !== "device") return raw;
|
|
10524
|
+
if (Reflect.get(raw, "selector") !== void 0) return raw;
|
|
10525
|
+
const targets = Reflect.get(raw, "targets");
|
|
10526
|
+
if (!Array.isArray(targets)) return raw;
|
|
10527
|
+
return {
|
|
10528
|
+
type: "device",
|
|
10529
|
+
selector: {
|
|
10530
|
+
kind: "ids",
|
|
10531
|
+
ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
|
|
10532
|
+
},
|
|
10533
|
+
access: Reflect.get(raw, "access")
|
|
10534
|
+
};
|
|
10535
|
+
}
|
|
10536
|
+
var TokenScopeSchema = z.preprocess(migrateLegacyTokenScope, z.discriminatedUnion("type", [
|
|
10537
|
+
z.object({
|
|
10538
|
+
type: z.literal("category"),
|
|
10539
|
+
target: CapScopeSchema,
|
|
10540
|
+
access: z.array(MethodAccessSchema).min(1)
|
|
10541
|
+
}),
|
|
10542
|
+
z.object({
|
|
10543
|
+
type: z.literal("capability"),
|
|
10544
|
+
target: z.string(),
|
|
10545
|
+
access: z.array(MethodAccessSchema).min(1)
|
|
10546
|
+
}),
|
|
10547
|
+
z.object({
|
|
10548
|
+
type: z.literal("addon"),
|
|
10549
|
+
target: z.string(),
|
|
10550
|
+
access: z.array(MethodAccessSchema).min(1)
|
|
10551
|
+
}),
|
|
10552
|
+
DeviceTokenScopeSchema
|
|
10553
|
+
]));
|
|
10554
|
+
var UserRecordSchema = z.object({
|
|
10555
|
+
id: z.string(),
|
|
10556
|
+
username: z.string(),
|
|
10557
|
+
passwordHash: z.string(),
|
|
10558
|
+
/**
|
|
10559
|
+
* Admin bypass. When true, the middleware skips the scope-access
|
|
10560
|
+
* check entirely. There is no other axis of privilege; the legacy
|
|
10561
|
+
* role enum collapsed onto this boolean in v2.
|
|
10562
|
+
*/
|
|
10563
|
+
isAdmin: z.boolean().default(false),
|
|
10564
|
+
allowedProviders: AllowedProviderSchema,
|
|
10565
|
+
allowedDevices: AllowedDevicesSchema,
|
|
10566
|
+
/**
|
|
10567
|
+
* Scopes granted to this user. Admins bypass; their `scopes` is
|
|
10568
|
+
* ignored. Non-admins without scopes are locked out of every
|
|
10569
|
+
* protected call.
|
|
10570
|
+
*/
|
|
10571
|
+
scopes: z.array(TokenScopeSchema).default([]),
|
|
10572
|
+
createdAt: z.number(),
|
|
10573
|
+
updatedAt: z.number()
|
|
10574
|
+
});
|
|
10575
|
+
var ApiKeyRecordSchema = z.object({
|
|
10576
|
+
id: z.string(),
|
|
10577
|
+
label: z.string(),
|
|
10578
|
+
isAdmin: z.boolean().default(false),
|
|
10579
|
+
allowedProviders: AllowedProviderSchema,
|
|
10580
|
+
allowedDevices: AllowedDevicesSchema,
|
|
10581
|
+
tokenHash: z.string(),
|
|
10582
|
+
tokenPrefix: z.string(),
|
|
10583
|
+
createdAt: z.number(),
|
|
10584
|
+
lastUsedAt: z.number().optional()
|
|
10585
|
+
});
|
|
10586
|
+
var ScopedTokenSchema = z.object({
|
|
10587
|
+
id: z.string(),
|
|
10588
|
+
userId: z.string(),
|
|
10589
|
+
name: z.string(),
|
|
10590
|
+
tokenHash: z.string(),
|
|
10591
|
+
tokenPrefix: z.string(),
|
|
10592
|
+
scopes: z.array(TokenScopeSchema),
|
|
10593
|
+
expiresAt: z.number().nullish(),
|
|
10594
|
+
lastUsedAt: z.number().nullish(),
|
|
10595
|
+
createdAt: z.number()
|
|
10596
|
+
});
|
|
10597
|
+
/** What a share-view grant lets its holder see. */
|
|
10598
|
+
var ShareViewGrantSchema = z.object({
|
|
10599
|
+
kind: z.enum(SHARE_VIEW_KINDS),
|
|
10600
|
+
deviceIds: z.array(z.number().int().nonnegative()).min(1).max(64),
|
|
10601
|
+
/** Talk-back, opt-in at mint time; absent means off. */
|
|
10602
|
+
talk: z.boolean().optional()
|
|
10603
|
+
});
|
|
10604
|
+
var ShareViewScopeSchema = z.object({
|
|
10605
|
+
type: z.literal("share-view"),
|
|
10606
|
+
grant: ShareViewGrantSchema
|
|
10607
|
+
});
|
|
10608
|
+
var AddonRoutesScopeSchema = z.object({
|
|
10609
|
+
type: z.literal("addon-routes"),
|
|
10610
|
+
access: z.array(MethodAccessSchema).min(1)
|
|
10611
|
+
});
|
|
10612
|
+
var CredentialScopeSchema = z.union([
|
|
10613
|
+
z.literal("*"),
|
|
10614
|
+
ShareViewScopeSchema,
|
|
10615
|
+
AddonRoutesScopeSchema,
|
|
10616
|
+
TokenScopeSchema
|
|
10617
|
+
]);
|
|
10618
|
+
/**
|
|
10619
|
+
* The claims of a unified token (`auth.mintToken`). It carries no `exp`: its
|
|
10620
|
+
* row (looked up by `jti` on every verify, for revocation) holds the ONE
|
|
10621
|
+
* expiry, so a share link can be extended and a JWT clock can never disagree
|
|
10622
|
+
* with the row.
|
|
10623
|
+
*/
|
|
10624
|
+
var CredentialTokenClaimsSchema = z.object({
|
|
10625
|
+
kind: z.literal("credential"),
|
|
10626
|
+
sub: z.string().min(1),
|
|
10627
|
+
jti: z.string().min(16),
|
|
10628
|
+
scopes: z.array(CredentialScopeSchema).min(1)
|
|
10629
|
+
});
|
|
10395
10630
|
z.enum(["new-session", "step-up"]);
|
|
10396
10631
|
/** The languages the hub's app landing pages are written in (D858). */
|
|
10397
10632
|
var AppPageLangSchema = z.enum(["en", "it"]);
|
|
@@ -46812,202 +47047,6 @@ var notificationRulesCapability = {
|
|
|
46812
47047
|
}
|
|
46813
47048
|
};
|
|
46814
47049
|
/**
|
|
46815
|
-
* Zod schemas for persisted record types.
|
|
46816
|
-
*
|
|
46817
|
-
* These schemas serve as the single source of truth for types that are
|
|
46818
|
-
* stored in the settings-store backend and retrieved via tRPC. They
|
|
46819
|
-
* replace the manual TypeScript interfaces with schema-derived types,
|
|
46820
|
-
* enabling runtime validation when reading from the backend.
|
|
46821
|
-
*
|
|
46822
|
-
* Convention: each schema is named `<Type>Schema`, the inferred TS type
|
|
46823
|
-
* keeps the original name for backward compatibility.
|
|
46824
|
-
*/
|
|
46825
|
-
/**
|
|
46826
|
-
* Auth model (v2 — 2026-05-12 caps-only):
|
|
46827
|
-
*
|
|
46828
|
-
* Two principals:
|
|
46829
|
-
* - `isAdmin: true` — full bypass. Admin scope set is ignored.
|
|
46830
|
-
* - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
|
|
46831
|
-
*
|
|
46832
|
-
* No role enum. There used to be `viewer / agent / scoped` and earlier
|
|
46833
|
-
* `super_admin` — collapsed onto the single boolean because every
|
|
46834
|
-
* non-admin caller is governed by the same scope-check rules; the
|
|
46835
|
-
* distinction was only ever used to route role-specific procedures
|
|
46836
|
-
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
46837
|
-
* with `isAdmin: false` + an explicit scope list.
|
|
46838
|
-
*/
|
|
46839
|
-
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
46840
|
-
var MethodAccessSchema = z.enum([
|
|
46841
|
-
"view",
|
|
46842
|
-
"create",
|
|
46843
|
-
"delete"
|
|
46844
|
-
]);
|
|
46845
|
-
/**
|
|
46846
|
-
* A single scope grant. Three forms — checked in matcher with OR
|
|
46847
|
-
* semantics; the first match decides whether the call passes:
|
|
46848
|
-
*
|
|
46849
|
-
* - `category` — broadest. `target: 'device' | 'system'` selects every
|
|
46850
|
-
* cap with the matching `scope` declaration. New caps inherit grants
|
|
46851
|
-
* automatically — adding a device cap to the codebase makes it
|
|
46852
|
-
* reachable to every user with `category:device [...]` without a
|
|
46853
|
-
* re-grant. Use this for "family viewer" / "operator" tiers.
|
|
46854
|
-
*
|
|
46855
|
-
* - `addon` — every cap that ships inside a given addon id. Niche;
|
|
46856
|
-
* useful when an integration needs to interact with one specific
|
|
46857
|
-
* addon's surface regardless of how many caps it exports.
|
|
46858
|
-
*
|
|
46859
|
-
* - `capability` — the most precise form. Single cap name. Use for
|
|
46860
|
-
* integration tokens where you want to grant `addons.installPackage`
|
|
46861
|
-
* and nothing else.
|
|
46862
|
-
*
|
|
46863
|
-
* `access` is REQUIRED with min 1 element. `admin` bypass is the
|
|
46864
|
-
* "give me everything" escape; there is no wildcard scope.
|
|
46865
|
-
*/
|
|
46866
|
-
var AllowedProviderSchema = z.union([z.literal("*"), z.array(z.string())]);
|
|
46867
|
-
var AllowedDevicesSchema = z.record(z.string(), z.union([z.literal("*"), z.array(z.string())]));
|
|
46868
|
-
var CapScopeSchema = z.enum(["device", "system"]);
|
|
46869
|
-
/**
|
|
46870
|
-
* DeviceSelector (scope model v3 — 2026-08-12).
|
|
46871
|
-
*
|
|
46872
|
-
* A `device` grant no longer carries a frozen list of deviceIds. It carries
|
|
46873
|
-
* a SELECTOR the matcher resolves against the live fleet, so the grant can be
|
|
46874
|
-
* DYNAMIC: a `types:['camera']` selector automatically covers a camera added
|
|
46875
|
-
* AFTER the grant was minted — no re-grant, no re-login.
|
|
46876
|
-
*
|
|
46877
|
-
* - `all` — every device in the deployment. The broad viewer/operator
|
|
46878
|
-
* lever without a `category` grant (a `category` grant also covers device
|
|
46879
|
-
* caps that carry no deviceId; `all` is specifically the device set).
|
|
46880
|
-
* - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
|
|
46881
|
-
* grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
|
|
46882
|
-
* is NOT covered until the grant is edited.
|
|
46883
|
-
* - `types` — every device of a `DeviceType` (e.g. every `camera`).
|
|
46884
|
-
* DYNAMIC. A device that changes type, or a new device of the type,
|
|
46885
|
-
* re-resolves on the next request.
|
|
46886
|
-
* - `locations` — every device whose operator-assigned `location` label is
|
|
46887
|
-
* in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
|
|
46888
|
-
* null/unset location matches NO `locations` selector.
|
|
46889
|
-
*/
|
|
46890
|
-
var DeviceSelectorSchema = z.discriminatedUnion("kind", [
|
|
46891
|
-
z.object({ kind: z.literal("all") }),
|
|
46892
|
-
z.object({
|
|
46893
|
-
kind: z.literal("ids"),
|
|
46894
|
-
ids: z.array(z.number().int()).min(1)
|
|
46895
|
-
}),
|
|
46896
|
-
z.object({
|
|
46897
|
-
kind: z.literal("types"),
|
|
46898
|
-
types: z.array(z.enum(DeviceType)).min(1)
|
|
46899
|
-
}),
|
|
46900
|
-
z.object({
|
|
46901
|
-
kind: z.literal("locations"),
|
|
46902
|
-
locations: z.array(z.string().min(1)).min(1)
|
|
46903
|
-
})
|
|
46904
|
-
]);
|
|
46905
|
-
var DeviceTokenScopeSchema = z.object({
|
|
46906
|
-
type: z.literal("device"),
|
|
46907
|
-
/** The device SET this grant covers — resolved against the live fleet. */
|
|
46908
|
-
selector: DeviceSelectorSchema,
|
|
46909
|
-
access: z.array(MethodAccessSchema).min(1),
|
|
46910
|
-
/**
|
|
46911
|
-
* Whether a grant on a PARENT device transparently covers its accessory
|
|
46912
|
-
* CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
|
|
46913
|
-
* Direction is parent → children ONLY.
|
|
46914
|
-
*
|
|
46915
|
-
* Absent → the matcher DERIVES it from the access flavour: `view`
|
|
46916
|
-
* inherits (a camera viewer sees the camera's accessories), `create` /
|
|
46917
|
-
* `delete` do NOT (actuating/removing a child is an explicit act the
|
|
46918
|
-
* operator must grant on the child, not inherit from the parent). Set it
|
|
46919
|
-
* explicitly to override that default per grant.
|
|
46920
|
-
*/
|
|
46921
|
-
includeLinked: z.boolean().optional()
|
|
46922
|
-
});
|
|
46923
|
-
/**
|
|
46924
|
-
* v2 → v3 lazy migration. A pre-v3 `device` grant carried
|
|
46925
|
-
* `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
|
|
46926
|
-
* `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
|
|
46927
|
-
* EVERY parse path — stored records AND the JWT-carried scope arrays
|
|
46928
|
-
* normalised at the request boundary ({@link normalizeTokenScopes} in
|
|
46929
|
-
* `device-selector.ts`). Chosen over a one-time DB migration because a
|
|
46930
|
-
* migration cannot reach a JWT already in a client's hands; parse-time
|
|
46931
|
-
* migration covers both without a flag day. No cast — the raw object is read
|
|
46932
|
-
* through `Reflect.get` (its static type is `unknown`).
|
|
46933
|
-
*/
|
|
46934
|
-
function migrateLegacyTokenScope(raw) {
|
|
46935
|
-
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
|
|
46936
|
-
if (Reflect.get(raw, "type") !== "device") return raw;
|
|
46937
|
-
if (Reflect.get(raw, "selector") !== void 0) return raw;
|
|
46938
|
-
const targets = Reflect.get(raw, "targets");
|
|
46939
|
-
if (!Array.isArray(targets)) return raw;
|
|
46940
|
-
return {
|
|
46941
|
-
type: "device",
|
|
46942
|
-
selector: {
|
|
46943
|
-
kind: "ids",
|
|
46944
|
-
ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
|
|
46945
|
-
},
|
|
46946
|
-
access: Reflect.get(raw, "access")
|
|
46947
|
-
};
|
|
46948
|
-
}
|
|
46949
|
-
var TokenScopeSchema = z.preprocess(migrateLegacyTokenScope, z.discriminatedUnion("type", [
|
|
46950
|
-
z.object({
|
|
46951
|
-
type: z.literal("category"),
|
|
46952
|
-
target: CapScopeSchema,
|
|
46953
|
-
access: z.array(MethodAccessSchema).min(1)
|
|
46954
|
-
}),
|
|
46955
|
-
z.object({
|
|
46956
|
-
type: z.literal("capability"),
|
|
46957
|
-
target: z.string(),
|
|
46958
|
-
access: z.array(MethodAccessSchema).min(1)
|
|
46959
|
-
}),
|
|
46960
|
-
z.object({
|
|
46961
|
-
type: z.literal("addon"),
|
|
46962
|
-
target: z.string(),
|
|
46963
|
-
access: z.array(MethodAccessSchema).min(1)
|
|
46964
|
-
}),
|
|
46965
|
-
DeviceTokenScopeSchema
|
|
46966
|
-
]));
|
|
46967
|
-
var UserRecordSchema = z.object({
|
|
46968
|
-
id: z.string(),
|
|
46969
|
-
username: z.string(),
|
|
46970
|
-
passwordHash: z.string(),
|
|
46971
|
-
/**
|
|
46972
|
-
* Admin bypass. When true, the middleware skips the scope-access
|
|
46973
|
-
* check entirely. There is no other axis of privilege; the legacy
|
|
46974
|
-
* role enum collapsed onto this boolean in v2.
|
|
46975
|
-
*/
|
|
46976
|
-
isAdmin: z.boolean().default(false),
|
|
46977
|
-
allowedProviders: AllowedProviderSchema,
|
|
46978
|
-
allowedDevices: AllowedDevicesSchema,
|
|
46979
|
-
/**
|
|
46980
|
-
* Scopes granted to this user. Admins bypass; their `scopes` is
|
|
46981
|
-
* ignored. Non-admins without scopes are locked out of every
|
|
46982
|
-
* protected call.
|
|
46983
|
-
*/
|
|
46984
|
-
scopes: z.array(TokenScopeSchema).default([]),
|
|
46985
|
-
createdAt: z.number(),
|
|
46986
|
-
updatedAt: z.number()
|
|
46987
|
-
});
|
|
46988
|
-
var ApiKeyRecordSchema = z.object({
|
|
46989
|
-
id: z.string(),
|
|
46990
|
-
label: z.string(),
|
|
46991
|
-
isAdmin: z.boolean().default(false),
|
|
46992
|
-
allowedProviders: AllowedProviderSchema,
|
|
46993
|
-
allowedDevices: AllowedDevicesSchema,
|
|
46994
|
-
tokenHash: z.string(),
|
|
46995
|
-
tokenPrefix: z.string(),
|
|
46996
|
-
createdAt: z.number(),
|
|
46997
|
-
lastUsedAt: z.number().optional()
|
|
46998
|
-
});
|
|
46999
|
-
var ScopedTokenSchema = z.object({
|
|
47000
|
-
id: z.string(),
|
|
47001
|
-
userId: z.string(),
|
|
47002
|
-
name: z.string(),
|
|
47003
|
-
tokenHash: z.string(),
|
|
47004
|
-
tokenPrefix: z.string(),
|
|
47005
|
-
scopes: z.array(TokenScopeSchema),
|
|
47006
|
-
expiresAt: z.number().nullish(),
|
|
47007
|
-
lastUsedAt: z.number().nullish(),
|
|
47008
|
-
createdAt: z.number()
|
|
47009
|
-
});
|
|
47010
|
-
/**
|
|
47011
47050
|
* `oauth-integration` — a collection cap by which an addon declares
|
|
47012
47051
|
* itself a linkable OAuth client of the hub's core `/oauth2/*` server.
|
|
47013
47052
|
* Each provider returns a static descriptor; the core enumerates them
|
|
@@ -88324,4 +88363,4 @@ function armRemovalReconcile(opts) {
|
|
|
88324
88363
|
return () => clearInterval(timer);
|
|
88325
88364
|
}
|
|
88326
88365
|
//#endregion
|
|
88327
|
-
export {
|
|
88366
|
+
export { STORAGE_ADMIN_MOVED_COLLECTIONS as $, normalizeNodeId as $i, resolveAppConnections as $n, DeclarationRefusedError as $r, enumerateInferenceDevices as $t, DEVICE_TOMBSTONE_RETENTION_MS as A, collectSecretLeaves as Ai, logDestinationCapability as An, withLocationMode as Ar, composerCapability as At, HUB_MDNS_TXT_KEYS as B, expandCapMethods as Bi, normalizeUnit as Bn, createStatefulExpressionMemory as Br, databaseSnapshotCapability as Bt, DATA_STORE_DATABASES as C, WELL_KNOWN_TAB_MAP as Ci, keychainAdminCapability as Cn, supportedRuntimes as Cr, buildDeviceEnrollmentLink as Ct, DEVICE_NONCE_TTL_MS as D, assertValidDeclaration as Di, lifecycleJobSchema as Dn, vectorDimFromBase64 as Dr, cameraGridLayoutCapability as Dt, DEVICE_ENROLLMENT_TTL_MS as E, asString$1 as Ei, legacyModeOf as En, validateCustomAddress as Er, calendarsCapability as Et, FIRST_LEVEL_MACRO_CLASSES as F, declarationsOf as Fi, memoizePinnedFfmpeg as Fn, composedDeviceStableId as Fr, coreBlockIdFromAddonId as Ft, LegacyStorageLocationDefaultSchema as G, isKeychainStoredField as Gi, planComposition as Gn, DeviceType as Gr, describeComposableCaps as Gt, KeychainAuditEntrySchema as H, hydrateSchema as Hi, objectInputDeclaresRequiredDeviceId as Hn, toExpressionValue as Hr, decodeVectorBase64 as Ht, FieldClaimModeSchema as I, defineCustomActions as Ii, metricsProviderCapability as In, compositionFeatureEnabled as Ir, coreBlockSourceKind as It, MOTION_CLOSE_AFTER_MS as J, isSecretMarkerLike as Ji, ptzAutotrackCapability as Jn, BatchTooLargeError as Jr, deviceHistoryCapability as Jt, METHOD_ACCESS_MAP as K, isSecretClear as Ki, platformProbeCapability as Kn, errMsg as Kr, deviceCredentialsCapability as Kt, FieldClaimSchema as L, defineRecordKinds as Li, modeMayWrite as Ln, compositionItemFieldPath as Lr, coreBlocksCapability as Lt, DeclaredDevices as M, collectZodSecretPaths as Mi, looseSchema as Mn, buildFfmpegArgs as Mr, compositionSourceRefs as Mt, DeviceStatusSchema as N, createEvent as Ni, mayReadLocation as Nn, cloneStatefulExpressionMemory as Nr, coreBlockAddonId as Nt, DEVICE_SAN_CREDENTIAL_PREFIX as O, buildSecretRef as Oi, localNetworkCapability as On, vectorIndexDimConflictError as Or, canonicalIconKey as Ot, DeviceTombstoneSchema as P, customAction as Pi, mayWriteToLocation as Pn, composedDeviceRef as Pr, coreBlockComposition as Pt, STORAGE_ACCESS_FALLBACK as Q, nodePin as Qi, replacedFieldKeys as Qn, DEVICE_STATUS_METHOD as Qr, deviceStatusCapability as Qt, HISTORY_CATALOG as R, emitDownForOwnedCaps as Ri, motionCapability as Rn, compositionSliceKey as Rr, createDeviceExtensionProvider as Rt, DATABASE_SNAPSHOT_TIMEOUT_MS as S, UnknownRecordKindError as Si, kebabToCamel as Sn, streamQualityLabel as Sr, buildCapabilityLookup as St, DERIVED_CAMERA_SILENCED_CAP_NAMES as T, asNumber as Ti, legacyAutoLinkIds as Tn, validateComposition as Tr, buildStreamParamsConfigSchema as Tt, KeychainResetRecordSchema as U, isDeviceConfigCap as Ui, parseStreamParamsFormPatch as Un, DeviceFeature as Ur, defineExtensionSlotProvider as Ut, KEYCHAIN_RESET_TRIGGER_ACTOR as V, formatSecretScope as Vi, objectInputDeclaresAddonId as Vn, disarmRoseMemory as Vr, declarationOwnerNodeId as Vt, LOG_LEVEL_RANK as W, isEvent as Wi, pickAppLinkHub as Wn, DeviceRole as Wr, deriveBatteryPresence as Wt, RECORDING_SOURCE_CAMSTACK_ADDON as X, makeSecretMarker as Xi, recordsCapability as Xn, DATAPLANE_SECRET_HEADER as Xr, deviceRemovalHookCapability as Xt, NetworkTunnelStartedDataSchema as Y, isSecretRefOwnedBy as Yi, recordEntriesCapability as Yn, CALLER_STAMPED_CAPABILITIES as Yr, deviceManagerCapability as Yt, RecordingStatusSchema as Z, mapSecretLeaves as Zi, reducePoints as Zn, DEVICE_SETTINGS_CONTRIBUTION_METHODS as Zr, deviceStateCapability as Zt, CatalogFileSchema as _, userError as _a, RecordTooLargeError as _i, isCollectionArrayMethod as _n, storageCapability as _r, armRemovalReconcile as _t, ApiKeyRecordSchema as a, parseSettingsBrokersAdoptsFrom as aa, PlaintextSecretError as ai, expressionContainsBuiltinCall as an, resolveMethodAuth as ar, StorageCleanupJobSchema as at, DATABASE_SNAPSHOT_PARTIAL_SUFFIX as b, SECRET_CLEAR as bi, isObjectInput as bn, storageProviderCapability as br, bareAddonId as bt, CAMERA_SWITCH_ORDER as c, resolveCapMount as ca, RECORD_DELETE_BATCH as ci, foldSnapshotByFunction as cn, scopesAllowAddon as cr, StorageMigrationJobSchema as ct, CATALOG_LANGS as d, secretTreeFromPaths as da, REMOVE_LEAF as di, gbToBytes as dn, settingsStoreCapability as dr, addonPagesCapability as dt, normalizeSecretOwner as ea, FilterRequiredError as ei, enumerateItemArrayFields as en, resolveBucketMs as er, STORAGE_ADMIN_SCOPED_BASES as et, COMPOSED_ITEM_FIXED_FIELDS as f, secretTreeFromSchema as fa, RUNTIME_DEFAULTS as fi, interpolate as fn, shortHostname as fr, addonSettingsCapability as ft, CalendarPreferencesSchema as g, transformSecretWrite as ga, RecordNotFoundError as gi, isArrayOutputSchema as gn, storageAdminCapability as gr, alertsCapability as gt, CORE_BLOCK_ADDON_PREFIX as h, toSecretFieldView as ha, RecordKindDeclarationSchema as hi, isAppLinkBase as hn, splitTranslationRef as hr, alertEpisodePayload as ht, AlertSchema as i, parseSettingsArrayAdoptsFrom as ia, NoCallerError as ii, expandContainer as in, resolveLocationMode as ir, SsoBridgeClaimsSchema as it, DataStoreDatabaseSchema as j, collectSecretMarkerRefs as ji, logLevelAtMost as jn, COMPOSER_ADDON_ID as jr, compositionFieldKey as jt, DEVICE_SAN_USER_PREFIX as k, collectSecretConfigKeys as ki, locationIconKey as kn, vectorStoreCapability as kr, checkRoleAddress as kt, CAMSTACK_APP_LINK_ORIGIN as l, resolveSecretMarkers as la, RECORD_SWEEP_INTERVAL_MS as li, formatDeviceRevoker as ln, scopesAllowDeviceCap as lr, TokenScopeSchema as lt, CORE_BLOCKS_ADDON_ID as m, toNodeId as ma, ReadinessTimeoutError as mi, isAlertEpisodeSeverity as mn, snapshotCapability as mr, alertEpisodeId as mt, AGENT_MDNS_TXT_KEYS as n, parseJsonUnknown as na, HISTORY_DEFAULT_MIN_INTERVAL_MS as ni, evaluateCompositionField as nn, resolveCoreBlockFiles as nr, ScopedTokenSchema as nt, BaseDevice as o, readinessKey as oa, RECORD_BATCH_MAX as oi, extractNestedAddonId as on, resolveNotificationTapAddress as or, StorageLocationModeSchema as ot, COMPOSER_RUNNER_ID as p, sleep as pa, ReadinessRegistry as pi, isAlertEpisodeOpen as pn, siteZoneKey as pr, addonWidgetsCapability as pt, MINUTES_PER_DAY as q, isSecretMarker as qi, procedureAuthKey as qn, BaseAddon as qr, deviceExtensionCapability as qt, ALL_CAPABILITY_DEFINITIONS as r, parseSecretRef as ra, InvalidRecordError as ri, evictionPolicyOfLocation as rn, resolveHubAddressRoles as rr, ServerNameSchema as rt, BatteryStatusSchema as s, recordSecretRef as sa, RECORD_BATCH_MAX_BYTES as si, filesystemBrowseCapability as sn, runtimeStatePolicyFor as sr, StorageLocationTypeSchema as st, AGENT_MDNS_SERVICE_TYPE as t, parseJsonObject as ta, ForeignSecretMarkerError as ti, enumerateSchemaFields as tn, resolveCoreBlockEntry as tr, STREAM_PROFILE_META as tt, CAP_NAMES_WITH_STATUS as u, scopeKey as ua, REDACTED_SECRET as ui, formatMinutes as un, scoreRuntimes as ur, UserRecordSchema as ut, CoreBlockSchema as v, withoutCallerStamp as va, RecordUniqueViolationError as vi, isDefaultAppConnectionEndpoint as vn, storageMigrationCapability as vr, authProviderCapability as vt, DAY_NAMES as w, asJsonObject as wi, keychainCapability as wn, userManagementCapability as wr, buildDeviceSignatureMessage as wt, DATABASE_SNAPSHOT_SUFFIX as x, UnindexedFilterError as xi, isVoidInput as xn, streamCatalogCapability as xr, batteryCapability as xt, CredentialTokenClaimsSchema as y, EventCategory as ya, RevConflictError as yi, isLocationEnabled as yn, storageOccupancyCapability as yr, backupCapability as yt, HUB_MDNS_SERVICE_TYPE as z, emitReadiness as zi, normalizeCoreBlockWrite as zn, compositionSourceKey as zr, dataStoreProviderCapability as zt };
|