@camstack/server 1.2.188 → 1.2.189

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.
@@ -4023,7 +4023,7 @@ function createCapRouter_intercom(getProvider, createRemoteProxy) {
4023
4023
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
4024
4024
  return p.getStatus(methodInput);
4025
4025
  }),
4026
- startSession: trpc_middleware_js_1.adminProcedure
4026
+ startSession: trpc_middleware_js_1.protectedProcedure
4027
4027
  .input(types_54.intercomCapability.methods.startSession.input.loose())
4028
4028
  .output(types_54.intercomCapability.methods.startSession.output)
4029
4029
  .mutation(async ({ input, ctx }) => {
@@ -4032,7 +4032,7 @@ function createCapRouter_intercom(getProvider, createRemoteProxy) {
4032
4032
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
4033
4033
  return p.startSession(methodInput);
4034
4034
  }),
4035
- handleAnswer: trpc_middleware_js_1.adminProcedure
4035
+ handleAnswer: trpc_middleware_js_1.protectedProcedure
4036
4036
  .input(types_54.intercomCapability.methods.handleAnswer.input.loose())
4037
4037
  .output(types_54.intercomCapability.methods.handleAnswer.output)
4038
4038
  .mutation(async ({ input, ctx }) => {
@@ -4041,7 +4041,7 @@ function createCapRouter_intercom(getProvider, createRemoteProxy) {
4041
4041
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
4042
4042
  return p.handleAnswer(methodInput);
4043
4043
  }),
4044
- stopSession: trpc_middleware_js_1.adminProcedure
4044
+ stopSession: trpc_middleware_js_1.protectedProcedure
4045
4045
  .input(types_54.intercomCapability.methods.stopSession.input.loose())
4046
4046
  .output(types_54.intercomCapability.methods.stopSession.output)
4047
4047
  .mutation(async ({ input, ctx }) => {
@@ -4050,7 +4050,7 @@ function createCapRouter_intercom(getProvider, createRemoteProxy) {
4050
4050
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
4051
4051
  return p.stopSession(methodInput);
4052
4052
  }),
4053
- startTalkSession: trpc_middleware_js_1.adminProcedure
4053
+ startTalkSession: trpc_middleware_js_1.protectedProcedure
4054
4054
  .input(types_54.intercomCapability.methods.startTalkSession.input.loose())
4055
4055
  .output(types_54.intercomCapability.methods.startTalkSession.output)
4056
4056
  .mutation(async ({ input, ctx }) => {
@@ -4059,7 +4059,7 @@ function createCapRouter_intercom(getProvider, createRemoteProxy) {
4059
4059
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
4060
4060
  return p.startTalkSession(methodInput);
4061
4061
  }),
4062
- pushTalkAudio: trpc_middleware_js_1.adminProcedure
4062
+ pushTalkAudio: trpc_middleware_js_1.protectedProcedure
4063
4063
  .input(types_54.intercomCapability.methods.pushTalkAudio.input.loose())
4064
4064
  .output(types_54.intercomCapability.methods.pushTalkAudio.output)
4065
4065
  .mutation(async ({ input, ctx }) => {
@@ -4068,7 +4068,7 @@ function createCapRouter_intercom(getProvider, createRemoteProxy) {
4068
4068
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
4069
4069
  return p.pushTalkAudio(methodInput);
4070
4070
  }),
4071
- endTalkSession: trpc_middleware_js_1.adminProcedure
4071
+ endTalkSession: trpc_middleware_js_1.protectedProcedure
4072
4072
  .input(types_54.intercomCapability.methods.endTalkSession.input.loose())
4073
4073
  .output(types_54.intercomCapability.methods.endTalkSession.output)
4074
4074
  .mutation(async ({ input, ctx }) => {
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DEVICE_ENUMERATION_METHODS = void 0;
4
+ exports.referencedDeviceIds = referencedDeviceIds;
4
5
  exports.checkScopeAccess = checkScopeAccess;
5
6
  /**
6
7
  * Pure scope-access matcher.
@@ -107,6 +108,10 @@ exports.DEVICE_ENUMERATION_METHODS = new Set(['deviceManager.listAll']);
107
108
  * {@link METHOD_DEVICE_SELECTORS}. Absent / null / malformed values are
108
109
  * skipped: an optional `deviceId` that was not sent references no device, and
109
110
  * `linkDeviceId: null` means "clear the link".
111
+ *
112
+ * Exported because the tRPC `onError` logger needs the same answer: a refusal
113
+ * on a device-scoped path has to say WHICH camera
114
+ * (`trpc-error-device-tags.ts`).
110
115
  */
111
116
  function referencedDeviceIds(path, input) {
112
117
  const fields = types_1.METHOD_DEVICE_SELECTORS[path];
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ /**
3
+ * A tRPC error line about a camera has to say WHICH camera.
4
+ *
5
+ * Sibling of `trpc-error-principal.ts`, and the same failure one field over.
6
+ * That one exists because a refusal did not say WHO; this one because a refusal
7
+ * did not say WHAT. On 2026-08-29 a scoped user was refused four times on
8
+ * `intercom.startSession`, and the four lines carried code, path, principal and
9
+ * message — but no `deviceId`. "Is talk-back broken on every camera, or on the
10
+ * doorbell?" is the first question asked, and the log could not answer it. The
11
+ * repo rule is unconditional: every log line about a device carries
12
+ * `tags: { deviceId }` with the numeric id.
13
+ *
14
+ * The deviceIds are read from the request input through the SAME codegen'd
15
+ * selector table the scope matcher uses (`METHOD_DEVICE_SELECTORS`, via
16
+ * `referencedDeviceIds`), so a path that gains or loses a `deviceId` field
17
+ * cannot leave the log tag behind.
18
+ *
19
+ * A request naming several devices tags the FIRST and records the count —
20
+ * `tags` is a flat index-friendly map, and a batch refusal is one event about
21
+ * one call, not N events. `deviceCount` is what tells a reader the line is
22
+ * about a batch rather than a single camera.
23
+ */
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.trpcErrorDeviceTags = trpcErrorDeviceTags;
26
+ const scope_access_js_1 = require("./scope-access.js");
27
+ /**
28
+ * Device tags for a tRPC error line. Returns `{}` — never a partial or a
29
+ * placeholder id — when the path names no device: a system-scope call is not
30
+ * "about device 0".
31
+ */
32
+ function trpcErrorDeviceTags(path, input) {
33
+ if (path === undefined)
34
+ return {};
35
+ const ids = (0, scope_access_js_1.referencedDeviceIds)(path, input);
36
+ const first = ids[0];
37
+ if (first === undefined)
38
+ return {};
39
+ return ids.length > 1 ? { deviceId: first, deviceCount: ids.length } : { deviceId: first };
40
+ }
package/dist/main.js CHANGED
@@ -75,6 +75,7 @@ const http_request_census_singleton_1 = require("./api/trpc/http-request-census.
75
75
  const trpc_context_1 = require("./api/trpc/trpc.context");
76
76
  const trpc_router_1 = require("./api/trpc/trpc.router");
77
77
  const trpc_error_principal_1 = require("./api/trpc/trpc-error-principal");
78
+ const trpc_error_device_tags_1 = require("./api/trpc/trpc-error-device-tags");
78
79
  const ws_request_census_1 = require("./api/trpc/ws-request-census");
79
80
  const addon_route_jwt_gate_js_1 = require("./auth/addon-route-jwt-gate.js");
80
81
  const session_cookie_js_1 = require("./auth/session-cookie.js");
@@ -596,9 +597,13 @@ async function bootstrap() {
596
597
  (0, http_request_census_hook_1.recordTrpcHttpRequest)(httpRequestCensus, req, trpcCtx.user);
597
598
  return trpcCtx;
598
599
  },
599
- onError: ({ path: trpcPath, error, ctx, }) => {
600
+ onError: ({ path: trpcPath, error, ctx, input, }) => {
600
601
  const trpcLogger = app.get(logging_service_1.LoggingService).createLogger('tRPC');
601
602
  trpcLogger.warn('tRPC error', {
603
+ // WHICH camera. A refusal on a device-scoped path that names no
604
+ // deviceId cannot answer "one camera or all of them?" — the
605
+ // question always asked first (2026-08-29, `intercom.startSession`).
606
+ tags: (0, trpc_error_device_tags_1.trpcErrorDeviceTags)(trpcPath, input),
602
607
  meta: {
603
608
  code: error.code,
604
609
  path: trpcPath ?? '?',
@@ -1175,9 +1180,12 @@ async function bootstrap() {
1175
1180
  (0, ws_request_census_1.identifyWsCensusSession)(opts.res, (0, trpc_error_principal_1.describeTrpcPrincipal)(wsCtx.user));
1176
1181
  return wsCtx;
1177
1182
  },
1178
- onError: ({ path: trpcPath, error, ctx, }) => {
1183
+ onError: ({ path: trpcPath, error, ctx, input, }) => {
1179
1184
  const trpcLogger = app.get(logging_service_1.LoggingService).createLogger('tRPC:ws');
1180
1185
  trpcLogger.warn('tRPC error', {
1186
+ // The socket the viewer uses — this is the transport that logged the
1187
+ // four `intercom.startSession` refusals with no camera on them.
1188
+ tags: (0, trpc_error_device_tags_1.trpcErrorDeviceTags)(trpcPath, input),
1181
1189
  meta: {
1182
1190
  code: error.code,
1183
1191
  path: trpcPath ?? '?',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.188",
3
+ "version": "1.2.189",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",