@camstack/addon-smtp-nodemailer 1.2.124 → 1.2.125

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.
@@ -7833,6 +7833,12 @@ function normalizeAddonInitResult(result) {
7833
7833
  if (Array.isArray(result)) return { providers: result };
7834
7834
  return result;
7835
7835
  }
7836
+ /**
7837
+ * The share-view scope kinds a `csv_*` share token can carry. The hub mints
7838
+ * and validates them (`share-token.service.ts` builds its enum from this
7839
+ * list); a data plane names the kinds it ACCEPTS in `share`.
7840
+ */
7841
+ var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7836
7842
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
7837
7843
  var PeerBytesTicketSchema = object({
7838
7844
  /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
@@ -12417,6 +12423,229 @@ var ConvertResultSchema = object({
12417
12423
  files: array(string()).readonly()
12418
12424
  })).readonly()
12419
12425
  });
12426
+ /**
12427
+ * Zod schemas for persisted record types.
12428
+ *
12429
+ * These schemas serve as the single source of truth for types that are
12430
+ * stored in the settings-store backend and retrieved via tRPC. They
12431
+ * replace the manual TypeScript interfaces with schema-derived types,
12432
+ * enabling runtime validation when reading from the backend.
12433
+ *
12434
+ * Convention: each schema is named `<Type>Schema`, the inferred TS type
12435
+ * keeps the original name for backward compatibility.
12436
+ */
12437
+ /**
12438
+ * Auth model (v2 — 2026-05-12 caps-only):
12439
+ *
12440
+ * Two principals:
12441
+ * - `isAdmin: true` — full bypass. Admin scope set is ignored.
12442
+ * - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
12443
+ *
12444
+ * No role enum. There used to be `viewer / agent / scoped` and earlier
12445
+ * `super_admin` — collapsed onto the single boolean because every
12446
+ * non-admin caller is governed by the same scope-check rules; the
12447
+ * distinction was only ever used to route role-specific procedures
12448
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
12449
+ * with `isAdmin: false` + an explicit scope list.
12450
+ */
12451
+ /** Per-method access flavour. Materialised on every cap method via codegen. */
12452
+ var MethodAccessSchema = _enum([
12453
+ "view",
12454
+ "create",
12455
+ "delete"
12456
+ ]);
12457
+ /**
12458
+ * A single scope grant. Three forms — checked in matcher with OR
12459
+ * semantics; the first match decides whether the call passes:
12460
+ *
12461
+ * - `category` — broadest. `target: 'device' | 'system'` selects every
12462
+ * cap with the matching `scope` declaration. New caps inherit grants
12463
+ * automatically — adding a device cap to the codebase makes it
12464
+ * reachable to every user with `category:device [...]` without a
12465
+ * re-grant. Use this for "family viewer" / "operator" tiers.
12466
+ *
12467
+ * - `addon` — every cap that ships inside a given addon id. Niche;
12468
+ * useful when an integration needs to interact with one specific
12469
+ * addon's surface regardless of how many caps it exports.
12470
+ *
12471
+ * - `capability` — the most precise form. Single cap name. Use for
12472
+ * integration tokens where you want to grant `addons.installPackage`
12473
+ * and nothing else.
12474
+ *
12475
+ * `access` is REQUIRED with min 1 element. `admin` bypass is the
12476
+ * "give me everything" escape; there is no wildcard scope.
12477
+ */
12478
+ var AllowedProviderSchema = union([literal("*"), array(string())]);
12479
+ var AllowedDevicesSchema = record(string(), union([literal("*"), array(string())]));
12480
+ var CapScopeSchema = _enum(["device", "system"]);
12481
+ /**
12482
+ * DeviceSelector (scope model v3 — 2026-08-12).
12483
+ *
12484
+ * A `device` grant no longer carries a frozen list of deviceIds. It carries
12485
+ * a SELECTOR the matcher resolves against the live fleet, so the grant can be
12486
+ * DYNAMIC: a `types:['camera']` selector automatically covers a camera added
12487
+ * AFTER the grant was minted — no re-grant, no re-login.
12488
+ *
12489
+ * - `all` — every device in the deployment. The broad viewer/operator
12490
+ * lever without a `category` grant (a `category` grant also covers device
12491
+ * caps that carry no deviceId; `all` is specifically the device set).
12492
+ * - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
12493
+ * grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
12494
+ * is NOT covered until the grant is edited.
12495
+ * - `types` — every device of a `DeviceType` (e.g. every `camera`).
12496
+ * DYNAMIC. A device that changes type, or a new device of the type,
12497
+ * re-resolves on the next request.
12498
+ * - `locations` — every device whose operator-assigned `location` label is
12499
+ * in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
12500
+ * null/unset location matches NO `locations` selector.
12501
+ */
12502
+ var DeviceSelectorSchema = discriminatedUnion("kind", [
12503
+ object({ kind: literal("all") }),
12504
+ object({
12505
+ kind: literal("ids"),
12506
+ ids: array(number().int()).min(1)
12507
+ }),
12508
+ object({
12509
+ kind: literal("types"),
12510
+ types: array(_enum(DeviceType)).min(1)
12511
+ }),
12512
+ object({
12513
+ kind: literal("locations"),
12514
+ locations: array(string().min(1)).min(1)
12515
+ })
12516
+ ]);
12517
+ var DeviceTokenScopeSchema = object({
12518
+ type: literal("device"),
12519
+ /** The device SET this grant covers — resolved against the live fleet. */
12520
+ selector: DeviceSelectorSchema,
12521
+ access: array(MethodAccessSchema).min(1),
12522
+ /**
12523
+ * Whether a grant on a PARENT device transparently covers its accessory
12524
+ * CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
12525
+ * Direction is parent → children ONLY.
12526
+ *
12527
+ * Absent → the matcher DERIVES it from the access flavour: `view`
12528
+ * inherits (a camera viewer sees the camera's accessories), `create` /
12529
+ * `delete` do NOT (actuating/removing a child is an explicit act the
12530
+ * operator must grant on the child, not inherit from the parent). Set it
12531
+ * explicitly to override that default per grant.
12532
+ */
12533
+ includeLinked: boolean().optional()
12534
+ });
12535
+ /**
12536
+ * v2 → v3 lazy migration. A pre-v3 `device` grant carried
12537
+ * `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
12538
+ * `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
12539
+ * EVERY parse path — stored records AND the JWT-carried scope arrays
12540
+ * normalised at the request boundary ({@link normalizeTokenScopes} in
12541
+ * `device-selector.ts`). Chosen over a one-time DB migration because a
12542
+ * migration cannot reach a JWT already in a client's hands; parse-time
12543
+ * migration covers both without a flag day. No cast — the raw object is read
12544
+ * through `Reflect.get` (its static type is `unknown`).
12545
+ */
12546
+ function migrateLegacyTokenScope(raw) {
12547
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
12548
+ if (Reflect.get(raw, "type") !== "device") return raw;
12549
+ if (Reflect.get(raw, "selector") !== void 0) return raw;
12550
+ const targets = Reflect.get(raw, "targets");
12551
+ if (!Array.isArray(targets)) return raw;
12552
+ return {
12553
+ type: "device",
12554
+ selector: {
12555
+ kind: "ids",
12556
+ ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
12557
+ },
12558
+ access: Reflect.get(raw, "access")
12559
+ };
12560
+ }
12561
+ var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
12562
+ object({
12563
+ type: literal("category"),
12564
+ target: CapScopeSchema,
12565
+ access: array(MethodAccessSchema).min(1)
12566
+ }),
12567
+ object({
12568
+ type: literal("capability"),
12569
+ target: string(),
12570
+ access: array(MethodAccessSchema).min(1)
12571
+ }),
12572
+ object({
12573
+ type: literal("addon"),
12574
+ target: string(),
12575
+ access: array(MethodAccessSchema).min(1)
12576
+ }),
12577
+ DeviceTokenScopeSchema
12578
+ ]));
12579
+ object({
12580
+ id: string(),
12581
+ username: string(),
12582
+ passwordHash: string(),
12583
+ /**
12584
+ * Admin bypass. When true, the middleware skips the scope-access
12585
+ * check entirely. There is no other axis of privilege; the legacy
12586
+ * role enum collapsed onto this boolean in v2.
12587
+ */
12588
+ isAdmin: boolean().default(false),
12589
+ allowedProviders: AllowedProviderSchema,
12590
+ allowedDevices: AllowedDevicesSchema,
12591
+ /**
12592
+ * Scopes granted to this user. Admins bypass; their `scopes` is
12593
+ * ignored. Non-admins without scopes are locked out of every
12594
+ * protected call.
12595
+ */
12596
+ scopes: array(TokenScopeSchema).default([]),
12597
+ createdAt: number(),
12598
+ updatedAt: number()
12599
+ });
12600
+ object({
12601
+ id: string(),
12602
+ label: string(),
12603
+ isAdmin: boolean().default(false),
12604
+ allowedProviders: AllowedProviderSchema,
12605
+ allowedDevices: AllowedDevicesSchema,
12606
+ tokenHash: string(),
12607
+ tokenPrefix: string(),
12608
+ createdAt: number(),
12609
+ lastUsedAt: number().optional()
12610
+ });
12611
+ object({
12612
+ id: string(),
12613
+ userId: string(),
12614
+ name: string(),
12615
+ tokenHash: string(),
12616
+ tokenPrefix: string(),
12617
+ scopes: array(TokenScopeSchema),
12618
+ expiresAt: number().nullish(),
12619
+ lastUsedAt: number().nullish(),
12620
+ createdAt: number()
12621
+ });
12622
+ /** What a share-view grant lets its holder see. */
12623
+ var ShareViewGrantSchema = object({
12624
+ kind: _enum(SHARE_VIEW_KINDS),
12625
+ deviceIds: array(number().int().nonnegative()).min(1).max(64),
12626
+ /** Talk-back, opt-in at mint time; absent means off. */
12627
+ talk: boolean().optional()
12628
+ });
12629
+ var ShareViewScopeSchema = object({
12630
+ type: literal("share-view"),
12631
+ grant: ShareViewGrantSchema
12632
+ });
12633
+ var AddonRoutesScopeSchema = object({
12634
+ type: literal("addon-routes"),
12635
+ access: array(MethodAccessSchema).min(1)
12636
+ });
12637
+ var CredentialScopeSchema = union([
12638
+ literal("*"),
12639
+ ShareViewScopeSchema,
12640
+ AddonRoutesScopeSchema,
12641
+ TokenScopeSchema
12642
+ ]);
12643
+ object({
12644
+ kind: literal("credential"),
12645
+ sub: string().min(1),
12646
+ jti: string().min(16),
12647
+ scopes: array(CredentialScopeSchema).min(1)
12648
+ });
12420
12649
  _enum(["new-session", "step-up"]);
12421
12650
  /** The languages the hub's app landing pages are written in (D858). */
12422
12651
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -43554,202 +43783,6 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
43554
43783
  auth: "admin"
43555
43784
  }), method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" });
43556
43785
  /**
43557
- * Zod schemas for persisted record types.
43558
- *
43559
- * These schemas serve as the single source of truth for types that are
43560
- * stored in the settings-store backend and retrieved via tRPC. They
43561
- * replace the manual TypeScript interfaces with schema-derived types,
43562
- * enabling runtime validation when reading from the backend.
43563
- *
43564
- * Convention: each schema is named `<Type>Schema`, the inferred TS type
43565
- * keeps the original name for backward compatibility.
43566
- */
43567
- /**
43568
- * Auth model (v2 — 2026-05-12 caps-only):
43569
- *
43570
- * Two principals:
43571
- * - `isAdmin: true` — full bypass. Admin scope set is ignored.
43572
- * - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
43573
- *
43574
- * No role enum. There used to be `viewer / agent / scoped` and earlier
43575
- * `super_admin` — collapsed onto the single boolean because every
43576
- * non-admin caller is governed by the same scope-check rules; the
43577
- * distinction was only ever used to route role-specific procedures
43578
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
43579
- * with `isAdmin: false` + an explicit scope list.
43580
- */
43581
- /** Per-method access flavour. Materialised on every cap method via codegen. */
43582
- var MethodAccessSchema = _enum([
43583
- "view",
43584
- "create",
43585
- "delete"
43586
- ]);
43587
- /**
43588
- * A single scope grant. Three forms — checked in matcher with OR
43589
- * semantics; the first match decides whether the call passes:
43590
- *
43591
- * - `category` — broadest. `target: 'device' | 'system'` selects every
43592
- * cap with the matching `scope` declaration. New caps inherit grants
43593
- * automatically — adding a device cap to the codebase makes it
43594
- * reachable to every user with `category:device [...]` without a
43595
- * re-grant. Use this for "family viewer" / "operator" tiers.
43596
- *
43597
- * - `addon` — every cap that ships inside a given addon id. Niche;
43598
- * useful when an integration needs to interact with one specific
43599
- * addon's surface regardless of how many caps it exports.
43600
- *
43601
- * - `capability` — the most precise form. Single cap name. Use for
43602
- * integration tokens where you want to grant `addons.installPackage`
43603
- * and nothing else.
43604
- *
43605
- * `access` is REQUIRED with min 1 element. `admin` bypass is the
43606
- * "give me everything" escape; there is no wildcard scope.
43607
- */
43608
- var AllowedProviderSchema = union([literal("*"), array(string())]);
43609
- var AllowedDevicesSchema = record(string(), union([literal("*"), array(string())]));
43610
- var CapScopeSchema = _enum(["device", "system"]);
43611
- /**
43612
- * DeviceSelector (scope model v3 — 2026-08-12).
43613
- *
43614
- * A `device` grant no longer carries a frozen list of deviceIds. It carries
43615
- * a SELECTOR the matcher resolves against the live fleet, so the grant can be
43616
- * DYNAMIC: a `types:['camera']` selector automatically covers a camera added
43617
- * AFTER the grant was minted — no re-grant, no re-login.
43618
- *
43619
- * - `all` — every device in the deployment. The broad viewer/operator
43620
- * lever without a `category` grant (a `category` grant also covers device
43621
- * caps that carry no deviceId; `all` is specifically the device set).
43622
- * - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
43623
- * grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
43624
- * is NOT covered until the grant is edited.
43625
- * - `types` — every device of a `DeviceType` (e.g. every `camera`).
43626
- * DYNAMIC. A device that changes type, or a new device of the type,
43627
- * re-resolves on the next request.
43628
- * - `locations` — every device whose operator-assigned `location` label is
43629
- * in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
43630
- * null/unset location matches NO `locations` selector.
43631
- */
43632
- var DeviceSelectorSchema = discriminatedUnion("kind", [
43633
- object({ kind: literal("all") }),
43634
- object({
43635
- kind: literal("ids"),
43636
- ids: array(number().int()).min(1)
43637
- }),
43638
- object({
43639
- kind: literal("types"),
43640
- types: array(_enum(DeviceType)).min(1)
43641
- }),
43642
- object({
43643
- kind: literal("locations"),
43644
- locations: array(string().min(1)).min(1)
43645
- })
43646
- ]);
43647
- var DeviceTokenScopeSchema = object({
43648
- type: literal("device"),
43649
- /** The device SET this grant covers — resolved against the live fleet. */
43650
- selector: DeviceSelectorSchema,
43651
- access: array(MethodAccessSchema).min(1),
43652
- /**
43653
- * Whether a grant on a PARENT device transparently covers its accessory
43654
- * CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
43655
- * Direction is parent → children ONLY.
43656
- *
43657
- * Absent → the matcher DERIVES it from the access flavour: `view`
43658
- * inherits (a camera viewer sees the camera's accessories), `create` /
43659
- * `delete` do NOT (actuating/removing a child is an explicit act the
43660
- * operator must grant on the child, not inherit from the parent). Set it
43661
- * explicitly to override that default per grant.
43662
- */
43663
- includeLinked: boolean().optional()
43664
- });
43665
- /**
43666
- * v2 → v3 lazy migration. A pre-v3 `device` grant carried
43667
- * `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
43668
- * `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
43669
- * EVERY parse path — stored records AND the JWT-carried scope arrays
43670
- * normalised at the request boundary ({@link normalizeTokenScopes} in
43671
- * `device-selector.ts`). Chosen over a one-time DB migration because a
43672
- * migration cannot reach a JWT already in a client's hands; parse-time
43673
- * migration covers both without a flag day. No cast — the raw object is read
43674
- * through `Reflect.get` (its static type is `unknown`).
43675
- */
43676
- function migrateLegacyTokenScope(raw) {
43677
- if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
43678
- if (Reflect.get(raw, "type") !== "device") return raw;
43679
- if (Reflect.get(raw, "selector") !== void 0) return raw;
43680
- const targets = Reflect.get(raw, "targets");
43681
- if (!Array.isArray(targets)) return raw;
43682
- return {
43683
- type: "device",
43684
- selector: {
43685
- kind: "ids",
43686
- ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
43687
- },
43688
- access: Reflect.get(raw, "access")
43689
- };
43690
- }
43691
- var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
43692
- object({
43693
- type: literal("category"),
43694
- target: CapScopeSchema,
43695
- access: array(MethodAccessSchema).min(1)
43696
- }),
43697
- object({
43698
- type: literal("capability"),
43699
- target: string(),
43700
- access: array(MethodAccessSchema).min(1)
43701
- }),
43702
- object({
43703
- type: literal("addon"),
43704
- target: string(),
43705
- access: array(MethodAccessSchema).min(1)
43706
- }),
43707
- DeviceTokenScopeSchema
43708
- ]));
43709
- object({
43710
- id: string(),
43711
- username: string(),
43712
- passwordHash: string(),
43713
- /**
43714
- * Admin bypass. When true, the middleware skips the scope-access
43715
- * check entirely. There is no other axis of privilege; the legacy
43716
- * role enum collapsed onto this boolean in v2.
43717
- */
43718
- isAdmin: boolean().default(false),
43719
- allowedProviders: AllowedProviderSchema,
43720
- allowedDevices: AllowedDevicesSchema,
43721
- /**
43722
- * Scopes granted to this user. Admins bypass; their `scopes` is
43723
- * ignored. Non-admins without scopes are locked out of every
43724
- * protected call.
43725
- */
43726
- scopes: array(TokenScopeSchema).default([]),
43727
- createdAt: number(),
43728
- updatedAt: number()
43729
- });
43730
- object({
43731
- id: string(),
43732
- label: string(),
43733
- isAdmin: boolean().default(false),
43734
- allowedProviders: AllowedProviderSchema,
43735
- allowedDevices: AllowedDevicesSchema,
43736
- tokenHash: string(),
43737
- tokenPrefix: string(),
43738
- createdAt: number(),
43739
- lastUsedAt: number().optional()
43740
- });
43741
- object({
43742
- id: string(),
43743
- userId: string(),
43744
- name: string(),
43745
- tokenHash: string(),
43746
- tokenPrefix: string(),
43747
- scopes: array(TokenScopeSchema),
43748
- expiresAt: number().nullish(),
43749
- lastUsedAt: number().nullish(),
43750
- createdAt: number()
43751
- });
43752
- /**
43753
43786
  * `oauth-integration` — a collection cap by which an addon declares
43754
43787
  * itself a linkable OAuth client of the hub's core `/oauth2/*` server.
43755
43788
  * Each provider returns a static descriptor; the core enumerates them
@@ -7831,6 +7831,12 @@ function normalizeAddonInitResult(result) {
7831
7831
  if (Array.isArray(result)) return { providers: result };
7832
7832
  return result;
7833
7833
  }
7834
+ /**
7835
+ * The share-view scope kinds a `csv_*` share token can carry. The hub mints
7836
+ * and validates them (`share-token.service.ts` builds its enum from this
7837
+ * list); a data plane names the kinds it ACCEPTS in `share`.
7838
+ */
7839
+ var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7834
7840
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
7835
7841
  var PeerBytesTicketSchema = object({
7836
7842
  /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
@@ -12415,6 +12421,229 @@ var ConvertResultSchema = object({
12415
12421
  files: array(string()).readonly()
12416
12422
  })).readonly()
12417
12423
  });
12424
+ /**
12425
+ * Zod schemas for persisted record types.
12426
+ *
12427
+ * These schemas serve as the single source of truth for types that are
12428
+ * stored in the settings-store backend and retrieved via tRPC. They
12429
+ * replace the manual TypeScript interfaces with schema-derived types,
12430
+ * enabling runtime validation when reading from the backend.
12431
+ *
12432
+ * Convention: each schema is named `<Type>Schema`, the inferred TS type
12433
+ * keeps the original name for backward compatibility.
12434
+ */
12435
+ /**
12436
+ * Auth model (v2 — 2026-05-12 caps-only):
12437
+ *
12438
+ * Two principals:
12439
+ * - `isAdmin: true` — full bypass. Admin scope set is ignored.
12440
+ * - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
12441
+ *
12442
+ * No role enum. There used to be `viewer / agent / scoped` and earlier
12443
+ * `super_admin` — collapsed onto the single boolean because every
12444
+ * non-admin caller is governed by the same scope-check rules; the
12445
+ * distinction was only ever used to route role-specific procedures
12446
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
12447
+ * with `isAdmin: false` + an explicit scope list.
12448
+ */
12449
+ /** Per-method access flavour. Materialised on every cap method via codegen. */
12450
+ var MethodAccessSchema = _enum([
12451
+ "view",
12452
+ "create",
12453
+ "delete"
12454
+ ]);
12455
+ /**
12456
+ * A single scope grant. Three forms — checked in matcher with OR
12457
+ * semantics; the first match decides whether the call passes:
12458
+ *
12459
+ * - `category` — broadest. `target: 'device' | 'system'` selects every
12460
+ * cap with the matching `scope` declaration. New caps inherit grants
12461
+ * automatically — adding a device cap to the codebase makes it
12462
+ * reachable to every user with `category:device [...]` without a
12463
+ * re-grant. Use this for "family viewer" / "operator" tiers.
12464
+ *
12465
+ * - `addon` — every cap that ships inside a given addon id. Niche;
12466
+ * useful when an integration needs to interact with one specific
12467
+ * addon's surface regardless of how many caps it exports.
12468
+ *
12469
+ * - `capability` — the most precise form. Single cap name. Use for
12470
+ * integration tokens where you want to grant `addons.installPackage`
12471
+ * and nothing else.
12472
+ *
12473
+ * `access` is REQUIRED with min 1 element. `admin` bypass is the
12474
+ * "give me everything" escape; there is no wildcard scope.
12475
+ */
12476
+ var AllowedProviderSchema = union([literal("*"), array(string())]);
12477
+ var AllowedDevicesSchema = record(string(), union([literal("*"), array(string())]));
12478
+ var CapScopeSchema = _enum(["device", "system"]);
12479
+ /**
12480
+ * DeviceSelector (scope model v3 — 2026-08-12).
12481
+ *
12482
+ * A `device` grant no longer carries a frozen list of deviceIds. It carries
12483
+ * a SELECTOR the matcher resolves against the live fleet, so the grant can be
12484
+ * DYNAMIC: a `types:['camera']` selector automatically covers a camera added
12485
+ * AFTER the grant was minted — no re-grant, no re-login.
12486
+ *
12487
+ * - `all` — every device in the deployment. The broad viewer/operator
12488
+ * lever without a `category` grant (a `category` grant also covers device
12489
+ * caps that carry no deviceId; `all` is specifically the device set).
12490
+ * - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
12491
+ * grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
12492
+ * is NOT covered until the grant is edited.
12493
+ * - `types` — every device of a `DeviceType` (e.g. every `camera`).
12494
+ * DYNAMIC. A device that changes type, or a new device of the type,
12495
+ * re-resolves on the next request.
12496
+ * - `locations` — every device whose operator-assigned `location` label is
12497
+ * in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
12498
+ * null/unset location matches NO `locations` selector.
12499
+ */
12500
+ var DeviceSelectorSchema = discriminatedUnion("kind", [
12501
+ object({ kind: literal("all") }),
12502
+ object({
12503
+ kind: literal("ids"),
12504
+ ids: array(number().int()).min(1)
12505
+ }),
12506
+ object({
12507
+ kind: literal("types"),
12508
+ types: array(_enum(DeviceType)).min(1)
12509
+ }),
12510
+ object({
12511
+ kind: literal("locations"),
12512
+ locations: array(string().min(1)).min(1)
12513
+ })
12514
+ ]);
12515
+ var DeviceTokenScopeSchema = object({
12516
+ type: literal("device"),
12517
+ /** The device SET this grant covers — resolved against the live fleet. */
12518
+ selector: DeviceSelectorSchema,
12519
+ access: array(MethodAccessSchema).min(1),
12520
+ /**
12521
+ * Whether a grant on a PARENT device transparently covers its accessory
12522
+ * CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
12523
+ * Direction is parent → children ONLY.
12524
+ *
12525
+ * Absent → the matcher DERIVES it from the access flavour: `view`
12526
+ * inherits (a camera viewer sees the camera's accessories), `create` /
12527
+ * `delete` do NOT (actuating/removing a child is an explicit act the
12528
+ * operator must grant on the child, not inherit from the parent). Set it
12529
+ * explicitly to override that default per grant.
12530
+ */
12531
+ includeLinked: boolean().optional()
12532
+ });
12533
+ /**
12534
+ * v2 → v3 lazy migration. A pre-v3 `device` grant carried
12535
+ * `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
12536
+ * `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
12537
+ * EVERY parse path — stored records AND the JWT-carried scope arrays
12538
+ * normalised at the request boundary ({@link normalizeTokenScopes} in
12539
+ * `device-selector.ts`). Chosen over a one-time DB migration because a
12540
+ * migration cannot reach a JWT already in a client's hands; parse-time
12541
+ * migration covers both without a flag day. No cast — the raw object is read
12542
+ * through `Reflect.get` (its static type is `unknown`).
12543
+ */
12544
+ function migrateLegacyTokenScope(raw) {
12545
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
12546
+ if (Reflect.get(raw, "type") !== "device") return raw;
12547
+ if (Reflect.get(raw, "selector") !== void 0) return raw;
12548
+ const targets = Reflect.get(raw, "targets");
12549
+ if (!Array.isArray(targets)) return raw;
12550
+ return {
12551
+ type: "device",
12552
+ selector: {
12553
+ kind: "ids",
12554
+ ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
12555
+ },
12556
+ access: Reflect.get(raw, "access")
12557
+ };
12558
+ }
12559
+ var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
12560
+ object({
12561
+ type: literal("category"),
12562
+ target: CapScopeSchema,
12563
+ access: array(MethodAccessSchema).min(1)
12564
+ }),
12565
+ object({
12566
+ type: literal("capability"),
12567
+ target: string(),
12568
+ access: array(MethodAccessSchema).min(1)
12569
+ }),
12570
+ object({
12571
+ type: literal("addon"),
12572
+ target: string(),
12573
+ access: array(MethodAccessSchema).min(1)
12574
+ }),
12575
+ DeviceTokenScopeSchema
12576
+ ]));
12577
+ object({
12578
+ id: string(),
12579
+ username: string(),
12580
+ passwordHash: string(),
12581
+ /**
12582
+ * Admin bypass. When true, the middleware skips the scope-access
12583
+ * check entirely. There is no other axis of privilege; the legacy
12584
+ * role enum collapsed onto this boolean in v2.
12585
+ */
12586
+ isAdmin: boolean().default(false),
12587
+ allowedProviders: AllowedProviderSchema,
12588
+ allowedDevices: AllowedDevicesSchema,
12589
+ /**
12590
+ * Scopes granted to this user. Admins bypass; their `scopes` is
12591
+ * ignored. Non-admins without scopes are locked out of every
12592
+ * protected call.
12593
+ */
12594
+ scopes: array(TokenScopeSchema).default([]),
12595
+ createdAt: number(),
12596
+ updatedAt: number()
12597
+ });
12598
+ object({
12599
+ id: string(),
12600
+ label: string(),
12601
+ isAdmin: boolean().default(false),
12602
+ allowedProviders: AllowedProviderSchema,
12603
+ allowedDevices: AllowedDevicesSchema,
12604
+ tokenHash: string(),
12605
+ tokenPrefix: string(),
12606
+ createdAt: number(),
12607
+ lastUsedAt: number().optional()
12608
+ });
12609
+ object({
12610
+ id: string(),
12611
+ userId: string(),
12612
+ name: string(),
12613
+ tokenHash: string(),
12614
+ tokenPrefix: string(),
12615
+ scopes: array(TokenScopeSchema),
12616
+ expiresAt: number().nullish(),
12617
+ lastUsedAt: number().nullish(),
12618
+ createdAt: number()
12619
+ });
12620
+ /** What a share-view grant lets its holder see. */
12621
+ var ShareViewGrantSchema = object({
12622
+ kind: _enum(SHARE_VIEW_KINDS),
12623
+ deviceIds: array(number().int().nonnegative()).min(1).max(64),
12624
+ /** Talk-back, opt-in at mint time; absent means off. */
12625
+ talk: boolean().optional()
12626
+ });
12627
+ var ShareViewScopeSchema = object({
12628
+ type: literal("share-view"),
12629
+ grant: ShareViewGrantSchema
12630
+ });
12631
+ var AddonRoutesScopeSchema = object({
12632
+ type: literal("addon-routes"),
12633
+ access: array(MethodAccessSchema).min(1)
12634
+ });
12635
+ var CredentialScopeSchema = union([
12636
+ literal("*"),
12637
+ ShareViewScopeSchema,
12638
+ AddonRoutesScopeSchema,
12639
+ TokenScopeSchema
12640
+ ]);
12641
+ object({
12642
+ kind: literal("credential"),
12643
+ sub: string().min(1),
12644
+ jti: string().min(16),
12645
+ scopes: array(CredentialScopeSchema).min(1)
12646
+ });
12418
12647
  _enum(["new-session", "step-up"]);
12419
12648
  /** The languages the hub's app landing pages are written in (D858). */
12420
12649
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -43552,202 +43781,6 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
43552
43781
  auth: "admin"
43553
43782
  }), method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" });
43554
43783
  /**
43555
- * Zod schemas for persisted record types.
43556
- *
43557
- * These schemas serve as the single source of truth for types that are
43558
- * stored in the settings-store backend and retrieved via tRPC. They
43559
- * replace the manual TypeScript interfaces with schema-derived types,
43560
- * enabling runtime validation when reading from the backend.
43561
- *
43562
- * Convention: each schema is named `<Type>Schema`, the inferred TS type
43563
- * keeps the original name for backward compatibility.
43564
- */
43565
- /**
43566
- * Auth model (v2 — 2026-05-12 caps-only):
43567
- *
43568
- * Two principals:
43569
- * - `isAdmin: true` — full bypass. Admin scope set is ignored.
43570
- * - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
43571
- *
43572
- * No role enum. There used to be `viewer / agent / scoped` and earlier
43573
- * `super_admin` — collapsed onto the single boolean because every
43574
- * non-admin caller is governed by the same scope-check rules; the
43575
- * distinction was only ever used to route role-specific procedures
43576
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
43577
- * with `isAdmin: false` + an explicit scope list.
43578
- */
43579
- /** Per-method access flavour. Materialised on every cap method via codegen. */
43580
- var MethodAccessSchema = _enum([
43581
- "view",
43582
- "create",
43583
- "delete"
43584
- ]);
43585
- /**
43586
- * A single scope grant. Three forms — checked in matcher with OR
43587
- * semantics; the first match decides whether the call passes:
43588
- *
43589
- * - `category` — broadest. `target: 'device' | 'system'` selects every
43590
- * cap with the matching `scope` declaration. New caps inherit grants
43591
- * automatically — adding a device cap to the codebase makes it
43592
- * reachable to every user with `category:device [...]` without a
43593
- * re-grant. Use this for "family viewer" / "operator" tiers.
43594
- *
43595
- * - `addon` — every cap that ships inside a given addon id. Niche;
43596
- * useful when an integration needs to interact with one specific
43597
- * addon's surface regardless of how many caps it exports.
43598
- *
43599
- * - `capability` — the most precise form. Single cap name. Use for
43600
- * integration tokens where you want to grant `addons.installPackage`
43601
- * and nothing else.
43602
- *
43603
- * `access` is REQUIRED with min 1 element. `admin` bypass is the
43604
- * "give me everything" escape; there is no wildcard scope.
43605
- */
43606
- var AllowedProviderSchema = union([literal("*"), array(string())]);
43607
- var AllowedDevicesSchema = record(string(), union([literal("*"), array(string())]));
43608
- var CapScopeSchema = _enum(["device", "system"]);
43609
- /**
43610
- * DeviceSelector (scope model v3 — 2026-08-12).
43611
- *
43612
- * A `device` grant no longer carries a frozen list of deviceIds. It carries
43613
- * a SELECTOR the matcher resolves against the live fleet, so the grant can be
43614
- * DYNAMIC: a `types:['camera']` selector automatically covers a camera added
43615
- * AFTER the grant was minted — no re-grant, no re-login.
43616
- *
43617
- * - `all` — every device in the deployment. The broad viewer/operator
43618
- * lever without a `category` grant (a `category` grant also covers device
43619
- * caps that carry no deviceId; `all` is specifically the device set).
43620
- * - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
43621
- * grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
43622
- * is NOT covered until the grant is edited.
43623
- * - `types` — every device of a `DeviceType` (e.g. every `camera`).
43624
- * DYNAMIC. A device that changes type, or a new device of the type,
43625
- * re-resolves on the next request.
43626
- * - `locations` — every device whose operator-assigned `location` label is
43627
- * in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
43628
- * null/unset location matches NO `locations` selector.
43629
- */
43630
- var DeviceSelectorSchema = discriminatedUnion("kind", [
43631
- object({ kind: literal("all") }),
43632
- object({
43633
- kind: literal("ids"),
43634
- ids: array(number().int()).min(1)
43635
- }),
43636
- object({
43637
- kind: literal("types"),
43638
- types: array(_enum(DeviceType)).min(1)
43639
- }),
43640
- object({
43641
- kind: literal("locations"),
43642
- locations: array(string().min(1)).min(1)
43643
- })
43644
- ]);
43645
- var DeviceTokenScopeSchema = object({
43646
- type: literal("device"),
43647
- /** The device SET this grant covers — resolved against the live fleet. */
43648
- selector: DeviceSelectorSchema,
43649
- access: array(MethodAccessSchema).min(1),
43650
- /**
43651
- * Whether a grant on a PARENT device transparently covers its accessory
43652
- * CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
43653
- * Direction is parent → children ONLY.
43654
- *
43655
- * Absent → the matcher DERIVES it from the access flavour: `view`
43656
- * inherits (a camera viewer sees the camera's accessories), `create` /
43657
- * `delete` do NOT (actuating/removing a child is an explicit act the
43658
- * operator must grant on the child, not inherit from the parent). Set it
43659
- * explicitly to override that default per grant.
43660
- */
43661
- includeLinked: boolean().optional()
43662
- });
43663
- /**
43664
- * v2 → v3 lazy migration. A pre-v3 `device` grant carried
43665
- * `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
43666
- * `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
43667
- * EVERY parse path — stored records AND the JWT-carried scope arrays
43668
- * normalised at the request boundary ({@link normalizeTokenScopes} in
43669
- * `device-selector.ts`). Chosen over a one-time DB migration because a
43670
- * migration cannot reach a JWT already in a client's hands; parse-time
43671
- * migration covers both without a flag day. No cast — the raw object is read
43672
- * through `Reflect.get` (its static type is `unknown`).
43673
- */
43674
- function migrateLegacyTokenScope(raw) {
43675
- if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
43676
- if (Reflect.get(raw, "type") !== "device") return raw;
43677
- if (Reflect.get(raw, "selector") !== void 0) return raw;
43678
- const targets = Reflect.get(raw, "targets");
43679
- if (!Array.isArray(targets)) return raw;
43680
- return {
43681
- type: "device",
43682
- selector: {
43683
- kind: "ids",
43684
- ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
43685
- },
43686
- access: Reflect.get(raw, "access")
43687
- };
43688
- }
43689
- var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
43690
- object({
43691
- type: literal("category"),
43692
- target: CapScopeSchema,
43693
- access: array(MethodAccessSchema).min(1)
43694
- }),
43695
- object({
43696
- type: literal("capability"),
43697
- target: string(),
43698
- access: array(MethodAccessSchema).min(1)
43699
- }),
43700
- object({
43701
- type: literal("addon"),
43702
- target: string(),
43703
- access: array(MethodAccessSchema).min(1)
43704
- }),
43705
- DeviceTokenScopeSchema
43706
- ]));
43707
- object({
43708
- id: string(),
43709
- username: string(),
43710
- passwordHash: string(),
43711
- /**
43712
- * Admin bypass. When true, the middleware skips the scope-access
43713
- * check entirely. There is no other axis of privilege; the legacy
43714
- * role enum collapsed onto this boolean in v2.
43715
- */
43716
- isAdmin: boolean().default(false),
43717
- allowedProviders: AllowedProviderSchema,
43718
- allowedDevices: AllowedDevicesSchema,
43719
- /**
43720
- * Scopes granted to this user. Admins bypass; their `scopes` is
43721
- * ignored. Non-admins without scopes are locked out of every
43722
- * protected call.
43723
- */
43724
- scopes: array(TokenScopeSchema).default([]),
43725
- createdAt: number(),
43726
- updatedAt: number()
43727
- });
43728
- object({
43729
- id: string(),
43730
- label: string(),
43731
- isAdmin: boolean().default(false),
43732
- allowedProviders: AllowedProviderSchema,
43733
- allowedDevices: AllowedDevicesSchema,
43734
- tokenHash: string(),
43735
- tokenPrefix: string(),
43736
- createdAt: number(),
43737
- lastUsedAt: number().optional()
43738
- });
43739
- object({
43740
- id: string(),
43741
- userId: string(),
43742
- name: string(),
43743
- tokenHash: string(),
43744
- tokenPrefix: string(),
43745
- scopes: array(TokenScopeSchema),
43746
- expiresAt: number().nullish(),
43747
- lastUsedAt: number().nullish(),
43748
- createdAt: number()
43749
- });
43750
- /**
43751
43784
  * `oauth-integration` — a collection cap by which an addon declares
43752
43785
  * itself a linkable OAuth client of the hub's core `/oauth2/*` server.
43753
43786
  * Each provider returns a static descriptor; the core enumerates them
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-smtp-nodemailer",
3
- "version": "1.2.124",
3
+ "version": "1.2.125",
4
4
  "description": "SMTP email provider addon for CamStack — wraps `nodemailer` and registers a `smtp-provider` cap collection entry. Used by notifier addons.",
5
5
  "keywords": [
6
6
  "camstack",