@aooth/arbac-moost 0.1.76 → 0.1.77

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.
Files changed (2) hide show
  1. package/dist/index.mjs +20 -2
  2. package/package.json +17 -17
package/dist/index.mjs CHANGED
@@ -329,6 +329,13 @@ function registeredControllers(target) {
329
329
  return perTarget ? [...perTarget.values()] : [];
330
330
  }
331
331
  /**
332
+ * Whether an ARBAC DB / value-help controller of the current app serves
333
+ * `type` — stable per-app registration, unlike runtime metadata.
334
+ */
335
+ function isArbacServedType(type) {
336
+ return registeredControllers(type).length > 0;
337
+ }
338
+ /**
332
339
  * The ARBAC resource + action a controller's handler is authorized as — the
333
340
  * precedence `useArbac()` applies while that handler serves a request.
334
341
  * Resource: method `@ArbacResource` → class `@ArbacResource` → controller id
@@ -1438,11 +1445,22 @@ function refTargetOf(entry) {
1438
1445
  return;
1439
1446
  }
1440
1447
  }
1441
- /** A table-served type: any `db.*` annotation (`db.table`, `db.view`, `db.http.path`, …). */
1448
+ /**
1449
+ * Whether a no-field target type is table-served (so its read visibility must
1450
+ * be checked). Decided from STABLE information only, never from the runtime
1451
+ * `db.http.path` metadata: moost-db mirrors it after init, deletes it for an
1452
+ * ambiguous model and rewrites it when another app publishes, so a pure
1453
+ * value-help dictionary whose only `db.*` key is that mirror would flip.
1454
+ * Served when (1) an ARBAC controller of THIS app is registered for the type
1455
+ * (fail closed: guarded here => readability is checked), or (2) the schema
1456
+ * declares a `db.*` annotation other than `db.http.path` (`db.table`,
1457
+ * `db.view`, ...).
1458
+ */
1442
1459
  function isDbServed(type) {
1460
+ if (isArbacServedType(type)) return true;
1443
1461
  const meta = type.metadata;
1444
1462
  if (!meta || typeof meta.keys !== "function") return false;
1445
- for (const key of meta.keys()) if (key.startsWith("db.")) return true;
1463
+ for (const key of meta.keys()) if (key.startsWith("db.") && key !== "db.http.path") return true;
1446
1464
  return false;
1447
1465
  }
1448
1466
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aooth/arbac-moost",
3
- "version": "0.1.76",
3
+ "version": "0.1.77",
4
4
  "description": "Moost RBAC integration for aoothjs (migrated from @moostjs/arbac)",
5
5
  "keywords": [
6
6
  "abac",
@@ -61,30 +61,30 @@
61
61
  },
62
62
  "dependencies": {
63
63
  "@uniqu/core": "^0.1.13",
64
- "@aooth/user": "0.1.76",
65
- "@aooth/arbac": "0.1.76",
66
- "@aooth/arbac-core": "0.1.76"
64
+ "@aooth/arbac": "0.1.77",
65
+ "@aooth/arbac-core": "0.1.77",
66
+ "@aooth/user": "0.1.77"
67
67
  },
68
68
  "devDependencies": {
69
- "@atscript/core": "^0.1.100",
70
- "@atscript/db": "^0.1.149",
71
- "@atscript/db-sql-tools": "^0.1.149",
72
- "@atscript/db-sqlite": "^0.1.149",
73
- "@atscript/moost-db": "^0.1.149",
74
- "@atscript/typescript": "^0.1.100",
75
- "@moostjs/event-http": "^0.6.45",
69
+ "@atscript/core": "^0.1.101",
70
+ "@atscript/db": "^0.1.150",
71
+ "@atscript/db-sql-tools": "^0.1.150",
72
+ "@atscript/db-sqlite": "^0.1.150",
73
+ "@atscript/moost-db": "^0.1.150",
74
+ "@atscript/typescript": "^0.1.101",
75
+ "@moostjs/event-http": "^0.6.47",
76
76
  "@types/better-sqlite3": "^7.6.13",
77
77
  "better-sqlite3": "^12.6.2",
78
- "unplugin-atscript": "^0.1.100"
78
+ "unplugin-atscript": "^0.1.101"
79
79
  },
80
80
  "peerDependencies": {
81
- "@atscript/db": "^0.1.149",
82
- "@atscript/moost-db": "^0.1.149",
83
- "@atscript/typescript": "^0.1.100",
84
- "@moostjs/event-http": "^0.6.45",
81
+ "@atscript/db": "^0.1.150",
82
+ "@atscript/moost-db": "^0.1.150",
83
+ "@atscript/typescript": "^0.1.101",
84
+ "@moostjs/event-http": "^0.6.47",
85
85
  "@wooksjs/event-core": "^0.7.26",
86
86
  "@wooksjs/event-http": "^0.7.26",
87
- "moost": "^0.6.45"
87
+ "moost": "^0.6.47"
88
88
  },
89
89
  "peerDependenciesMeta": {
90
90
  "@atscript/db": {