@camstack/types 1.2.68 → 1.2.69

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.
@@ -9450,9 +9450,72 @@ export type AppRouter = TrpcCoreRouter<{
9450
9450
  };
9451
9451
  isApiKey: boolean;
9452
9452
  agentId?: string | undefined;
9453
+ scope?: {
9454
+ isAdmin: boolean;
9455
+ allDevicesViewable: boolean;
9456
+ viewableDeviceCount: number;
9457
+ device: {
9458
+ view: {
9459
+ all: boolean;
9460
+ deviceCount: number;
9461
+ };
9462
+ create: {
9463
+ all: boolean;
9464
+ deviceCount: number;
9465
+ };
9466
+ delete: {
9467
+ all: boolean;
9468
+ deviceCount: number;
9469
+ };
9470
+ };
9471
+ system: readonly ("delete" | "view" | "create")[];
9472
+ capabilities: readonly {
9473
+ name: string;
9474
+ access: readonly ("delete" | "view" | "create")[];
9475
+ }[];
9476
+ addons: readonly {
9477
+ name: string;
9478
+ access: readonly ("delete" | "view" | "create")[];
9479
+ }[];
9480
+ } | undefined;
9453
9481
  } | null;
9454
9482
  meta: object;
9455
9483
  }>;
9484
+ previewScope: import("@trpc/server").TRPCQueryProcedure<{
9485
+ input: {
9486
+ scopes: unknown[];
9487
+ isAdmin?: boolean | undefined;
9488
+ };
9489
+ output: {
9490
+ isAdmin: boolean;
9491
+ allDevicesViewable: boolean;
9492
+ viewableDeviceCount: number;
9493
+ device: {
9494
+ view: {
9495
+ all: boolean;
9496
+ deviceCount: number;
9497
+ };
9498
+ create: {
9499
+ all: boolean;
9500
+ deviceCount: number;
9501
+ };
9502
+ delete: {
9503
+ all: boolean;
9504
+ deviceCount: number;
9505
+ };
9506
+ };
9507
+ system: readonly ("delete" | "view" | "create")[];
9508
+ capabilities: readonly {
9509
+ name: string;
9510
+ access: readonly ("delete" | "view" | "create")[];
9511
+ }[];
9512
+ addons: readonly {
9513
+ name: string;
9514
+ access: readonly ("delete" | "view" | "create")[];
9515
+ }[];
9516
+ };
9517
+ meta: object;
9518
+ }>;
9456
9519
  changeOwnPassword: import("@trpc/server").TRPCMutationProcedure<{
9457
9520
  input: {
9458
9521
  currentPassword: string;
@@ -9763,9 +9826,72 @@ export type AppRouter = TrpcCoreRouter<{
9763
9826
  };
9764
9827
  isApiKey: boolean;
9765
9828
  agentId?: string | undefined;
9829
+ scope?: {
9830
+ isAdmin: boolean;
9831
+ allDevicesViewable: boolean;
9832
+ viewableDeviceCount: number;
9833
+ device: {
9834
+ view: {
9835
+ all: boolean;
9836
+ deviceCount: number;
9837
+ };
9838
+ create: {
9839
+ all: boolean;
9840
+ deviceCount: number;
9841
+ };
9842
+ delete: {
9843
+ all: boolean;
9844
+ deviceCount: number;
9845
+ };
9846
+ };
9847
+ system: readonly ("delete" | "view" | "create")[];
9848
+ capabilities: readonly {
9849
+ name: string;
9850
+ access: readonly ("delete" | "view" | "create")[];
9851
+ }[];
9852
+ addons: readonly {
9853
+ name: string;
9854
+ access: readonly ("delete" | "view" | "create")[];
9855
+ }[];
9856
+ } | undefined;
9766
9857
  } | null;
9767
9858
  meta: object;
9768
9859
  }>;
9860
+ previewScope: import("@trpc/server").TRPCQueryProcedure<{
9861
+ input: {
9862
+ scopes: unknown[];
9863
+ isAdmin?: boolean | undefined;
9864
+ };
9865
+ output: {
9866
+ isAdmin: boolean;
9867
+ allDevicesViewable: boolean;
9868
+ viewableDeviceCount: number;
9869
+ device: {
9870
+ view: {
9871
+ all: boolean;
9872
+ deviceCount: number;
9873
+ };
9874
+ create: {
9875
+ all: boolean;
9876
+ deviceCount: number;
9877
+ };
9878
+ delete: {
9879
+ all: boolean;
9880
+ deviceCount: number;
9881
+ };
9882
+ };
9883
+ system: readonly ("delete" | "view" | "create")[];
9884
+ capabilities: readonly {
9885
+ name: string;
9886
+ access: readonly ("delete" | "view" | "create")[];
9887
+ }[];
9888
+ addons: readonly {
9889
+ name: string;
9890
+ access: readonly ("delete" | "view" | "create")[];
9891
+ }[];
9892
+ };
9893
+ meta: object;
9894
+ }>;
9769
9895
  changeOwnPassword: import("@trpc/server").TRPCMutationProcedure<{
9770
9896
  input: {
9771
9897
  currentPassword: string;
@@ -30,6 +30,7 @@ import { humidifierCapability } from '../capabilities/humidifier.cap.js';
30
30
  import { humiditySensorCapability } from '../capabilities/humidity-sensor.cap.js';
31
31
  import { imageCapability } from '../capabilities/image.cap.js';
32
32
  import { imageSettingsCapability } from '../capabilities/image-settings.cap.js';
33
+ import { intercomCapability } from '../capabilities/intercom.cap.js';
33
34
  import { lawnMowerControlCapability } from '../capabilities/lawn-mower-control.cap.js';
34
35
  import { lockControlCapability } from '../capabilities/lock-control.cap.js';
35
36
  import { mediaPlayerCapability } from '../capabilities/media-player.cap.js';
@@ -104,6 +105,7 @@ export interface DeviceLocalState {
104
105
  humiditySensor: InferRuntimeState<typeof humiditySensorCapability>;
105
106
  image: InferRuntimeState<typeof imageCapability>;
106
107
  imageSettings: InferRuntimeState<typeof imageSettingsCapability>;
108
+ intercom: InferRuntimeState<typeof intercomCapability>;
107
109
  lawnMowerControl: InferRuntimeState<typeof lawnMowerControlCapability>;
108
110
  lockControl: InferRuntimeState<typeof lockControlCapability>;
109
111
  mediaPlayer: InferRuntimeState<typeof mediaPlayerCapability>;
@@ -188,6 +190,7 @@ export interface CapNameToRuntimeStateMap {
188
190
  'humidity-sensor': InferRuntimeState<typeof humiditySensorCapability>;
189
191
  'image': InferRuntimeState<typeof imageCapability>;
190
192
  'image-settings': InferRuntimeState<typeof imageSettingsCapability>;
193
+ 'intercom': InferRuntimeState<typeof intercomCapability>;
191
194
  'lawn-mower-control': InferRuntimeState<typeof lawnMowerControlCapability>;
192
195
  'lock-control': InferRuntimeState<typeof lockControlCapability>;
193
196
  'media-player': InferRuntimeState<typeof mediaPlayerCapability>;
@@ -135,6 +135,7 @@ export interface DeviceProxyState {
135
135
  readonly humiditySensor: SliceHandle<InferRuntimeState<typeof humiditySensorCapability>>;
136
136
  readonly image: SliceHandle<InferRuntimeState<typeof imageCapability>>;
137
137
  readonly imageSettings: SliceHandle<InferRuntimeState<typeof imageSettingsCapability>>;
138
+ readonly intercom: SliceHandle<InferRuntimeState<typeof intercomCapability>>;
138
139
  readonly lawnMowerControl: SliceHandle<InferRuntimeState<typeof lawnMowerControlCapability>>;
139
140
  readonly lockControl: SliceHandle<InferRuntimeState<typeof lockControlCapability>>;
140
141
  readonly mediaPlayer: SliceHandle<InferRuntimeState<typeof mediaPlayerCapability>>;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * AUTO-GENERATED by scripts/generate-method-device-selectors.ts — DO NOT EDIT.
3
+ *
4
+ * Where the DEVICE REFERENCES live in each cap method's input, so the scope
5
+ * matcher can apply the per-device check to SYSTEM-scope methods too (a
6
+ * system-scope cap that takes a deviceId was previously never device-filtered
7
+ * — see the generator header).
8
+ *
9
+ * Coverage: 330 methods carry a device reference, of which
10
+ * 124 are on SYSTEM-scope caps.
11
+ *
12
+ * Only TOP-LEVEL input fields appear here; a nested device id is not
13
+ * extractable by the middleware and is failed by the classification guard
14
+ * instead of passing unenforced.
15
+ */
16
+ /** How a device reference is carried: one number, or an array of numbers. */
17
+ export type DeviceRefForm = 'single' | 'array';
18
+ export interface DeviceRefField {
19
+ readonly name: string;
20
+ readonly form: DeviceRefForm;
21
+ /** When true the field may be absent or null — enforcement skips it. */
22
+ readonly optional: boolean;
23
+ }
24
+ export declare const METHOD_DEVICE_SELECTORS: Readonly<Record<string, readonly DeviceRefField[]>>;
25
+ /** Cap-method paths that carry a device reference AND live on a system-scope
26
+ * cap — the set the v3 device check newly reaches. */
27
+ export declare const SYSTEM_SCOPE_DEVICE_METHODS: readonly string[];
@@ -11,7 +11,7 @@ export interface RuntimeStatePolicy {
11
11
  }
12
12
  /**
13
13
  * Per-cap runtime-state policy, projected from every `*.cap.ts` that declares
14
- * `runtimeState`. 62 caps: 33 `restored`, 29 `session`.
14
+ * `runtimeState`. 63 caps: 33 `restored`, 30 `session`.
15
15
  *
16
16
  * A cap absent from this map has no runtime-state slice at all. A cap PRESENT
17
17
  * with `durability: 'session'` has one and has decided not to keep it.
@@ -13,4 +13,4 @@ export interface ScopePresetSpec {
13
13
  readonly rows: readonly TokenScope[];
14
14
  }
15
15
  export declare const SCOPE_PRESETS: readonly ScopePresetSpec[];
16
- export type ScopePresetId = "camera-viewer" | "camera-operator" | "cli-deployer" | "event-listener";
16
+ export type ScopePresetId = "camera-viewer" | "camera-operator" | "full-management" | "cli-deployer" | "event-listener";
package/dist/index.d.ts CHANGED
@@ -175,6 +175,8 @@ export { createDeviceProxy } from './generated/device-proxy.js';
175
175
  export { DEVICE_SCOPED_CAPS, isDeviceScopedCap } from './generated/device-scoped-caps.js';
176
176
  export type { MethodAccessRecord } from './generated/method-access-map.js';
177
177
  export { DEVICE_CAP_NAMES, KNOWN_CAP_NAMES, METHOD_ACCESS_MAP, SYSTEM_CAP_NAMES, } from './generated/method-access-map.js';
178
+ export type { DeviceRefField, DeviceRefForm } from './generated/method-device-selectors.js';
179
+ export { METHOD_DEVICE_SELECTORS, SYSTEM_SCOPE_DEVICE_METHODS, } from './generated/method-device-selectors.js';
178
180
  export { CAP_PROVIDER_KIND_MAP, getCapsByProviderKind, PROVIDER_KIND_CAP_NAMES, } from './generated/provider-kind-map.js';
179
181
  export type { RuntimeStatePolicy } from './generated/runtime-state-durability.js';
180
182
  export { isRestoredCap, RESTORED_CAP_NAMES, RUNTIME_STATE_POLICY, runtimeStatePolicyFor, } from './generated/runtime-state-durability.js';
@@ -195,7 +197,9 @@ export type { TimelapseCadencePair, TimelapsePreviewMode, TimelapseRule, Timelap
195
197
  export { assertTimelapseCadences, DEFAULT_TIMELAPSE_PREVIEW_TEXT, readTimelapseGeneratedAt, TIMELAPSE_DENSE_FLOOR_SEC, TimelapseRuleInputSchema, TimelapseRulePatchSchema, TimelapseRuleSchema, TimelapseTemplateSchema, } from './notification/timelapse-rule.js';
196
198
  export { DEFAULT_DETAIL_CROP_CONVENTION, DETAIL_CROP_PADDING_FIELD, DETAIL_CROP_PADDING_KEY, DETAIL_CROP_SECTION_ID, DETAIL_CROP_SQUARE_KEY, type DetailCropConvention, DetailCropConventionSchema, type DetailCropRect, deriveDetailCropRect, type HydratedSettingsSection, type HydratedSettingsView, pickDetailCropConvention, readDetailCropConvention, } from './pipeline/detail-crop.js';
197
199
  export { DEFAULT_NATIVE_LEASE_SETTINGS, NATIVE_LEASE_ACTIVITY_FIELD, NATIVE_LEASE_ACTIVITY_KEY, NATIVE_LEASE_ADMISSION_FIELD, NATIVE_LEASE_ADMISSION_KEY, NATIVE_LEASE_BUDGET_FIELD, NATIVE_LEASE_BUDGET_KEY, NATIVE_LEASE_HOLD_FIELD, NATIVE_LEASE_HOLD_KEY, NATIVE_LEASE_SECTION_ID, NATIVE_LEASE_TILE_BUDGET_FIELD, NATIVE_LEASE_TILE_BUDGET_KEY, type NativeLeaseAdmission, NativeLeaseAdmissionSchema, type NativeLeaseKnob, type NativeLeaseNumberKnob, type NativeLeaseSettings, type NativeLeaseSettingsOverride, NativeLeaseSettingsSchema, pickNativeLeaseOverride, readNativeLeaseOverride, } from './pipeline/native-lease.js';
198
- export { type ApiKeyRecord, ApiKeyRecordSchema, type CapScope, CapScopeSchema, type MethodAccess, MethodAccessSchema, type ScopedToken, ScopedTokenSchema, type TokenScope, TokenScopeSchema, type UserRecord, UserRecordSchema, } from './schemas/auth-records.js';
200
+ export { type ApiKeyRecord, ApiKeyRecordSchema, type CapScope, CapScopeSchema, type DeviceSelector, DeviceSelectorSchema, type DeviceTokenScope, type MethodAccess, MethodAccessSchema, type ScopedToken, ScopedTokenSchema, type TokenScope, TokenScopeSchema, type UserRecord, UserRecordSchema, } from './schemas/auth-records.js';
201
+ export { ACCESS_ROLES, type AccessRoleAssignment, type AccessRoleId, type AccessRoleSpec, buildRoleScopes, detectAccessRole, roleSpec, } from './schemas/access-roles.js';
202
+ export { type DeviceMetaLike, type DeviceReachSummary, deviceSelectorMatches, type EffectiveScope, normalizeTokenScopes, resolveViewableDeviceIds, type ScopeGrantSummary, scopeInherits, summarizeEffectiveScope, } from './schemas/device-selector.js';
199
203
  export type { CameraDetectionCapabilities, CameraMotionConfig, CameraNativeDetectionConfig, } from './types/camera-detection.js';
200
204
  export { DEVICE_TYPE_INFO, type DeviceTypeInfo } from './types/device-type.js';
201
205
  export * from './units/index.js';