@authup/access 1.0.0-beta.27 → 1.0.0-beta.29

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 (107) hide show
  1. package/LICENSE +201 -201
  2. package/dist/index.mjs +758 -541
  3. package/dist/index.mjs.map +1 -1
  4. package/dist/permission/checker/index.d.ts +3 -0
  5. package/dist/permission/checker/index.d.ts.map +1 -0
  6. package/dist/permission/{module.d.ts → checker/module.d.ts} +8 -7
  7. package/dist/permission/checker/module.d.ts.map +1 -0
  8. package/dist/permission/checker/types.d.ts +26 -0
  9. package/dist/permission/checker/types.d.ts.map +1 -0
  10. package/dist/permission/error/index.d.ts +0 -1
  11. package/dist/permission/error/index.d.ts.map +1 -1
  12. package/dist/permission/error/module.d.ts +4 -5
  13. package/dist/permission/error/module.d.ts.map +1 -1
  14. package/dist/permission/index.d.ts +2 -2
  15. package/dist/permission/index.d.ts.map +1 -1
  16. package/dist/permission/repository/index.d.ts.map +1 -0
  17. package/dist/permission/repository/memory.d.ts +9 -0
  18. package/dist/permission/repository/memory.d.ts.map +1 -0
  19. package/dist/permission/{provider → repository}/types.d.ts +2 -2
  20. package/dist/permission/repository/types.d.ts.map +1 -0
  21. package/dist/permission/types.d.ts +1 -19
  22. package/dist/permission/types.d.ts.map +1 -1
  23. package/dist/policy/built-in/attribute-names/evaluator.d.ts +5 -8
  24. package/dist/policy/built-in/attribute-names/evaluator.d.ts.map +1 -1
  25. package/dist/policy/built-in/attributes/evaluator.d.ts +5 -9
  26. package/dist/policy/built-in/attributes/evaluator.d.ts.map +1 -1
  27. package/dist/policy/built-in/attributes/validator.d.ts.map +1 -1
  28. package/dist/policy/built-in/composite/evaluator.d.ts +3 -8
  29. package/dist/policy/built-in/composite/evaluator.d.ts.map +1 -1
  30. package/dist/policy/built-in/composite/validator.d.ts.map +1 -1
  31. package/dist/policy/built-in/date/evaluator.d.ts +3 -8
  32. package/dist/policy/built-in/date/evaluator.d.ts.map +1 -1
  33. package/dist/policy/built-in/identity/data/index.d.ts +2 -0
  34. package/dist/policy/built-in/identity/data/index.d.ts.map +1 -0
  35. package/dist/policy/built-in/identity/data/validator.d.ts +6 -0
  36. package/dist/policy/built-in/identity/data/validator.d.ts.map +1 -0
  37. package/dist/policy/built-in/identity/evaluator.d.ts +7 -8
  38. package/dist/policy/built-in/identity/evaluator.d.ts.map +1 -1
  39. package/dist/policy/built-in/identity/types.d.ts +22 -0
  40. package/dist/policy/built-in/identity/types.d.ts.map +1 -1
  41. package/dist/policy/built-in/permission-binding/module.d.ts +3 -8
  42. package/dist/policy/built-in/permission-binding/module.d.ts.map +1 -1
  43. package/dist/policy/built-in/realm-match/evaluator.d.ts +7 -8
  44. package/dist/policy/built-in/realm-match/evaluator.d.ts.map +1 -1
  45. package/dist/policy/built-in/time/evaluator.d.ts +3 -8
  46. package/dist/policy/built-in/time/evaluator.d.ts.map +1 -1
  47. package/dist/policy/constants.d.ts +12 -0
  48. package/dist/policy/constants.d.ts.map +1 -0
  49. package/dist/policy/data.d.ts +20 -0
  50. package/dist/policy/data.d.ts.map +1 -0
  51. package/dist/policy/engine/module.d.ts +9 -9
  52. package/dist/policy/engine/module.d.ts.map +1 -1
  53. package/dist/policy/engine/types.d.ts +6 -3
  54. package/dist/policy/engine/types.d.ts.map +1 -1
  55. package/dist/policy/error/module.d.ts +5 -2
  56. package/dist/policy/error/module.d.ts.map +1 -1
  57. package/dist/policy/evaluation/context/define.d.ts +3 -0
  58. package/dist/policy/evaluation/context/define.d.ts.map +1 -0
  59. package/dist/policy/evaluation/context/index.d.ts +3 -0
  60. package/dist/policy/evaluation/context/index.d.ts.map +1 -0
  61. package/dist/policy/evaluation/context/types.d.ts +11 -0
  62. package/dist/policy/evaluation/context/types.d.ts.map +1 -0
  63. package/dist/policy/evaluation/index.d.ts +3 -0
  64. package/dist/policy/evaluation/index.d.ts.map +1 -0
  65. package/dist/policy/evaluation/types.d.ts +14 -0
  66. package/dist/policy/evaluation/types.d.ts.map +1 -0
  67. package/dist/policy/index.d.ts +4 -1
  68. package/dist/policy/index.d.ts.map +1 -1
  69. package/dist/policy/issue/constants.d.ts +21 -0
  70. package/dist/policy/issue/constants.d.ts.map +1 -0
  71. package/dist/policy/issue/define.d.ts +4 -0
  72. package/dist/policy/issue/define.d.ts.map +1 -0
  73. package/dist/policy/issue/index.d.ts +4 -0
  74. package/dist/policy/issue/index.d.ts.map +1 -0
  75. package/dist/policy/issue/types.d.ts +5 -0
  76. package/dist/policy/issue/types.d.ts.map +1 -0
  77. package/dist/policy/types.d.ts +3 -41
  78. package/dist/policy/types.d.ts.map +1 -1
  79. package/package.json +19 -15
  80. package/dist/index.cjs +0 -1055
  81. package/dist/index.cjs.map +0 -1
  82. package/dist/permission/error/types.d.ts +0 -11
  83. package/dist/permission/error/types.d.ts.map +0 -1
  84. package/dist/permission/module.d.ts.map +0 -1
  85. package/dist/permission/provider/index.d.ts.map +0 -1
  86. package/dist/permission/provider/memory.d.ts +0 -9
  87. package/dist/permission/provider/memory.d.ts.map +0 -1
  88. package/dist/permission/provider/types.d.ts.map +0 -1
  89. package/dist/policy/evaluator/data/identity/index.d.ts +0 -2
  90. package/dist/policy/evaluator/data/identity/index.d.ts.map +0 -1
  91. package/dist/policy/evaluator/data/identity/validator.d.ts +0 -6
  92. package/dist/policy/evaluator/data/identity/validator.d.ts.map +0 -1
  93. package/dist/policy/evaluator/data/index.d.ts +0 -4
  94. package/dist/policy/evaluator/data/index.d.ts.map +0 -1
  95. package/dist/policy/evaluator/data/permission/index.d.ts +0 -2
  96. package/dist/policy/evaluator/data/permission/index.d.ts.map +0 -1
  97. package/dist/policy/evaluator/data/permission/validator.d.ts +0 -6
  98. package/dist/policy/evaluator/data/permission/validator.d.ts.map +0 -1
  99. package/dist/policy/evaluator/data/validator.d.ts +0 -6
  100. package/dist/policy/evaluator/data/validator.d.ts.map +0 -1
  101. package/dist/policy/evaluator/evaluate.d.ts +0 -4
  102. package/dist/policy/evaluator/evaluate.d.ts.map +0 -1
  103. package/dist/policy/evaluator/index.d.ts +0 -4
  104. package/dist/policy/evaluator/index.d.ts.map +0 -1
  105. package/dist/policy/evaluator/types.d.ts +0 -44
  106. package/dist/policy/evaluator/types.d.ts.map +0 -1
  107. /package/dist/permission/{provider → repository}/index.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/permission/checker/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE3D,MAAM,WAAW,kBAAkB;IAC/B,KAAK,CAAC,GAAG,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzD,UAAU,CAAC,GAAG,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9D,QAAQ,CAAC,GAAG,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5D,aAAa,CAAC,GAAG,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACnE;AAED,MAAM,MAAM,wBAAwB,GAAG;IACnC,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IACxC,gBAAgB,CAAC,EAAE,GAAG,gBAAgB,EAAE,CAAC;IACzC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IACxC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,OAAO,CAAC,EAAE,6BAA6B,CAAA;CAC1C,CAAC"}
@@ -1,3 +1,2 @@
1
1
  export * from './module';
2
- export * from './types';
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/permission/error/index.ts"],"names":[],"mappings":"AAOA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/permission/error/index.ts"],"names":[],"mappings":"AAOA,cAAc,UAAU,CAAC"}
@@ -1,14 +1,13 @@
1
1
  import type { AuthupErrorOptions } from '@authup/errors';
2
2
  import { AuthupError } from '@authup/errors';
3
- import type { PolicyError, PolicyWithType } from '../../policy';
4
- import type { PermissionEvaluationErrorOptions } from './types';
3
+ import type { PolicyIssue } from '../../policy';
5
4
  export declare class PermissionError extends AuthupError {
6
- policy: PolicyWithType | undefined;
7
- policyError: PolicyError | undefined;
8
5
  constructor(options?: AuthupErrorOptions);
6
+ addIssue(data: PolicyIssue): void;
7
+ addIssues(data: PolicyIssue[]): void;
9
8
  static notFound(name: string): PermissionError;
10
9
  static denied(name: string): PermissionError;
11
10
  static deniedAll(names: string[]): PermissionError;
12
- static evaluationFailed(options: PermissionEvaluationErrorOptions): PermissionError;
11
+ static evaluationFailed(name: string | string[]): PermissionError;
13
12
  }
14
13
  //# sourceMappingURL=module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/permission/error/module.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAa,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,SAAS,CAAC;AAEhE,qBAAa,eAAgB,SAAQ,WAAW;IACrC,MAAM,EAAG,cAAc,GAAG,SAAS,CAAC;IAEpC,WAAW,EAAG,WAAW,GAAG,SAAS,CAAC;gBAEjC,OAAO,GAAE,kBAAuB;IAQ5C,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM;IAO5B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM;IAO1B,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE;IAOhC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,gCAAgC;CAoBpE"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/permission/error/module.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAa,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,qBAAa,eAAgB,SAAQ,WAAW;gBAChC,OAAO,GAAE,kBAAuB;IAQ5C,QAAQ,CAAC,IAAI,EAAE,WAAW;IAI1B,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE;IAI7B,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM;IAO5B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM;IAO1B,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE;IAOhC,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE;CAalD"}
@@ -1,6 +1,6 @@
1
1
  export * from './error';
2
2
  export * from './helpers';
3
- export * from './provider';
4
- export * from './module';
3
+ export * from './repository';
4
+ export * from './checker';
5
5
  export * from './types';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/permission/index.ts"],"names":[],"mappings":"AAOA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/permission/index.ts"],"names":[],"mappings":"AAOA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/permission/repository/index.ts"],"names":[],"mappings":"AAOA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { PermissionItem } from '../types';
2
+ import type { IPermissionRepository, PermissionGetOptions } from './types';
3
+ export declare class PermissionMemoryRepository implements IPermissionRepository {
4
+ protected items: Record<string, PermissionItem>;
5
+ constructor(items?: PermissionItem[]);
6
+ findOne(options: PermissionGetOptions): Promise<PermissionItem | null>;
7
+ setMany(input: PermissionItem[]): void;
8
+ }
9
+ //# sourceMappingURL=memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../src/permission/repository/memory.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE3E,qBAAa,0BAA2B,YAAW,qBAAqB;IACpE,SAAS,CAAC,KAAK,EAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAM;gBAE1C,KAAK,GAAE,cAAc,EAAO;IAIlC,OAAO,CACT,OAAO,EAAE,oBAAoB,GAC9B,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IASjC,OAAO,CAAC,KAAK,EAAE,cAAc,EAAE;CAOlC"}
@@ -4,7 +4,7 @@ export type PermissionGetOptions = {
4
4
  clientId?: string | null;
5
5
  realmId?: string | null;
6
6
  };
7
- export interface PermissionProvider {
8
- get(criteria: PermissionGetOptions): Promise<PermissionItem | undefined>;
7
+ export interface IPermissionRepository {
8
+ findOne(criteria: PermissionGetOptions): Promise<PermissionItem | null>;
9
9
  }
10
10
  //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/permission/repository/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,MAAM,oBAAoB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B,CAAC;AAEF,MAAM,WAAW,qBAAqB;IAClC,OAAO,CAAC,QAAQ,EAAE,oBAAoB,GAAI,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CAC5E"}
@@ -1,26 +1,8 @@
1
- import type { DecisionStrategy } from '../constants';
2
- import type { PolicyEngine, PolicyInput, PolicyWithType } from '../policy';
3
- import type { PermissionProvider } from './provider';
1
+ import type { PolicyWithType } from '../policy';
4
2
  export type PermissionItem = {
5
3
  name: string;
6
4
  clientId?: string | null;
7
5
  realmId?: string | null;
8
6
  policy?: PolicyWithType;
9
7
  };
10
- export type PermissionCheckerOptions = {
11
- provider?: PermissionProvider;
12
- policyEngine?: PolicyEngine;
13
- realmId?: string | null;
14
- clientId?: string | null;
15
- };
16
- export type PermissionCheckerCheckOptions = {
17
- decisionStrategy?: `${DecisionStrategy}`;
18
- policiesIncluded?: string[];
19
- policiesExcluded?: string[];
20
- };
21
- export type PermissionCheckerCheckContext = {
22
- name: string | string[];
23
- input?: PolicyInput;
24
- options?: PermissionCheckerCheckOptions;
25
- };
26
8
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/permission/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EACR,YAAY,EAAE,WAAW,EAAE,cAAc,EAC5C,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,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,MAAM,CAAC,EAAE,cAAc,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACnC,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IACxC,gBAAgB,CAAC,EAAE,GAAG,gBAAgB,EAAE,CAAC;IACzC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IACxC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,OAAO,CAAC,EAAE,6BAA6B,CAAA;CAC1C,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/permission/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,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,MAAM,CAAC,EAAE,cAAc,CAAC;CAC3B,CAAC"}
@@ -1,13 +1,10 @@
1
- import type { PolicyEvaluateContext, PolicyEvaluator } from '../../evaluator';
2
- import type { PolicyInput, PolicyWithType } from '../../types';
3
- import type { AttributeNamesPolicy } from './types';
1
+ import type { IPolicyEvaluator, PolicyEvaluationContext, PolicyEvaluationResult } from '../../evaluation';
4
2
  import { AttributeNamesPolicyValidator } from './validator';
5
- export declare class AttributeNamesPolicyEvaluator implements PolicyEvaluator<AttributeNamesPolicy> {
3
+ import { AttributesPolicyEvaluator } from '../attributes';
4
+ export declare class AttributeNamesPolicyEvaluator implements IPolicyEvaluator {
6
5
  protected validator: AttributeNamesPolicyValidator;
6
+ protected attributesEvaluator: AttributesPolicyEvaluator;
7
7
  constructor();
8
- can(ctx: PolicyEvaluateContext<PolicyWithType>): Promise<boolean>;
9
- validateConfig(ctx: PolicyEvaluateContext<PolicyWithType>): Promise<AttributeNamesPolicy>;
10
- validateInput(ctx: PolicyEvaluateContext<AttributeNamesPolicy>): Promise<PolicyInput>;
11
- evaluate(ctx: PolicyEvaluateContext<AttributeNamesPolicy, PolicyInput>): Promise<boolean>;
8
+ evaluate(value: Record<string, any>, ctx: PolicyEvaluationContext): Promise<PolicyEvaluationResult>;
12
9
  }
13
10
  //# 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":"AASA,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE9E,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAE5D,qBAAa,6BAA8B,YAAW,eAAe,CAAC,oBAAoB,CAAC;IACvF,SAAS,CAAC,SAAS,EAAG,6BAA6B,CAAC;;IAM9C,GAAG,CAAC,GAAG,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAAI,OAAO,CAAC,OAAO,CAAC;IAIlE,cAAc,CAAC,GAAG,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAAI,OAAO,CAAC,oBAAoB,CAAC;IAI1F,aAAa,CAAC,GAAG,EAAE,qBAAqB,CAAC,oBAAoB,CAAC,GAAI,OAAO,CAAC,WAAW,CAAC;IAQtF,QAAQ,CAAC,GAAG,EAAE,qBAAqB,CAAC,oBAAoB,EAAE,WAAW,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;CAgBlG"}
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;AAI1G,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;CAsC5G"}
@@ -1,14 +1,10 @@
1
- import type { PolicyEvaluateContext, PolicyEvaluator } from '../../evaluator';
2
- import type { PolicyInput, PolicyWithType } from '../../types';
3
- import type { AttributesPolicy } from './types';
1
+ import type { IPolicyEvaluator, PolicyEvaluationContext, PolicyEvaluationResult } from '../../evaluation';
4
2
  import { AttributesPolicyValidator } from './validator';
5
- export declare class AttributesPolicyEvaluator<T extends Record<string, any> = Record<string, any>> implements PolicyEvaluator<AttributesPolicy<T>> {
3
+ export declare class AttributesPolicyEvaluator<T extends Record<string, any> = Record<string, any>> implements IPolicyEvaluator {
6
4
  protected validator: AttributesPolicyValidator<T>;
7
5
  constructor();
8
- can(ctx: PolicyEvaluateContext<PolicyWithType>): Promise<boolean>;
9
- validateConfig(ctx: PolicyEvaluateContext): Promise<AttributesPolicy<T>>;
10
- validateInput(ctx: PolicyEvaluateContext<AttributesPolicy<T>>): Promise<PolicyInput>;
11
- evaluate(ctx: PolicyEvaluateContext<AttributesPolicy<T>>): Promise<boolean>;
12
- protected fixQuery(query: Record<string, any>): void;
6
+ accessData(ctx: PolicyEvaluationContext): Promise<T | null>;
7
+ evaluate(value: Record<string, any>, ctx: PolicyEvaluationContext): Promise<PolicyEvaluationResult>;
8
+ protected fixQuery(query: unknown | unknown[]): void;
13
9
  }
14
10
  //# sourceMappingURL=evaluator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/attributes/evaluator.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE9E,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,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,eAAe,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAC7C,SAAS,CAAC,SAAS,EAAG,yBAAyB,CAAC,CAAC,CAAC,CAAC;;IAM7C,GAAG,CACL,GAAG,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAC1C,OAAO,CAAC,OAAO,CAAC;IAId,cAAc,CAAC,GAAG,EAAE,qBAAqB,GAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAIzE,aAAa,CAAC,GAAG,EAAE,qBAAqB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAI,OAAO,CAAC,WAAW,CAAC;IAQrF,QAAQ,CAAC,GAAG,EAAE,qBAAqB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAWjF,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAsBhD"}
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;IA2BzG,SAAS,CAAC,QAAQ,CACd,KAAK,EAAE,OAAO,GAAG,OAAO,EAAE;CAiCjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/attributes/validator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,qBAAa,yBAAyB,CAClC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACrD,SAAQ,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;IACpC,UAAU;CAqBb"}
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/attributes/validator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,qBAAa,yBAAyB,CAClC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACrD,SAAQ,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;IACpC,UAAU;CAoBb"}
@@ -1,13 +1,8 @@
1
- import type { PolicyEvaluateContext, PolicyEvaluator } from '../../evaluator';
2
- import type { PolicyInput, PolicyWithType } from '../../types';
3
- import type { CompositePolicy } from './types';
1
+ import type { IPolicyEvaluator, PolicyEvaluationContext, PolicyEvaluationResult } from '../../evaluation';
4
2
  import { CompositePolicyValidator } from './validator';
5
- export declare class CompositePolicyEvaluator implements PolicyEvaluator<CompositePolicy> {
3
+ export declare class CompositePolicyEvaluator implements IPolicyEvaluator {
6
4
  protected validator: CompositePolicyValidator;
7
5
  constructor();
8
- can(ctx: PolicyEvaluateContext<PolicyWithType>): Promise<boolean>;
9
- validateConfig(ctx: PolicyEvaluateContext): Promise<CompositePolicy>;
10
- validateInput(ctx: PolicyEvaluateContext<CompositePolicy>): Promise<PolicyInput>;
11
- evaluate(ctx: PolicyEvaluateContext<CompositePolicy>): Promise<boolean>;
6
+ evaluate(value: Record<string, any>, ctx: PolicyEvaluationContext): Promise<PolicyEvaluationResult>;
12
7
  }
13
8
  //# sourceMappingURL=evaluator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/composite/evaluator.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAG9E,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,qBAAa,wBAAyB,YAAW,eAAe,CAAC,eAAe,CAAC;IAC7E,SAAS,CAAC,SAAS,EAAG,wBAAwB,CAAC;;IAMzC,GAAG,CACL,GAAG,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAC1C,OAAO,CAAC,OAAO,CAAC;IAId,cAAc,CAAC,GAAG,EAAE,qBAAqB,GAAI,OAAO,CAAC,eAAe,CAAC;IAIrE,aAAa,CAAC,GAAG,EAAE,qBAAqB,CAAC,eAAe,CAAC,GAAI,OAAO,CAAC,WAAW,CAAC;IAIjF,QAAQ,CAAC,GAAG,EAAE,qBAAqB,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;CAuChF"}
1
+ {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/composite/evaluator.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACR,gBAAgB,EAAE,uBAAuB,EAAE,sBAAsB,EACpE,MAAM,kBAAkB,CAAC;AAG1B,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;CAyE5G"}
@@ -1 +1 @@
1
- {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/composite/validator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,qBAAa,wBAAyB,SAAQ,SAAS,CAAC,eAAe,CAAC;IACpE,UAAU;CAiCb"}
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/composite/validator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,qBAAa,wBAAyB,SAAQ,SAAS,CAAC,eAAe,CAAC;IACpE,UAAU;CAgCb"}
@@ -1,13 +1,8 @@
1
- import type { PolicyEvaluateContext, PolicyEvaluator } from '../../evaluator';
2
- import type { PolicyInput, PolicyWithType } from '../../types';
3
- import type { DatePolicy } from './types';
1
+ import type { IPolicyEvaluator, PolicyEvaluationContext, PolicyEvaluationResult } from '../../evaluation';
4
2
  import { DatePolicyValidator } from './validator';
5
- export declare class DatePolicyEvaluator implements PolicyEvaluator<DatePolicy> {
3
+ export declare class DatePolicyEvaluator implements IPolicyEvaluator {
6
4
  protected validator: DatePolicyValidator;
7
5
  constructor();
8
- can(ctx: PolicyEvaluateContext<PolicyWithType>): Promise<boolean>;
9
- validateConfig(ctx: PolicyEvaluateContext): Promise<DatePolicy>;
10
- validateInput(ctx: PolicyEvaluateContext<DatePolicy>): Promise<PolicyInput>;
11
- evaluate(ctx: PolicyEvaluateContext<DatePolicy>): Promise<boolean>;
6
+ evaluate(value: Record<string, any>, ctx: PolicyEvaluationContext): Promise<PolicyEvaluationResult>;
12
7
  }
13
8
  //# sourceMappingURL=evaluator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/date/evaluator.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE9E,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAkBlD,qBAAa,mBAAoB,YAAW,eAAe,CAAC,UAAU,CAAC;IACnE,SAAS,CAAC,SAAS,EAAG,mBAAmB,CAAC;;IAMpC,GAAG,CACL,GAAG,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAC1C,OAAO,CAAC,OAAO,CAAC;IAId,cAAc,CAAC,GAAG,EAAE,qBAAqB,GAAI,OAAO,CAAC,UAAU,CAAC;IAIhE,aAAa,CAAC,GAAG,EAAE,qBAAqB,CAAC,UAAU,CAAC,GAAI,OAAO,CAAC,WAAW,CAAC;IAI5E,QAAQ,CAAC,GAAG,EAAE,qBAAqB,CAAC,UAAU,CAAC,GAAI,OAAO,CAAC,OAAO,CAAC;CAwB5E"}
1
+ {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/date/evaluator.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAG1G,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAkBlD,qBAAa,mBAAoB,YAAW,gBAAgB;IACxD,SAAS,CAAC,SAAS,EAAG,mBAAmB,CAAC;;IAMpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC;CA0C5G"}
@@ -0,0 +1,2 @@
1
+ export * from './validator.ts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/policy/built-in/identity/data/index.ts"],"names":[],"mappings":"AAOA,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Container } from 'validup';
2
+ import type { IdentityPolicyData } from '../types.ts';
3
+ export declare class PolicyIdentityDataValidator extends Container<IdentityPolicyData> {
4
+ initialize(): void;
5
+ }
6
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../../src/policy/built-in/identity/data/validator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,qBAAa,2BAA4B,SAAQ,SAAS,CAAC,kBAAkB,CAAC;IAC1E,UAAU;CA+Cb"}
@@ -1,13 +1,12 @@
1
- import type { PolicyEvaluateContext, PolicyEvaluator } from '../../evaluator';
2
- import type { PolicyInput, PolicyWithType } from '../../types';
3
- import type { IdentityPolicy } from './types';
1
+ import type { IPolicyEvaluator, PolicyEvaluationContext, PolicyEvaluationResult } from '../../evaluation';
2
+ import { PolicyIdentityDataValidator } from './data';
3
+ import type { IdentityPolicyData } from './types';
4
4
  import { IdentityPolicyValidator } from './validator';
5
- export declare class IdentityPolicyEvaluator implements PolicyEvaluator<IdentityPolicy> {
5
+ export declare class IdentityPolicyEvaluator implements IPolicyEvaluator {
6
6
  protected validator: IdentityPolicyValidator;
7
+ protected dataValidator: PolicyIdentityDataValidator;
7
8
  constructor();
8
- can(ctx: PolicyEvaluateContext<PolicyWithType>): Promise<boolean>;
9
- validateConfig(ctx: PolicyEvaluateContext): Promise<IdentityPolicy>;
10
- validateInput(ctx: PolicyEvaluateContext<IdentityPolicy>): Promise<PolicyInput>;
11
- evaluate(ctx: PolicyEvaluateContext<IdentityPolicy>): Promise<boolean>;
9
+ accessData(ctx: PolicyEvaluationContext): Promise<IdentityPolicyData | null>;
10
+ evaluate(value: Record<string, any>, ctx: PolicyEvaluationContext): Promise<PolicyEvaluationResult>;
12
11
  }
13
12
  //# sourceMappingURL=evaluator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/identity/evaluator.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,qBAAa,uBAAwB,YAAW,eAAe,CAAC,cAAc,CAAC;IAC3E,SAAS,CAAC,SAAS,EAAG,uBAAuB,CAAC;;IAMxC,GAAG,CACL,GAAG,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAC1C,OAAO,CAAC,OAAO,CAAC;IAId,cAAc,CAAC,GAAG,EAAE,qBAAqB,GAAI,OAAO,CAAC,cAAc,CAAC;IAIpE,aAAa,CAAC,GAAG,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAAI,OAAO,CAAC,WAAW,CAAC;IAIhF,QAAQ,CAAC,GAAG,EAAE,qBAAqB,CACzC,cAAc,CACb,GAAG,OAAO,CAAC,OAAO,CAAC;CAcvB"}
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"}
@@ -5,4 +5,26 @@ export interface IdentityPolicy extends PolicyBase {
5
5
  */
6
6
  types?: string[];
7
7
  }
8
+ export type IdentityPolicyData = {
9
+ /**
10
+ * user, client, robot
11
+ */
12
+ type: string;
13
+ /**
14
+ * UUID
15
+ */
16
+ id: string;
17
+ /**
18
+ * Client associated with identity.
19
+ */
20
+ clientId?: string | null;
21
+ /**
22
+ * Realm id associated with identity.
23
+ */
24
+ realmId?: string | null;
25
+ /**
26
+ * Realm name associated with identity.
27
+ */
28
+ realmName?: string | null;
29
+ };
8
30
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/identity/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,cAAe,SAAQ,UAAU;IAC9C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/identity/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,cAAe,SAAQ,UAAU;IAC9C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC7B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B,CAAC"}
@@ -1,13 +1,8 @@
1
- import type { PolicyEvaluateContext, PolicyEvaluator } from '../../evaluator';
2
- import type { PolicyInput, PolicyWithType } from '../../types';
3
- import type { PermissionBindingPolicy } from './types';
1
+ import type { IPolicyEvaluator, PolicyEvaluationResult } from '../../evaluation';
4
2
  import { PermissionBindingPolicyValidator } from './validator';
5
- export declare class PermissionBindingPolicyEvaluator implements PolicyEvaluator<PermissionBindingPolicy> {
3
+ export declare class PermissionBindingPolicyEvaluator implements IPolicyEvaluator {
6
4
  protected validator: PermissionBindingPolicyValidator;
7
5
  constructor();
8
- can(ctx: PolicyEvaluateContext<PolicyWithType>): Promise<boolean>;
9
- validateConfig(ctx: PolicyEvaluateContext): Promise<PermissionBindingPolicy>;
10
- validateInput(ctx: PolicyEvaluateContext): Promise<PolicyInput>;
11
- evaluate(ctx: PolicyEvaluateContext<PermissionBindingPolicy, PolicyInput>): Promise<boolean>;
6
+ evaluate(value: Record<string, any>): Promise<PolicyEvaluationResult>;
12
7
  }
13
8
  //# 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":"AASA,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE9E,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE/D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAC;AAE/D,qBAAa,gCAAiC,YAAW,eAAe,CAAC,uBAAuB,CAAC;IAC7F,SAAS,CAAC,SAAS,EAAE,gCAAgC,CAAC;;IAMhD,GAAG,CACL,GAAG,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAC3C,OAAO,CAAC,OAAO,CAAC;IAIb,cAAc,CAAC,GAAG,EAAE,qBAAqB,GAAI,OAAO,CAAC,uBAAuB,CAAC;IAI7E,aAAa,CAAC,GAAG,EAAE,qBAAqB,GAAI,OAAO,CAAC,WAAW,CAAC;IAQhE,QAAQ,CAAC,GAAG,EAAE,qBAAqB,CACzC,uBAAuB,EACvB,WAAW,CACV,GAAG,OAAO,CAAC,OAAO,CAAC;CAIvB"}
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;CAQ9E"}
@@ -1,13 +1,12 @@
1
- import type { PolicyEvaluateContext, PolicyEvaluator } from '../../evaluator';
2
- import type { PolicyInput, PolicyWithType } from '../../types';
3
- import type { RealmMatchPolicy } from './types';
1
+ import type { IPolicyEvaluator, PolicyEvaluationContext, PolicyEvaluationResult } from '../../evaluation';
2
+ import { AttributesPolicyEvaluator } from '../attributes';
3
+ import { IdentityPolicyEvaluator } from '../identity';
4
4
  import { RealmMatchPolicyValidator } from './validator';
5
- export declare class RealmMatchPolicyEvaluator implements PolicyEvaluator<RealmMatchPolicy> {
5
+ export declare class RealmMatchPolicyEvaluator implements IPolicyEvaluator {
6
6
  protected validator: RealmMatchPolicyValidator;
7
+ protected identityEvaluator: IdentityPolicyEvaluator;
8
+ protected attributesEvaluator: AttributesPolicyEvaluator;
7
9
  constructor();
8
- can(ctx: PolicyEvaluateContext<PolicyWithType>): Promise<boolean>;
9
- validateConfig(ctx: PolicyEvaluateContext): Promise<RealmMatchPolicy>;
10
- validateInput(ctx: PolicyEvaluateContext<RealmMatchPolicy>): Promise<PolicyInput>;
11
- evaluate(ctx: PolicyEvaluateContext<RealmMatchPolicy>): Promise<boolean>;
10
+ evaluate(value: Record<string, any>, ctx: PolicyEvaluationContext): Promise<PolicyEvaluationResult>;
12
11
  }
13
12
  //# 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":"AAUA,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAExD,qBAAa,yBAA0B,YAAW,eAAe,CAAC,gBAAgB,CAAC;IAC/E,SAAS,CAAC,SAAS,EAAG,yBAAyB,CAAC;;IAM1C,GAAG,CACL,GAAG,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAC1C,OAAO,CAAC,OAAO,CAAC;IAId,cAAc,CAAC,GAAG,EAAE,qBAAqB,GAAI,OAAO,CAAC,gBAAgB,CAAC;IAItE,aAAa,CAAC,GAAG,EAAE,qBAAqB,CAAC,gBAAgB,CAAC,GAAI,OAAO,CAAC,WAAW,CAAC;IAWlF,QAAQ,CAAC,GAAG,EAAE,qBAAqB,CACzC,gBAAgB,CACf,GAAG,OAAO,CAAC,OAAO,CAAC;CAmGvB"}
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;AAC1D,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;CAsI5G"}
@@ -1,13 +1,8 @@
1
- import type { PolicyEvaluateContext, PolicyEvaluator } from '../../evaluator';
2
- import type { PolicyInput, PolicyWithType } from '../../types';
3
- import type { TimePolicy } from './types';
1
+ import type { IPolicyEvaluator, PolicyEvaluationContext, PolicyEvaluationResult } from '../../evaluation';
4
2
  import { TimePolicyValidator } from './validator';
5
- export declare class TimePolicyEvaluator implements PolicyEvaluator<TimePolicy> {
3
+ export declare class TimePolicyEvaluator implements IPolicyEvaluator {
6
4
  protected validator: TimePolicyValidator;
7
5
  constructor();
8
- can(ctx: PolicyEvaluateContext<PolicyWithType>): Promise<boolean>;
9
- validateConfig(ctx: PolicyEvaluateContext): Promise<TimePolicy>;
10
- validateInput(ctx: PolicyEvaluateContext<TimePolicy>): Promise<PolicyInput>;
11
- evaluate(ctx: PolicyEvaluateContext<TimePolicy>): Promise<boolean>;
6
+ evaluate(value: Record<string, any>, ctx: PolicyEvaluationContext): Promise<PolicyEvaluationResult>;
12
7
  }
13
8
  //# sourceMappingURL=evaluator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/time/evaluator.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE9E,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAiClD,qBAAa,mBAAoB,YAAW,eAAe,CAAC,UAAU,CAAC;IACnE,SAAS,CAAC,SAAS,EAAG,mBAAmB,CAAC;;IAMpC,GAAG,CACL,GAAG,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAC1C,OAAO,CAAC,OAAO,CAAC;IAId,cAAc,CAAC,GAAG,EAAE,qBAAqB,GAAI,OAAO,CAAC,UAAU,CAAC;IAIhE,aAAa,CAAC,GAAG,EAAE,qBAAqB,CAAC,UAAU,CAAC,GAAI,OAAO,CAAC,WAAW,CAAC;IAI5E,QAAQ,CAAC,GAAG,EAAE,qBAAqB,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;CA4D3E"}
1
+ {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/time/evaluator.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAI1G,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAiClD,qBAAa,mBAAoB,YAAW,gBAAgB;IACxD,SAAS,CAAC,SAAS,EAAG,mBAAmB,CAAC;;IAMpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAoF5G"}
@@ -0,0 +1,12 @@
1
+ import { AttributeNamesPolicyEvaluator, AttributesPolicyEvaluator, CompositePolicyEvaluator, DatePolicyEvaluator, IdentityPolicyEvaluator, PermissionBindingPolicyEvaluator, RealmMatchPolicyEvaluator, TimePolicyEvaluator } from './built-in';
2
+ export declare const PolicyDefaultEvaluators: {
3
+ readonly composite: CompositePolicyEvaluator;
4
+ readonly attributes: AttributesPolicyEvaluator<Record<string, any>>;
5
+ readonly attributeNames: AttributeNamesPolicyEvaluator;
6
+ readonly date: DatePolicyEvaluator;
7
+ readonly identity: IdentityPolicyEvaluator;
8
+ readonly permissionBinding: PermissionBindingPolicyEvaluator;
9
+ readonly realmMatch: RealmMatchPolicyEvaluator;
10
+ readonly time: TimePolicyEvaluator;
11
+ };
12
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/policy/constants.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,6BAA6B,EAC7B,yBAAyB,EAEzB,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,gCAAgC,EAChC,yBAAyB,EACzB,mBAAmB,EACtB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,uBAAuB;;;;;;;;;CAS1B,CAAC"}
@@ -0,0 +1,20 @@
1
+ export interface IPolicyData {
2
+ set(key: string, value: unknown): void;
3
+ has(key: string): boolean;
4
+ get<T = unknown>(key: string): T;
5
+ isValidated(key: string): boolean;
6
+ setValidated(key: string): void;
7
+ clone(): IPolicyData;
8
+ }
9
+ export declare class PolicyData implements IPolicyData {
10
+ protected data: Record<string, any>;
11
+ protected validated: Set<string>;
12
+ constructor(data?: Record<string, any>, validated?: Set<string>);
13
+ set<T = unknown>(key: string, value: T): void;
14
+ get<T = unknown>(key: string): T;
15
+ has(key: string): boolean;
16
+ setValidated(key: string): void;
17
+ isValidated(key: string): boolean;
18
+ clone(): PolicyData;
19
+ }
20
+ //# sourceMappingURL=data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/policy/data.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,WAAW;IACxB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAI,IAAI,CAAC;IACxC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAI,CAAC,CAAC;IAElC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAI,IAAI,CAAC;IAEjC,KAAK,IAAK,WAAW,CAAA;CACxB;AAED,qBAAa,UAAW,YAAW,WAAW;IAC1C,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEpC,SAAS,CAAC,SAAS,EAAG,GAAG,CAAC,MAAM,CAAC,CAAC;gBAG9B,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAC9B,SAAS,GAAE,GAAG,CAAC,MAAM,CAAa;IAMtC,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAI,IAAI;IAK9C,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAI,CAAC;IAQjC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAI,IAAI;IAIhC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAI,OAAO;IAIlC,KAAK;CAKR"}
@@ -1,20 +1,20 @@
1
- import type { PolicyEvaluator, PolicyEvaluators } from '../evaluator';
2
- import type { PolicyEngineEvaluateContext } from './types';
1
+ import type { IPolicyEvaluator, PolicyEvaluationContext, PolicyEvaluationResult, PolicyEvaluators } from '../evaluation';
2
+ import type { IPolicy } from '../types.ts';
3
+ import type { IPolicyEngine } from './types.ts';
3
4
  /**
4
5
  * The policy engine is a component that interprets defined policies and makes decisions
5
6
  * on whether to allow or deny a particular access.
6
7
  */
7
- export declare class PolicyEngine {
8
- protected evaluators: PolicyEvaluators;
8
+ export declare class PolicyEngine implements IPolicyEngine {
9
+ protected evaluators: Record<string, IPolicyEvaluator>;
9
10
  constructor(evaluators?: PolicyEvaluators);
10
- registerEvaluator(type: string, evaluator: PolicyEvaluator): void;
11
+ registerEvaluator(type: string, evaluator: IPolicyEvaluator): void;
11
12
  registerEvaluators(evaluators: PolicyEvaluators): void;
12
- private registerDefaultEvaluators;
13
13
  /**
14
- * @throws PolicyError
15
- *
14
+ * @param policy
16
15
  * @param ctx
17
16
  */
18
- evaluate(ctx: PolicyEngineEvaluateContext): Promise<boolean>;
17
+ evaluate(policy: IPolicy, ctx: PolicyEvaluationContext): Promise<PolicyEvaluationResult>;
18
+ evaluateOrFail(policy: IPolicy, ctx: PolicyEvaluationContext): Promise<void>;
19
19
  }
20
20
  //# sourceMappingURL=module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/policy/engine/module.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAItE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAE3D;;;GAGG;AACH,qBAAa,YAAY;IACrB,SAAS,CAAC,UAAU,EAAG,gBAAgB,CAAC;gBAE5B,UAAU,GAAE,gBAAqB;IAMtC,iBAAiB,CACpB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,eAAe,GAC1B,IAAI;IAID,kBAAkB,CAAC,UAAU,EAAE,gBAAgB;IAOtD,OAAO,CAAC,yBAAyB;IAWjC;;;;OAIG;IACG,QAAQ,CAAC,GAAG,EAAE,2BAA2B,GAAI,OAAO,CAAC,OAAO,CAAC;CAOtE"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/policy/engine/module.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACR,gBAAgB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,gBAAgB,EACtF,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD;;;GAGG;AACH,qBAAa,YAAa,YAAW,aAAa;IAC9C,SAAS,CAAC,UAAU,EAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;gBAE5C,UAAU,GAAE,gBAAqB;IAItC,iBAAiB,CACpB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,gBAAgB,GAC3B,IAAI;IAID,kBAAkB,CAAC,UAAU,EAAE,gBAAgB;IAOtD;;;OAGG;IACG,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,uBAAuB,GAAI,OAAO,CAAC,sBAAsB,CAAC;IA4DzF,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,uBAAuB,GAAI,OAAO,CAAC,IAAI,CAAC;CAuBtF"}
@@ -1,4 +1,7 @@
1
- import type { PolicyEvaluateContextInput } from '../evaluator';
2
- import type { PolicyWithType } from '../types';
3
- export type PolicyEngineEvaluateContext = Omit<PolicyEvaluateContextInput<PolicyWithType>, 'evaluators'>;
1
+ import type { PolicyEvaluationContext, PolicyEvaluationResult } from '../evaluation';
2
+ import type { IPolicy } from '../types';
3
+ export interface IPolicyEngine {
4
+ evaluate(policy: IPolicy, options: PolicyEvaluationContext): Promise<PolicyEvaluationResult>;
5
+ evaluateOrFail(policy: IPolicy, options: PolicyEvaluationContext): Promise<void>;
6
+ }
4
7
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/policy/engine/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAAC,0BAA0B,CAAC,cAAc,CAAC,EAAE,YAAY,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/policy/engine/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,WAAW,aAAa;IAC1B,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,uBAAuB,GAAI,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAE9F,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,uBAAuB,GAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACrF"}
@@ -1,8 +1,11 @@
1
1
  import { AuthupError } from '@authup/errors';
2
+ import type { PolicyIssue } from '../issue';
2
3
  export declare class PolicyError extends AuthupError {
3
4
  constructor(message?: string, code?: string | null);
5
+ addIssue(data: PolicyIssue): void;
6
+ addIssues(data: PolicyIssue[]): void;
4
7
  static evaluatorNotFound(type: string): PolicyError;
5
- static evaluatorNotProcessable(): void;
6
- static evaluatorContextInvalid(): void;
8
+ static evaluatorNotProcessable(): PolicyError;
9
+ static evaluatorContextInvalid(): PolicyError;
7
10
  }
8
11
  //# sourceMappingURL=module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/policy/error/module.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAa,MAAM,gBAAgB,CAAC;AAExD,qBAAa,WAAY,SAAQ,WAAW;gBAC5B,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;IAIlD,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM;IAOrC,MAAM,CAAC,uBAAuB;IAO9B,MAAM,CAAC,uBAAuB;CAMjC"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/policy/error/module.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAa,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,qBAAa,WAAY,SAAQ,WAAW;gBAC5B,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;IAIlD,QAAQ,CAAC,IAAI,EAAE,WAAW;IAI1B,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE;IAI7B,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM;IAOrC,MAAM,CAAC,uBAAuB;IAO9B,MAAM,CAAC,uBAAuB;CAMjC"}
@@ -0,0 +1,3 @@
1
+ import type { PolicyEvaluationContext, PolicyEvaluationContextInput } from './types.ts';
2
+ export declare function definePolicyEvaluationContext(input?: PolicyEvaluationContextInput): PolicyEvaluationContext;
3
+ //# sourceMappingURL=define.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,3 @@
1
+ export * from './define.ts';
2
+ export * from './types.ts';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/policy/evaluation/context/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { PolicyData } from '../../data.ts';
2
+ import type { IPolicyEvaluator } from '../types.ts';
3
+ export type PolicyEvaluationContext = {
4
+ readonly evaluators: Record<string, IPolicyEvaluator>;
5
+ readonly path: (string | number)[];
6
+ readonly exclude: string[];
7
+ readonly include: string[];
8
+ readonly data: PolicyData;
9
+ };
10
+ export type PolicyEvaluationContextInput = Partial<PolicyEvaluationContext>;
11
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,3 @@
1
+ export * from './types';
2
+ export * from './context';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/policy/evaluation/index.ts"],"names":[],"mappings":"AAOA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}