@camstack/server 1.1.41 → 1.1.42
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.
- package/dist/api/trpc/cap-router-runtime.js +2 -3
- package/dist/api/trpc/scope-access.js +2 -2
- package/dist/api/trpc/trpc.middleware.js +2 -2
- package/dist/core/addon/addon-registry.service.js +3 -3
- package/dist/core/moleculer/moleculer.service.js +1 -1
- package/dist/main.js +9 -6
- package/package.json +1 -1
|
@@ -25,7 +25,6 @@ exports.createCapRouterPrimitives = createCapRouterPrimitives;
|
|
|
25
25
|
exports.createCapRouterServices = createCapRouterServices;
|
|
26
26
|
exports.buildRuntimeCapRouters = buildRuntimeCapRouters;
|
|
27
27
|
const system_1 = require("@camstack/system");
|
|
28
|
-
const types_1 = require("@camstack/types");
|
|
29
28
|
const server_1 = require("@trpc/server");
|
|
30
29
|
const cap_mount_helpers_js_1 = require("./cap-mount-helpers.js");
|
|
31
30
|
const trpc_middleware_js_1 = require("./trpc.middleware.js");
|
|
@@ -38,7 +37,7 @@ const trpc_middleware_js_1 = require("./trpc.middleware.js");
|
|
|
38
37
|
exports.COLLECTION_ARRAY_METHODS = computeArrayMethods();
|
|
39
38
|
function computeArrayMethods() {
|
|
40
39
|
const out = new Map();
|
|
41
|
-
for (const def of
|
|
40
|
+
for (const def of system_1.ALL_CAPABILITY_DEFINITIONS) {
|
|
42
41
|
if (def.mode !== 'collection')
|
|
43
42
|
continue;
|
|
44
43
|
const names = [];
|
|
@@ -46,7 +45,7 @@ function computeArrayMethods() {
|
|
|
46
45
|
const m = schema;
|
|
47
46
|
if (m.kind === 'subscription')
|
|
48
47
|
continue;
|
|
49
|
-
if ((0,
|
|
48
|
+
if ((0, system_1.isArrayOutputSchema)(m.output))
|
|
50
49
|
names.push(name);
|
|
51
50
|
}
|
|
52
51
|
if (names.length > 0)
|
|
@@ -24,7 +24,7 @@ exports.checkScopeAccess = checkScopeAccess;
|
|
|
24
24
|
* method's required `access` flavour.
|
|
25
25
|
* 4. No matching scope → FORBIDDEN with a human-readable reason.
|
|
26
26
|
*/
|
|
27
|
-
const
|
|
27
|
+
const system_1 = require("@camstack/system");
|
|
28
28
|
/**
|
|
29
29
|
* Pull `deviceId` off a tRPC request input. Device-scope cap methods
|
|
30
30
|
* uniformly take `{deviceId: number, ...}` per the DeviceProxy contract,
|
|
@@ -51,7 +51,7 @@ function effectiveDeviceIds(deviceId, getAncestors) {
|
|
|
51
51
|
return [...out];
|
|
52
52
|
}
|
|
53
53
|
function checkScopeAccess(scopes, path, input, getDeviceAncestors) {
|
|
54
|
-
const meta =
|
|
54
|
+
const meta = system_1.METHOD_ACCESS_MAP[path];
|
|
55
55
|
if (!meta) {
|
|
56
56
|
return { ok: false, reason: `Unknown method '${path}' — codegen drift` };
|
|
57
57
|
}
|
|
@@ -8,7 +8,7 @@ exports.iterableSubscription = iterableSubscription;
|
|
|
8
8
|
exports.iterableInterval = iterableInterval;
|
|
9
9
|
const server_1 = require("@trpc/server");
|
|
10
10
|
const superjson_1 = __importDefault(require("superjson"));
|
|
11
|
-
const
|
|
11
|
+
const system_1 = require("@camstack/system");
|
|
12
12
|
const scope_access_js_1 = require("./scope-access.js");
|
|
13
13
|
const cap_route_error_formatter_js_1 = require("./cap-route-error-formatter.js");
|
|
14
14
|
const t = server_1.initTRPC.context().create({
|
|
@@ -102,7 +102,7 @@ exports.protectedProcedure = t.procedure.use(async ({ ctx, next, path, getRawInp
|
|
|
102
102
|
// Hand-written core route — no cap entry. Authentication has already
|
|
103
103
|
// passed; defer further gating to any explicit `adminProcedure`
|
|
104
104
|
// chained on top of this one.
|
|
105
|
-
if (!(path in
|
|
105
|
+
if (!(path in system_1.METHOD_ACCESS_MAP)) {
|
|
106
106
|
return next({ ctx: { ...ctx, user: ctx.user } });
|
|
107
107
|
}
|
|
108
108
|
// Device-scope caps may be gated by a `device:N` scope. Resolve the
|
|
@@ -50,8 +50,8 @@ const fs = __importStar(require("node:fs"));
|
|
|
50
50
|
const node_url_1 = require("node:url");
|
|
51
51
|
const addon_settings_provider_js_1 = require("./addon-settings-provider.js");
|
|
52
52
|
const addon_call_gateway_js_1 = require("./addon-call-gateway.js");
|
|
53
|
+
const system_5 = require("@camstack/system");
|
|
53
54
|
const types_2 = require("@camstack/types");
|
|
54
|
-
const types_3 = require("@camstack/types");
|
|
55
55
|
/**
|
|
56
56
|
* Type predicate: true when an `ISettingsBackend` also satisfies the
|
|
57
57
|
* sync `ISettingsStore` contract (system/addon/device key-value ops)
|
|
@@ -355,7 +355,7 @@ class AddonRegistryService {
|
|
|
355
355
|
// Register the addon-settings singleton provider — replaces the
|
|
356
356
|
// former `$addonHost` Moleculer service. The provider resolves
|
|
357
357
|
// addonId → local addon instance (hub) or remote Moleculer call.
|
|
358
|
-
this.capabilityRegistry.declareCapability(
|
|
358
|
+
this.capabilityRegistry.declareCapability(system_5.addonSettingsCapability);
|
|
359
359
|
// The SINGLE router for addon-level calls (routes / custom / settings).
|
|
360
360
|
// It classifies in-process | hub-local-child (UDS) | remote-agent
|
|
361
361
|
// (Moleculer) in ONE place — `resolveNode` reports only the BASE node
|
|
@@ -2592,7 +2592,7 @@ class AddonRegistryService {
|
|
|
2592
2592
|
let chain = this.disposerChains.get(addonId);
|
|
2593
2593
|
if (chain == null) {
|
|
2594
2594
|
const log = this.loggingService.createLogger().withTags({ addonId });
|
|
2595
|
-
chain = new
|
|
2595
|
+
chain = new types_2.DisposerChain({
|
|
2596
2596
|
onError: (err, index) => {
|
|
2597
2597
|
log.error(`Disposer #${index} threw during teardown`, {
|
|
2598
2598
|
meta: { error: (0, types_1.errMsg)(err) },
|
|
@@ -717,7 +717,7 @@ class MoleculerService {
|
|
|
717
717
|
},
|
|
718
718
|
});
|
|
719
719
|
const proxy = { id: addonId, nodeId };
|
|
720
|
-
for (const methodName of Object.keys((0,
|
|
720
|
+
for (const methodName of Object.keys((0, system_1.expandCapMethods)(capDef))) {
|
|
721
721
|
proxy[methodName] = (methodParams) => callFn(methodName, methodParams);
|
|
722
722
|
}
|
|
723
723
|
registry.registerProvider(capName, registryKey, proxy);
|
package/dist/main.js
CHANGED
|
@@ -57,7 +57,10 @@ const auth_service_1 = require("./core/auth/auth.service");
|
|
|
57
57
|
// `npx tsx scripts/generate-capability-router-types.ts`. The previous
|
|
58
58
|
// hand-curated list silently dropped caps (zones, zone-rules,
|
|
59
59
|
// zone-analytics, audio-metrics — see git for the regression).
|
|
60
|
-
|
|
60
|
+
// Sourced from `@camstack/system` (not `@camstack/types`) so the hub's
|
|
61
|
+
// capability surface refreshes on `camstack deploy packages/system` with no new
|
|
62
|
+
// server image. `@camstack/types` is never deployed to the hub.
|
|
63
|
+
const system_1 = require("@camstack/system");
|
|
61
64
|
const stream_probe_service_1 = require("./core/streaming/stream-probe.service");
|
|
62
65
|
const feature_service_1 = require("./core/feature/feature.service");
|
|
63
66
|
const agent_registry_service_1 = require("./core/agent/agent-registry.service");
|
|
@@ -79,7 +82,7 @@ const auth_whoami_1 = require("./api/auth-whoami");
|
|
|
79
82
|
const session_cookie_js_1 = require("./auth/session-cookie.js");
|
|
80
83
|
const health_routes_1 = require("./api/health/health.routes");
|
|
81
84
|
const oauth2_routes_js_1 = require("./api/oauth2/oauth2-routes.js");
|
|
82
|
-
const
|
|
85
|
+
const system_2 = require("@camstack/system");
|
|
83
86
|
const boot_config_1 = require("./boot/boot-config");
|
|
84
87
|
const manual_boot_1 = require("./manual-boot");
|
|
85
88
|
const post_boot_service_1 = require("./boot/post-boot.service");
|
|
@@ -238,8 +241,8 @@ async function bootstrap() {
|
|
|
238
241
|
// If registration fails, start in degraded mode: serve a health warning endpoint.
|
|
239
242
|
// Instantiate new core services
|
|
240
243
|
const loggingService = app.get(logging_service_1.LoggingService);
|
|
241
|
-
const addonRouteRegistry = new
|
|
242
|
-
const dataPlaneRegistry = new
|
|
244
|
+
const addonRouteRegistry = new system_2.AddonRouteRegistry();
|
|
245
|
+
const dataPlaneRegistry = new system_2.DataPlaneRegistry();
|
|
243
246
|
// Use Fastify-managed notification/toast wrappers (globally provided by NotificationModule)
|
|
244
247
|
const { NotificationServiceWrapper } = await Promise.resolve().then(() => __importStar(require('./core/notification/notification-wrapper.service')));
|
|
245
248
|
const { ToastServiceWrapper } = await Promise.resolve().then(() => __importStar(require('./core/notification/toast-wrapper.service')));
|
|
@@ -260,7 +263,7 @@ async function bootstrap() {
|
|
|
260
263
|
// from forked workers / agents) find their definition during
|
|
261
264
|
// onModuleInit. The list comes from the codegen — see the import
|
|
262
265
|
// comment above for the rationale.
|
|
263
|
-
for (const capDef of
|
|
266
|
+
for (const capDef of system_1.ALL_CAPABILITY_DEFINITIONS) {
|
|
264
267
|
capabilityRegistry.declareCapability(capDef);
|
|
265
268
|
}
|
|
266
269
|
// Hub-internal `sso-bridge` provider — gives auth-provider addons
|
|
@@ -730,7 +733,7 @@ async function bootstrap() {
|
|
|
730
733
|
const upstreamPath = `/${subPath}${queryString}`;
|
|
731
734
|
// Take over the socket — `proxyToUpstream` drives the raw response.
|
|
732
735
|
reply.hijack();
|
|
733
|
-
(0,
|
|
736
|
+
(0, system_2.proxyToUpstream)({
|
|
734
737
|
baseUrl: dpMatch.endpoint.baseUrl,
|
|
735
738
|
secret: dpMatch.endpoint.secret,
|
|
736
739
|
upstreamPath,
|