@camstack/server 1.2.377 → 1.2.379

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.
@@ -63,6 +63,7 @@
63
63
  Object.defineProperty(exports, "__esModule", { value: true });
64
64
  exports.SOURCE_LISTING_METHOD = void 0;
65
65
  exports.requireDeviceCollection = requireDeviceCollection;
66
+ const system_1 = require("@camstack/system");
66
67
  const types_1 = require("@camstack/types");
67
68
  const server_1 = require("@trpc/server");
68
69
  /**
@@ -232,10 +233,32 @@ async function callSource(source, method, input, capName, deviceId) {
232
233
  if (typeof fn !== 'function') {
233
234
  throw new server_1.TRPCError({
234
235
  code: 'NOT_IMPLEMENTED',
235
- message: `Capability "${capName}" source "${source.addonId}" for device ${deviceId} does not implement "${method}"`,
236
+ message: notImplementedMessage(capName, source.addonId, deviceId, method),
236
237
  });
237
238
  }
238
- return await fn.call(source.provider, input);
239
+ // …and that check is VACUOUS for a forked provider: the UDS proxy fabricates
240
+ // a callable for every property, so the absence is only observable on the
241
+ // child. `child-cap-dispatch` answers a method declared `optionalMethod`
242
+ // with a prefixed message, which becomes the SAME refusal here — otherwise
243
+ // an honest "this source has no file behind it" arrives as
244
+ // INTERNAL_SERVER_ERROR and reads as a method somebody forgot.
245
+ try {
246
+ return await fn.call(source.provider, input);
247
+ }
248
+ catch (err) {
249
+ if (errMessage(err).includes(system_1.CAP_METHOD_NOT_IMPLEMENTED)) {
250
+ throw new server_1.TRPCError({
251
+ code: 'NOT_IMPLEMENTED',
252
+ message: notImplementedMessage(capName, source.addonId, deviceId, method),
253
+ });
254
+ }
255
+ throw err;
256
+ }
257
+ }
258
+ /** One sentence for both arms, so the two paths cannot describe the same fact
259
+ * differently. */
260
+ function notImplementedMessage(capName, addonId, deviceId, method) {
261
+ return `Capability "${capName}" source "${addonId}" for device ${deviceId} does not implement "${method}"`;
239
262
  }
240
263
  /**
241
264
  * The `startMs` a row is ordered by, or null when the row does not declare a
@@ -5798,6 +5798,24 @@ function createCapRouter_notificationRules(getProvider, createRemoteProxy) {
5798
5798
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
5799
5799
  return p.getConditionCatalog(methodInput);
5800
5800
  }),
5801
+ getTemplateCatalog: trpc_middleware_js_1.protectedProcedure
5802
+ .input(types_81.notificationRulesCapability.methods.getTemplateCatalog.input.loose())
5803
+ .output(types_81.notificationRulesCapability.methods.getTemplateCatalog.output)
5804
+ .query(async ({ input, ctx }) => {
5805
+ const { nodeId, ...methodInput } = input;
5806
+ const p = resolveProvider('notification-rules', nodeId, () => getProvider(ctx), createRemoteProxy);
5807
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
5808
+ return p.getTemplateCatalog(methodInput);
5809
+ }),
5810
+ previewTemplate: trpc_middleware_js_1.protectedProcedure
5811
+ .input(types_81.notificationRulesCapability.methods.previewTemplate.input.loose())
5812
+ .output(types_81.notificationRulesCapability.methods.previewTemplate.output)
5813
+ .mutation(async ({ input, ctx }) => {
5814
+ const { nodeId, ...methodInput } = input;
5815
+ const p = resolveProvider('notification-rules', nodeId, () => getProvider(ctx), createRemoteProxy);
5816
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
5817
+ return p.previewTemplate(methodInput);
5818
+ }),
5801
5819
  getHistory: trpc_middleware_js_1.adminProcedure
5802
5820
  .input(types_81.notificationRulesCapability.methods.getHistory.input.loose())
5803
5821
  .output(types_81.notificationRulesCapability.methods.getHistory.output)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.377",
3
+ "version": "1.2.379",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",
@@ -35,18 +35,18 @@
35
35
  ]
36
36
  },
37
37
  "dependencies": {
38
- "@camstack/addon-admin-ui": "1.2.258",
39
- "@camstack/addon-agent-ui": "1.2.141",
38
+ "@camstack/addon-admin-ui": "1.2.260",
39
+ "@camstack/addon-agent-ui": "1.2.142",
40
40
  "@camstack/addon-auth": "1.2.123",
41
41
  "@camstack/addon-decoder-nodeav": "1.2.115",
42
42
  "@camstack/addon-notifiers": "1.2.119",
43
43
  "@camstack/addon-pipeline": "1.2.290",
44
- "@camstack/addon-pipeline-orchestrator": "1.2.245",
45
- "@camstack/addon-post-analysis": "1.2.274",
44
+ "@camstack/addon-pipeline-orchestrator": "1.2.247",
45
+ "@camstack/addon-post-analysis": "1.2.275",
46
46
  "@camstack/sdk": "1.2.118",
47
- "@camstack/system": "1.2.291",
48
- "@camstack/types": "1.2.247",
49
- "@camstack/ui-library": "1.2.199",
47
+ "@camstack/system": "1.2.293",
48
+ "@camstack/types": "1.2.249",
49
+ "@camstack/ui-library": "1.2.200",
50
50
  "@fastify/compress": "^9.0.0",
51
51
  "@fastify/cookie": "^11.0.2",
52
52
  "@fastify/cors": "^11.2.0",