@authup/access 1.0.0-beta.24

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 (144) hide show
  1. package/LICENSE +201 -0
  2. package/dist/constants.d.ts +15 -0
  3. package/dist/constants.d.ts.map +1 -0
  4. package/dist/index.cjs +1007 -0
  5. package/dist/index.cjs.map +1 -0
  6. package/dist/index.d.ts +4 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.mjs +974 -0
  9. package/dist/index.mjs.map +1 -0
  10. package/dist/permission/error/index.d.ts +3 -0
  11. package/dist/permission/error/index.d.ts.map +1 -0
  12. package/dist/permission/error/module.d.ts +13 -0
  13. package/dist/permission/error/module.d.ts.map +1 -0
  14. package/dist/permission/error/types.d.ts +11 -0
  15. package/dist/permission/error/types.d.ts.map +1 -0
  16. package/dist/permission/helpers/equal.d.ts +3 -0
  17. package/dist/permission/helpers/equal.d.ts.map +1 -0
  18. package/dist/permission/helpers/index.d.ts +3 -0
  19. package/dist/permission/helpers/index.d.ts.map +1 -0
  20. package/dist/permission/helpers/merge.d.ts +3 -0
  21. package/dist/permission/helpers/merge.d.ts.map +1 -0
  22. package/dist/permission/index.d.ts +6 -0
  23. package/dist/permission/index.d.ts.map +1 -0
  24. package/dist/permission/module.d.ts +34 -0
  25. package/dist/permission/module.d.ts.map +1 -0
  26. package/dist/permission/provider/index.d.ts +3 -0
  27. package/dist/permission/provider/index.d.ts.map +1 -0
  28. package/dist/permission/provider/memory.d.ts +9 -0
  29. package/dist/permission/provider/memory.d.ts.map +1 -0
  30. package/dist/permission/provider/types.d.ts +9 -0
  31. package/dist/permission/provider/types.d.ts.map +1 -0
  32. package/dist/permission/types.d.ts +24 -0
  33. package/dist/permission/types.d.ts.map +1 -0
  34. package/dist/policy/built-in/attribute-names/evaluator.d.ts +13 -0
  35. package/dist/policy/built-in/attribute-names/evaluator.d.ts.map +1 -0
  36. package/dist/policy/built-in/attribute-names/index.d.ts +4 -0
  37. package/dist/policy/built-in/attribute-names/index.d.ts.map +1 -0
  38. package/dist/policy/built-in/attribute-names/types.d.ts +5 -0
  39. package/dist/policy/built-in/attribute-names/types.d.ts.map +1 -0
  40. package/dist/policy/built-in/attribute-names/validator.d.ts +6 -0
  41. package/dist/policy/built-in/attribute-names/validator.d.ts.map +1 -0
  42. package/dist/policy/built-in/attributes/evaluator.d.ts +14 -0
  43. package/dist/policy/built-in/attributes/evaluator.d.ts.map +1 -0
  44. package/dist/policy/built-in/attributes/index.d.ts +4 -0
  45. package/dist/policy/built-in/attributes/index.d.ts.map +1 -0
  46. package/dist/policy/built-in/attributes/types.d.ts +7 -0
  47. package/dist/policy/built-in/attributes/types.d.ts.map +1 -0
  48. package/dist/policy/built-in/attributes/validator.d.ts +7 -0
  49. package/dist/policy/built-in/attributes/validator.d.ts.map +1 -0
  50. package/dist/policy/built-in/composite/evaluator.d.ts +13 -0
  51. package/dist/policy/built-in/composite/evaluator.d.ts.map +1 -0
  52. package/dist/policy/built-in/composite/helper.d.ts +4 -0
  53. package/dist/policy/built-in/composite/helper.d.ts.map +1 -0
  54. package/dist/policy/built-in/composite/index.d.ts +5 -0
  55. package/dist/policy/built-in/composite/index.d.ts.map +1 -0
  56. package/dist/policy/built-in/composite/types.d.ts +13 -0
  57. package/dist/policy/built-in/composite/types.d.ts.map +1 -0
  58. package/dist/policy/built-in/composite/validator.d.ts +7 -0
  59. package/dist/policy/built-in/composite/validator.d.ts.map +1 -0
  60. package/dist/policy/built-in/constants.d.ts +35 -0
  61. package/dist/policy/built-in/constants.d.ts.map +1 -0
  62. package/dist/policy/built-in/date/evaluator.d.ts +13 -0
  63. package/dist/policy/built-in/date/evaluator.d.ts.map +1 -0
  64. package/dist/policy/built-in/date/index.d.ts +4 -0
  65. package/dist/policy/built-in/date/index.d.ts.map +1 -0
  66. package/dist/policy/built-in/date/types.d.ts +6 -0
  67. package/dist/policy/built-in/date/types.d.ts.map +1 -0
  68. package/dist/policy/built-in/date/validator.d.ts +7 -0
  69. package/dist/policy/built-in/date/validator.d.ts.map +1 -0
  70. package/dist/policy/built-in/identity/evaluator.d.ts +13 -0
  71. package/dist/policy/built-in/identity/evaluator.d.ts.map +1 -0
  72. package/dist/policy/built-in/identity/index.d.ts +4 -0
  73. package/dist/policy/built-in/identity/index.d.ts.map +1 -0
  74. package/dist/policy/built-in/identity/types.d.ts +8 -0
  75. package/dist/policy/built-in/identity/types.d.ts.map +1 -0
  76. package/dist/policy/built-in/identity/validator.d.ts +6 -0
  77. package/dist/policy/built-in/identity/validator.d.ts.map +1 -0
  78. package/dist/policy/built-in/index.d.ts +11 -0
  79. package/dist/policy/built-in/index.d.ts.map +1 -0
  80. package/dist/policy/built-in/permission-binding/index.d.ts +4 -0
  81. package/dist/policy/built-in/permission-binding/index.d.ts.map +1 -0
  82. package/dist/policy/built-in/permission-binding/module.d.ts +13 -0
  83. package/dist/policy/built-in/permission-binding/module.d.ts.map +1 -0
  84. package/dist/policy/built-in/permission-binding/types.d.ts +4 -0
  85. package/dist/policy/built-in/permission-binding/types.d.ts.map +1 -0
  86. package/dist/policy/built-in/permission-binding/validator.d.ts +6 -0
  87. package/dist/policy/built-in/permission-binding/validator.d.ts.map +1 -0
  88. package/dist/policy/built-in/realm-match/evaluator.d.ts +13 -0
  89. package/dist/policy/built-in/realm-match/evaluator.d.ts.map +1 -0
  90. package/dist/policy/built-in/realm-match/index.d.ts +4 -0
  91. package/dist/policy/built-in/realm-match/index.d.ts.map +1 -0
  92. package/dist/policy/built-in/realm-match/types.d.ts +28 -0
  93. package/dist/policy/built-in/realm-match/types.d.ts.map +1 -0
  94. package/dist/policy/built-in/realm-match/validator.d.ts +7 -0
  95. package/dist/policy/built-in/realm-match/validator.d.ts.map +1 -0
  96. package/dist/policy/built-in/time/constants.d.ts +7 -0
  97. package/dist/policy/built-in/time/constants.d.ts.map +1 -0
  98. package/dist/policy/built-in/time/evaluator.d.ts +13 -0
  99. package/dist/policy/built-in/time/evaluator.d.ts.map +1 -0
  100. package/dist/policy/built-in/time/index.d.ts +5 -0
  101. package/dist/policy/built-in/time/index.d.ts.map +1 -0
  102. package/dist/policy/built-in/time/types.d.ts +29 -0
  103. package/dist/policy/built-in/time/types.d.ts.map +1 -0
  104. package/dist/policy/built-in/time/validator.d.ts +7 -0
  105. package/dist/policy/built-in/time/validator.d.ts.map +1 -0
  106. package/dist/policy/built-in/types.d.ts +7 -0
  107. package/dist/policy/built-in/types.d.ts.map +1 -0
  108. package/dist/policy/engine/index.d.ts +3 -0
  109. package/dist/policy/engine/index.d.ts.map +1 -0
  110. package/dist/policy/engine/module.d.ts +20 -0
  111. package/dist/policy/engine/module.d.ts.map +1 -0
  112. package/dist/policy/engine/types.d.ts +4 -0
  113. package/dist/policy/engine/types.d.ts.map +1 -0
  114. package/dist/policy/error/index.d.ts +2 -0
  115. package/dist/policy/error/index.d.ts.map +1 -0
  116. package/dist/policy/error/module.d.ts +8 -0
  117. package/dist/policy/error/module.d.ts.map +1 -0
  118. package/dist/policy/evaluator/data/identity/index.d.ts +2 -0
  119. package/dist/policy/evaluator/data/identity/index.d.ts.map +1 -0
  120. package/dist/policy/evaluator/data/identity/validator.d.ts +8 -0
  121. package/dist/policy/evaluator/data/identity/validator.d.ts.map +1 -0
  122. package/dist/policy/evaluator/data/index.d.ts +4 -0
  123. package/dist/policy/evaluator/data/index.d.ts.map +1 -0
  124. package/dist/policy/evaluator/data/permission/index.d.ts +2 -0
  125. package/dist/policy/evaluator/data/permission/index.d.ts.map +1 -0
  126. package/dist/policy/evaluator/data/permission/validator.d.ts +8 -0
  127. package/dist/policy/evaluator/data/permission/validator.d.ts.map +1 -0
  128. package/dist/policy/evaluator/data/validator.d.ts +8 -0
  129. package/dist/policy/evaluator/data/validator.d.ts.map +1 -0
  130. package/dist/policy/evaluator/evaluate.d.ts +4 -0
  131. package/dist/policy/evaluator/evaluate.d.ts.map +1 -0
  132. package/dist/policy/evaluator/index.d.ts +4 -0
  133. package/dist/policy/evaluator/index.d.ts.map +1 -0
  134. package/dist/policy/evaluator/types.d.ts +44 -0
  135. package/dist/policy/evaluator/types.d.ts.map +1 -0
  136. package/dist/policy/helpers/index.d.ts +2 -0
  137. package/dist/policy/helpers/index.d.ts.map +1 -0
  138. package/dist/policy/helpers/invert.d.ts +4 -0
  139. package/dist/policy/helpers/invert.d.ts.map +1 -0
  140. package/dist/policy/index.d.ts +7 -0
  141. package/dist/policy/index.d.ts.map +1 -0
  142. package/dist/policy/types.d.ts +36 -0
  143. package/dist/policy/types.d.ts.map +1 -0
  144. package/package.json +59 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/composite/validator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,qBAAa,wBAAyB,SAAQ,SAAS,CAAC,eAAe,CAAC;gBACxD,OAAO,GAAE,gBAAgB,CAAC,eAAe,CAAM;IAM3D,QAAQ;CASX"}
@@ -0,0 +1,35 @@
1
+ export declare enum BuiltInPolicyType {
2
+ /**
3
+ * Bundles different policies.
4
+ */
5
+ COMPOSITE = "composite",
6
+ /**
7
+ * Date Based Access Control (DBAC)
8
+ */
9
+ DATE = "date",
10
+ /**
11
+ * Time Based Access Control (TBAC)
12
+ */
13
+ TIME = "time",
14
+ /**
15
+ * Attribute Name Based Access Control (ANBAC)
16
+ */
17
+ ATTRIBUTE_NAMES = "attributeNames",
18
+ /**
19
+ * Attribute Based Access Control (ABAC)
20
+ */
21
+ ATTRIBUTES = "attributes",
22
+ /**
23
+ * Realm of Identity is for attribute realm.
24
+ */
25
+ REALM_MATCH = "realmMatch",
26
+ /**
27
+ * Restriction based on identity (type, id, ...)
28
+ */
29
+ IDENTITY = "identity",
30
+ /**
31
+ * Restriction based on a binding between identity <-> permission
32
+ */
33
+ PERMISSION_BINDING = "permissionBinding"
34
+ }
35
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,13 @@
1
+ import type { PolicyEvaluateContext, PolicyEvaluator } from '../../evaluator';
2
+ import type { PolicyData, PolicyWithType } from '../../types';
3
+ import type { DatePolicy } from './types';
4
+ import { DatePolicyValidator } from './validator';
5
+ export declare class DatePolicyEvaluator implements PolicyEvaluator<DatePolicy> {
6
+ protected validator: DatePolicyValidator;
7
+ constructor();
8
+ can(ctx: PolicyEvaluateContext<PolicyWithType>): Promise<boolean>;
9
+ validateSpecification(ctx: PolicyEvaluateContext): Promise<DatePolicy>;
10
+ validateData(ctx: PolicyEvaluateContext<DatePolicy>): Promise<PolicyData>;
11
+ evaluate(ctx: PolicyEvaluateContext<DatePolicy>): Promise<boolean>;
12
+ }
13
+ //# sourceMappingURL=evaluator.d.ts.map
@@ -0,0 +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,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE9D,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,qBAAqB,CAAC,GAAG,EAAE,qBAAqB,GAAI,OAAO,CAAC,UAAU,CAAC;IAIvE,YAAY,CAAC,GAAG,EAAE,qBAAqB,CAAC,UAAU,CAAC,GAAI,OAAO,CAAC,UAAU,CAAC;IAI1E,QAAQ,CAAC,GAAG,EAAE,qBAAqB,CAAC,UAAU,CAAC,GAAI,OAAO,CAAC,OAAO,CAAC;CAwB5E"}
@@ -0,0 +1,4 @@
1
+ export * from './evaluator';
2
+ export * from './validator';
3
+ export * from './types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/date/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { PolicyBase } from '../../types';
2
+ export interface DatePolicy extends PolicyBase {
3
+ start?: string | Date | number;
4
+ end?: string | Date | number;
5
+ }
6
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/date/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,UAAW,SAAQ,UAAU;IAC1C,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC;IAE/B,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC;CAChC"}
@@ -0,0 +1,7 @@
1
+ import { Container, type ContainerOptions } from 'validup';
2
+ import type { DatePolicy } from './types';
3
+ export declare class DatePolicyValidator extends Container<DatePolicy> {
4
+ constructor(options?: ContainerOptions<DatePolicy>);
5
+ mountAll(): void;
6
+ }
7
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/date/validator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,qBAAa,mBAAoB,SAAQ,SAAS,CAAC,UAAU,CAAC;gBAC9C,OAAO,GAAE,gBAAgB,CAAC,UAAU,CAAM;IAMtD,QAAQ;CAMX"}
@@ -0,0 +1,13 @@
1
+ import type { PolicyEvaluateContext, PolicyEvaluator } from '../../evaluator';
2
+ import type { PolicyData, PolicyWithType } from '../../types';
3
+ import type { IdentityPolicy } from './types';
4
+ import { IdentityPolicyValidator } from './validator';
5
+ export declare class IdentityPolicyEvaluator implements PolicyEvaluator<IdentityPolicy> {
6
+ protected validator: IdentityPolicyValidator;
7
+ constructor();
8
+ can(ctx: PolicyEvaluateContext<PolicyWithType>): Promise<boolean>;
9
+ validateSpecification(ctx: PolicyEvaluateContext): Promise<IdentityPolicy>;
10
+ validateData(ctx: PolicyEvaluateContext<IdentityPolicy>): Promise<PolicyData>;
11
+ evaluate(ctx: PolicyEvaluateContext<IdentityPolicy>): Promise<boolean>;
12
+ }
13
+ //# sourceMappingURL=evaluator.d.ts.map
@@ -0,0 +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,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG9D,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,qBAAqB,CAAC,GAAG,EAAE,qBAAqB,GAAI,OAAO,CAAC,cAAc,CAAC;IAI3E,YAAY,CAAC,GAAG,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAAI,OAAO,CAAC,UAAU,CAAC;IAI9E,QAAQ,CAAC,GAAG,EAAE,qBAAqB,CACzC,cAAc,CACb,GAAG,OAAO,CAAC,OAAO,CAAC;CAcvB"}
@@ -0,0 +1,4 @@
1
+ export * from './evaluator';
2
+ export * from './types';
3
+ export * from './validator';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/identity/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { PolicyBase } from '../../types';
2
+ export interface IdentityPolicy extends PolicyBase {
3
+ /**
4
+ * Set of allowed identity types.
5
+ */
6
+ types?: string[];
7
+ }
8
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,6 @@
1
+ import { Container } from 'validup';
2
+ import type { IdentityPolicy } from './types';
3
+ export declare class IdentityPolicyValidator extends Container<IdentityPolicy> {
4
+ protected 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/validator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,qBAAa,uBAAwB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAClE,SAAS,CAAC,UAAU;CAKvB"}
@@ -0,0 +1,11 @@
1
+ export * from './attribute-names';
2
+ export * from './attributes';
3
+ export * from './composite';
4
+ export * from './date';
5
+ export * from './identity';
6
+ export * from './permission-binding';
7
+ export * from './realm-match';
8
+ export * from './time';
9
+ export * from './constants';
10
+ export * from './types';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/policy/built-in/index.ts"],"names":[],"mappings":"AAOA,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AAEvB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './module';
2
+ export * from './types';
3
+ export * from './validator';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/permission-binding/index.ts"],"names":[],"mappings":"AAOA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { PolicyEvaluateContext, PolicyEvaluator } from '../../evaluator';
2
+ import type { PolicyData, PolicyWithType } from '../../types';
3
+ import type { PermissionBindingPolicy } from './types';
4
+ import { PermissionBindingPolicyValidator } from './validator';
5
+ export declare class PermissionBindingPolicyEvaluator implements PolicyEvaluator<PermissionBindingPolicy> {
6
+ protected validator: PermissionBindingPolicyValidator;
7
+ constructor();
8
+ can(ctx: PolicyEvaluateContext<PolicyWithType>): Promise<boolean>;
9
+ validateSpecification(ctx: PolicyEvaluateContext): Promise<PermissionBindingPolicy>;
10
+ validateData(ctx: PolicyEvaluateContext): Promise<PolicyData>;
11
+ evaluate(ctx: PolicyEvaluateContext<PermissionBindingPolicy, PolicyData>): Promise<boolean>;
12
+ }
13
+ //# sourceMappingURL=module.d.ts.map
@@ -0,0 +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,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE9D,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,qBAAqB,CAAC,GAAG,EAAE,qBAAqB,GAAI,OAAO,CAAC,uBAAuB,CAAC;IAIpF,YAAY,CAAC,GAAG,EAAE,qBAAqB,GAAI,OAAO,CAAC,UAAU,CAAC;IAQ9D,QAAQ,CAAC,GAAG,EAAE,qBAAqB,CACzC,uBAAuB,EACvB,UAAU,CACT,GAAG,OAAO,CAAC,OAAO,CAAC;CAIvB"}
@@ -0,0 +1,4 @@
1
+ import type { PolicyBase } from '../../types';
2
+ export interface PermissionBindingPolicy extends PolicyBase {
3
+ }
4
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/permission-binding/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,uBAAwB,SAAQ,UAAU;CAE1D"}
@@ -0,0 +1,6 @@
1
+ import { Container } from 'validup';
2
+ import type { PermissionBindingPolicy } from './types';
3
+ export declare class PermissionBindingPolicyValidator extends Container<PermissionBindingPolicy> {
4
+ protected 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/permission-binding/validator.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvD,qBAAa,gCAAiC,SAAQ,SAAS,CAAC,uBAAuB,CAAC;IACpF,SAAS,CAAC,UAAU;CAEvB"}
@@ -0,0 +1,13 @@
1
+ import type { PolicyEvaluateContext, PolicyEvaluator } from '../../evaluator';
2
+ import type { PolicyData, PolicyWithType } from '../../types';
3
+ import type { RealmMatchPolicy } from './types';
4
+ import { RealmMatchPolicyValidator } from './validator';
5
+ export declare class RealmMatchPolicyEvaluator implements PolicyEvaluator<RealmMatchPolicy> {
6
+ protected validator: RealmMatchPolicyValidator;
7
+ constructor();
8
+ can(ctx: PolicyEvaluateContext<PolicyWithType>): Promise<boolean>;
9
+ validateSpecification(ctx: PolicyEvaluateContext): Promise<RealmMatchPolicy>;
10
+ validateData(ctx: PolicyEvaluateContext<RealmMatchPolicy>): Promise<PolicyData>;
11
+ evaluate(ctx: PolicyEvaluateContext<RealmMatchPolicy>): Promise<boolean>;
12
+ }
13
+ //# sourceMappingURL=evaluator.d.ts.map
@@ -0,0 +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,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG9D,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,qBAAqB,CAAC,GAAG,EAAE,qBAAqB,GAAI,OAAO,CAAC,gBAAgB,CAAC;IAI7E,YAAY,CAAC,GAAG,EAAE,qBAAqB,CAAC,gBAAgB,CAAC,GAAI,OAAO,CAAC,UAAU,CAAC;IAWhF,QAAQ,CAAC,GAAG,EAAE,qBAAqB,CACzC,gBAAgB,CACf,GAAG,OAAO,CAAC,OAAO,CAAC;CAmGvB"}
@@ -0,0 +1,4 @@
1
+ export * from './evaluator';
2
+ export * from './types';
3
+ export * from './validator';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/realm-match/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { DecisionStrategy } from '../../../constants';
2
+ import type { PolicyBase } from '../../types';
3
+ export interface RealmMatchPolicy extends PolicyBase {
4
+ /**
5
+ * Determines how realm-id/name matches are handled.
6
+ */
7
+ decisionStrategy?: `${DecisionStrategy}`;
8
+ /**
9
+ * Specifies the name(s) of the realm-id/name attribute(s) used for matching.
10
+ * Can be a single attribute name or an array of attribute names.
11
+ */
12
+ attributeName?: string | string[];
13
+ /**
14
+ * Only match if the attribute is strict equal to the name.
15
+ */
16
+ attributeNameStrict?: boolean;
17
+ /**
18
+ * Determines if resources with null realm-id/name value should match all identity realms.
19
+ * If true, any identity realm can access resources with null realm-id/name values.
20
+ */
21
+ attributeNullMatchAll?: boolean;
22
+ /**
23
+ * Specifies whether the master realm of an identity should match all realm-id/name attributes, including null.
24
+ * If true, the master realm can access any resource regardless of its realm value.
25
+ */
26
+ identityMasterMatchAll?: boolean;
27
+ }
28
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +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,oBAAoB,CAAC;AAC3D,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;;;OAGG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;CACnC"}
@@ -0,0 +1,7 @@
1
+ import { Container, type ContainerOptions } from 'validup';
2
+ import type { RealmMatchPolicy } from './types';
3
+ export declare class RealmMatchPolicyValidator extends Container<RealmMatchPolicy> {
4
+ constructor(options?: ContainerOptions<RealmMatchPolicy>);
5
+ mountAll(): void;
6
+ }
7
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/realm-match/validator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,qBAAa,yBAA0B,SAAQ,SAAS,CAAC,gBAAgB,CAAC;gBAC1D,OAAO,GAAE,gBAAgB,CAAC,gBAAgB,CAAM;IAM5D,QAAQ;CAWX"}
@@ -0,0 +1,7 @@
1
+ export declare enum TimePolicyInterval {
2
+ DAILY = "daily",
3
+ WEEKLY = "weekly",
4
+ MONTHLY = "monthly",
5
+ YEARLY = "yearly"
6
+ }
7
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/time/constants.ts"],"names":[],"mappings":"AAOA,oBAAY,kBAAkB;IAC1B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,MAAM,WAAW;CACpB"}
@@ -0,0 +1,13 @@
1
+ import type { PolicyEvaluateContext, PolicyEvaluator } from '../../evaluator';
2
+ import type { PolicyData, PolicyWithType } from '../../types';
3
+ import type { TimePolicy } from './types';
4
+ import { TimePolicyValidator } from './validator';
5
+ export declare class TimePolicyEvaluator implements PolicyEvaluator<TimePolicy> {
6
+ protected validator: TimePolicyValidator;
7
+ constructor();
8
+ can(ctx: PolicyEvaluateContext<PolicyWithType>): Promise<boolean>;
9
+ validateSpecification(ctx: PolicyEvaluateContext): Promise<TimePolicy>;
10
+ validateData(ctx: PolicyEvaluateContext<TimePolicy>): Promise<PolicyData>;
11
+ evaluate(ctx: PolicyEvaluateContext<TimePolicy>): Promise<boolean>;
12
+ }
13
+ //# sourceMappingURL=evaluator.d.ts.map
@@ -0,0 +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,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE9D,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,qBAAqB,CAAC,GAAG,EAAE,qBAAqB,GAAI,OAAO,CAAC,UAAU,CAAC;IAIvE,YAAY,CAAC,GAAG,EAAE,qBAAqB,CAAC,UAAU,CAAC,GAAI,OAAO,CAAC,UAAU,CAAC;IAI1E,QAAQ,CAAC,GAAG,EAAE,qBAAqB,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;CAkD3E"}
@@ -0,0 +1,5 @@
1
+ export * from './constants';
2
+ export * from './evaluator';
3
+ export * from './validator';
4
+ export * from './types';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/time/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { PolicyBase } from '../../types';
2
+ import type { TimePolicyInterval } from './constants';
3
+ export interface TimePolicy extends PolicyBase {
4
+ /**
5
+ * Format: HH:MM
6
+ */
7
+ start?: string | number | Date;
8
+ /**
9
+ * Format HH:MM
10
+ */
11
+ end?: string | number | Date;
12
+ /**
13
+ * Interval: daily, weekly, monthly, yearly
14
+ */
15
+ interval?: `${TimePolicyInterval}`;
16
+ /**
17
+ * 0 (Sunday) - 6 (Saturday)
18
+ */
19
+ dayOfWeek?: number;
20
+ /**
21
+ * 1 - 31
22
+ */
23
+ dayOfMonth?: number;
24
+ /**
25
+ * 1 - 365
26
+ */
27
+ dayOfYear?: number;
28
+ }
29
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +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,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -0,0 +1,7 @@
1
+ import { Container, type ContainerOptions } from 'validup';
2
+ import type { TimePolicy } from './types';
3
+ export declare class TimePolicyValidator extends Container<TimePolicy> {
4
+ constructor(options?: ContainerOptions<TimePolicy>);
5
+ mountAll(): void;
6
+ }
7
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/time/validator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C,qBAAa,mBAAoB,SAAQ,SAAS,CAAC,UAAU,CAAC;gBAC9C,OAAO,GAAE,gBAAgB,CAAC,UAAU,CAAM;IAMtD,QAAQ;CAYX"}
@@ -0,0 +1,7 @@
1
+ import type { AttributeNamesPolicy } from './attribute-names';
2
+ import type { AttributesPolicy } from './attributes';
3
+ import type { DatePolicy } from './date';
4
+ import type { CompositePolicy } from './composite';
5
+ import type { TimePolicy } from './time';
6
+ export type BuiltInPolicy<T extends Record<string, any> = Record<string, any>> = AttributesPolicy<T> | AttributeNamesPolicy | DatePolicy | CompositePolicy | TimePolicy;
7
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/policy/built-in/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEzC,MAAM,MAAM,aAAa,CACrB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IACnD,gBAAgB,CAAC,CAAC,CAAC,GACvB,oBAAoB,GACpB,UAAU,GACV,eAAe,GACf,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './module';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/policy/engine/index.ts"],"names":[],"mappings":"AAOA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { PolicyEvaluator, PolicyEvaluators } from '../evaluator';
2
+ import type { PolicyEngineEvaluateContext } from './types';
3
+ /**
4
+ * The policy engine is a component that interprets defined policies and makes decisions
5
+ * on whether to allow or deny a particular access.
6
+ */
7
+ export declare class PolicyEngine {
8
+ protected evaluators: PolicyEvaluators;
9
+ constructor(evaluators?: PolicyEvaluators);
10
+ registerEvaluator(type: string, evaluator: PolicyEvaluator): void;
11
+ registerEvaluators(evaluators: PolicyEvaluators): void;
12
+ private registerDefaultEvaluators;
13
+ /**
14
+ * @throws PolicyError
15
+ *
16
+ * @param ctx
17
+ */
18
+ evaluate(ctx: PolicyEngineEvaluateContext): Promise<boolean>;
19
+ }
20
+ //# sourceMappingURL=module.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,4 @@
1
+ import type { PolicyEvaluateContextInput } from '../evaluator';
2
+ import type { PolicyWithType } from '../types';
3
+ export type PolicyEngineEvaluateContext = Omit<PolicyEvaluateContextInput<PolicyWithType>, 'evaluators'>;
4
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,2 @@
1
+ export * from './module';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/policy/error/index.ts"],"names":[],"mappings":"AAOA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare class PolicyError extends Error {
2
+ code: null | string;
3
+ constructor(message?: string, code?: string | null);
4
+ static evaluatorNotFound(type: string): PolicyError;
5
+ static evaluatorNotProcessable(): void;
6
+ static evaluatorContextInvalid(): void;
7
+ }
8
+ //# sourceMappingURL=module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/policy/error/module.ts"],"names":[],"mappings":"AASA,qBAAa,WAAY,SAAQ,KAAK;IAC3B,IAAI,EAAG,IAAI,GAAG,MAAM,CAAC;gBAEhB,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;IAMlD,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM;IAOrC,MAAM,CAAC,uBAAuB;IAO9B,MAAM,CAAC,uBAAuB;CAMjC"}
@@ -0,0 +1,2 @@
1
+ export * from './validator';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/policy/evaluator/data/identity/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { ContainerOptions } from 'validup';
2
+ import { Container } from 'validup';
3
+ import type { PolicyIdentity } from '../../../types';
4
+ export declare class PolicyDataIdentityValidator extends Container<PolicyIdentity> {
5
+ constructor(options?: ContainerOptions<PolicyIdentity>);
6
+ mountAll(): void;
7
+ }
8
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../../src/policy/evaluator/data/identity/validator.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,qBAAa,2BAA4B,SAAQ,SAAS,CAAC,cAAc,CAAC;gBAC1D,OAAO,GAAE,gBAAgB,CAAC,cAAc,CAAM;IAM1D,QAAQ;CASX"}
@@ -0,0 +1,4 @@
1
+ export * from './identity';
2
+ export * from './permission';
3
+ export * from './validator';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/policy/evaluator/data/index.ts"],"names":[],"mappings":"AAOA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './validator';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/policy/evaluator/data/permission/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { ContainerOptions } from 'validup';
2
+ import { Container } from 'validup';
3
+ import type { PermissionItem } from '../../../../permission';
4
+ export declare class PolicyDataPermissionValidator extends Container<PermissionItem> {
5
+ constructor(options?: ContainerOptions<PermissionItem>);
6
+ mountAll(): void;
7
+ }
8
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../../src/policy/evaluator/data/permission/validator.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,qBAAa,6BAA8B,SAAQ,SAAS,CAAC,cAAc,CAAC;gBAC5D,OAAO,GAAE,gBAAgB,CAAC,cAAc,CAAM;IAM1D,QAAQ;CASX"}
@@ -0,0 +1,8 @@
1
+ import type { ContainerOptions } from 'validup';
2
+ import { Container } from 'validup';
3
+ import type { PolicyData } from '../../types';
4
+ export declare class PolicyDataValidator extends Container<PolicyData> {
5
+ constructor(options?: ContainerOptions<PolicyData>);
6
+ mountAll(): void;
7
+ }
8
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../src/policy/evaluator/data/validator.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9C,qBAAa,mBAAoB,SAAQ,SAAS,CAAC,UAAU,CAAC;gBAC9C,OAAO,GAAE,gBAAgB,CAAC,UAAU,CAAM;IAMtD,QAAQ;CA6BX"}
@@ -0,0 +1,4 @@
1
+ import type { PolicyWithType } from '../types';
2
+ import type { PolicyEvaluateContext } from './types';
3
+ export declare function evaluatePolicy(ctx: PolicyEvaluateContext<PolicyWithType>): Promise<boolean>;
4
+ //# sourceMappingURL=evaluate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../../src/policy/evaluator/evaluate.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,wBAAsB,cAAc,CAAC,GAAG,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAAI,OAAO,CAAC,OAAO,CAAC,CAyDlG"}
@@ -0,0 +1,4 @@
1
+ export * from './data';
2
+ export * from './evaluate';
3
+ export * from './types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/policy/evaluator/index.ts"],"names":[],"mappings":"AAOA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,44 @@
1
+ import type { PolicyData, PolicyWithType } from '../types';
2
+ export type PolicyEvaluateContext<SPEC extends Record<string, any> = Record<string, any>, DATA extends PolicyData = PolicyData> = {
3
+ spec: SPEC;
4
+ data: DATA;
5
+ evaluators: PolicyEvaluators;
6
+ options: PolicyEvaluateOptions;
7
+ };
8
+ export type PolicyEvaluateContextInput<SPEC extends Record<string, any> = Record<string, any>, DATA extends PolicyData = PolicyData> = Omit<PolicyEvaluateContext<SPEC, DATA>, 'evaluators' | 'options'> & Partial<Pick<PolicyEvaluateContext<SPEC, DATA>, 'evaluators' | 'options'>>;
9
+ export type PolicyEvaluateOptions = {
10
+ include?: string[];
11
+ exclude?: string[];
12
+ };
13
+ export type PolicyEvaluators = Record<string, PolicyEvaluator>;
14
+ export interface PolicyEvaluator<SPEC extends Record<string, any> = Record<string, any>, DATA extends Record<string, any> = Record<string, any>> {
15
+ /**
16
+ * Execute the evaluator with a given
17
+ * evaluator context.
18
+ *
19
+ * @throws PolicyError
20
+ * @param ctx
21
+ */
22
+ evaluate(ctx: PolicyEvaluateContext<SPEC, DATA>): Promise<boolean>;
23
+ /**
24
+ * Validate the specification.
25
+ *
26
+ * @throws PolicyError
27
+ * @param ctx
28
+ */
29
+ validateSpecification(ctx: PolicyEvaluateContext<Record<string, any>, DATA>): Promise<SPEC>;
30
+ /**
31
+ * Validate the passed data.
32
+ *
33
+ * @param ctx
34
+ */
35
+ validateData(ctx: PolicyEvaluateContext<SPEC>): Promise<DATA>;
36
+ /**
37
+ * Verify if the evaluator (might) can hande the provided
38
+ * evaluator context.
39
+ *
40
+ * @param ctx
41
+ */
42
+ can(ctx: PolicyEvaluateContext<PolicyWithType>): Promise<boolean>;
43
+ }
44
+ //# sourceMappingURL=types.d.ts.map