@via-profit/ability 3.4.0 → 3.4.1

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.
package/package.json CHANGED
@@ -1,73 +1,73 @@
1
- {
2
- "name": "@via-profit/ability",
3
- "support": "https://via-profit.ru",
4
- "version": "3.4.0",
5
- "description": "Via-Profit Ability service",
6
- "keywords": [
7
- "ability",
8
- "access",
9
- "via-profit"
10
- ],
11
- "main": "./dist/index.js",
12
- "engines": {
13
- "node": ">= 17.0.0",
14
- "npm": ">= 8.19.3"
15
- },
16
- "files": [
17
- "dist",
18
- "README.md",
19
- "LICENSE",
20
- "CHANGELOG.md",
21
- "CONTRIBUTING.md",
22
- "SECURITY.md"
23
- ],
24
- "scripts": {
25
- "build": "rollup -c",
26
- "build:dev": "cross-env NODE_ENV=development rollup -c -w",
27
- "bench": "npm run build && node ./bench/benchmark.js",
28
- "test": "jest",
29
- "lint": "tsc --noEmit && eslint --fix .",
30
- "pretty": "prettier --write ./src"
31
- },
32
- "repository": {
33
- "type": "git",
34
- "url": "https://github.com/via-profit/ability.git"
35
- },
36
- "author": {
37
- "name": "Via Profit",
38
- "url": "https://dev.via-profit.ru"
39
- },
40
- "contributors": [
41
- "Vasily Novosad <delhsmail@gmail.com>",
42
- "Pavel Natalin <trubonru@gmail.com>"
43
- ],
44
- "license": "MIT",
45
- "devDependencies": {
46
- "@eslint/js": "^9.13.0",
47
- "@jagi/jest-transform-graphql": "^1.0.2",
48
- "@jest/types": "^29.6.3",
49
- "@rollup/plugin-alias": "^6.0.0",
50
- "@rollup/plugin-commonjs": "^29.0.2",
51
- "@rollup/plugin-node-resolve": "^16.0.3",
52
- "@rollup/plugin-typescript": "^12.3.0",
53
- "@types/jest": "^29.5.13",
54
- "@types/node": "^22.7.7",
55
- "@types/nodemon": "^1.19.6",
56
- "concurrently": "^9.0.1",
57
- "cross-env": "^7.0.3",
58
- "eslint": "^9.13.0",
59
- "globals": "^15.11.0",
60
- "jest": "^29.7.0",
61
- "jest-transform-graphql": "^2.1.0",
62
- "nodemon": "^3.1.7",
63
- "prettier": "^3.3.3",
64
- "rollup": "^4.60.0",
65
- "rollup-plugin-copy": "^3.5.0",
66
- "tinybench": "^6.0.0",
67
- "ts-jest": "^29.2.5",
68
- "ts-loader": "^9.5.1",
69
- "ts-node": "^10.9.2",
70
- "typescript": "^5.6.3",
71
- "typescript-eslint": "^8.10.0"
72
- }
73
- }
1
+ {
2
+ "name": "@via-profit/ability",
3
+ "support": "https://via-profit.ru",
4
+ "version": "3.4.1",
5
+ "description": "Via-Profit Ability service",
6
+ "keywords": [
7
+ "ability",
8
+ "access",
9
+ "via-profit"
10
+ ],
11
+ "main": "./dist/index.js",
12
+ "engines": {
13
+ "node": ">= 17.0.0",
14
+ "npm": ">= 8.19.3"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md",
19
+ "LICENSE",
20
+ "CHANGELOG.md",
21
+ "CONTRIBUTING.md",
22
+ "SECURITY.md"
23
+ ],
24
+ "scripts": {
25
+ "build": "rollup -c",
26
+ "build:dev": "cross-env NODE_ENV=development rollup -c -w",
27
+ "bench": "npm run build && node ./bench/benchmark.js",
28
+ "test": "jest",
29
+ "lint": "tsc --noEmit && eslint --fix .",
30
+ "pretty": "prettier --write ./src"
31
+ },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/via-profit/ability.git"
35
+ },
36
+ "author": {
37
+ "name": "Via Profit",
38
+ "url": "https://dev.via-profit.ru"
39
+ },
40
+ "contributors": [
41
+ "Vasily Novosad <delhsmail@gmail.com>",
42
+ "Pavel Natalin <trubonru@gmail.com>"
43
+ ],
44
+ "license": "MIT",
45
+ "devDependencies": {
46
+ "@eslint/js": "^9.13.0",
47
+ "@jagi/jest-transform-graphql": "^1.0.2",
48
+ "@jest/types": "^29.6.3",
49
+ "@rollup/plugin-alias": "^6.0.0",
50
+ "@rollup/plugin-commonjs": "^29.0.2",
51
+ "@rollup/plugin-node-resolve": "^16.0.3",
52
+ "@rollup/plugin-typescript": "^12.3.0",
53
+ "@types/jest": "^29.5.13",
54
+ "@types/node": "^22.7.7",
55
+ "@types/nodemon": "^1.19.6",
56
+ "concurrently": "^9.0.1",
57
+ "cross-env": "^7.0.3",
58
+ "eslint": "^9.13.0",
59
+ "globals": "^15.11.0",
60
+ "jest": "^29.7.0",
61
+ "jest-transform-graphql": "^2.1.0",
62
+ "nodemon": "^3.1.7",
63
+ "prettier": "^3.3.3",
64
+ "rollup": "^4.60.0",
65
+ "rollup-plugin-copy": "^3.5.0",
66
+ "tinybench": "^6.0.0",
67
+ "ts-jest": "^29.2.5",
68
+ "ts-loader": "^9.5.1",
69
+ "ts-node": "^10.9.2",
70
+ "typescript": "^5.6.3",
71
+ "typescript-eslint": "^8.10.0"
72
+ }
73
+ }
@@ -1,61 +0,0 @@
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;