@camstack/addon-training 0.1.59 → 0.1.60

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.
Files changed (20) hide show
  1. package/dist/{MotionZonesSettings-D3MA168j.mjs → MotionZonesSettings-BVAWM6Mp.mjs} +2 -2
  2. package/dist/{PrivacyMaskSettings-DlILfRb9.mjs → PrivacyMaskSettings-C6n5XvTF.mjs} +2 -2
  3. package/dist/{SceneMonitorEditor-DgOpS2v_.mjs → SceneMonitorEditor-YqjreNwk.mjs} +1 -1
  4. package/dist/_stub.js +12 -12
  5. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-BbkzYirO.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-D2t3iWfl.mjs} +4 -4
  6. package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DNz5PuiW.mjs +26 -0
  7. package/dist/{dist-DM9y4CJe.mjs → dist-CLSVfoxe.mjs} +229 -196
  8. package/dist/{dist-DfNFNGnO.js → dist-Co-Ch58W.js} +229 -196
  9. package/dist/{hostInit-SLlPYdLV.mjs → hostInit-BzYWXDTu.mjs} +3 -3
  10. package/dist/index.js +1 -1
  11. package/dist/orchestrator/training.addon.js +1 -1
  12. package/dist/orchestrator/training.addon.mjs +1 -1
  13. package/dist/{player-overlays-pM6iC4GI.mjs → player-overlays-CsC1EU9M.mjs} +1 -1
  14. package/dist/providers/modal/training-modal.addon.js +1 -1
  15. package/dist/providers/modal/training-modal.addon.mjs +1 -1
  16. package/dist/remoteEntry.js +1 -1
  17. package/dist/{responsive-BAAHnmTT.mjs → responsive-CqqXFNE0.mjs} +1 -1
  18. package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_training_page__remoteEntry_js-D81A7IJp.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_training_page__remoteEntry_js-mXPV__C7.mjs} +1 -1
  19. package/package.json +1 -1
  20. package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DlLXF7aF.mjs +0 -26
@@ -7929,6 +7929,12 @@ function normalizeAddonInitResult(result) {
7929
7929
  if (Array.isArray(result)) return { providers: result };
7930
7930
  return result;
7931
7931
  }
7932
+ /**
7933
+ * The share-view scope kinds a `csv_*` share token can carry. The hub mints
7934
+ * and validates them (`share-token.service.ts` builds its enum from this
7935
+ * list); a data plane names the kinds it ACCEPTS in `share`.
7936
+ */
7937
+ var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7932
7938
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
7933
7939
  var PeerBytesTicketSchema = object({
7934
7940
  /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
@@ -12790,6 +12796,229 @@ var ConvertResultSchema = object({
12790
12796
  files: array(string()).readonly()
12791
12797
  })).readonly()
12792
12798
  });
12799
+ /**
12800
+ * Zod schemas for persisted record types.
12801
+ *
12802
+ * These schemas serve as the single source of truth for types that are
12803
+ * stored in the settings-store backend and retrieved via tRPC. They
12804
+ * replace the manual TypeScript interfaces with schema-derived types,
12805
+ * enabling runtime validation when reading from the backend.
12806
+ *
12807
+ * Convention: each schema is named `<Type>Schema`, the inferred TS type
12808
+ * keeps the original name for backward compatibility.
12809
+ */
12810
+ /**
12811
+ * Auth model (v2 — 2026-05-12 caps-only):
12812
+ *
12813
+ * Two principals:
12814
+ * - `isAdmin: true` — full bypass. Admin scope set is ignored.
12815
+ * - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
12816
+ *
12817
+ * No role enum. There used to be `viewer / agent / scoped` and earlier
12818
+ * `super_admin` — collapsed onto the single boolean because every
12819
+ * non-admin caller is governed by the same scope-check rules; the
12820
+ * distinction was only ever used to route role-specific procedures
12821
+ * which we no longer have. CLI / webhook integrations are `cst_*` tokens
12822
+ * with `isAdmin: false` + an explicit scope list.
12823
+ */
12824
+ /** Per-method access flavour. Materialised on every cap method via codegen. */
12825
+ var MethodAccessSchema = _enum([
12826
+ "view",
12827
+ "create",
12828
+ "delete"
12829
+ ]);
12830
+ /**
12831
+ * A single scope grant. Three forms — checked in matcher with OR
12832
+ * semantics; the first match decides whether the call passes:
12833
+ *
12834
+ * - `category` — broadest. `target: 'device' | 'system'` selects every
12835
+ * cap with the matching `scope` declaration. New caps inherit grants
12836
+ * automatically — adding a device cap to the codebase makes it
12837
+ * reachable to every user with `category:device [...]` without a
12838
+ * re-grant. Use this for "family viewer" / "operator" tiers.
12839
+ *
12840
+ * - `addon` — every cap that ships inside a given addon id. Niche;
12841
+ * useful when an integration needs to interact with one specific
12842
+ * addon's surface regardless of how many caps it exports.
12843
+ *
12844
+ * - `capability` — the most precise form. Single cap name. Use for
12845
+ * integration tokens where you want to grant `addons.installPackage`
12846
+ * and nothing else.
12847
+ *
12848
+ * `access` is REQUIRED with min 1 element. `admin` bypass is the
12849
+ * "give me everything" escape; there is no wildcard scope.
12850
+ */
12851
+ var AllowedProviderSchema = union([literal("*"), array(string())]);
12852
+ var AllowedDevicesSchema = record(string(), union([literal("*"), array(string())]));
12853
+ var CapScopeSchema = _enum(["device", "system"]);
12854
+ /**
12855
+ * DeviceSelector (scope model v3 — 2026-08-12).
12856
+ *
12857
+ * A `device` grant no longer carries a frozen list of deviceIds. It carries
12858
+ * a SELECTOR the matcher resolves against the live fleet, so the grant can be
12859
+ * DYNAMIC: a `types:['camera']` selector automatically covers a camera added
12860
+ * AFTER the grant was minted — no re-grant, no re-login.
12861
+ *
12862
+ * - `all` — every device in the deployment. The broad viewer/operator
12863
+ * lever without a `category` grant (a `category` grant also covers device
12864
+ * caps that carry no deviceId; `all` is specifically the device set).
12865
+ * - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
12866
+ * grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
12867
+ * is NOT covered until the grant is edited.
12868
+ * - `types` — every device of a `DeviceType` (e.g. every `camera`).
12869
+ * DYNAMIC. A device that changes type, or a new device of the type,
12870
+ * re-resolves on the next request.
12871
+ * - `locations` — every device whose operator-assigned `location` label is
12872
+ * in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
12873
+ * null/unset location matches NO `locations` selector.
12874
+ */
12875
+ var DeviceSelectorSchema = discriminatedUnion("kind", [
12876
+ object({ kind: literal("all") }),
12877
+ object({
12878
+ kind: literal("ids"),
12879
+ ids: array(number().int()).min(1)
12880
+ }),
12881
+ object({
12882
+ kind: literal("types"),
12883
+ types: array(_enum(DeviceType)).min(1)
12884
+ }),
12885
+ object({
12886
+ kind: literal("locations"),
12887
+ locations: array(string().min(1)).min(1)
12888
+ })
12889
+ ]);
12890
+ var DeviceTokenScopeSchema = object({
12891
+ type: literal("device"),
12892
+ /** The device SET this grant covers — resolved against the live fleet. */
12893
+ selector: DeviceSelectorSchema,
12894
+ access: array(MethodAccessSchema).min(1),
12895
+ /**
12896
+ * Whether a grant on a PARENT device transparently covers its accessory
12897
+ * CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
12898
+ * Direction is parent → children ONLY.
12899
+ *
12900
+ * Absent → the matcher DERIVES it from the access flavour: `view`
12901
+ * inherits (a camera viewer sees the camera's accessories), `create` /
12902
+ * `delete` do NOT (actuating/removing a child is an explicit act the
12903
+ * operator must grant on the child, not inherit from the parent). Set it
12904
+ * explicitly to override that default per grant.
12905
+ */
12906
+ includeLinked: boolean().optional()
12907
+ });
12908
+ /**
12909
+ * v2 → v3 lazy migration. A pre-v3 `device` grant carried
12910
+ * `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
12911
+ * `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
12912
+ * EVERY parse path — stored records AND the JWT-carried scope arrays
12913
+ * normalised at the request boundary ({@link normalizeTokenScopes} in
12914
+ * `device-selector.ts`). Chosen over a one-time DB migration because a
12915
+ * migration cannot reach a JWT already in a client's hands; parse-time
12916
+ * migration covers both without a flag day. No cast — the raw object is read
12917
+ * through `Reflect.get` (its static type is `unknown`).
12918
+ */
12919
+ function migrateLegacyTokenScope(raw) {
12920
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
12921
+ if (Reflect.get(raw, "type") !== "device") return raw;
12922
+ if (Reflect.get(raw, "selector") !== void 0) return raw;
12923
+ const targets = Reflect.get(raw, "targets");
12924
+ if (!Array.isArray(targets)) return raw;
12925
+ return {
12926
+ type: "device",
12927
+ selector: {
12928
+ kind: "ids",
12929
+ ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
12930
+ },
12931
+ access: Reflect.get(raw, "access")
12932
+ };
12933
+ }
12934
+ var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
12935
+ object({
12936
+ type: literal("category"),
12937
+ target: CapScopeSchema,
12938
+ access: array(MethodAccessSchema).min(1)
12939
+ }),
12940
+ object({
12941
+ type: literal("capability"),
12942
+ target: string(),
12943
+ access: array(MethodAccessSchema).min(1)
12944
+ }),
12945
+ object({
12946
+ type: literal("addon"),
12947
+ target: string(),
12948
+ access: array(MethodAccessSchema).min(1)
12949
+ }),
12950
+ DeviceTokenScopeSchema
12951
+ ]));
12952
+ object({
12953
+ id: string(),
12954
+ username: string(),
12955
+ passwordHash: string(),
12956
+ /**
12957
+ * Admin bypass. When true, the middleware skips the scope-access
12958
+ * check entirely. There is no other axis of privilege; the legacy
12959
+ * role enum collapsed onto this boolean in v2.
12960
+ */
12961
+ isAdmin: boolean().default(false),
12962
+ allowedProviders: AllowedProviderSchema,
12963
+ allowedDevices: AllowedDevicesSchema,
12964
+ /**
12965
+ * Scopes granted to this user. Admins bypass; their `scopes` is
12966
+ * ignored. Non-admins without scopes are locked out of every
12967
+ * protected call.
12968
+ */
12969
+ scopes: array(TokenScopeSchema).default([]),
12970
+ createdAt: number(),
12971
+ updatedAt: number()
12972
+ });
12973
+ object({
12974
+ id: string(),
12975
+ label: string(),
12976
+ isAdmin: boolean().default(false),
12977
+ allowedProviders: AllowedProviderSchema,
12978
+ allowedDevices: AllowedDevicesSchema,
12979
+ tokenHash: string(),
12980
+ tokenPrefix: string(),
12981
+ createdAt: number(),
12982
+ lastUsedAt: number().optional()
12983
+ });
12984
+ object({
12985
+ id: string(),
12986
+ userId: string(),
12987
+ name: string(),
12988
+ tokenHash: string(),
12989
+ tokenPrefix: string(),
12990
+ scopes: array(TokenScopeSchema),
12991
+ expiresAt: number().nullish(),
12992
+ lastUsedAt: number().nullish(),
12993
+ createdAt: number()
12994
+ });
12995
+ /** What a share-view grant lets its holder see. */
12996
+ var ShareViewGrantSchema = object({
12997
+ kind: _enum(SHARE_VIEW_KINDS),
12998
+ deviceIds: array(number().int().nonnegative()).min(1).max(64),
12999
+ /** Talk-back, opt-in at mint time; absent means off. */
13000
+ talk: boolean().optional()
13001
+ });
13002
+ var ShareViewScopeSchema = object({
13003
+ type: literal("share-view"),
13004
+ grant: ShareViewGrantSchema
13005
+ });
13006
+ var AddonRoutesScopeSchema = object({
13007
+ type: literal("addon-routes"),
13008
+ access: array(MethodAccessSchema).min(1)
13009
+ });
13010
+ var CredentialScopeSchema = union([
13011
+ literal("*"),
13012
+ ShareViewScopeSchema,
13013
+ AddonRoutesScopeSchema,
13014
+ TokenScopeSchema
13015
+ ]);
13016
+ object({
13017
+ kind: literal("credential"),
13018
+ sub: string().min(1),
13019
+ jti: string().min(16),
13020
+ scopes: array(CredentialScopeSchema).min(1)
13021
+ });
12793
13022
  _enum(["new-session", "step-up"]);
12794
13023
  /** The languages the hub's app landing pages are written in (D858). */
12795
13024
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -43944,202 +44173,6 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
43944
44173
  auth: "admin"
43945
44174
  }), method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" });
43946
44175
  /**
43947
- * Zod schemas for persisted record types.
43948
- *
43949
- * These schemas serve as the single source of truth for types that are
43950
- * stored in the settings-store backend and retrieved via tRPC. They
43951
- * replace the manual TypeScript interfaces with schema-derived types,
43952
- * enabling runtime validation when reading from the backend.
43953
- *
43954
- * Convention: each schema is named `<Type>Schema`, the inferred TS type
43955
- * keeps the original name for backward compatibility.
43956
- */
43957
- /**
43958
- * Auth model (v2 — 2026-05-12 caps-only):
43959
- *
43960
- * Two principals:
43961
- * - `isAdmin: true` — full bypass. Admin scope set is ignored.
43962
- * - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
43963
- *
43964
- * No role enum. There used to be `viewer / agent / scoped` and earlier
43965
- * `super_admin` — collapsed onto the single boolean because every
43966
- * non-admin caller is governed by the same scope-check rules; the
43967
- * distinction was only ever used to route role-specific procedures
43968
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
43969
- * with `isAdmin: false` + an explicit scope list.
43970
- */
43971
- /** Per-method access flavour. Materialised on every cap method via codegen. */
43972
- var MethodAccessSchema = _enum([
43973
- "view",
43974
- "create",
43975
- "delete"
43976
- ]);
43977
- /**
43978
- * A single scope grant. Three forms — checked in matcher with OR
43979
- * semantics; the first match decides whether the call passes:
43980
- *
43981
- * - `category` — broadest. `target: 'device' | 'system'` selects every
43982
- * cap with the matching `scope` declaration. New caps inherit grants
43983
- * automatically — adding a device cap to the codebase makes it
43984
- * reachable to every user with `category:device [...]` without a
43985
- * re-grant. Use this for "family viewer" / "operator" tiers.
43986
- *
43987
- * - `addon` — every cap that ships inside a given addon id. Niche;
43988
- * useful when an integration needs to interact with one specific
43989
- * addon's surface regardless of how many caps it exports.
43990
- *
43991
- * - `capability` — the most precise form. Single cap name. Use for
43992
- * integration tokens where you want to grant `addons.installPackage`
43993
- * and nothing else.
43994
- *
43995
- * `access` is REQUIRED with min 1 element. `admin` bypass is the
43996
- * "give me everything" escape; there is no wildcard scope.
43997
- */
43998
- var AllowedProviderSchema = union([literal("*"), array(string())]);
43999
- var AllowedDevicesSchema = record(string(), union([literal("*"), array(string())]));
44000
- var CapScopeSchema = _enum(["device", "system"]);
44001
- /**
44002
- * DeviceSelector (scope model v3 — 2026-08-12).
44003
- *
44004
- * A `device` grant no longer carries a frozen list of deviceIds. It carries
44005
- * a SELECTOR the matcher resolves against the live fleet, so the grant can be
44006
- * DYNAMIC: a `types:['camera']` selector automatically covers a camera added
44007
- * AFTER the grant was minted — no re-grant, no re-login.
44008
- *
44009
- * - `all` — every device in the deployment. The broad viewer/operator
44010
- * lever without a `category` grant (a `category` grant also covers device
44011
- * caps that carry no deviceId; `all` is specifically the device set).
44012
- * - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
44013
- * grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
44014
- * is NOT covered until the grant is edited.
44015
- * - `types` — every device of a `DeviceType` (e.g. every `camera`).
44016
- * DYNAMIC. A device that changes type, or a new device of the type,
44017
- * re-resolves on the next request.
44018
- * - `locations` — every device whose operator-assigned `location` label is
44019
- * in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
44020
- * null/unset location matches NO `locations` selector.
44021
- */
44022
- var DeviceSelectorSchema = discriminatedUnion("kind", [
44023
- object({ kind: literal("all") }),
44024
- object({
44025
- kind: literal("ids"),
44026
- ids: array(number().int()).min(1)
44027
- }),
44028
- object({
44029
- kind: literal("types"),
44030
- types: array(_enum(DeviceType)).min(1)
44031
- }),
44032
- object({
44033
- kind: literal("locations"),
44034
- locations: array(string().min(1)).min(1)
44035
- })
44036
- ]);
44037
- var DeviceTokenScopeSchema = object({
44038
- type: literal("device"),
44039
- /** The device SET this grant covers — resolved against the live fleet. */
44040
- selector: DeviceSelectorSchema,
44041
- access: array(MethodAccessSchema).min(1),
44042
- /**
44043
- * Whether a grant on a PARENT device transparently covers its accessory
44044
- * CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
44045
- * Direction is parent → children ONLY.
44046
- *
44047
- * Absent → the matcher DERIVES it from the access flavour: `view`
44048
- * inherits (a camera viewer sees the camera's accessories), `create` /
44049
- * `delete` do NOT (actuating/removing a child is an explicit act the
44050
- * operator must grant on the child, not inherit from the parent). Set it
44051
- * explicitly to override that default per grant.
44052
- */
44053
- includeLinked: boolean().optional()
44054
- });
44055
- /**
44056
- * v2 → v3 lazy migration. A pre-v3 `device` grant carried
44057
- * `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
44058
- * `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
44059
- * EVERY parse path — stored records AND the JWT-carried scope arrays
44060
- * normalised at the request boundary ({@link normalizeTokenScopes} in
44061
- * `device-selector.ts`). Chosen over a one-time DB migration because a
44062
- * migration cannot reach a JWT already in a client's hands; parse-time
44063
- * migration covers both without a flag day. No cast — the raw object is read
44064
- * through `Reflect.get` (its static type is `unknown`).
44065
- */
44066
- function migrateLegacyTokenScope(raw) {
44067
- if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
44068
- if (Reflect.get(raw, "type") !== "device") return raw;
44069
- if (Reflect.get(raw, "selector") !== void 0) return raw;
44070
- const targets = Reflect.get(raw, "targets");
44071
- if (!Array.isArray(targets)) return raw;
44072
- return {
44073
- type: "device",
44074
- selector: {
44075
- kind: "ids",
44076
- ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
44077
- },
44078
- access: Reflect.get(raw, "access")
44079
- };
44080
- }
44081
- var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
44082
- object({
44083
- type: literal("category"),
44084
- target: CapScopeSchema,
44085
- access: array(MethodAccessSchema).min(1)
44086
- }),
44087
- object({
44088
- type: literal("capability"),
44089
- target: string(),
44090
- access: array(MethodAccessSchema).min(1)
44091
- }),
44092
- object({
44093
- type: literal("addon"),
44094
- target: string(),
44095
- access: array(MethodAccessSchema).min(1)
44096
- }),
44097
- DeviceTokenScopeSchema
44098
- ]));
44099
- object({
44100
- id: string(),
44101
- username: string(),
44102
- passwordHash: string(),
44103
- /**
44104
- * Admin bypass. When true, the middleware skips the scope-access
44105
- * check entirely. There is no other axis of privilege; the legacy
44106
- * role enum collapsed onto this boolean in v2.
44107
- */
44108
- isAdmin: boolean().default(false),
44109
- allowedProviders: AllowedProviderSchema,
44110
- allowedDevices: AllowedDevicesSchema,
44111
- /**
44112
- * Scopes granted to this user. Admins bypass; their `scopes` is
44113
- * ignored. Non-admins without scopes are locked out of every
44114
- * protected call.
44115
- */
44116
- scopes: array(TokenScopeSchema).default([]),
44117
- createdAt: number(),
44118
- updatedAt: number()
44119
- });
44120
- object({
44121
- id: string(),
44122
- label: string(),
44123
- isAdmin: boolean().default(false),
44124
- allowedProviders: AllowedProviderSchema,
44125
- allowedDevices: AllowedDevicesSchema,
44126
- tokenHash: string(),
44127
- tokenPrefix: string(),
44128
- createdAt: number(),
44129
- lastUsedAt: number().optional()
44130
- });
44131
- object({
44132
- id: string(),
44133
- userId: string(),
44134
- name: string(),
44135
- tokenHash: string(),
44136
- tokenPrefix: string(),
44137
- scopes: array(TokenScopeSchema),
44138
- expiresAt: number().nullish(),
44139
- lastUsedAt: number().nullish(),
44140
- createdAt: number()
44141
- });
44142
- /**
44143
44176
  * `oauth-integration` — a collection cap by which an addon declares
44144
44177
  * itself a linkable OAuth client of the hub's core `/oauth2/*` server.
44145
44178
  * Each provider returns a static descriptor; the core enumerates them