@authup/access 1.0.0-beta.28 → 1.0.0-beta.30

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 (104) hide show
  1. package/dist/index.mjs +693 -499
  2. package/dist/index.mjs.map +1 -1
  3. package/dist/permission/checker/index.d.ts +3 -0
  4. package/dist/permission/checker/index.d.ts.map +1 -0
  5. package/dist/permission/{module.d.ts → checker/module.d.ts} +8 -7
  6. package/dist/permission/checker/module.d.ts.map +1 -0
  7. package/dist/permission/checker/types.d.ts +26 -0
  8. package/dist/permission/checker/types.d.ts.map +1 -0
  9. package/dist/permission/error/index.d.ts +0 -1
  10. package/dist/permission/error/index.d.ts.map +1 -1
  11. package/dist/permission/error/module.d.ts +4 -5
  12. package/dist/permission/error/module.d.ts.map +1 -1
  13. package/dist/permission/index.d.ts +2 -2
  14. package/dist/permission/index.d.ts.map +1 -1
  15. package/dist/permission/repository/index.d.ts.map +1 -0
  16. package/dist/permission/repository/memory.d.ts +9 -0
  17. package/dist/permission/repository/memory.d.ts.map +1 -0
  18. package/dist/permission/{provider → repository}/types.d.ts +2 -2
  19. package/dist/permission/repository/types.d.ts.map +1 -0
  20. package/dist/permission/types.d.ts +1 -19
  21. package/dist/permission/types.d.ts.map +1 -1
  22. package/dist/policy/built-in/attribute-names/evaluator.d.ts +5 -8
  23. package/dist/policy/built-in/attribute-names/evaluator.d.ts.map +1 -1
  24. package/dist/policy/built-in/attributes/evaluator.d.ts +4 -8
  25. package/dist/policy/built-in/attributes/evaluator.d.ts.map +1 -1
  26. package/dist/policy/built-in/attributes/validator.d.ts.map +1 -1
  27. package/dist/policy/built-in/composite/evaluator.d.ts +3 -8
  28. package/dist/policy/built-in/composite/evaluator.d.ts.map +1 -1
  29. package/dist/policy/built-in/composite/validator.d.ts.map +1 -1
  30. package/dist/policy/built-in/date/evaluator.d.ts +3 -8
  31. package/dist/policy/built-in/date/evaluator.d.ts.map +1 -1
  32. package/dist/policy/built-in/identity/data/index.d.ts +2 -0
  33. package/dist/policy/built-in/identity/data/index.d.ts.map +1 -0
  34. package/dist/policy/built-in/identity/data/validator.d.ts +6 -0
  35. package/dist/policy/built-in/identity/data/validator.d.ts.map +1 -0
  36. package/dist/policy/built-in/identity/evaluator.d.ts +7 -8
  37. package/dist/policy/built-in/identity/evaluator.d.ts.map +1 -1
  38. package/dist/policy/built-in/identity/types.d.ts +22 -0
  39. package/dist/policy/built-in/identity/types.d.ts.map +1 -1
  40. package/dist/policy/built-in/permission-binding/module.d.ts +3 -8
  41. package/dist/policy/built-in/permission-binding/module.d.ts.map +1 -1
  42. package/dist/policy/built-in/realm-match/evaluator.d.ts +7 -8
  43. package/dist/policy/built-in/realm-match/evaluator.d.ts.map +1 -1
  44. package/dist/policy/built-in/time/evaluator.d.ts +3 -8
  45. package/dist/policy/built-in/time/evaluator.d.ts.map +1 -1
  46. package/dist/policy/constants.d.ts +12 -0
  47. package/dist/policy/constants.d.ts.map +1 -0
  48. package/dist/policy/data.d.ts +20 -0
  49. package/dist/policy/data.d.ts.map +1 -0
  50. package/dist/policy/engine/module.d.ts +9 -9
  51. package/dist/policy/engine/module.d.ts.map +1 -1
  52. package/dist/policy/engine/types.d.ts +6 -3
  53. package/dist/policy/engine/types.d.ts.map +1 -1
  54. package/dist/policy/error/module.d.ts +3 -0
  55. package/dist/policy/error/module.d.ts.map +1 -1
  56. package/dist/policy/evaluation/context/define.d.ts +3 -0
  57. package/dist/policy/evaluation/context/define.d.ts.map +1 -0
  58. package/dist/policy/evaluation/context/index.d.ts +3 -0
  59. package/dist/policy/evaluation/context/index.d.ts.map +1 -0
  60. package/dist/policy/evaluation/context/types.d.ts +11 -0
  61. package/dist/policy/evaluation/context/types.d.ts.map +1 -0
  62. package/dist/policy/evaluation/index.d.ts +3 -0
  63. package/dist/policy/evaluation/index.d.ts.map +1 -0
  64. package/dist/policy/evaluation/types.d.ts +14 -0
  65. package/dist/policy/evaluation/types.d.ts.map +1 -0
  66. package/dist/policy/index.d.ts +4 -1
  67. package/dist/policy/index.d.ts.map +1 -1
  68. package/dist/policy/issue/constants.d.ts +21 -0
  69. package/dist/policy/issue/constants.d.ts.map +1 -0
  70. package/dist/policy/issue/define.d.ts +4 -0
  71. package/dist/policy/issue/define.d.ts.map +1 -0
  72. package/dist/policy/issue/index.d.ts +4 -0
  73. package/dist/policy/issue/index.d.ts.map +1 -0
  74. package/dist/policy/issue/types.d.ts +5 -0
  75. package/dist/policy/issue/types.d.ts.map +1 -0
  76. package/dist/policy/types.d.ts +3 -41
  77. package/dist/policy/types.d.ts.map +1 -1
  78. package/package.json +17 -13
  79. package/dist/permission/error/types.d.ts +0 -11
  80. package/dist/permission/error/types.d.ts.map +0 -1
  81. package/dist/permission/module.d.ts.map +0 -1
  82. package/dist/permission/provider/index.d.ts.map +0 -1
  83. package/dist/permission/provider/memory.d.ts +0 -9
  84. package/dist/permission/provider/memory.d.ts.map +0 -1
  85. package/dist/permission/provider/types.d.ts.map +0 -1
  86. package/dist/policy/evaluator/data/identity/index.d.ts +0 -2
  87. package/dist/policy/evaluator/data/identity/index.d.ts.map +0 -1
  88. package/dist/policy/evaluator/data/identity/validator.d.ts +0 -6
  89. package/dist/policy/evaluator/data/identity/validator.d.ts.map +0 -1
  90. package/dist/policy/evaluator/data/index.d.ts +0 -4
  91. package/dist/policy/evaluator/data/index.d.ts.map +0 -1
  92. package/dist/policy/evaluator/data/permission/index.d.ts +0 -2
  93. package/dist/policy/evaluator/data/permission/index.d.ts.map +0 -1
  94. package/dist/policy/evaluator/data/permission/validator.d.ts +0 -6
  95. package/dist/policy/evaluator/data/permission/validator.d.ts.map +0 -1
  96. package/dist/policy/evaluator/data/validator.d.ts +0 -6
  97. package/dist/policy/evaluator/data/validator.d.ts.map +0 -1
  98. package/dist/policy/evaluator/evaluate.d.ts +0 -4
  99. package/dist/policy/evaluator/evaluate.d.ts.map +0 -1
  100. package/dist/policy/evaluator/index.d.ts +0 -4
  101. package/dist/policy/evaluator/index.d.ts.map +0 -1
  102. package/dist/policy/evaluator/types.d.ts +0 -44
  103. package/dist/policy/evaluator/types.d.ts.map +0 -1
  104. /package/dist/permission/{provider → repository}/index.d.ts +0 -0
@@ -0,0 +1,14 @@
1
+ import type { Issue } from 'validup';
2
+ import type { PolicyEvaluationContext } from './context';
3
+ export type PolicyEvaluators = Record<string, IPolicyEvaluator>;
4
+ export type PolicyEvaluationResult = {
5
+ success: boolean;
6
+ issues?: Issue[];
7
+ };
8
+ export interface IPolicyEvaluator {
9
+ /**
10
+ * Execute the policy with specific data and a given context.
11
+ */
12
+ evaluate(value: Record<string, any>, context: PolicyEvaluationContext): Promise<PolicyEvaluationResult>;
13
+ }
14
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +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,WAAW,CAAC;AAEzD,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAEhE,MAAM,MAAM,sBAAsB,GAAG;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,KAAK,EAAE,CAAA;CACnB,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC7B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;CAC3G"}
@@ -1,7 +1,10 @@
1
1
  export * from './engine';
2
- export * from './evaluator';
2
+ export * from './evaluation';
3
3
  export * from './error';
4
+ export * from './issue';
4
5
  export * from './helpers';
5
6
  export * from './built-in';
6
7
  export * from './types';
8
+ export * from './constants.ts';
9
+ export * from './data.ts';
7
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/policy/index.ts"],"names":[],"mappings":"AAOA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/policy/index.ts"],"names":[],"mappings":"AAOA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AAExB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,21 @@
1
+ export declare enum PolicyIssueSeverity {
2
+ WARNING = "warning",
3
+ ERROR = "error"
4
+ }
5
+ export declare enum PolicyIssueCode {
6
+ DATA_MISSING = "DATA_MISSING",
7
+ DATA_INVALID = "DATA_INVALID",
8
+ INVALID = "INVALID",
9
+ TYPE_UNKNOWN = "TYPE_UNKNOWN",
10
+ FIELD_MISSING = "FIELD_MISSING",
11
+ FIELD_INVALID = "FIELD_INVALID",
12
+ CHILD_INVALID = "CHILD_INVALID",
13
+ CHILD_EVALUATION_FAILED = "CHILD_EVALUATION_FAILED",
14
+ EVALUATION_DENIED = "EVALUATION_DENIED",
15
+ EVALUATOR_NOT_FOUND = "EVALUATOR_NOT_FOUND",
16
+ EVALUATOR_ERROR = "EVALUATOR_ERROR",
17
+ SKIPPED_EXCLUDED = "SKIPPED_EXCLUDED",
18
+ SKIPPED_NOT_INCLUDED = "SKIPPED_NOT_INCLUDED",
19
+ INTERNAL_ERROR = "INTERNAL_ERROR"
20
+ }
21
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/policy/issue/constants.ts"],"names":[],"mappings":"AAOA,oBAAY,mBAAmB;IAC3B,OAAO,YAAY;IACnB,KAAK,UAAU;CAClB;AAED,oBAAY,eAAe;IAEvB,YAAY,iBAAiB;IAC7B,YAAY,iBAAiB;IAG7B,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAG/B,aAAa,kBAAkB;IAC/B,uBAAuB,4BAA4B;IAGnD,iBAAiB,sBAAsB;IACvC,mBAAmB,wBAAwB;IAC3C,eAAe,oBAAoB;IAGnC,gBAAgB,qBAAqB;IACrC,oBAAoB,yBAAyB;IAG7C,cAAc,mBAAmB;CACpC"}
@@ -0,0 +1,4 @@
1
+ import type { PolicyIssueGroup, PolicyIssueItem } from './types.ts';
2
+ export declare function definePolicyIssueItem(input: Omit<PolicyIssueItem, 'type'>): PolicyIssueItem;
3
+ export declare function definePolicyIssueGroup(input: Omit<PolicyIssueGroup, 'type'>): PolicyIssueGroup;
4
+ //# sourceMappingURL=define.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../../src/policy/issue/define.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEpE,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,GAAI,eAAe,CAE5F;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,GAAI,gBAAgB,CAE/F"}
@@ -0,0 +1,4 @@
1
+ export * from './constants.ts';
2
+ export * from './define.ts';
3
+ export * from './types.ts';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/policy/issue/index.ts"],"names":[],"mappings":"AAOA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { IssueGroup, IssueItem } from 'validup';
2
+ export type PolicyIssueItem = IssueItem;
3
+ export type PolicyIssueGroup = IssueGroup;
4
+ export type PolicyIssue = PolicyIssueItem | PolicyIssueGroup;
5
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/policy/issue/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAErD,MAAM,MAAM,eAAe,GAAG,SAAS,CAAC;AACxC,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC;AAE1C,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,gBAAgB,CAAC"}
@@ -1,4 +1,3 @@
1
- import type { PermissionItem } from '../permission';
2
1
  export interface PolicyBase {
3
2
  /**
4
3
  * Invert evaluation result of policy (true->false and false->true)
@@ -8,45 +7,8 @@ export interface PolicyBase {
8
7
  export type PolicyWithType<R extends Record<string, any> = Record<string, any>, T = string> = R & {
9
8
  type: T;
10
9
  };
11
- export type PolicyIdentity = {
12
- /**
13
- * user, client, robot
14
- */
10
+ export interface IPolicy {
15
11
  type: string;
16
- /**
17
- * UUID
18
- */
19
- id: string;
20
- /**
21
- * Client associated with identity.
22
- */
23
- clientId?: string | null;
24
- /**
25
- * Realm id associated with identity.
26
- */
27
- realmId?: string | null;
28
- /**
29
- * Realm name associated with identity.
30
- */
31
- realmName?: string | null;
32
- };
33
- export type PolicyInput = {
34
- /**
35
- * Permission for which the policy is evaluated.
36
- */
37
- permission?: PermissionItem;
38
- /**
39
- * Identity of the executing party.
40
- */
41
- identity?: PolicyIdentity;
42
- /**
43
- * Attributes
44
- */
45
- attributes?: Record<string, any>;
46
- /**
47
- * The dateTime to use for time & date policy.
48
- */
49
- dateTime?: Date | number | string;
50
- [key: string]: any;
51
- };
12
+ invert?: boolean;
13
+ }
52
14
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/policy/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,MAAM,WAAW,UAAU;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,cAAc,CACtB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACnD,CAAC,GAAG,MAAM,IACV,CAAC,GAAG;IACJ,IAAI,EAAE,CAAC,CAAA;CACV,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IACzB;;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;AAEF,MAAM,MAAM,WAAW,GAAG;IACtB;;OAEG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAE1B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEjC;;OAEG;IACH,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;IAClC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACrB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/policy/types.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,UAAU;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,cAAc,CACtB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACnD,CAAC,GAAG,MAAM,IACV,CAAC,GAAG;IACJ,IAAI,EAAE,CAAC,CAAA;CACV,CAAC;AAEF,MAAM,WAAW,OAAO;IACpB,IAAI,EAAE,MAAM,CAAC;IAEb,MAAM,CAAC,EAAE,OAAO,CAAA;CACnB"}
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.28",
4
+ "version": "1.0.0-beta.30",
5
5
  "description": "A library for evaluating permissions and policies.",
6
6
  "license": "Apache-2.0",
7
7
  "exports": {
@@ -21,13 +21,16 @@
21
21
  "build:js": "rollup -c",
22
22
  "build": "rimraf ./dist && cross-env NODE_ENV=production npm run build:js && npm run build:types",
23
23
  "build:watch": "npm run build -- --watch",
24
- "test": "cross-env NODE_ENV=test vitest run test/unit",
24
+ "test": "cross-env NODE_ENV=test vitest run",
25
25
  "test:coverage": "cross-env NODE_ENV=test vitest run --coverage"
26
26
  },
27
27
  "engines": {
28
28
  "node": "^20.19.0 || ^22.13.0 || ^23.5.0 || >=24.0.0"
29
29
  },
30
- "keywords": [],
30
+ "keywords": [
31
+ "policy",
32
+ "permission"
33
+ ],
31
34
  "author": {
32
35
  "name": "Peter Placzek",
33
36
  "email": "contact@tada5hi.net",
@@ -43,20 +46,21 @@
43
46
  },
44
47
  "homepage": "https://github.com/authup/authup#readme",
45
48
  "dependencies": {
46
- "@ucast/mongo2js": "^1.3.4",
47
- "@validup/adapter-zod": "^0.1.12",
48
- "pathtrace": "^1.1.0",
49
- "validup": "^0.1.9",
50
- "zod": "^4.3.5"
49
+ "@ucast/mongo2js": "^1.4.1",
50
+ "@validup/adapter-zod": "^0.2.4",
51
+ "pathtrace": "^2.1.0",
52
+ "validup": "^0.2.2",
53
+ "zod": "^4.3.6"
51
54
  },
52
55
  "devDependencies": {
53
- "@authup/errors": "^1.0.0-beta.28",
54
- "@authup/kit": "^1.0.0-beta.28",
55
- "vitest": "^4.0.14"
56
+ "@authup/errors": "^1.0.0-beta.30",
57
+ "@authup/kit": "^1.0.0-beta.30",
58
+ "vitest": "^4.0.14",
59
+ "unplugin-swc": "^1.5.9"
56
60
  },
57
61
  "peerDependencies": {
58
- "@authup/errors": "^1.0.0-beta.28",
59
- "@authup/kit": "^1.0.0-beta.28"
62
+ "@authup/errors": "^1.0.0-beta.30",
63
+ "@authup/kit": "^1.0.0-beta.30"
60
64
  },
61
65
  "publishConfig": {
62
66
  "access": "public"
@@ -1,11 +0,0 @@
1
- import type { PolicyError, PolicyWithType } from '../../policy';
2
- export type PermissionEvaluationErrorOptions = {
3
- name: string;
4
- policy?: PolicyWithType;
5
- policyError?: PolicyError;
6
- };
7
- export type PermissionErrorOptions = {
8
- message?: string;
9
- code?: string | null;
10
- };
11
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/permission/error/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEhE,MAAM,MAAM,gCAAgC,GAAG;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,WAAW,CAAC,EAAE,WAAW,CAAA;CAC5B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/permission/module.ts"],"names":[],"mappings":"AAQA,OAAO,EAAqB,YAAY,EAAe,MAAM,WAAW,CAAC;AAEzE,OAAO,KAAK,EAAE,mBAAmB,EAAwB,MAAM,YAAY,CAAC;AAG5E,OAAO,KAAK,EACR,6BAA6B,EAAE,wBAAwB,EAAE,cAAc,EAC1E,MAAM,SAAS,CAAC;AAEjB,qBAAa,iBAAiB;IAC1B,SAAS,CAAC,QAAQ,EAAG,mBAAmB,CAAC;IAEzC,SAAS,CAAC,YAAY,EAAG,YAAY,CAAC;IAEtC,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEnC,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;gBAItB,OAAO,GAAE,wBAA6B;IAwBlD;;;;OAIG;cACa,GAAG,CAAC,KAAK,EAAE,MAAM,GAAI,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IAkBxE;;;;;;OAMG;IACG,KAAK,CAAC,GAAG,EAAE,6BAA6B,GAAI,OAAO,CAAC,IAAI,CAAC;IAwG/D;;;;;;OAMG;IACG,UAAU,CAAC,GAAG,EAAE,6BAA6B,GAAI,OAAO,CAAC,IAAI,CAAC;IAY9D,QAAQ,CAAC,GAAG,EAAE,6BAA6B,GAAI,OAAO,CAAC,IAAI,CAAC;IAc5D,aAAa,CAAC,GAAG,EAAE,6BAA6B,GAAI,OAAO,CAAC,IAAI,CAAC;CAS1E"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/permission/provider/index.ts"],"names":[],"mappings":"AAOA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
@@ -1,9 +0,0 @@
1
- import type { PermissionItem } from '../types';
2
- import type { IPermissionProvider, PermissionGetOptions } from './types';
3
- export declare class PermissionMemoryProvider implements IPermissionProvider {
4
- protected items: Record<string, PermissionItem>;
5
- constructor(items?: PermissionItem[]);
6
- get(options: PermissionGetOptions): Promise<PermissionItem | undefined>;
7
- setMany(input: PermissionItem[]): void;
8
- }
9
- //# sourceMappingURL=memory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../src/permission/provider/memory.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEzE,qBAAa,wBAAyB,YAAW,mBAAmB;IAChE,SAAS,CAAC,KAAK,EAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAM;gBAE1C,KAAK,GAAE,cAAc,EAAO;IAIlC,GAAG,CACL,OAAO,EAAE,oBAAoB,GAC9B,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IAItC,OAAO,CAAC,KAAK,EAAE,cAAc,EAAE;CAOlC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/permission/provider/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,mBAAmB;IAChC,GAAG,CAAC,QAAQ,EAAE,oBAAoB,GAAI,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;CAC7E"}
@@ -1,2 +0,0 @@
1
- export * from './validator';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/policy/evaluator/data/identity/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAC"}
@@ -1,6 +0,0 @@
1
- import { Container } from 'validup';
2
- import type { PolicyIdentity } from '../../../types';
3
- export declare class PolicyDataIdentityValidator extends Container<PolicyIdentity> {
4
- initialize(): void;
5
- }
6
- //# sourceMappingURL=validator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../../src/policy/evaluator/data/identity/validator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,qBAAa,2BAA4B,SAAQ,SAAS,CAAC,cAAc,CAAC;IACtE,UAAU;CA+Cb"}
@@ -1,4 +0,0 @@
1
- export * from './identity';
2
- export * from './permission';
3
- export * from './validator';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- export * from './validator';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/policy/evaluator/data/permission/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAC"}
@@ -1,6 +0,0 @@
1
- import { Container } from 'validup';
2
- import type { PermissionItem } from '../../../../permission';
3
- export declare class PolicyDataPermissionValidator extends Container<PermissionItem> {
4
- initialize(): void;
5
- }
6
- //# sourceMappingURL=validator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../../src/policy/evaluator/data/permission/validator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,qBAAa,6BAA8B,SAAQ,SAAS,CAAC,cAAc,CAAC;IACxE,UAAU;CA2Bb"}
@@ -1,6 +0,0 @@
1
- import { Container } from 'validup';
2
- import type { PolicyInput } from '../../types';
3
- export declare class PolicyDataValidator extends Container<PolicyInput> {
4
- initialize(): void;
5
- }
6
- //# sourceMappingURL=validator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../src/policy/evaluator/data/validator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/C,qBAAa,mBAAoB,SAAQ,SAAS,CAAC,WAAW,CAAC;IAC3D,UAAU;CA+Bb"}
@@ -1,4 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,4 +0,0 @@
1
- export * from './data';
2
- export * from './evaluate';
3
- export * from './types';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,44 +0,0 @@
1
- import type { PolicyInput, PolicyWithType } from '../types';
2
- export type PolicyEvaluateContext<CONFIG extends Record<string, any> = Record<string, any>, INPUT extends PolicyInput = PolicyInput> = {
3
- config: CONFIG;
4
- input: INPUT;
5
- evaluators: PolicyEvaluators;
6
- options: PolicyEvaluateOptions;
7
- };
8
- export type PolicyEvaluateContextInput<SPEC extends Record<string, any> = Record<string, any>, DATA extends PolicyInput = PolicyInput> = 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<CONFIG extends Record<string, any> = Record<string, any>, INPUT 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<CONFIG, INPUT>): Promise<boolean>;
23
- /**
24
- * Validate the configuration for the policy.
25
- *
26
- * @throws PolicyError
27
- * @param ctx
28
- */
29
- validateConfig(ctx: PolicyEvaluateContext<Record<string, any>, INPUT>): Promise<CONFIG>;
30
- /**
31
- * Validate the passed input.
32
- *
33
- * @param ctx
34
- */
35
- validateInput(ctx: PolicyEvaluateContext<CONFIG>): Promise<INPUT>;
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/policy/evaluator/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE5D,MAAM,MAAM,qBAAqB,CAC7B,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACxD,KAAK,SAAS,WAAW,GAAG,WAAW,IACvC;IACA,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,EAAE,gBAAgB,CAAA;IAC5B,OAAO,EAAE,qBAAqB,CAAA;CACjC,CAAC;AAEF,MAAM,MAAM,0BAA0B,CAClC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACtD,IAAI,SAAS,WAAW,GAAG,WAAW,IACtC,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC,GACrE,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC;AAE3E,MAAM,MAAM,qBAAqB,GAAG;IAChC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAE/D,MAAM,WAAW,eAAe,CAC5B,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACxD,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAEvD;;;;;;OAMG;IACH,QAAQ,CAAC,GAAG,EAAE,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtE;;;;;OAKG;IACH,cAAc,CACV,GAAG,EAAE,qBAAqB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GACtD,OAAO,CAAC,MAAM,CAAC,CAAC;IAEpB;;;;OAIG;IACH,aAAa,CACT,GAAG,EAAE,qBAAqB,CAAC,MAAM,CAAC,GAClC,OAAO,CAAC,KAAK,CAAC,CAAC;IAEnB;;;;;OAKG;IACH,GAAG,CAAC,GAAG,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACrE"}