@camstack/server 1.2.683 → 1.2.685
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/CHANGELOG.md +13 -0
- package/dist/api/data-plane/form-body.js +54 -0
- package/dist/api/oauth2/oauth2-routes.js +4 -20
- package/dist/api/trpc/generated-cap-mounts.js +18 -1
- package/dist/api/trpc/generated-cap-routers.js +638 -536
- package/dist/core/moleculer/moleculer.service.js +29 -0
- package/dist/main.js +5 -5
- package/package.json +7 -7
|
@@ -341,6 +341,9 @@ class MoleculerService {
|
|
|
341
341
|
// owning runner, whose `getStatus` is the native slice. The SAME
|
|
342
342
|
// question the registry's resolvers ask, through the same method.
|
|
343
343
|
claimedStatus: (capName, deviceId) => this.resolveClaimedStatus(capName, deviceId),
|
|
344
|
+
// A covered device call the device's remote takes over (D963) — the
|
|
345
|
+
// same question the registry's wrappers and the other entries ask.
|
|
346
|
+
deviceCallRedirect: this.deviceCallRedirectHook(),
|
|
344
347
|
// `nodeIdMode: 'data'` signal: for these caps (`addon-settings`,
|
|
345
348
|
// `addons`, `nodes`, `pipeline-orchestrator`) an inline `args.nodeId`
|
|
346
349
|
// is provider DATA — the hub singleton dispatches internally — never a
|
|
@@ -446,6 +449,8 @@ class MoleculerService {
|
|
|
446
449
|
// sibling short-circuit can dispatch it to the owning child (D663, S3)
|
|
447
450
|
// — the same resolver the handler above and `callCapabilityOnNode` use.
|
|
448
451
|
claimedStatus: (capName, deviceId) => this.resolveClaimedStatus(capName, deviceId),
|
|
452
|
+
// The same device-call redirect, before the sibling short-circuit (D963).
|
|
453
|
+
deviceCallRedirect: this.deviceCallRedirectHook(),
|
|
449
454
|
// A collection ARRAY method must reach `onUnownedCall` (which fans it
|
|
450
455
|
// across every provider) instead of being short-circuited to ONE local
|
|
451
456
|
// sibling. Same predicate the aggregate itself uses, so the two agree
|
|
@@ -807,6 +812,21 @@ class MoleculerService {
|
|
|
807
812
|
? registry.resolveClaimedStatus(capName, deviceId)
|
|
808
813
|
: Promise.resolve(system_1.UNCLAIMED);
|
|
809
814
|
}
|
|
815
|
+
/**
|
|
816
|
+
* The device-call redirect (D963): `CapabilityRegistry.coversDeviceCall` /
|
|
817
|
+
* `redirectDeviceCall`, resolved at CALL time so a redirect installed after
|
|
818
|
+
* this entry was wired (core-blocks boots later) is honoured. Every entry
|
|
819
|
+
* that routes a device-scoped call by name asks it through
|
|
820
|
+
* `answerDeviceCallRedirect`.
|
|
821
|
+
*/
|
|
822
|
+
deviceCallRedirectHook() {
|
|
823
|
+
return {
|
|
824
|
+
covers: (capName, method) => this.capabilityService.getRegistry()?.coversDeviceCall(capName, method) === true,
|
|
825
|
+
attempt: async (call) => (await this.capabilityService.getRegistry()?.redirectDeviceCall(call)) ?? {
|
|
826
|
+
kind: 'not-redirected',
|
|
827
|
+
},
|
|
828
|
+
};
|
|
829
|
+
}
|
|
810
830
|
/**
|
|
811
831
|
* Call a capability method on a specific node.
|
|
812
832
|
*
|
|
@@ -833,6 +853,15 @@ class MoleculerService {
|
|
|
833
853
|
const claimed = await (0, system_1.answerClaimedGetStatus)((capName, deviceId) => this.resolveClaimedStatus(capName, deviceId), { capName: capabilityName, method: methodName, args: params });
|
|
834
854
|
if (claimed !== null)
|
|
835
855
|
return claimed.slice;
|
|
856
|
+
// A covered device call the device's remote takes over (D963): the hub's
|
|
857
|
+
// own tRPC and every in-process `ctx.api` call arrive here with a pin.
|
|
858
|
+
const redirected = await (0, system_1.answerDeviceCallRedirect)(this.deviceCallRedirectHook(), {
|
|
859
|
+
capName: capabilityName,
|
|
860
|
+
method: methodName,
|
|
861
|
+
args: params,
|
|
862
|
+
});
|
|
863
|
+
if (redirected !== null)
|
|
864
|
+
return redirected.result;
|
|
836
865
|
const resolver = this.resolver;
|
|
837
866
|
if (resolver !== null) {
|
|
838
867
|
// Extract deviceId from params so device-scoped native caps (ptz, motion-zones, …)
|
package/dist/main.js
CHANGED
|
@@ -71,6 +71,7 @@ const release_identity_1 = require("./core/release-identity");
|
|
|
71
71
|
const runner_boot_check_1 = require("./core/runner-health/runner-boot-check");
|
|
72
72
|
const hub_cluster_url_1 = require("./api/hub-cluster-url");
|
|
73
73
|
const model_distributor_js_1 = require("./api/model-distributor.js");
|
|
74
|
+
const form_body_js_1 = require("./api/data-plane/form-body.js");
|
|
74
75
|
const oauth2_routes_js_1 = require("./api/oauth2/oauth2-routes.js");
|
|
75
76
|
const embed_auth_route_js_1 = require("./auth/embed-auth-route.js");
|
|
76
77
|
const live_user_js_1 = require("./auth/live-user.js");
|
|
@@ -1128,13 +1129,12 @@ async function bootstrap() {
|
|
|
1128
1129
|
}
|
|
1129
1130
|
if (shareHeaders !== null)
|
|
1130
1131
|
Object.assign(request.raw.headers, shareHeaders);
|
|
1132
|
+
const replayBody = (0, form_body_js_1.dataPlaneReplayBody)(request.raw, request.body, addonGateLogger);
|
|
1133
|
+
if (replayBody === null) {
|
|
1134
|
+
return reply.status(500).send({ error: 'Request body could not be forwarded' });
|
|
1135
|
+
}
|
|
1131
1136
|
// Take over the socket — `proxyToUpstream` drives the raw response.
|
|
1132
1137
|
reply.hijack();
|
|
1133
|
-
const replayBody = request.body === undefined
|
|
1134
|
-
? undefined
|
|
1135
|
-
: Buffer.isBuffer(request.body)
|
|
1136
|
-
? request.body
|
|
1137
|
-
: Buffer.from(typeof request.body === 'string' ? request.body : JSON.stringify(request.body));
|
|
1138
1138
|
(0, system_1.proxyToUpstream)({
|
|
1139
1139
|
baseUrl: dpMatch.endpoint.baseUrl,
|
|
1140
1140
|
secret: dpMatch.endpoint.secret,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.685",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
]
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@camstack/addon-admin-ui": "1.2.
|
|
53
|
-
"@camstack/addon-agent-ui": "1.2.
|
|
52
|
+
"@camstack/addon-admin-ui": "1.2.513",
|
|
53
|
+
"@camstack/addon-agent-ui": "1.2.290",
|
|
54
54
|
"@camstack/addon-auth": "1.2.170",
|
|
55
|
-
"@camstack/addon-benchmark": "1.2.
|
|
55
|
+
"@camstack/addon-benchmark": "1.2.289",
|
|
56
56
|
"@camstack/addon-decoder-nodeav": "1.2.144",
|
|
57
57
|
"@camstack/addon-notifiers": "1.2.623",
|
|
58
58
|
"@camstack/addon-pipeline": "1.2.633",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"@camstack/addon-post-analysis": "1.2.650",
|
|
61
61
|
"@camstack/develop": "0.1.39",
|
|
62
62
|
"@camstack/sdk": "1.2.154",
|
|
63
|
-
"@camstack/system": "1.2.
|
|
64
|
-
"@camstack/types": "1.2.
|
|
65
|
-
"@camstack/ui-library": "1.2.
|
|
63
|
+
"@camstack/system": "1.2.515",
|
|
64
|
+
"@camstack/types": "1.2.441",
|
|
65
|
+
"@camstack/ui-library": "1.2.348",
|
|
66
66
|
"@fastify/compress": "^9.0.0",
|
|
67
67
|
"@fastify/cookie": "^11.0.2",
|
|
68
68
|
"@fastify/cors": "^11.2.0",
|