@camstack/server 1.2.300 → 1.2.302

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.
@@ -2811,6 +2811,65 @@ function createCapRouter_deviceManager(getProvider, createRemoteProxy) {
2811
2811
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
2812
2812
  return p.setLocationIcon(methodInput);
2813
2813
  }),
2814
+ listLocationDescriptions: trpc_middleware_js_1.protectedProcedure
2815
+ .input(zod_1.z.object({ nodeId: zod_1.z.string().optional() }).optional())
2816
+ .output(types_41.deviceManagerCapability.methods.listLocationDescriptions.output)
2817
+ .query(async ({ input, ctx }) => {
2818
+ const p = resolveProvider('device-manager', input?.nodeId, () => getProvider(ctx), createRemoteProxy);
2819
+ return p.listLocationDescriptions();
2820
+ }),
2821
+ setLocationDescription: trpc_middleware_js_1.adminProcedure
2822
+ .input(types_41.deviceManagerCapability.methods.setLocationDescription.input.loose())
2823
+ .output(types_41.deviceManagerCapability.methods.setLocationDescription.output)
2824
+ .mutation(async ({ input, ctx }) => {
2825
+ const { nodeId, ...methodInput } = input;
2826
+ const p = resolveProvider('device-manager', nodeId, () => getProvider(ctx), createRemoteProxy);
2827
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
2828
+ return p.setLocationDescription(methodInput);
2829
+ }),
2830
+ listSiteZones: trpc_middleware_js_1.protectedProcedure
2831
+ .input(zod_1.z.object({ nodeId: zod_1.z.string().optional() }).optional())
2832
+ .output(types_41.deviceManagerCapability.methods.listSiteZones.output)
2833
+ .query(async ({ input, ctx }) => {
2834
+ const p = resolveProvider('device-manager', input?.nodeId, () => getProvider(ctx), createRemoteProxy);
2835
+ return p.listSiteZones();
2836
+ }),
2837
+ setSiteZone: trpc_middleware_js_1.adminProcedure
2838
+ .input(types_41.deviceManagerCapability.methods.setSiteZone.input.loose())
2839
+ .output(types_41.deviceManagerCapability.methods.setSiteZone.output)
2840
+ .mutation(async ({ input, ctx }) => {
2841
+ const { nodeId, ...methodInput } = input;
2842
+ const p = resolveProvider('device-manager', nodeId, () => getProvider(ctx), createRemoteProxy);
2843
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
2844
+ return p.setSiteZone(methodInput);
2845
+ }),
2846
+ removeSiteZone: trpc_middleware_js_1.adminProcedure
2847
+ .input(types_41.deviceManagerCapability.methods.removeSiteZone.input.loose())
2848
+ .output(types_41.deviceManagerCapability.methods.removeSiteZone.output)
2849
+ .mutation(async ({ input, ctx }) => {
2850
+ const { nodeId, ...methodInput } = input;
2851
+ const p = resolveProvider('device-manager', nodeId, () => getProvider(ctx), createRemoteProxy);
2852
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
2853
+ return p.removeSiteZone(methodInput);
2854
+ }),
2855
+ renameSiteZone: trpc_middleware_js_1.adminProcedure
2856
+ .input(types_41.deviceManagerCapability.methods.renameSiteZone.input.loose())
2857
+ .output(types_41.deviceManagerCapability.methods.renameSiteZone.output)
2858
+ .mutation(async ({ input, ctx }) => {
2859
+ const { nodeId, ...methodInput } = input;
2860
+ const p = resolveProvider('device-manager', nodeId, () => getProvider(ctx), createRemoteProxy);
2861
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
2862
+ return p.renameSiteZone(methodInput);
2863
+ }),
2864
+ setLocationZone: trpc_middleware_js_1.adminProcedure
2865
+ .input(types_41.deviceManagerCapability.methods.setLocationZone.input.loose())
2866
+ .output(types_41.deviceManagerCapability.methods.setLocationZone.output)
2867
+ .mutation(async ({ input, ctx }) => {
2868
+ const { nodeId, ...methodInput } = input;
2869
+ const p = resolveProvider('device-manager', nodeId, () => getProvider(ctx), createRemoteProxy);
2870
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
2871
+ return p.setLocationZone(methodInput);
2872
+ }),
2814
2873
  setDisabled: trpc_middleware_js_1.adminProcedure
2815
2874
  .input(types_41.deviceManagerCapability.methods.setDisabled.input.loose())
2816
2875
  .output(types_41.deviceManagerCapability.methods.setDisabled.output)
@@ -17,6 +17,16 @@ const GRID_VIEW_OPEN_METHODS = new Set([
17
17
  'turnProvider.getTurnServers',
18
18
  'live.onEvent',
19
19
  ]);
20
+ /**
21
+ * Talk-back, callable only on a token minted with `scope.talk` AND only for an
22
+ * in-scope deviceId. Enumerated, never `intercom.*`: a namespace grant here
23
+ * would pick up whatever the cap grows next.
24
+ */
25
+ const GRID_VIEW_TALK_METHODS = new Set([
26
+ 'intercom.startSession',
27
+ 'intercom.handleAnswer',
28
+ 'intercom.stopSession',
29
+ ]);
20
30
  /**
21
31
  * Methods callable ONLY with an in-scope `input.deviceId`. A missing or
22
32
  * non-numeric deviceId is denied (fail closed).
@@ -135,7 +145,15 @@ function checkShareViewAccess(scope, path, input) {
135
145
  if (GRID_VIEW_OPEN_METHODS.has(path)) {
136
146
  return { ok: true };
137
147
  }
138
- if (GRID_VIEW_DEVICE_METHODS.has(path)) {
148
+ // Talk-back BEFORE the device enumeration, because it is the one gate that
149
+ // can refuse for a reason other than the device: a token that never asked
150
+ // for it must be told that, not told its camera is out of scope.
151
+ if (GRID_VIEW_TALK_METHODS.has(path)) {
152
+ if (scope.talk !== true) {
153
+ return { ok: false, reason: `'${path}' needs a share link minted with talk-back` };
154
+ }
155
+ }
156
+ if (GRID_VIEW_TALK_METHODS.has(path) || GRID_VIEW_DEVICE_METHODS.has(path)) {
139
157
  const deviceId = extractDeviceId(input);
140
158
  if (deviceId === null) {
141
159
  return { ok: false, reason: `'${path}' requires a numeric deviceId for share-view access` };
@@ -118,6 +118,22 @@ exports.SHARE_TOKEN_MAX_DEVICES = 64;
118
118
  exports.ShareTokenScopeSchema = zod_1.z.object({
119
119
  kind: zod_1.z.enum(types_1.SHARE_VIEW_KINDS),
120
120
  deviceIds: zod_1.z.array(zod_1.z.number().int().nonnegative()).min(1).max(exports.SHARE_TOKEN_MAX_DEVICES),
121
+ /**
122
+ * TALK-BACK, opt-in at mint time. Absent means OFF, and that is the whole
123
+ * point: a share link is handed to third parties, so the difference between
124
+ * "can watch the kitchen" and "can speak into the kitchen" must be a choice
125
+ * somebody made for THAT link, on the day they made it.
126
+ *
127
+ * It rides on the scope rather than widening the grid enumeration because
128
+ * the enumeration is retroactive: a method added there is granted to every
129
+ * token ever minted, including the one handed to a neighbour last week.
130
+ * `share-view-access.ts` says so about event history; the same rule with
131
+ * actuation into the home on the other end of it is not a smaller matter.
132
+ *
133
+ * It widens WHAT may be called, never WHICH cameras — `deviceIds` still
134
+ * gates every talk call.
135
+ */
136
+ talk: zod_1.z.boolean().optional(),
121
137
  });
122
138
  /** Persisted record — never leaves the server with `tokenHash` attached. */
123
139
  exports.ShareTokenRecordSchema = zod_1.z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.300",
3
+ "version": "1.2.302",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",
@@ -35,16 +35,16 @@
35
35
  ]
36
36
  },
37
37
  "dependencies": {
38
- "@camstack/addon-admin-ui": "1.2.207",
38
+ "@camstack/addon-admin-ui": "1.2.208",
39
39
  "@camstack/addon-agent-ui": "1.2.112",
40
40
  "@camstack/addon-auth": "1.2.114",
41
41
  "@camstack/addon-decoder-nodeav": "1.2.107",
42
42
  "@camstack/addon-notifiers": "1.2.111",
43
- "@camstack/addon-pipeline": "1.2.249",
44
- "@camstack/addon-pipeline-orchestrator": "1.2.212",
45
- "@camstack/addon-post-analysis": "1.2.252",
43
+ "@camstack/addon-pipeline": "1.2.250",
44
+ "@camstack/addon-pipeline-orchestrator": "1.2.213",
45
+ "@camstack/addon-post-analysis": "1.2.254",
46
46
  "@camstack/sdk": "1.2.110",
47
- "@camstack/system": "1.2.244",
47
+ "@camstack/system": "1.2.245",
48
48
  "@camstack/types": "1.2.204",
49
49
  "@camstack/ui-library": "1.2.169",
50
50
  "@fastify/compress": "^9.0.0",