@authup/access 1.0.0-beta.52 → 1.0.0-beta.54

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 (44) hide show
  1. package/dist/index.d.mts +150 -24
  2. package/dist/index.d.mts.map +1 -1
  3. package/dist/index.mjs +309 -89
  4. package/dist/index.mjs.map +1 -1
  5. package/dist/permission/evaluator/module.d.ts +12 -1
  6. package/dist/permission/evaluator/module.d.ts.map +1 -1
  7. package/dist/permission/evaluator/types.d.ts +48 -0
  8. package/dist/permission/evaluator/types.d.ts.map +1 -1
  9. package/dist/permission/helpers/aggregate.d.ts +1 -1
  10. package/dist/permission/realm-scope/constants.d.ts +1 -1
  11. package/dist/permission/realm-scope/constants.d.ts.map +1 -1
  12. package/dist/permission/types.d.ts +7 -7
  13. package/dist/permission/types.d.ts.map +1 -1
  14. package/dist/policy/built-in/attribute-names/evaluator.d.ts +1 -0
  15. package/dist/policy/built-in/attribute-names/evaluator.d.ts.map +1 -1
  16. package/dist/policy/built-in/attributes/evaluator.d.ts +5 -0
  17. package/dist/policy/built-in/attributes/evaluator.d.ts.map +1 -1
  18. package/dist/policy/built-in/attributes/types.d.ts +2 -2
  19. package/dist/policy/built-in/attributes/types.d.ts.map +1 -1
  20. package/dist/policy/built-in/composite/evaluator.d.ts.map +1 -1
  21. package/dist/policy/built-in/composite/types.d.ts +1 -1
  22. package/dist/policy/built-in/composite/types.d.ts.map +1 -1
  23. package/dist/policy/built-in/constants.d.ts +0 -1
  24. package/dist/policy/built-in/constants.d.ts.map +1 -1
  25. package/dist/policy/built-in/identity/evaluator.d.ts +1 -0
  26. package/dist/policy/built-in/identity/evaluator.d.ts.map +1 -1
  27. package/dist/policy/built-in/identity/types.d.ts +1 -1
  28. package/dist/policy/built-in/permission-binding/module.d.ts +1 -0
  29. package/dist/policy/built-in/permission-binding/module.d.ts.map +1 -1
  30. package/dist/policy/built-in/realm-match/evaluator.d.ts +14 -0
  31. package/dist/policy/built-in/realm-match/evaluator.d.ts.map +1 -1
  32. package/dist/policy/built-in/realm-match/types.d.ts +6 -6
  33. package/dist/policy/built-in/realm-match/types.d.ts.map +1 -1
  34. package/dist/policy/built-in/time/types.d.ts +3 -3
  35. package/dist/policy/built-in/time/types.d.ts.map +1 -1
  36. package/dist/policy/built-in/types.d.ts +2 -0
  37. package/dist/policy/built-in/types.d.ts.map +1 -1
  38. package/dist/policy/engine/module.d.ts.map +1 -1
  39. package/dist/policy/evaluation/context/define.d.ts.map +1 -1
  40. package/dist/policy/evaluation/context/types.d.ts +7 -0
  41. package/dist/policy/evaluation/context/types.d.ts.map +1 -1
  42. package/dist/policy/evaluation/types.d.ts +42 -0
  43. package/dist/policy/evaluation/types.d.ts.map +1 -1
  44. package/package.json +6 -4
@@ -1,7 +1,7 @@
1
1
  import type { IPolicyEngine } from '../../policy';
2
2
  import type { IPermissionProvider } from '../provider';
3
3
  import type { PermissionPolicyBindingAggregated } from '../types.ts';
4
- import type { IPermissionEvaluator, PermissionEvaluationContext, PermissionEvaluatorOptions } from './types.ts';
4
+ import type { IPermissionEvaluator, PermissionCompileContext, PermissionCompileResult, PermissionEvaluationContext, PermissionEvaluatorOptions } from './types.ts';
5
5
  export declare class PermissionEvaluator implements IPermissionEvaluator {
6
6
  protected provider: IPermissionProvider;
7
7
  protected policyEngine: IPolicyEngine;
@@ -16,5 +16,16 @@ export declare class PermissionEvaluator implements IPermissionEvaluator {
16
16
  evaluateOneOf(ctx: PermissionEvaluationContext): Promise<void>;
17
17
  preEvaluate(ctx: PermissionEvaluationContext): Promise<void>;
18
18
  preEvaluateOneOf(ctx: PermissionEvaluationContext): Promise<void>;
19
+ /**
20
+ * Compile the permission's policy trees against the knowns bag into a
21
+ * {@link PermissionCompileResult} — the query-build counterpart of
22
+ * {@link evaluate} (issue #3286 phase 3). Runs the SAME evaluation walk with
23
+ * `withConditions` enabled: policies that settle with the knowns settle here,
24
+ * pending subtrees contribute their exact condition form. Multiple names are
25
+ * a disjunction (any-of), so a single non-expressible name degrades the whole
26
+ * compilation to `post` — pushing only some disjuncts would wrongly exclude
27
+ * rows another name would admit.
28
+ */
29
+ compile(ctx: PermissionCompileContext): Promise<PermissionCompileResult>;
19
30
  }
20
31
  //# sourceMappingURL=module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/permission/evaluator/module.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAA+B,aAAa,EAAE,MAAM,cAAc,CAAC;AAU/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAEhH,qBAAa,mBAAoB,YAAW,oBAAoB;IAC5D,SAAS,CAAC,QAAQ,EAAG,mBAAmB,CAAC;IAEzC,SAAS,CAAC,YAAY,EAAG,aAAa,CAAC;IAEvC,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEnC,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;gBAItB,OAAO,EAAE,0BAA0B;cAe/B,OAAO,CACnB,KAAK,EAAE,MAAM,EACb,SAAS,GAAE;QACP,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KACtB,GACN,OAAO,CAAC,iCAAiC,GAAG,IAAI,CAAC;IAU/C,QAAQ,CAAC,GAAG,EAAE,2BAA2B,GAAI,OAAO,CAAC,IAAI,CAAC;IAmH1D,aAAa,CAAC,GAAG,EAAE,2BAA2B,GAAI,OAAO,CAAC,IAAI,CAAC;IAY/D,WAAW,CAAC,GAAG,EAAE,2BAA2B,GAAI,OAAO,CAAC,IAAI,CAAC;IAc7D,gBAAgB,CAAC,GA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E,wBAAwB,GAAI,OAAO,CAAC,uBAAuB,CAAC;CAyElF"}
@@ -1,3 +1,4 @@
1
+ import type { ICondition } from '@rapiq/core';
1
2
  import type { DecisionStrategy } from '@authup/kit';
2
3
  import type { IPolicyEngine, PolicyData } from '../../policy';
3
4
  import type { IPermissionProvider } from '../provider';
@@ -6,6 +7,7 @@ export interface IPermissionEvaluator {
6
7
  evaluateOneOf(ctx: PermissionEvaluationContext): Promise<void>;
7
8
  preEvaluate(ctx: PermissionEvaluationContext): Promise<void>;
8
9
  preEvaluateOneOf(ctx: PermissionEvaluationContext): Promise<void>;
10
+ compile(ctx: PermissionCompileContext): Promise<PermissionCompileResult>;
9
11
  }
10
12
  export type PermissionEvaluatorOptions = {
11
13
  provider: IPermissionProvider;
@@ -17,6 +19,16 @@ export type PermissionEvaluationOptions = {
17
19
  decisionStrategy?: `${DecisionStrategy}`;
18
20
  policiesIncluded?: string[];
19
21
  policiesExcluded?: string[];
22
+ /**
23
+ * How a grant whose policy evaluation is PENDING (a required data key is absent —
24
+ * see `PolicyEvaluationResult.pending`) is treated:
25
+ *
26
+ * - `deny` (default): pending counts as failure — full `evaluate()` semantics,
27
+ * matching the historical missing-data deny.
28
+ * - `permit`: pending counts as pass — the data-availability-derived pre-gate
29
+ * (`preEvaluate()`): only a tree that settles false with the current bag denies.
30
+ */
31
+ pendingPolicies?: 'deny' | 'permit';
20
32
  };
21
33
  export type PermissionEvaluationContext = {
22
34
  name: string | string[];
@@ -25,4 +37,40 @@ export type PermissionEvaluationContext = {
25
37
  data?: PolicyData;
26
38
  options?: PermissionEvaluationOptions;
27
39
  };
40
+ export type PermissionCompileContext = {
41
+ /**
42
+ * Permission name(s). Several names compile as a disjunction — the row is
43
+ * readable when ANY of them passes (`evaluateOneOf` semantics).
44
+ */
45
+ name: string | string[];
46
+ realmId?: string | null;
47
+ clientId?: string | null;
48
+ /**
49
+ * The knowns bag (typically the actor identity). Row-dependent keys
50
+ * (`attributes`, `realmMatch`) are deliberately absent — they are what the
51
+ * compiled condition ranges over.
52
+ */
53
+ data?: PolicyData;
54
+ };
55
+ /**
56
+ * Outcome of compiling a permission's policy trees against the knowns bag
57
+ * (issue #3286 phase 3) — the query-build counterpart of `evaluate()`:
58
+ *
59
+ * - `allow` — settled true for every row; no restriction needed.
60
+ * - `deny` — settled false for every row; no row can pass.
61
+ * - `conditional` — the EXACT residual as a rapiq condition over row attributes:
62
+ * push it into the row query (WHERE) and skip per-row post-evaluation.
63
+ * - `post` — some pending policy is not expressible as a condition; fall back to
64
+ * loading rows and evaluating per row (always sound).
65
+ */
66
+ export type PermissionCompileResult = {
67
+ verdict: 'allow';
68
+ } | {
69
+ verdict: 'deny';
70
+ } | {
71
+ verdict: 'conditional';
72
+ condition: ICondition;
73
+ } | {
74
+ verdict: 'post';
75
+ };
28
76
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/permission/evaluator/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,WAAW,oBAAoB;IACjC,QAAQ,CAAC,GAAG,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1D,aAAa,CAAC,GAAG,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/D,WAAW,CAAC,GAAG,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7D,gBAAgB,CAAC,GAAG,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrE;AAED,MAAM,MAAM,0BAA0B,GAAG;IACrC,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,YAAY,CAAC,EAAE,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AAC;IAAC,SAAS,EAAE,UAAU,CAAA;CAAE,GACjD;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import type { PermissionPolicyBinding, PermissionPolicyBindingAggregated } from '../types';
2
2
  /**
3
3
  * Group raw permission-policy bindings by permission key into the actor's disjunction of
4
- * `(realm_scope, policy)` grants per permission — with NO lossy collapse. Every consumer
4
+ * `(realmScope, policy)` grants per permission — with NO lossy collapse. Every consumer
5
5
  * (the binding evaluator, isSuperset, junction propagation, the memory provider) evaluates the
6
6
  * grant disjunction directly, so each grant's realm reach stays paired with the policy that
7
7
  * gates it.
@@ -10,7 +10,7 @@ export declare enum RealmScope {
10
10
  NONE = "none",
11
11
  /** Own realm only — resource realm must equal the actor's realm. */
12
12
  OWN = "own",
13
- /** Own realm or null/global resources (realm_id === null). */
13
+ /** Own realm or null/global resources (realmId === null). */
14
14
  OWN_OR_NULL = "ownOrNull",
15
15
  /** Any realm, including null/global. */
16
16
  ANY = "any"
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/permission/realm-scope/constants.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,oBAAY,UAAU;IAClB,sDAAsD;IACtD,IAAI,SAAS;IACb,oEAAoE;IACpE,GAAG,QAAQ;IACX,8DAA8D;IAC9D,WAAW,cAAc;IACzB,wCAAwC;IACxC,GAAG,QAAQ;CACd;AAED,4EAA4E;AAC5E,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,GAAG,UAAU,EAAE,EAAE,MAAM,CAK7D,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/permission/realm-scope/constants.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,oBAAY,UAAU;IAClB,sDAAsD;IACtD,IAAI,SAAS;IACb,oEAAoE;IACpE,GAAG,QAAQ;IACX,6DAA6D;IAC7D,WAAW,cAAc;IACzB,wCAAwC;IACxC,GAAG,QAAQ;CACd;AAED,4EAA4E;AAC5E,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,GAAG,UAAU,EAAE,EAAE,MAAM,CAK7D,CAAC"}
@@ -3,9 +3,9 @@ import type { DecisionStrategy } from '@authup/kit';
3
3
  import type { RealmScope } from './realm-scope';
4
4
  export type BasePermission = {
5
5
  name: string;
6
- client_id?: string | null;
7
- realm_id?: string | null;
8
- decision_strategy?: `${DecisionStrategy}` | null;
6
+ clientId?: string | null;
7
+ realmId?: string | null;
8
+ decisionStrategy?: `${DecisionStrategy}` | null;
9
9
  };
10
10
  /**
11
11
  * A raw permission grant: one permission with its policies and realm reach, as loaded from a
@@ -20,16 +20,16 @@ export type PermissionPolicyBinding = {
20
20
  * most restrictive `own` (fail-closed). NOT part of the binding identity key
21
21
  * (see isPermissionPolicyBindingEqual).
22
22
  */
23
- realm_scope?: `${RealmScope}`;
23
+ realmScope?: `${RealmScope}`;
24
24
  };
25
25
  /**
26
26
  * One disjunction term of an aggregated binding: a single grant's realm reach paired with its
27
- * own (single) policy. A disjunction-aware consumer ORs `realmScopeMatches(realm_scope) ∧ policy`
27
+ * own (single) policy. A disjunction-aware consumer ORs `realmScopeMatches(realmScope) ∧ policy`
28
28
  * across the grants of a permission.
29
29
  */
30
30
  export type PermissionGrant = {
31
31
  /** Relative realm reach (none/own/ownOrNull/any), normalized — fail-closed default `own`. */
32
- realm_scope: `${RealmScope}`;
32
+ realmScope: `${RealmScope}`;
33
33
  /**
34
34
  * The grant's policy: the raw junction policy (its `id` preserved, for propagation) for a
35
35
  * single-policy grant, a composite for a multi-policy (Layer-1) binding, or `undefined`
@@ -40,7 +40,7 @@ export type PermissionGrant = {
40
40
  /**
41
41
  * A permission together with the actor's disjunction of grants for it. Output of
42
42
  * `aggregatePermissionPolicyBindings` — the honest, lossless replacement for the collapsed
43
- * `PermissionPolicyBinding` (no top-level realm_scope/policies; the access decision is the
43
+ * `PermissionPolicyBinding` (no top-level realmScope/policies; the access decision is the
44
44
  * OR over `grants`).
45
45
  */
46
46
  export type PermissionPolicyBindingAggregated = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/permission/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,MAAM,cAAc,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,iBAAiB,CAAC,EAAE,GAAG,gBAAgB,EAAE,GAAG,IAAI,CAAA;CACnD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG;IAClC,UAAU,EAAE,cAAc,CAAC;IAC3B,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;IACxB;;;;OAIG;IACH,WAAW,CAAC,EAAE,GAAG,UAAU,EAAE,CAAC;CACjC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B,6FAA6F;IAC7F,WAAW,EAAE,GAAG,UAAU,EAAE,CAAC;IAC7B;;;;OAIG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;CACvB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC5C,UAAU,EAAE,cAAc,CAAC;IAC3B,MAAM,EAAE,eAAe,EAAE,CAAC;CAC7B,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/permission/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,MAAM,cAAc,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,gBAAgB,CAAC,EAAE,GAAG,gBAAgB,EAAE,GAAG,IAAI,CAAA;CAClD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG;IAClC,UAAU,EAAE,cAAc,CAAC;IAC3B,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;IACxB;;;;OAIG;IACH,UAAU,CAAC,EAAE,GAAG,UAAU,EAAE,CAAC;CAChC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B,6FAA6F;IAC7F,UAAU,EAAE,GAAG,UAAU,EAAE,CAAC;IAC5B;;;;OAIG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;CACvB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC5C,UAAU,EAAE,cAAc,CAAC;IAC3B,MAAM,EAAE,eAAe,EAAE,CAAC;CAC7B,CAAC"}
@@ -5,6 +5,7 @@ export declare class AttributeNamesPolicyEvaluator implements IPolicyEvaluator {
5
5
  protected validator: AttributeNamesPolicyValidator;
6
6
  protected attributesEvaluator: AttributesPolicyEvaluator;
7
7
  constructor();
8
+ requires(): string[];
8
9
  evaluate(value: Record<string, any>, ctx: PolicyEvaluationContext): Promise<PolicyEvaluationResult>;
9
10
  }
10
11
  //# sourceMappingURL=evaluator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/attribute-names/evaluator.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAG1G,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE1D,qBAAa,6BAA8B,YAAW,gBAAgB;IAClE,SAAS,CAAC,SAAS,EAAG,6BAA6B,CAAC;IAEpD,SAAS,CAAC,mBAAmB,EAAG,yBAAyB,CAAC;;IAOpD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAuD5G"}
1
+ {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/attribute-names/evaluator.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAG1G,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAG1D,qBAAa,6BAA8B,YAAW,gBAAgB;IAClE,SAAS,CAAC,SAAS,EAAG,6BAA6B,CAAC;IAEpD,SAAS,CAAC,mBAAmB,EAAG,yBAAyB,CAAC;;IAO1D,QAAQ,IAAK,MAAM,EAAE;IAIf,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAuD5G"}
@@ -1,8 +1,13 @@
1
+ import type { ICondition } from '@rapiq/core';
2
+ import { MongoFiltersParser } from '@rapiq/parser-mongo';
1
3
  import type { IPolicyEvaluator, PolicyEvaluationContext, PolicyEvaluationResult } from '../../evaluation';
2
4
  import { AttributesPolicyValidator } from './validator';
3
5
  export declare class AttributesPolicyEvaluator<T extends Record<string, any> = Record<string, any>> implements IPolicyEvaluator {
4
6
  protected validator: AttributesPolicyValidator<T>;
7
+ protected parser: MongoFiltersParser;
5
8
  constructor();
9
+ requires(): string[];
10
+ toCondition(value: Record<string, any>): Promise<ICondition | null>;
6
11
  accessData(ctx: PolicyEvaluationContext): Promise<T | null>;
7
12
  evaluate(value: Record<string, any>, ctx: PolicyEvaluationContext): Promise<PolicyEvaluationResult>;
8
13
  protected fixQuery(query: unknown | unknown[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/attributes/evaluator.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAI1G,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAExD,qBAAa,yBAAyB,CAClC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACrD,YAAW,gBAAgB;IACzB,SAAS,CAAC,SAAS,EAAG,yBAAyB,CAAC,CAAC,CAAC,CAAC;;IAM7C,UAAU,CAAC,GAAG,EAAE,uBAAuB,GAAI,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAkB5D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAyBzG,SAAS,CAAC,QAAQ,CACd,KAAK,EAAE,OAAO,GAAG,OAAO,EAAE;CAgCjC"}
1
+ {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/attributes/evaluator.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAK1G,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAExD,qBAAa,yBAAyB,CAClC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACrD,YAAW,gBAAgB;IACzB,SAAS,CAAC,SAAS,EAAG,yBAAyB,CAAC,CAAC,CAAC,CAAC;IAEnD,SAAS,CAAC,MAAM,EAAG,kBAAkB,CAAC;;IAOtC,QAAQ,IAAK,MAAM,EAAE;IAIf,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAiBpE,UAAU,CAAC,GAAG,EAAE,uBAAuB,GAAI,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAkB5D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IA6CzG,SAAS,CAAC,QAAQ,CACd,KAAK,EAAE,OAAO,GAAG,OAAO,EAAE;CAgCjC"}
@@ -1,6 +1,6 @@
1
- import type { MongoQuery } from '@ucast/mongo2js';
1
+ import type { MongoFiltersParserInput } from '@rapiq/parser-mongo';
2
2
  import type { BasePolicy } from '../../types';
3
- export type AttributesPolicyQuery<T> = MongoQuery<T>;
3
+ export type AttributesPolicyQuery<T extends Record<string, any> = Record<string, any>> = MongoFiltersParserInput<T>;
4
4
  export interface AttributesPolicy<T extends Record<string, any> = Record<string, any>> extends BasePolicy {
5
5
  query: AttributesPolicyQuery<T>;
6
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/attributes/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,MAAM,qBAAqB,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;AAErD,MAAM,WAAW,gBAAgB,CAC7B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACrD,SAAQ,UAAU;IAChB,KAAK,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAA;CAClC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/attributes/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,MAAM,qBAAqB,CAC7B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IACnD,uBAAuB,CAAC,CAAC,CAAC,CAAC;AAE/B,MAAM,WAAW,gBAAgB,CAC7B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACrD,SAAQ,UAAU;IAChB,KAAK,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAA;CAClC"}
@@ -1 +1 @@
1
- {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/composite/evaluator.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAG1G,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,qBAAa,wBAAyB,YAAW,gBAAgB;IAC7D,SAAS,CAAC,SAAS,EAAG,wBAAwB,CAAC;;IAMzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC;CA8E5G"}
1
+ {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/composite/evaluator.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAI1G,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,qBAAa,wBAAyB,YAAW,gBAAgB;IAC7D,SAAS,CAAC,SAAS,EAAG,wBAAwB,CAAC;;IAMzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAgM5G"}
@@ -4,7 +4,7 @@ export interface CompositePolicy extends BasePolicy {
4
4
  /**
5
5
  * How to decide if a policy evaluates to true.
6
6
  */
7
- decision_strategy?: `${DecisionStrategy}`;
7
+ decisionStrategy?: `${DecisionStrategy}`;
8
8
  /**
9
9
  * Child policies.
10
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/composite/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,eAAgB,SAAQ,UAAU;IAC/C;;OAEG;IACH,iBAAiB,CAAC,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAC1C;;OAEG;IACH,QAAQ,EAAE,UAAU,EAAE,CAAC;CAC1B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/composite/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,eAAgB,SAAQ,UAAU;IAC/C;;OAEG;IACH,gBAAgB,CAAC,EAAE,GAAG,gBAAgB,EAAE,CAAC;IACzC;;OAEG;IACH,QAAQ,EAAE,UAAU,EAAE,CAAC;CAC1B"}
@@ -38,7 +38,6 @@ export declare const SystemPolicyName: {
38
38
  readonly PERMISSION_BINDING: "system.permission-binding";
39
39
  readonly REALM_MATCH: "system.realm-match";
40
40
  readonly CLIENT_NAMES_SELF_MANAGE: "system.client-names-self-manage";
41
- readonly ROBOT_NAMES_SELF_MANAGE: "system.robot-names-self-manage";
42
41
  readonly USER_NAMES_SELF_MANAGE: "system.user-names-self-manage";
43
42
  };
44
43
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/policy/built-in/constants.ts"],"names":[],"mappings":"AAOA,oBAAY,iBAAiB;IACzB;;OAEG;IACH,SAAS,cAAc;IACvB;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,eAAe,mBAAmB;IAClC;;OAEG;IACH,UAAU,eAAe;IACzB;;OAEG;IACH,WAAW,eAAe;IAE1B;;OAEG;IACH,QAAQ,aAAa;IAErB;;OAEG;IACH,kBAAkB,sBAAsB;CAI3C;AAED,eAAO,MAAM,gBAAgB;;;;;;;;CAQnB,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/policy/built-in/constants.ts"],"names":[],"mappings":"AAOA,oBAAY,iBAAiB;IACzB;;OAEG;IACH,SAAS,cAAc;IACvB;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,eAAe,mBAAmB;IAClC;;OAEG;IACH,UAAU,eAAe;IACzB;;OAEG;IACH,WAAW,eAAe;IAE1B;;OAEG;IACH,QAAQ,aAAa;IAErB;;OAEG;IACH,kBAAkB,sBAAsB;CAI3C;AAED,eAAO,MAAM,gBAAgB;;;;;;;CAOnB,CAAC"}
@@ -6,6 +6,7 @@ export declare class IdentityPolicyEvaluator implements IPolicyEvaluator {
6
6
  protected validator: IdentityPolicyValidator;
7
7
  protected dataValidator: PolicyIdentityDataValidator;
8
8
  constructor();
9
+ requires(): string[];
9
10
  accessData(ctx: PolicyEvaluationContext): Promise<IdentityPolicyData | null>;
10
11
  evaluate(value: Record<string, any>, ctx: PolicyEvaluationContext): Promise<PolicyEvaluationResult>;
11
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/identity/evaluator.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAG1G,OAAO,EAAE,2BAA2B,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,qBAAa,uBAAwB,YAAW,gBAAgB;IAC5D,SAAS,CAAC,SAAS,EAAG,uBAAuB,CAAC;IAE9C,SAAS,CAAC,aAAa,EAAG,2BAA2B,CAAC;;IAOhD,UAAU,CAAC,GAAG,EAAE,uBAAuB,GAAI,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAiB7E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC;CA0C5G"}
1
+ {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/identity/evaluator.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAI1G,OAAO,EAAE,2BAA2B,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,qBAAa,uBAAwB,YAAW,gBAAgB;IAC5D,SAAS,CAAC,SAAS,EAAG,uBAAuB,CAAC;IAE9C,SAAS,CAAC,aAAa,EAAG,2BAA2B,CAAC;;IAOtD,QAAQ,IAAK,MAAM,EAAE;IAIf,UAAU,CAAC,GAAG,EAAE,uBAAuB,GAAI,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAiB7E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC;CA0C5G"}
@@ -7,7 +7,7 @@ export interface IdentityPolicy extends BasePolicy {
7
7
  }
8
8
  export type IdentityPolicyData = {
9
9
  /**
10
- * user, client, robot
10
+ * user, client
11
11
  */
12
12
  type: string;
13
13
  /**
@@ -3,6 +3,7 @@ import { PermissionBindingPolicyValidator } from './validator';
3
3
  export declare class PermissionBindingPolicyEvaluator implements IPolicyEvaluator {
4
4
  protected validator: PermissionBindingPolicyValidator;
5
5
  constructor();
6
+ requires(): string[];
6
7
  evaluate(value: Record<string, any>): Promise<PolicyEvaluationResult>;
7
8
  }
8
9
  //# sourceMappingURL=module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/permission-binding/module.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAEjF,OAAO,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAC;AAE/D,qBAAa,gCAAiC,YAAW,gBAAgB;IACrE,SAAS,CAAC,SAAS,EAAE,gCAAgC,CAAC;;IAMhD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAM9E"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/permission-binding/module.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAGjF,OAAO,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAC;AAE/D,qBAAa,gCAAiC,YAAW,gBAAgB;IACrE,SAAS,CAAC,SAAS,EAAE,gCAAgC,CAAC;;IAMtD,QAAQ,IAAK,MAAM,EAAE;IAMf,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAM9E"}
@@ -1,3 +1,4 @@
1
+ import type { ICondition } from '@rapiq/core';
1
2
  import type { IPolicyEvaluator, PolicyEvaluationContext, PolicyEvaluationResult } from '../../evaluation';
2
3
  import { AttributesPolicyEvaluator } from '../attributes';
3
4
  import { IdentityPolicyEvaluator } from '../identity';
@@ -7,6 +8,19 @@ export declare class RealmMatchPolicyEvaluator implements IPolicyEvaluator {
7
8
  protected identityEvaluator: IdentityPolicyEvaluator;
8
9
  protected attributesEvaluator: AttributesPolicyEvaluator;
9
10
  constructor();
11
+ requires(value: Record<string, any>): string[];
12
+ /**
13
+ * Condition form over the row's realm column, with the actor realm baked in
14
+ * (mirrors `realmScopeMatches` / the attribute-mode match). Exactness holds for
15
+ * row-shaped data where the referenced field exists (DB rows) — the object-bag
16
+ * "key absent → neutral-pass" case has no SQL counterpart. Lowerable configs:
17
+ * scope mode (field = single-string `attributeName`, default `realmId` — scope-mode
18
+ * EVALUATION ignores `attributeName`, lowering reuses it as the column override),
19
+ * and strict attribute mode with a single explicit `attributeName`. Everything
20
+ * else (multi-key / default-key CONSENSUS, non-strict key expansion) is
21
+ * row-shape-dependent and stays a post-check.
22
+ */
23
+ toCondition(value: Record<string, any>, ctx: PolicyEvaluationContext): Promise<ICondition | null>;
10
24
  evaluate(value: Record<string, any>, ctx: PolicyEvaluationContext): Promise<PolicyEvaluationResult>;
11
25
  }
12
26
  //# sourceMappingURL=evaluator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/realm-match/evaluator.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAG1G,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAExD,qBAAa,yBAA0B,YAAW,gBAAgB;IAC9D,SAAS,CAAC,SAAS,EAAG,yBAAyB,CAAC;IAEhD,SAAS,CAAC,iBAAiB,EAAE,uBAAuB,CAAC;IAErD,SAAS,CAAC,mBAAmB,EAAG,yBAAyB,CAAC;;IAQpD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC;CA2J5G"}
1
+ {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/realm-match/evaluator.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAU9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAG1G,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAExD,qBAAa,yBAA0B,YAAW,gBAAgB;IAC9D,SAAS,CAAC,SAAS,EAAG,yBAAyB,CAAC;IAEhD,SAAS,CAAC,iBAAiB,EAAE,uBAAuB,CAAC;IAErD,SAAS,CAAC,mBAAmB,EAAG,yBAAyB,CAAC;;IAQ1D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAI,MAAM,EAAE;IAW/C;;;;;;;;;;OAUG;IACG,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,uBAAuB,GAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAuFlG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAuK5G"}
@@ -5,26 +5,26 @@ export interface RealmMatchPolicy extends BasePolicy {
5
5
  /**
6
6
  * Determines how realm-id/name matches are handled.
7
7
  */
8
- decision_strategy?: `${DecisionStrategy}`;
8
+ decisionStrategy?: `${DecisionStrategy}`;
9
9
  /**
10
10
  * Specifies the name(s) of the realm-id/name attribute(s) used for matching.
11
11
  * Can be a single attribute name or an array of attribute names.
12
12
  */
13
- attribute_name?: string | string[];
13
+ attributeName?: string | string[];
14
14
  /**
15
15
  * Only match if the attribute is strict equal to the name.
16
16
  */
17
- attribute_name_strict?: boolean;
17
+ attributeNameStrict?: boolean;
18
18
  /**
19
19
  * Determines if resources with null realm-id/name value should match all identity realms.
20
20
  * If true, any identity realm can access resources with null realm-id/name values.
21
21
  */
22
- attribute_null_match_all?: boolean;
22
+ attributeNullMatchAll?: boolean;
23
23
  /**
24
24
  * Coarse, actor-relative realm reach (none/own/ownOrNull/any). When set, the evaluator
25
25
  * runs in SCOPE MODE: it matches the resource realm read from the REALM_MATCH data key
26
- * against the identity realm via `realmScopeMatches`, and ignores `attribute_name` /
27
- * `attribute_null_match_all`. With no REALM_MATCH key present it neutral-passes.
26
+ * against the identity realm via `realmScopeMatches`, and ignores `attributeName` /
27
+ * `attributeNullMatchAll`. With no REALM_MATCH key present it neutral-passes.
28
28
  */
29
29
  scope?: `${RealmScope}`;
30
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/realm-match/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAChD;;OAEG;IACH,iBAAiB,CAAC,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAE1C;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAEnC;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;OAGG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAEnC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,GAAG,UAAU,EAAE,CAAA;CAC1B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/realm-match/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAChD;;OAEG;IACH,gBAAgB,CAAC,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAEzC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAElC;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,GAAG,UAAU,EAAE,CAAA;CAC1B"}
@@ -16,14 +16,14 @@ export interface TimePolicy extends BasePolicy {
16
16
  /**
17
17
  * 0 (Sunday) - 6 (Saturday)
18
18
  */
19
- day_of_week?: number;
19
+ dayOfWeek?: number;
20
20
  /**
21
21
  * 1 - 31
22
22
  */
23
- day_of_month?: number;
23
+ dayOfMonth?: number;
24
24
  /**
25
25
  * 1 - 365
26
26
  */
27
- day_of_year?: number;
27
+ dayOfYear?: number;
28
28
  }
29
29
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/time/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,WAAW,UAAW,SAAQ,UAAU;IAC1C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAE/B;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,EAAE,GAAG,kBAAkB,EAAE,CAAC;IAEnC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/time/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,WAAW,UAAW,SAAQ,UAAU;IAC1C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAE/B;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,EAAE,GAAG,kBAAkB,EAAE,CAAC;IAEnC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -5,6 +5,7 @@ import type { DatePolicy } from './date';
5
5
  import type { CompositePolicy } from './composite';
6
6
  import type { IdentityPolicy } from './identity';
7
7
  import type { PermissionBindingPolicy } from './permission-binding';
8
+ import type { RealmMatchPolicy } from './realm-match';
8
9
  import type { TimePolicy } from './time';
9
10
  type BuiltInPolicyTypeMapRaw<T extends Record<string, any> = Record<string, any>> = {
10
11
  [BuiltInPolicyType.ATTRIBUTES]: AttributesPolicy<T>;
@@ -14,6 +15,7 @@ type BuiltInPolicyTypeMapRaw<T extends Record<string, any> = Record<string, any>
14
15
  [BuiltInPolicyType.TIME]: TimePolicy;
15
16
  [BuiltInPolicyType.IDENTITY]: IdentityPolicy;
16
17
  [BuiltInPolicyType.PERMISSION_BINDING]: PermissionBindingPolicy;
18
+ [BuiltInPolicyType.REALM_MATCH]: RealmMatchPolicy;
17
19
  };
18
20
  export type BuiltInPolicyTypeMap<T extends Record<string, any> = Record<string, any>> = {
19
21
  [K in keyof BuiltInPolicyTypeMapRaw<T> as `${K}`]: BuiltInPolicyTypeMapRaw<T>[K];
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/policy/built-in/types.ts"],"names":[],"mappings":"AAOA,OAAO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@@
1
- {"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../../../src/policy/evaluation/context/define.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAGxF,wBAAgB,6BAA6B,CACzC,KAAK,GAAE,4BAAiC,GACxC,uBAAuB,CAQ1B"}
1
+ {"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../../../src/policy/evaluation/context/define.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAGxF,wBAAgB,6BAA6B,CACzC,KAAK,GAAE,4BAAiC,GACxC,uBAAuB,CAS1B"}
@@ -6,6 +6,13 @@ export type PolicyEvaluationContext = {
6
6
  readonly exclude: string[];
7
7
  readonly include: string[];
8
8
  readonly data: PolicyData;
9
+ /**
10
+ * Attach the condition form (`PolicyEvaluationResult.condition`) to pending
11
+ * subtrees via `IPolicyEvaluator.toCondition`. Off by default — evaluation-only
12
+ * callers (evaluate / preEvaluate hot paths) must not pay the lowering cost;
13
+ * query-build callers opt in.
14
+ */
15
+ readonly withConditions: boolean;
9
16
  };
10
17
  export type PolicyEvaluationContextInput = Partial<PolicyEvaluationContext>;
11
18
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/policy/evaluation/context/types.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,MAAM,uBAAuB,GAAG;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACtD,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAC5B,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/policy/evaluation/context/types.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,MAAM,uBAAuB,GAAG;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACtD,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAA;CACnC,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC"}
@@ -1,11 +1,53 @@
1
+ import type { ICondition } from '@rapiq/core';
1
2
  import type { Issue } from 'validup';
2
3
  import type { PolicyEvaluationContext } from './context';
3
4
  export type PolicyEvaluators = Record<string, IPolicyEvaluator>;
4
5
  export type PolicyEvaluationResult = {
5
6
  success: boolean;
7
+ /**
8
+ * The policy could not be settled yet — a data key it requires is absent from the
9
+ * evaluation bag (see {@link IPolicyEvaluator.requires}). Pending always rides on
10
+ * `success: false` (fail-closed: a consumer that ignores the flag behaves like a
11
+ * deny); only pre-gate style consumers treat pending as a pass.
12
+ *
13
+ * Unknown stays unknown: `invert` is never applied to a pending result.
14
+ */
15
+ pending?: boolean;
16
+ /**
17
+ * EXACT condition form of the pending subtree (see
18
+ * {@link IPolicyEvaluator.toCondition}): a row satisfies the condition iff the
19
+ * pending subtree settles true on that row's attributes, given the current bag.
20
+ * Attached only on pending results, only when the evaluation context requested it
21
+ * (`withConditions`), and only when the ENTIRE pending subtree is expressible —
22
+ * a partially expressible tree carries no condition (fail-safe: the consumer
23
+ * falls back to a per-row post-check).
24
+ */
25
+ condition?: ICondition;
6
26
  issues?: Issue[];
7
27
  };
8
28
  export interface IPolicyEvaluator {
29
+ /**
30
+ * PolicyData keys this policy needs before it can settle (e.g. `identity`,
31
+ * `attributes`). When any returned key is absent from the evaluation bag, the
32
+ * engine returns a pending result instead of invoking {@link evaluate}.
33
+ *
34
+ * Receives the raw (unvalidated) policy configuration, since data needs may be
35
+ * config-dependent (e.g. realm-match scope vs. attribute mode). Omit the method
36
+ * (or return an empty array) for policies evaluable with ambient data only.
37
+ */
38
+ requires?(value: Record<string, any>): string[];
39
+ /**
40
+ * Express the policy as a condition over row attributes (rapiq `ICondition`)
41
+ * instead of waiting for the row — the WHERE-pushdown capability. The result is
42
+ * a partial evaluation against the knowns in `context.data` (e.g. the actor's
43
+ * realm is baked into a realm-match condition), and must be EXACT: for every
44
+ * row, `condition(row)` === "this policy settles true with attributes = row".
45
+ *
46
+ * Return `null` when this configuration is not expressible (the policy then
47
+ * stays a per-row post-check — always sound). Omit the method for policies that
48
+ * never lower (identity, date/time, attributeNames).
49
+ */
50
+ toCondition?(value: Record<string, any>, context: PolicyEvaluationContext): Promise<ICondition | null>;
9
51
  /**
10
52
  * Execute the policy with specific data and a given context.
11
53
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/policy/evaluation/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,WA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IAAI,CAAC,CAAC;IAEvG;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;CAC3G"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@authup/access",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.52",
4
+ "version": "1.0.0-beta.54",
5
5
  "description": "A library for evaluating permissions and policies.",
6
6
  "license": "Apache-2.0",
7
7
  "exports": {
@@ -53,9 +53,11 @@
53
53
  },
54
54
  "homepage": "https://github.com/authup/authup#readme",
55
55
  "dependencies": {
56
- "@authup/errors": "^1.0.0-beta.52",
57
- "@authup/kit": "^1.0.0-beta.52",
58
- "@ucast/mongo2js": "^2.0.0",
56
+ "@authup/errors": "^1.0.0-beta.54",
57
+ "@authup/kit": "^1.0.0-beta.54",
58
+ "@rapiq/core": "^2.0.0-beta.7",
59
+ "@rapiq/memory": "^2.0.0-beta.7",
60
+ "@rapiq/parser-mongo": "^2.0.0-beta.7",
59
61
  "@validup/zod": "^0.3.3",
60
62
  "smob": "^1.6.1",
61
63
  "validup": "^0.5.1",