@via-profit/ability 2.1.0 → 3.1.0

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 (36) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/CONTRIBUTING.md +14 -0
  3. package/LICENSE +21 -0
  4. package/README.md +1058 -319
  5. package/SECURITY.md +33 -0
  6. package/dist/cache/AbilityCacheAdapter.d.ts +8 -0
  7. package/dist/cache/AbilityInMemoryCache.d.ts +12 -0
  8. package/dist/core/AbilityCondition.d.ts +21 -0
  9. package/dist/core/AbilityExplain.d.ts +27 -0
  10. package/dist/core/AbilityParser.d.ts +61 -0
  11. package/dist/core/AbilityPolicy.d.ts +84 -0
  12. package/dist/core/AbilityResolver.d.ts +35 -0
  13. package/dist/core/AbilityResult.d.ts +27 -0
  14. package/dist/core/AbilityRule.d.ts +77 -0
  15. package/dist/{AbilityRuleSet.d.ts → core/AbilityRuleSet.d.ts} +14 -11
  16. package/dist/index.d.ts +19 -11
  17. package/dist/index.js +2097 -303
  18. package/dist/parsers/dsl/AbilityDSLLexer.d.ts +24 -0
  19. package/dist/parsers/dsl/AbilityDSLParser.d.ts +86 -0
  20. package/dist/parsers/dsl/AbilityDSLSyntaxError.d.ts +13 -0
  21. package/dist/parsers/dsl/AbilityDSLToken.d.ts +55 -0
  22. package/dist/parsers/json/AbilityJSONParser.d.ts +22 -0
  23. package/package.json +15 -4
  24. package/assets/ability-01.drawio.png +0 -0
  25. package/build/playground.js +0 -456
  26. package/build/playground.js.map +0 -1
  27. package/dist/AbilityCondition.d.ts +0 -16
  28. package/dist/AbilityParser.d.ts +0 -18
  29. package/dist/AbilityPolicy.d.ts +0 -65
  30. package/dist/AbilityResolver.d.ts +0 -30
  31. package/dist/AbilityRule.d.ts +0 -70
  32. /package/dist/{AbilityCode.d.ts → core/AbilityCode.d.ts} +0 -0
  33. /package/dist/{AbilityCompare.d.ts → core/AbilityCompare.d.ts} +0 -0
  34. /package/dist/{AbilityError.d.ts → core/AbilityError.d.ts} +0 -0
  35. /package/dist/{AbilityMatch.d.ts → core/AbilityMatch.d.ts} +0 -0
  36. /package/dist/{AbilityPolicyEffect.d.ts → core/AbilityPolicyEffect.d.ts} +0 -0
package/SECURITY.md ADDED
@@ -0,0 +1,33 @@
1
+ # Security Policy
2
+
3
+ ## Reporting a Vulnerability
4
+
5
+ I take the security of `@via-profit/ability` seriously. If you discover a security vulnerability, please report it responsibly.
6
+
7
+ ### How to Report a Vulnerability
8
+
9
+ **Please DO NOT create a public GitHub issue for security vulnerabilities.**
10
+
11
+ Instead, send the details directly to me:
12
+
13
+ - **Email**: [delhsmail@gmail.com](mailto:delhsmail@gmail.com)
14
+ - **Author**: Vasily Novosad
15
+ - **Timezone**: UTC+5 (for coordinating response time)
16
+
17
+ ### What to Include
18
+
19
+ To help me address the issue quickly, please include:
20
+
21
+ - Description of the vulnerability
22
+ - Steps to reproduce (if applicable)
23
+ - Potential impact
24
+ - Suggestions for fixing (if any)
25
+
26
+ ### Process
27
+
28
+ 1. I will acknowledge your report within 48 hours
29
+ 2. I will assess the vulnerability
30
+ 3. Work on a fix will begin depending on severity
31
+ 4. After the fix is released, I will notify you and acknowledge your contribution (if you agree)
32
+
33
+ Thank you for helping keep this project secure!
@@ -0,0 +1,8 @@
1
+ export interface AbilityCacheAdapter {
2
+ get<T = unknown>(key: string): Promise<T | undefined>;
3
+ set<T = unknown>(key: string, value: T, ttlSeconds?: number): Promise<void>;
4
+ serialize<T = unknown>(input: T): string;
5
+ delete(key: string): Promise<void>;
6
+ clear(): Promise<void>;
7
+ deleteByPrefix(prefix: string): Promise<void>;
8
+ }
@@ -0,0 +1,12 @@
1
+ import { AbilityCacheAdapter } from '../cache/AbilityCacheAdapter';
2
+ export declare class AbilityInMemoryCache implements AbilityCacheAdapter {
3
+ private store;
4
+ get<T>(key: string): Promise<T | undefined>;
5
+ set<T>(key: string, value: T, ttlSeconds?: number): Promise<void>;
6
+ serialize(input: unknown): string;
7
+ delete(key: string): Promise<void>;
8
+ clear(): Promise<void>;
9
+ deleteByPrefix(prefix: string): Promise<void>;
10
+ private fastHash;
11
+ private stableStringify;
12
+ }
@@ -0,0 +1,21 @@
1
+ import AbilityCode from './AbilityCode';
2
+ export type AbilityConditionCodeType = '=' | '<>' | '>' | '<' | '>=' | '<=' | 'in' | 'not in' | 'contains' | 'not contains' | 'length greater than' | 'length less than' | 'length equals';
3
+ export type AbilityConditionLiteralType = 'equals' | 'not_equals' | 'contains' | 'no_contains' | 'in' | 'not_in' | 'greater_than' | 'less_than' | 'less_or_equal' | 'greater_or_equal' | 'length_greater_than' | 'length_less_than' | 'length_equals';
4
+ export declare class AbilityCondition extends AbilityCode<AbilityConditionCodeType> {
5
+ static equals: AbilityCondition;
6
+ static not_equals: AbilityCondition;
7
+ static greater_than: AbilityCondition;
8
+ static less_than: AbilityCondition;
9
+ static less_or_equal: AbilityCondition;
10
+ static greater_or_equal: AbilityCondition;
11
+ static in: AbilityCondition;
12
+ static not_in: AbilityCondition;
13
+ static contains: AbilityCondition;
14
+ static not_contains: AbilityCondition;
15
+ static length_greater_than: AbilityCondition;
16
+ static length_less_than: AbilityCondition;
17
+ static length_equals: AbilityCondition;
18
+ static fromLiteral(literal: AbilityConditionLiteralType): AbilityCondition;
19
+ get literal(): AbilityConditionLiteralType;
20
+ }
21
+ export default AbilityCondition;
@@ -0,0 +1,27 @@
1
+ import AbilityRule from './AbilityRule';
2
+ import AbilityRuleSet from '../core/AbilityRuleSet';
3
+ import AbilityPolicy from '../core/AbilityPolicy';
4
+ import AbilityMatch from '../core/AbilityMatch';
5
+ export type AbilityExplainConfig = {
6
+ readonly type: AbilityExplainType;
7
+ readonly name: string;
8
+ readonly match: AbilityMatch;
9
+ };
10
+ export declare class AbilityExplain {
11
+ readonly type: AbilityExplainType;
12
+ readonly children: AbilityExplain[];
13
+ readonly name: string;
14
+ readonly match: AbilityMatch;
15
+ constructor(config: AbilityExplainConfig, children?: AbilityExplain[]);
16
+ toString(indent?: number): string;
17
+ }
18
+ export declare class AbilityExplainRule extends AbilityExplain {
19
+ constructor(rule: AbilityRule);
20
+ }
21
+ export declare class AbilityExplainRuleSet extends AbilityExplain {
22
+ constructor(ruleSet: AbilityRuleSet);
23
+ }
24
+ export declare class AbilityExplainPolicy extends AbilityExplain {
25
+ constructor(policy: AbilityPolicy);
26
+ }
27
+ export type AbilityExplainType = 'policy' | 'rule' | 'ruleSet';
@@ -0,0 +1,61 @@
1
+ import AbilityPolicy from './AbilityPolicy';
2
+ export type Primitive = string | number | boolean | null | undefined;
3
+ export type NestedDict<T = Primitive> = {
4
+ [key: string]: NestedDict<T> | T;
5
+ };
6
+ export type ResourceObject = Record<string, unknown>;
7
+ export type ResourcesMap = Record<string, ResourceObject>;
8
+ export declare class AbilityParser {
9
+ /**
10
+ * Sets a value in a nested object structure based on a dot/bracket notation path.
11
+ * @param object - The target object to modify.
12
+ * @param path - The path to the property in dot/bracket notation.
13
+ * @param value - The value to set at the specified path.
14
+ */
15
+ static setValueDotValue<T extends Primitive>(object: NestedDict<T>, path: string, value: T): void;
16
+ /**
17
+ * Generates TypeScript type definitions based on the provided policies.
18
+ * @param policies - An array of AbilityPolicy instances.
19
+ * @returns A generated type definitions.
20
+ */
21
+ static generateTypeDefs(policies: readonly AbilityPolicy[]): string;
22
+ /**
23
+ * Determines TypeScript type based on the rule
24
+ * @param rule - The rule to analyze
25
+ * @returns TypeScript type as string
26
+ */
27
+ private static determineTypeFromRule;
28
+ /**
29
+ * Gets TypeScript type for array values
30
+ * @param resource - The resource value to analyze
31
+ * @returns TypeScript array type as string
32
+ */
33
+ private static getArrayType;
34
+ /**
35
+ * Gets primitive TypeScript type for a value
36
+ * @param value - The value to analyze
37
+ * @returns TypeScript primitive type as string
38
+ */
39
+ private static getPrimitiveType;
40
+ /**
41
+ * Builds nested structure from flat paths
42
+ * Example: 'user.profile.name' -> { user: { profile: { name: 'string' } } }
43
+ * @param flatStructure - Flat structure with dot notation paths
44
+ * @returns Nested object structure
45
+ */
46
+ private static buildNestedStructure;
47
+ /**
48
+ * Formats type structure into a string
49
+ * @param structure - Nested type structure
50
+ * @returns Formatted TypeScript type definition string
51
+ */
52
+ private static formatTypeDefinitions;
53
+ /**
54
+ * Recursively formats nested object
55
+ * @param obj - Object to format
56
+ * @param indent - Current indentation level
57
+ * @returns Formatted string
58
+ */
59
+ private static formatNestedObject;
60
+ }
61
+ export default AbilityParser;
@@ -0,0 +1,84 @@
1
+ import AbilityRuleSet, { AbilityRuleSetConfig } from './AbilityRuleSet';
2
+ import AbilityMatch from './AbilityMatch';
3
+ import AbilityCompare, { AbilityCompareCodeType } from './AbilityCompare';
4
+ import AbilityPolicyEffect, { AbilityPolicyEffectCodeType } from './AbilityPolicyEffect';
5
+ import { AbilityExplain } from './AbilityExplain';
6
+ import { ResourceObject } from './AbilityParser';
7
+ export type AbilityPolicyConfig = {
8
+ readonly permission: string;
9
+ readonly effect: AbilityPolicyEffectCodeType;
10
+ readonly compareMethod: AbilityCompareCodeType;
11
+ readonly ruleSet: readonly AbilityRuleSetConfig[];
12
+ readonly id: string;
13
+ readonly name: string;
14
+ };
15
+ export type AbilityPolicyConstructorProps = {
16
+ id: string;
17
+ name: string;
18
+ permission: string;
19
+ effect: AbilityPolicyEffect;
20
+ compareMethod?: AbilityCompare;
21
+ };
22
+ export declare class AbilityPolicy<Resource extends ResourceObject = Record<string, unknown>, Environment = unknown> {
23
+ matchState: AbilityMatch;
24
+ /**
25
+ * List of rules
26
+ */
27
+ ruleSet: AbilityRuleSet<Resource, Environment>[];
28
+ /**
29
+ * Policy effect
30
+ */
31
+ effect: AbilityPolicyEffect;
32
+ /**
33
+ * Rules compare method.\
34
+ * For the «and» method the rule will be permitted if all\
35
+ * rules will be returns «permit» status and for the «or» - if\
36
+ * one of the rules returns as «permit»
37
+ */
38
+ compareMethod: AbilityCompare;
39
+ /**
40
+ * Policy name
41
+ */
42
+ name: string;
43
+ /**
44
+ * Policy ID
45
+ */
46
+ id: string;
47
+ /**
48
+ * Running the `enforce` or `resolve` method
49
+ * will select only those from all passed policies that fall under the specified permission key.
50
+ */
51
+ permission: string;
52
+ constructor(params: AbilityPolicyConstructorProps);
53
+ /**
54
+ * Add rule set to the policy
55
+ * @param ruleSet - The rule set to add
56
+ */
57
+ addRuleSet(ruleSet: AbilityRuleSet<Resource, Environment>): this;
58
+ /**
59
+ * Add rule set to the policy
60
+ * @param ruleSets - The array of rule set to add
61
+ */
62
+ addRuleSets(ruleSets: readonly AbilityRuleSet<Resource, Environment>[]): this;
63
+ /**
64
+ * Check if the policy is matched
65
+ * @param resource - The resource to check
66
+ * @param environment - The user environment object
67
+ */
68
+ check(resource: Resource, environment?: Environment): Promise<AbilityMatch>;
69
+ explain(): AbilityExplain;
70
+ /**
71
+ * Parses an array of policy configurations into an array of AbilityPolicy instances.
72
+ * @param configs - Array of policy configurations
73
+ * @returns Array of AbilityPolicy instances
74
+ */
75
+ static fromJSONAll<Resource extends ResourceObject, Environment = unknown>(configs: readonly AbilityPolicyConfig[]): AbilityPolicy<Resource, Environment>[];
76
+ /**
77
+ * Parse the config JSON format to Policy class instance
78
+ */
79
+ static fromJSON<Resource extends ResourceObject = Record<string, unknown>, Environment = unknown>(config: AbilityPolicyConfig): AbilityPolicy<Resource, Environment>;
80
+ static fromDSL<Resource extends ResourceObject = Record<string, unknown>, Environment = unknown>(dsl: string): AbilityPolicy<Resource, Environment>;
81
+ toJSON(): AbilityPolicyConfig;
82
+ toString(): string;
83
+ }
84
+ export default AbilityPolicy;
@@ -0,0 +1,35 @@
1
+ import AbilityPolicy from './AbilityPolicy';
2
+ import { AbilityResult } from './AbilityResult';
3
+ import { ResourcesMap } from './AbilityParser';
4
+ import { AbilityCacheAdapter } from '../cache/AbilityCacheAdapter';
5
+ export type AbilityResolverOptions = {
6
+ readonly cache?: AbilityCacheAdapter | null;
7
+ };
8
+ export declare class AbilityResolver<Resources extends ResourcesMap, Environment = unknown> {
9
+ private policies;
10
+ private readonly cache?;
11
+ constructor(
12
+ /**
13
+ * `Important!` The incorrect Resources type was intentionally passed to AbilityPolicy so that TypeScript could suggest the name of the permission and the structure of its resource in the parse method.
14
+ */
15
+ policyOrListOfPolicies: readonly AbilityPolicy<Resources>[] | AbilityPolicy<Resources>, options?: AbilityResolverOptions);
16
+ /**
17
+ * Resolve policy for the resource and permission key
18
+ *
19
+ * @param permission - Permission key
20
+ * @param resource - Resource
21
+ * @param environment
22
+ */
23
+ resolve<Permission extends keyof Resources>(permission: Permission, resource: Resources[Permission], environment?: Environment): Promise<AbilityResult<Resources[Permission]>>;
24
+ enforce<Permission extends keyof Resources>(permission: Permission, resource: Resources[Permission], environment?: Environment): Promise<void | never>;
25
+ /**
26
+ * Check if the permission key is contained in another permission key
27
+ * @param permissionA - The first permission to check
28
+ * @param permissionB - The second permission to check
29
+ */
30
+ static isInPermissionContain(permissionA: string, permissionB: string): boolean;
31
+ private makeCacheKey;
32
+ invalidatePolicy(policyId: string): Promise<void>;
33
+ invalidateCache(): Promise<void>;
34
+ }
35
+ export default AbilityResolver;
@@ -0,0 +1,27 @@
1
+ import { AbilityExplain } from './AbilityExplain';
2
+ import { ResourceObject } from './AbilityParser';
3
+ import AbilityPolicy from './AbilityPolicy';
4
+ import AbilityPolicyEffect from './AbilityPolicyEffect';
5
+ export declare class AbilityResult<Resource extends ResourceObject = Record<string, unknown>> {
6
+ /**
7
+ * Already checked policies (after call the policy.check())
8
+ */
9
+ readonly policies: readonly AbilityPolicy<Resource>[];
10
+ constructor(policies: readonly AbilityPolicy<Resource>[]);
11
+ /**
12
+ * Returns a list of explanations for each policy involved in the ability evaluation.
13
+ * Each item describes how a specific policy contributed to the final permission result.
14
+ *
15
+ * Useful for debugging, logging, or building UI tools that visualize permission logic.
16
+ */
17
+ explain(): readonly AbilityExplain[];
18
+ getLastMatchedPolicy(): AbilityPolicy<Resource> | null;
19
+ isAllowed(): boolean;
20
+ isDenied(): boolean;
21
+ /**
22
+ * Get the last effect of the policy
23
+ *
24
+ * @returns {AbilityPolicyEffect | null}
25
+ */
26
+ getLastEffectOfMatchedPolicy(): AbilityPolicyEffect | null;
27
+ }
@@ -0,0 +1,77 @@
1
+ import AbilityMatch from './AbilityMatch';
2
+ import AbilityCondition, { AbilityConditionCodeType } from './AbilityCondition';
3
+ export type AbilityRuleConfig = {
4
+ readonly id?: string | null;
5
+ readonly name?: string | null;
6
+ /**
7
+ * Subject key path like a 'user.name'
8
+ */
9
+ readonly subject: string;
10
+ /**
11
+ * Resource key path like a 'user.name' or value
12
+ */
13
+ readonly resource: string | number | boolean | null | (string | number | boolean | null)[];
14
+ readonly condition: AbilityConditionCodeType;
15
+ };
16
+ export type AbilityRuleConstructorProps = Omit<AbilityRuleConfig, 'condition'> & {
17
+ readonly condition: AbilityCondition;
18
+ };
19
+ /**
20
+ * Represents a rule that defines a condition to be checked against a subject and resource.
21
+ */
22
+ export declare class AbilityRule<Resources extends object = object, Environment = unknown> {
23
+ /**
24
+ * Subject key path like a 'user.name'
25
+ */
26
+ subject: string;
27
+ /**
28
+ * Resource key path like a 'user.name' or value
29
+ */
30
+ resource: AbilityRuleConfig['resource'];
31
+ condition: AbilityCondition;
32
+ name: string;
33
+ id: string;
34
+ state: AbilityMatch;
35
+ /**
36
+ * Creates an instance of AbilityRule.
37
+ * @param {string} params.id - The unique identifier of the rule.
38
+ * @param {string} params.name - The name of the rule.
39
+ * @param {AbilityCondition} params.condition - The condition to evaluate.
40
+ * @param {string} params.subject - The subject of the rule.
41
+ * @param {string} params.resource - The resource to compare against.
42
+ * @param params
43
+ */
44
+ constructor(params: AbilityRuleConstructorProps);
45
+ /**
46
+ * Check if the rule is matched
47
+ * @param resource - The resource to check
48
+ * @param environment
49
+ */
50
+ check(resource: Resources | null, environment?: Environment): Promise<AbilityMatch>;
51
+ /**
52
+ * Extract values from the resourceData
53
+ * @param resourceData - The resourceData to extract values from
54
+ * @param environment - Environment data
55
+ */
56
+ extractValues(resourceData: Resources | null, environment?: Environment | null): [AbilityRuleConfig['resource'] | undefined, AbilityRuleConfig['resource'] | undefined];
57
+ /**
58
+ * Get the value of the object by dot notation
59
+ * @param resource - The object to get the value from
60
+ * @param desc - The dot notation string
61
+ */
62
+ getDotNotationValue<T = unknown>(resource: unknown, desc: string): T | undefined;
63
+ toString(): string;
64
+ static fromJSON<Resources extends object, Environment = unknown>(config: AbilityRuleConfig): AbilityRule<Resources, Environment>;
65
+ static equals<Resources extends object = object, Environment = unknown>(subject: string, resource: AbilityRuleConfig['resource']): AbilityRule<Resources, Environment>;
66
+ static notEquals<Resources extends object = object, Environment = unknown>(subject: string, resource: AbilityRuleConfig['resource']): AbilityRule<Resources, Environment>;
67
+ static contains<Resources extends object = object, Environment = unknown>(subject: string, resource: AbilityRuleConfig['resource']): AbilityRule<Resources, Environment>;
68
+ static notContains<Resources extends object = object, Environment = unknown>(subject: string, resource: AbilityRuleConfig['resource']): AbilityRule<Resources, Environment>;
69
+ static notIn<Resources extends object = object, Environment = unknown>(subject: string, resource: AbilityRuleConfig['resource']): AbilityRule<Resources, Environment>;
70
+ static in<Resources extends object = object, Environment = unknown>(subject: string, resource: AbilityRuleConfig['resource']): AbilityRule<Resources, Environment>;
71
+ static notEqual<Resources extends object = object, Environment = unknown>(subject: string, resource: AbilityRuleConfig['resource']): AbilityRule<Resources, Environment>;
72
+ static lessThan<Resources extends object = object, Environment = unknown>(subject: string, resource: AbilityRuleConfig['resource']): AbilityRule<Resources, Environment>;
73
+ static lessOrEqual<Resources extends object = object, Environment = unknown>(subject: string, resource: AbilityRuleConfig['resource']): AbilityRule<Resources, Environment>;
74
+ static moreThan<Resources extends object = object, Environment = unknown>(subject: string, resource: AbilityRuleConfig['resource']): AbilityRule<Resources, Environment>;
75
+ static moreOrEqual<Resources extends object = object, Environment = unknown>(subject: string, resource: AbilityRuleConfig['resource']): AbilityRule<Resources, Environment>;
76
+ }
77
+ export default AbilityRule;
@@ -1,23 +1,24 @@
1
1
  import AbilityRule, { AbilityRuleConfig } from './AbilityRule';
2
2
  import AbilityCompare, { AbilityCompareCodeType } from './AbilityCompare';
3
3
  import AbilityMatch from './AbilityMatch';
4
+ import { ResourceObject } from './AbilityParser';
4
5
  export type AbilityRuleSetConfig = {
5
- readonly id: string;
6
- readonly name: string;
6
+ readonly id?: string | null;
7
+ readonly name?: string | null;
7
8
  readonly compareMethod: AbilityCompareCodeType;
8
9
  readonly rules: readonly AbilityRuleConfig[];
9
10
  };
10
11
  export type AbilityRuleSetConstructorProps = {
11
- readonly id: string;
12
- readonly name: string;
12
+ readonly id?: string | null;
13
+ readonly name?: string | null;
13
14
  readonly compareMethod: AbilityCompare;
14
15
  };
15
- export declare class AbilityRuleSet<Resources extends object = object> {
16
+ export declare class AbilityRuleSet<Resources extends ResourceObject = Record<string, unknown>, Environment = unknown> {
16
17
  state: AbilityMatch;
17
18
  /**
18
19
  * List of rules
19
20
  */
20
- rules: AbilityRule[];
21
+ rules: AbilityRule<Resources, Environment>[];
21
22
  /**
22
23
  * Rules compare method.\
23
24
  * For the «and» method the rule will be permitted if all\
@@ -34,13 +35,15 @@ export declare class AbilityRuleSet<Resources extends object = object> {
34
35
  */
35
36
  id: string;
36
37
  constructor(params: AbilityRuleSetConstructorProps);
37
- addRule(rule: AbilityRule): this;
38
- addRules(rules: AbilityRule[]): this;
39
- check(resources: Resources | null): AbilityMatch;
38
+ addRule(rule: AbilityRule<Resources, Environment>): this;
39
+ addRules(rules: AbilityRule<Resources, Environment>[]): this;
40
+ check(resources: Resources | null, environment?: Environment): Promise<AbilityMatch>;
41
+ toString(): string;
40
42
  /**
41
43
  * Parse the config JSON format to Group class instance
42
44
  */
43
- static parse<Resource extends object = object>(config: AbilityRuleSetConfig): AbilityRuleSet<Resource>;
44
- export(): AbilityRuleSetConfig;
45
+ static fromJSON<Resource extends ResourceObject = Record<string, unknown>, Environment = unknown>(config: AbilityRuleSetConfig): AbilityRuleSet<Resource, Environment>;
46
+ static and(rules: AbilityRule[]): AbilityRuleSet<Record<string, unknown>, unknown>;
47
+ static or(rules: AbilityRule[]): AbilityRuleSet<Record<string, unknown>, unknown>;
45
48
  }
46
49
  export default AbilityRuleSet;
package/dist/index.d.ts CHANGED
@@ -1,11 +1,19 @@
1
- export * from './AbilityCode';
2
- export * from './AbilityCompare';
3
- export * from './AbilityCondition';
4
- export * from './AbilityError';
5
- export * from './AbilityMatch';
6
- export * from './AbilityParser';
7
- export * from './AbilityPolicy';
8
- export * from './AbilityPolicyEffect';
9
- export * from './AbilityResolver';
10
- export * from './AbilityRule';
11
- export * from './AbilityRuleSet';
1
+ export * from './core/AbilityCode';
2
+ export * from './core/AbilityCompare';
3
+ export * from './core/AbilityCondition';
4
+ export * from './core/AbilityError';
5
+ export * from './core/AbilityMatch';
6
+ export * from './core/AbilityParser';
7
+ export * from './core/AbilityPolicy';
8
+ export * from './core/AbilityPolicyEffect';
9
+ export * from './core/AbilityResolver';
10
+ export * from './core/AbilityRule';
11
+ export * from './core/AbilityRuleSet';
12
+ export * from './core/AbilityExplain';
13
+ export * from './core/AbilityResult';
14
+ export * from './cache/AbilityCacheAdapter';
15
+ export * from './cache/AbilityInMemoryCache';
16
+ export * from './parsers/json/AbilityJSONParser';
17
+ export * from './parsers/dsl/AbilityDSLParser';
18
+ export * from './parsers/dsl/AbilityDSLLexer';
19
+ export * from './parsers/dsl/AbilityDSLToken';