@aooth/arbac-moost 0.2.6 → 0.2.8

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.
@@ -1,4 +1,4 @@
1
- import { r as AoothArbacClaims, t as ArbacUserProvider } from "../user.provider-BSEBh1px.mjs";
1
+ import { r as AoothArbacClaims, t as ArbacUserProvider } from "../user.provider-Dfo2byri.mjs";
2
2
  import { TAtscriptAnnotatedType, TAtscriptTypeObject, TMetadataMap, TValidatorOptions, Validator } from "@atscript/typescript/utils";
3
3
  import { AoothUserCredentials } from "@aooth/user/atscript-db/model.as";
4
4
  /**
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as ProjectionOf, a as conjoinArbacDbScopes, b as TArbacMeta, c as ArbacDbScope, d as extractUsedControlValues, f as applyAllowedFieldsAndSet, g as OwnFieldKey, h as NavTarget, i as ConjoinArbacDbScopesOptions, l as AsArbacDbController, m as NavRelationKey, n as ArbacUserProviderToken, o as RefForeignKey, p as ControlsOf, r as AoothArbacClaims, s as RefTableSource, t as ArbacUserProvider, u as enforceControlsPolicy, v as ARBAC_DELEGATED_AUTH, x as getArbacMate, y as ArbacDelegatedAuth } from "./user.provider-BSEBh1px.mjs";
1
+ import { _ as ProjectionOf, a as conjoinArbacDbScopes, b as TArbacMeta, c as ArbacDbScope, d as extractUsedControlValues, f as applyAllowedFieldsAndSet, g as OwnFieldKey, h as NavTarget, i as ConjoinArbacDbScopesOptions, l as AsArbacDbController, m as NavRelationKey, n as ArbacUserProviderToken, o as RefForeignKey, p as ControlsOf, r as AoothArbacClaims, s as RefTableSource, t as ArbacUserProvider, u as enforceControlsPolicy, v as ARBAC_DELEGATED_AUTH, x as getArbacMate, y as ArbacDelegatedAuth } from "./user.provider-Dfo2byri.mjs";
2
2
  import { Arbac, Arbac as Arbac$1, TArbacCompiledRule, TArbacEvalResult, TArbacEvalResult as TArbacEvalResult$1, TArbacRole, TArbacRoleForResource, TArbacRule, arbacPatternToRegex } from "@aooth/arbac-core";
3
3
  import { ControlGate, ControlGate as ControlGate$1, TProjection, TScopeFieldRules, TScopeFilter, conjoinScopeFilters } from "@aooth/arbac";
4
4
  import { EventContext } from "@wooksjs/event-core";
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ import { cached, cachedBy, current, eventTypeKey, key, tryGetCurrent } from "@wo
5
5
  import { Inherit, Injectable, TInterceptorPriority, defineBeforeInterceptor, formatMessage, getConstructor, getMoostMate, registerMessages, useControllerContext, useLogger } from "moost";
6
6
  import { Authenticate, HttpError } from "@moostjs/event-http";
7
7
  import { computeInsights, containsRelationFilter, findAncestorInSet, getPath, hasRelationOp, isPlainObject, isRelationOp, translateQueryTree } from "@atscript/db";
8
- import { AsDbController, AsDbReadableController, AsJsonValueHelpController, AsValueHelpController, DB_CRUD_HANDLERS, VALUE_HELP_CRUD_HANDLERS, badRequest, discoverRowLevelActions, getControllerFormType, getDbEndpoint, hasActionDelegations, notFoundError, resolveTerminalRef, stableMeta } from "@atscript/moost-db";
8
+ import { AsDbController, AsDbReadableController, AsJsonValueHelpController, AsValueHelpController, DB_CRUD_HANDLERS, VALUE_HELP_CRUD_HANDLERS, discoverRowLevelActions, getControllerFormType, getDbEndpoint, hasActionDelegations, notFoundError, resolveTerminalRef, stableMeta, unknownFieldError } from "@atscript/moost-db";
9
9
  import { groupByFields, resolveAlias, walkFilter } from "@uniqu/core";
10
10
  // src/db/helpers.ts
11
11
  /** `map.get(key)`, created with `create()` and stored on a miss. */
@@ -2186,7 +2186,7 @@ const NOT_CONTROLS = /* @__PURE__ */ new Set(["filter", "insights"]);
2186
2186
  /**
2187
2187
  * Whether `control` is unusable in an op listing `list` under `policy`: its
2188
2188
  * gate is `false`, or everything it qualifies is unusable (`$index` /
2189
- * `$fuzzy` / `$vector` name how `$search` runs, `$threshold` bounds
2189
+ * `$fuzzy` / `$rank` / `$vector` name how `$search` runs, `$threshold` bounds
2190
2190
  * `$vector`, `$rowOrder` orders `first()` / `last()` in an aggregate
2191
2191
  * `$select`, `$nulls` places NULLs in `$sort` and `$rowOrder` keys, `$from`
2192
2192
  * is the inner level of an aggregate `$select`).
@@ -2196,7 +2196,8 @@ function isControlOff(control, list, policy) {
2196
2196
  const off = (c) => isControlOff(c, list, policy);
2197
2197
  switch (control) {
2198
2198
  case "index":
2199
- case "fuzzy": return list.includes("search") && off("search");
2199
+ case "fuzzy":
2200
+ case "rank": return list.includes("search") && off("search");
2200
2201
  case "vector": return off("search");
2201
2202
  case "threshold": return off("vector");
2202
2203
  case "rowOrder":
@@ -2961,7 +2962,7 @@ function arbacRowFilter(filter) {
2961
2962
  function arbacRelationFilter(path, filter, readable) {
2962
2963
  let level = visibilityFor(requireRequestScopes(), readable);
2963
2964
  for (const name of path.split(".")) level = level && visibleRelation(name, level);
2964
- if (!level?.scopes) throw badRequest(path, `Unknown field "${path}"`);
2965
+ if (!level?.scopes) throw unknownFieldError(path);
2965
2966
  return conjoinScopeFilters$1(effectiveScope(level.scopes).filter, filter) ?? filter;
2966
2967
  }
2967
2968
  // src/db/write-fields.ts
@@ -82,7 +82,7 @@ type NavRelationKey<T> = keyof NavPropsOf<T> extends never ? string : (keyof Nav
82
82
  */
83
83
  type ProjectionOf<T> = IsUnknown<T> extends true ? TProjection : Partial<Record<OwnFieldKey<T>, 0 | 1>>;
84
84
  /** The Uniquery controls a gate can only allow or deny (`true` / `false`). */
85
- type BooleanControl = "$select" | "$sort" | "$nulls" | "$skip" | "$limit" | "$count" | "$page" | "$size" | "$search" | "$index" | "$fuzzy" | "$vector" | "$threshold" | "$actions" | "$rowOrder" | "$having" | "$from" | "$center" | "$maxDistance" | "$minDistance";
85
+ type BooleanControl = "$select" | "$sort" | "$nulls" | "$skip" | "$limit" | "$count" | "$page" | "$size" | "$search" | "$index" | "$fuzzy" | "$rank" | "$vector" | "$threshold" | "$actions" | "$rowOrder" | "$having" | "$from" | "$center" | "$maxDistance" | "$minDistance";
86
86
  /**
87
87
  * Typed control gates, matching what `unionControlsPolicy` accepts: only
88
88
  * `$with` (nav relation names) and `$groupBy` (own field paths) take a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aooth/arbac-moost",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "Moost RBAC integration for aoothjs (migrated from @moostjs/arbac)",
5
5
  "keywords": [
6
6
  "abac",
@@ -60,30 +60,30 @@
60
60
  "access": "public"
61
61
  },
62
62
  "dependencies": {
63
- "@uniqu/core": "^0.2.1",
64
- "@aooth/user": "0.2.6",
65
- "@aooth/arbac": "0.2.6",
66
- "@aooth/arbac-core": "0.2.6"
63
+ "@uniqu/core": "^0.2.2",
64
+ "@aooth/arbac": "0.2.8",
65
+ "@aooth/user": "0.2.8",
66
+ "@aooth/arbac-core": "0.2.8"
67
67
  },
68
68
  "devDependencies": {
69
- "@atscript/core": "^0.2.9",
70
- "@atscript/db": "^0.1.174",
71
- "@atscript/db-sql-tools": "^0.1.174",
72
- "@atscript/db-sqlite": "^0.1.174",
73
- "@atscript/moost-db": "^0.1.174",
74
- "@atscript/typescript": "^0.2.9",
75
- "@moostjs/event-http": "^0.7.4",
69
+ "@atscript/core": "^0.2.12",
70
+ "@atscript/db": "^0.1.176",
71
+ "@atscript/db-sql-tools": "^0.1.176",
72
+ "@atscript/db-sqlite": "^0.1.176",
73
+ "@atscript/moost-db": "^0.1.176",
74
+ "@atscript/typescript": "^0.2.12",
75
+ "@moostjs/event-http": "^0.7.6",
76
76
  "@types/better-sqlite3": "^7.6.13",
77
77
  "better-sqlite3": "^12.6.2",
78
- "unplugin-atscript": "^0.2.9"
78
+ "unplugin-atscript": "^0.2.12"
79
79
  },
80
80
  "peerDependencies": {
81
- "@atscript/db": "^0.1.174",
82
- "@atscript/moost-db": "^0.1.174",
83
- "@atscript/typescript": "^0.2.9",
84
- "@moostjs/event-http": "^0.7.4",
85
- "@wooksjs/event-core": "^0.8.1",
86
- "moost": "^0.7.4"
81
+ "@atscript/db": "^0.1.176",
82
+ "@atscript/moost-db": "^0.1.176",
83
+ "@atscript/typescript": "^0.2.12",
84
+ "@moostjs/event-http": "^0.7.6",
85
+ "@wooksjs/event-core": "^0.8.3",
86
+ "moost": "^0.7.6"
87
87
  },
88
88
  "peerDependenciesMeta": {
89
89
  "@atscript/db": {