@camstack/system 1.1.44 → 1.1.45

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/index.js CHANGED
@@ -5007,6 +5007,23 @@ var CapabilityRegistry = class CapabilityRegistry {
5007
5007
  * `buildCapRouters(t, services)` contract), keeping the kernel free of any
5008
5008
  * backend coupling (self-sufficiency invariant).
5009
5009
  */
5010
+ /**
5011
+ * The mount kind a `systemOnly` method resolves through — the cap's
5012
+ * SYSTEM/wrapper provider, keyed off the cap's `mode` (singleton or
5013
+ * collection), NEVER the per-device native.
5014
+ *
5015
+ * A `systemOnly` method (declared via the `systemMethod()` factory) belongs
5016
+ * to the cap's hub-resident system/wrapper provider — e.g. a device-scoped
5017
+ * (`device-native`) cap exposing a batch/metadata call that takes `deviceIds`
5018
+ * (an ARRAY) rather than a single `deviceId`. Routing it through the cap's
5019
+ * `device-native` mount would push it into `requireDeviceScoped`, whose
5020
+ * dispatcher demands a numeric `deviceId` on EVERY method call and rejects a
5021
+ * deviceId-less input with `input must carry numeric "deviceId"`. Resolving it
5022
+ * as the cap's mode-appropriate system provider instead keeps it reachable.
5023
+ */
5024
+ function systemMountKindFor(def) {
5025
+ return def.mode === "collection" ? "collection" : "singleton";
5026
+ }
5010
5027
  function methodsFor(def) {
5011
5028
  const effective = require_dist.expandCapMethods(def);
5012
5029
  return Object.entries(effective).map(([name, schema]) => {
@@ -5065,11 +5082,13 @@ function requireLocal(capName, getLocal, services) {
5065
5082
  function buildOneCapRouter(def, primitives, services) {
5066
5083
  const capName = def.name;
5067
5084
  const mount = require_dist.resolveCapMount(def);
5068
- const isCollection = mount.kind === "collection";
5085
+ const systemMountKind = systemMountKindFor(def);
5069
5086
  const nodeIdData = def.nodeIdMode === "data";
5070
5087
  const procedures = {};
5071
- const getLocal = (ctx, addonId) => services.getLocalProvider(capName, mount.kind, ctx, addonId);
5072
5088
  for (const method of methodsFor(def)) {
5089
+ const effectiveMountKind = method.schema.systemOnly === true ? systemMountKind : mount.kind;
5090
+ const isCollection = effectiveMountKind === "collection";
5091
+ const getLocal = (ctx, addonId) => services.getLocalProvider(capName, effectiveMountKind, ctx, addonId);
5073
5092
  const base = primitives.procedures[require_dist.procedureAuthKey(method.auth)];
5074
5093
  const inputSchema = method.schema.input;
5075
5094
  if (method.kind === "subscription") {
package/dist/index.mjs CHANGED
@@ -4999,6 +4999,23 @@ var CapabilityRegistry = class CapabilityRegistry {
4999
4999
  * `buildCapRouters(t, services)` contract), keeping the kernel free of any
5000
5000
  * backend coupling (self-sufficiency invariant).
5001
5001
  */
5002
+ /**
5003
+ * The mount kind a `systemOnly` method resolves through — the cap's
5004
+ * SYSTEM/wrapper provider, keyed off the cap's `mode` (singleton or
5005
+ * collection), NEVER the per-device native.
5006
+ *
5007
+ * A `systemOnly` method (declared via the `systemMethod()` factory) belongs
5008
+ * to the cap's hub-resident system/wrapper provider — e.g. a device-scoped
5009
+ * (`device-native`) cap exposing a batch/metadata call that takes `deviceIds`
5010
+ * (an ARRAY) rather than a single `deviceId`. Routing it through the cap's
5011
+ * `device-native` mount would push it into `requireDeviceScoped`, whose
5012
+ * dispatcher demands a numeric `deviceId` on EVERY method call and rejects a
5013
+ * deviceId-less input with `input must carry numeric "deviceId"`. Resolving it
5014
+ * as the cap's mode-appropriate system provider instead keeps it reachable.
5015
+ */
5016
+ function systemMountKindFor(def) {
5017
+ return def.mode === "collection" ? "collection" : "singleton";
5018
+ }
5002
5019
  function methodsFor(def) {
5003
5020
  const effective = expandCapMethods(def);
5004
5021
  return Object.entries(effective).map(([name, schema]) => {
@@ -5057,11 +5074,13 @@ function requireLocal(capName, getLocal, services) {
5057
5074
  function buildOneCapRouter(def, primitives, services) {
5058
5075
  const capName = def.name;
5059
5076
  const mount = resolveCapMount(def);
5060
- const isCollection = mount.kind === "collection";
5077
+ const systemMountKind = systemMountKindFor(def);
5061
5078
  const nodeIdData = def.nodeIdMode === "data";
5062
5079
  const procedures = {};
5063
- const getLocal = (ctx, addonId) => services.getLocalProvider(capName, mount.kind, ctx, addonId);
5064
5080
  for (const method of methodsFor(def)) {
5081
+ const effectiveMountKind = method.schema.systemOnly === true ? systemMountKind : mount.kind;
5082
+ const isCollection = effectiveMountKind === "collection";
5083
+ const getLocal = (ctx, addonId) => services.getLocalProvider(capName, effectiveMountKind, ctx, addonId);
5065
5084
  const base = primitives.procedures[procedureAuthKey(method.auth)];
5066
5085
  const inputSchema = method.schema.input;
5067
5086
  if (method.kind === "subscription") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/system",
3
- "version": "1.1.44",
3
+ "version": "1.1.45",
4
4
  "description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
5
5
  "keywords": [
6
6
  "camstack",