permissions-contractx 1.0.0 → 1.0.2
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/dist/constants/contractx-permissions.constants.d.ts.map +1 -1
- package/dist/constants/contractx-permissions.constants.js +18 -1
- package/dist/constants/contractx-roles.constants.d.ts +3 -3
- package/dist/constants/contractx-roles.constants.d.ts.map +1 -1
- package/dist/constants/contractx-roles.constants.js +1 -2
- package/dist/constants/index.d.ts +2 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +4 -1
- package/dist/services/contractx-authorization.service.d.ts.map +1 -1
- package/dist/services/contractx-authorization.service.js +13 -6
- package/dist/services/contractx-validation.service.d.ts.map +1 -1
- package/dist/services/contractx-validation.service.js +24 -7
- package/dist/services/user-context.service.d.ts +19 -2
- package/dist/services/user-context.service.d.ts.map +1 -1
- package/dist/services/user-context.service.js +148 -33
- package/package.json +12 -335
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contractx-permissions.constants.d.ts","sourceRoot":"","sources":["../../src/constants/contractx-permissions.constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,oBAAY,uBAAuB;IACjC,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAGD,oBAAY,wBAAwB;IAClC,MAAM,WAAW;IACjB,YAAY,iBAAiB;IAC7B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,QAAQ,aAAa;CACtB;AAGD,oBAAY,2BAA2B;IACrC,eAAe,oBAAoB;IACnC,mBAAmB,wBAAwB;IAC3C,iBAAiB,sBAAsB;IACvC,mBAAmB,wBAAwB;IAC3C,mBAAmB,wBAAwB;IAC3C,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,YAAY,iBAAiB;IAC7B,KAAK,UAAU;IACf,WAAW,gBAAgB;CAC5B;AAGD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;CAqCpB,CAAC;AAGX,eAAO,MAAM,kBAAkB;;;;;;;CAOrB,CAAC;AAcX,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCxB,CAAC;AAOX,eAAO,MAAM,2BAA2B;;;;;;;;;;CAyE9B,CAAC;AAGX,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;CAw0BvB,CAAC;AAGX,eAAO,MAAM,2BAA2B,UACG,CAAC;AAG5C,eAAO,MAAM,kBAAkB,GAAI,YAAY,MAAM,KAAG,
|
|
1
|
+
{"version":3,"file":"contractx-permissions.constants.d.ts","sourceRoot":"","sources":["../../src/constants/contractx-permissions.constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,oBAAY,uBAAuB;IACjC,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAGD,oBAAY,wBAAwB;IAClC,MAAM,WAAW;IACjB,YAAY,iBAAiB;IAC7B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,QAAQ,aAAa;CACtB;AAGD,oBAAY,2BAA2B;IACrC,eAAe,oBAAoB;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B,GAAI,WAAW,MAAM,KAAG,MAAM,EAK7D,CAAC;AAGF,MAAM,MAAM,mBAAmB,GAAG,OAAO,2BAA2B,CAAC,MAAM,CAAC,CAAC;AAC7E,MAAM,MAAM,eAAe,GAAG,OAAO,iBAAiB,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AACvF,MAAM,MAAM,yBAAyB,GAAG,OAAO,kBAAkB,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -1026,7 +1026,20 @@ exports.VALID_CONTRACTX_PERMISSIONS = Object.values(exports.CONTRACTX_PERMISSION
|
|
|
1026
1026
|
.flatMap(module => Object.values(module));
|
|
1027
1027
|
// Helper functions for permission validation
|
|
1028
1028
|
const validatePermission = (permission) => {
|
|
1029
|
-
|
|
1029
|
+
// Handle null/undefined
|
|
1030
|
+
if (!permission) {
|
|
1031
|
+
return false;
|
|
1032
|
+
}
|
|
1033
|
+
// Check if it's a predefined permission
|
|
1034
|
+
if (exports.VALID_CONTRACTX_PERMISSIONS.includes(permission)) {
|
|
1035
|
+
return true;
|
|
1036
|
+
}
|
|
1037
|
+
// Check if it's a wildcard permission
|
|
1038
|
+
if (permission.includes(':*')) {
|
|
1039
|
+
const [module] = permission.split(':');
|
|
1040
|
+
return Object.values(exports.CONTRACTX_MODULES).includes(module);
|
|
1041
|
+
}
|
|
1042
|
+
return false;
|
|
1030
1043
|
};
|
|
1031
1044
|
exports.validatePermission = validatePermission;
|
|
1032
1045
|
const getModuleFromPermission = (permission) => {
|
|
@@ -1036,6 +1049,10 @@ const getModuleFromPermission = (permission) => {
|
|
|
1036
1049
|
exports.getModuleFromPermission = getModuleFromPermission;
|
|
1037
1050
|
const getActionFromPermission = (permission) => {
|
|
1038
1051
|
const [, action] = permission.split(':');
|
|
1052
|
+
// Handle wildcard actions
|
|
1053
|
+
if (action === '*') {
|
|
1054
|
+
return '*';
|
|
1055
|
+
}
|
|
1039
1056
|
return Object.values(ContractXPermissionType).includes(action) ? action : null;
|
|
1040
1057
|
};
|
|
1041
1058
|
exports.getActionFromPermission = getActionFromPermission;
|
|
@@ -39,7 +39,7 @@ export declare const CONTRACTX_ROLE_DEFINITIONS: {
|
|
|
39
39
|
readonly description: "Full system access with all permissions";
|
|
40
40
|
readonly type: ContractXRoleType.ADMIN;
|
|
41
41
|
readonly scope: ContractXRoleScope.GLOBAL;
|
|
42
|
-
readonly level:
|
|
42
|
+
readonly level: 100;
|
|
43
43
|
readonly isSystem: true;
|
|
44
44
|
readonly tenant: "system";
|
|
45
45
|
};
|
|
@@ -166,7 +166,7 @@ export declare const CONTRACTX_ROLE_GROUPS: {
|
|
|
166
166
|
readonly SYSTEM_ROLES: readonly ["superadmin", "support"];
|
|
167
167
|
readonly CLIENT_ROLES: readonly ["client_contract_admin", "client_performance_manager", "client_finance_manager", "client_reports_manager", "client_relationship_manager", "client_risk_manager"];
|
|
168
168
|
readonly PROVIDER_ROLES: readonly ["provider_contract_admin", "provider_performance_manager", "provider_finance_manager", "provider_reports_manager", "provider_relationship_manager", "provider_risk_manager"];
|
|
169
|
-
readonly ADMIN_ROLES: readonly ["superadmin", "
|
|
169
|
+
readonly ADMIN_ROLES: readonly ["superadmin", "client_contract_admin", "provider_contract_admin"];
|
|
170
170
|
readonly MANAGER_ROLES: readonly ["client_contract_admin", "provider_contract_admin", "client_performance_manager", "provider_performance_manager", "client_finance_manager", "provider_finance_manager"];
|
|
171
171
|
};
|
|
172
172
|
export declare const isSystemRole: (role: string) => boolean;
|
|
@@ -178,7 +178,7 @@ export declare const getRoleMetadata: (role: string) => {
|
|
|
178
178
|
readonly description: "Full system access with all permissions";
|
|
179
179
|
readonly type: ContractXRoleType.ADMIN;
|
|
180
180
|
readonly scope: ContractXRoleScope.GLOBAL;
|
|
181
|
-
readonly level:
|
|
181
|
+
readonly level: 100;
|
|
182
182
|
readonly isSystem: true;
|
|
183
183
|
readonly tenant: "system";
|
|
184
184
|
} | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contractx-roles.constants.d.ts","sourceRoot":"","sources":["../../src/constants/contractx-roles.constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,oBAAY,iBAAiB;IAC3B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAGD,oBAAY,kBAAkB;IAC5B,MAAM,WAAW;IACjB,YAAY,iBAAiB;IAC7B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,IAAI,SAAS;CACd;AAGD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;CAoBlB,CAAC;AAGX,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8I7B,CAAC;AAGX,eAAO,MAAM,qBAAqB,wXAAiC,CAAC;AAGpE,eAAO,MAAM,qBAAqB;;;;;;
|
|
1
|
+
{"version":3,"file":"contractx-roles.constants.d.ts","sourceRoot":"","sources":["../../src/constants/contractx-roles.constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,oBAAY,iBAAiB;IAC3B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAGD,oBAAY,kBAAkB;IAC5B,MAAM,WAAW;IACjB,YAAY,iBAAiB;IAC7B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,IAAI,SAAS;CACd;AAGD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;CAoBlB,CAAC;AAGX,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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|
|
54
|
+
level: 100,
|
|
55
55
|
isSystem: true,
|
|
56
56
|
tenant: 'system'
|
|
57
57
|
},
|
|
@@ -198,7 +198,6 @@ exports.CONTRACTX_ROLE_GROUPS = {
|
|
|
198
198
|
],
|
|
199
199
|
ADMIN_ROLES: [
|
|
200
200
|
exports.CONTRACTX_ROLES.SUPERADMIN,
|
|
201
|
-
exports.CONTRACTX_ROLES.SUPPORT,
|
|
202
201
|
exports.CONTRACTX_ROLES.CLIENT_CONTRACT_ADMIN,
|
|
203
202
|
exports.CONTRACTX_ROLES.PROVIDER_CONTRACT_ADMIN,
|
|
204
203
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/constants/index.js
CHANGED
|
@@ -14,5 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
17
|
+
exports.MODULE_CONSTANTS = void 0;
|
|
18
|
+
__exportStar(require("./contractx-roles.constants"), exports);
|
|
18
19
|
__exportStar(require("./contractx-permissions.constants"), exports);
|
|
20
|
+
var security_constants_1 = require("./security.constants");
|
|
21
|
+
Object.defineProperty(exports, "MODULE_CONSTANTS", { enumerable: true, get: function () { return security_constants_1.MODULE_CONSTANTS; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contractx-authorization.service.d.ts","sourceRoot":"","sources":["../../src/services/contractx-authorization.service.ts"],"names":[],"mappings":"AACA,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EACjB,MAAM,gCAAgC,CAAC;AAgBxC,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IACnC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,YAAY;IAC3B,eAAe,EAAE,OAAO,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC;AAED,qBACa,6BAA6B;IAE5B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAAjB,iBAAiB,EAAE,0BAA0B;IAE1E;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,oBAAoB,GAAG,mBAAmB;
|
|
1
|
+
{"version":3,"file":"contractx-authorization.service.d.ts","sourceRoot":"","sources":["../../src/services/contractx-authorization.service.ts"],"names":[],"mappings":"AACA,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EACjB,MAAM,gCAAgC,CAAC;AAgBxC,M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AG,YAAY;CAQ3F"}
|
|
@@ -22,6 +22,14 @@ let ContractXAuthorizationService = class ContractXAuthorizationService {
|
|
|
22
22
|
* Authorize a user for a specific action on a resource
|
|
23
23
|
*/
|
|
24
24
|
authorize(context) {
|
|
25
|
+
// Handle null context
|
|
26
|
+
if (!context) {
|
|
27
|
+
return {
|
|
28
|
+
granted: false,
|
|
29
|
+
reason: 'Invalid context: context is null or undefined',
|
|
30
|
+
level: 'denied',
|
|
31
|
+
};
|
|
32
|
+
}
|
|
25
33
|
const { userRoles, userPermissions, requestedResource, requestedAction } = context;
|
|
26
34
|
// First validate the user context
|
|
27
35
|
const userValidation = this.validationService.validateUser(userRoles, userPermissions);
|
|
@@ -162,15 +170,14 @@ let ContractXAuthorizationService = class ContractXAuthorizationService {
|
|
|
162
170
|
.filter(meta => meta !== null);
|
|
163
171
|
// Analyze access levels
|
|
164
172
|
const hasSystemAccess = userRoles.some(role => (0, contractx_roles_constants_1.isSystemRole)(role));
|
|
165
|
-
const hasClientAccess = userRoles.some(role => (0, contractx_roles_constants_1.isClientRole)(role));
|
|
166
|
-
const hasProviderAccess = userRoles.some(role => (0, contractx_roles_constants_1.isProviderRole)(role));
|
|
173
|
+
const hasClientAccess = userRoles.some(role => (0, contractx_roles_constants_1.isClientRole)(role)) || hasSystemAccess;
|
|
174
|
+
const hasProviderAccess = userRoles.some(role => (0, contractx_roles_constants_1.isProviderRole)(role)) || hasSystemAccess;
|
|
167
175
|
const hasAdminAccess = userRoles.some(role => (0, contractx_roles_constants_1.isAdminRole)(role));
|
|
168
|
-
// Get accessible modules
|
|
169
|
-
const
|
|
176
|
+
// Get accessible modules from both explicit permissions and role-based permissions
|
|
177
|
+
const effectivePermissions = this.validationService.getEffectivePermissions(userRoles, userPermissions);
|
|
178
|
+
const accessibleModules = this.validationService.getUserModules(effectivePermissions);
|
|
170
179
|
// Calculate highest role level
|
|
171
180
|
const highestRoleLevel = Math.max(...roleMetadata.map(meta => meta?.level || 0), 0);
|
|
172
|
-
// Get effective permissions
|
|
173
|
-
const effectivePermissions = this.validationService.getEffectivePermissions(userRoles, userPermissions);
|
|
174
181
|
return {
|
|
175
182
|
hasSystemAccess,
|
|
176
183
|
hasClientAccess,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contractx-validation.service.d.ts","sourceRoot":"","sources":["../../src/services/contractx-validation.service.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,0BAA2B,SAAQ,gBAAgB;IAClE,cAAc,CAAC,EAAE;QACf,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,OAAO,CAAC;KAClB,EAAE,CAAC;CACL;AAED,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D,QAAQ,CAAC,EAAE;QACT,aAAa,EAAE,OAAO,CAAC;QACvB,mBAAmB,EAAE,OAAO,CAAC;QAC7B,SAAS,EAAE,MAAM,CAAC;QAClB,eAAe,EAAE,MAAM,CAAC;QACxB,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;QACnD,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED,qBACa,0BAA0B;IAErC;;OAEG;IACH,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB;IAuCtD,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,oBAAoB;IA4CpD,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,0BAA0B;IA8CxE,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,0BAA0B;IA2CtE;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,oBAAoB;
|
|
1
|
+
{"version":3,"file":"contractx-validation.service.d.ts","sourceRoot":"","sources":["../../src/services/contractx-validation.service.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,0BAA2B,SAAQ,gBAAgB;IAClE,cAAc,CAAC,EAAE;QACf,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,OAAO,CAAC;KAClB,EAAE,CAAC;CACL;AAED,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D,QAAQ,CAAC,EAAE;QACT,aAAa,EAAE,OAAO,CAAC;QACvB,mBAAmB,EAAE,O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
|
163
163
|
const errors = [];
|
|
164
164
|
const warnings = [];
|
|
165
|
+
// Handle undefined or null inputs
|
|
166
|
+
const safeRoles = Array.isArray(roles) ? roles : [];
|
|
167
|
+
const safePermissions = Array.isArray(permissions) ? permissions : [];
|
|
168
|
+
if (!Array.isArray(roles)) {
|
|
169
|
+
errors.push('Roles must be an array');
|
|
170
|
+
}
|
|
171
|
+
if (!Array.isArray(permissions)) {
|
|
172
|
+
errors.push('Permissions must be an array');
|
|
173
|
+
}
|
|
165
174
|
// Validate roles
|
|
166
|
-
const roleValidation = this.validateRoles(
|
|
175
|
+
const roleValidation = this.validateRoles(safeRoles);
|
|
167
176
|
errors.push(...roleValidation.errors);
|
|
168
177
|
warnings.push(...roleValidation.warnings);
|
|
169
178
|
// Validate permissions
|
|
170
|
-
const permissionValidation = this.validatePermissions(
|
|
179
|
+
const permissionValidation = this.validatePermissions(safePermissions);
|
|
171
180
|
errors.push(...permissionValidation.errors);
|
|
172
181
|
warnings.push(...permissionValidation.warnings);
|
|
173
182
|
// Determine tenant type
|
|
@@ -183,9 +192,9 @@ let ContractXValidationService = class ContractXValidationService {
|
|
|
183
192
|
// Calculate access level (highest role level)
|
|
184
193
|
const accessLevel = Math.max(...roleInfos.map((r) => r.level), 0);
|
|
185
194
|
// Cross-validation: check if permissions align with roles
|
|
186
|
-
const expectedPermissions = this.getExpectedPermissionsForRoles(
|
|
187
|
-
const missingPermissions = expectedPermissions.filter(p => !
|
|
188
|
-
const extraPermissions =
|
|
195
|
+
const expectedPermissions = this.getExpectedPermissionsForRoles(safeRoles);
|
|
196
|
+
const missingPermissions = expectedPermissions.filter(p => !safePermissions.includes(p));
|
|
197
|
+
const extraPermissions = safePermissions.filter(p => !expectedPermissions.includes(p));
|
|
189
198
|
if (missingPermissions.length > 0) {
|
|
190
199
|
warnings.push(`Missing expected permissions for roles: ${missingPermissions.slice(0, 5).join(', ')}${missingPermissions.length > 5 ? '...' : ''}`);
|
|
191
200
|
}
|
|
@@ -199,8 +208,8 @@ let ContractXValidationService = class ContractXValidationService {
|
|
|
199
208
|
userInfo: {
|
|
200
209
|
hasValidRoles: roleValidation.isValid,
|
|
201
210
|
hasValidPermissions: permissionValidation.isValid,
|
|
202
|
-
roleCount:
|
|
203
|
-
permissionCount:
|
|
211
|
+
roleCount: safeRoles.length,
|
|
212
|
+
permissionCount: safePermissions.length,
|
|
204
213
|
tenant,
|
|
205
214
|
accessLevel,
|
|
206
215
|
},
|
|
@@ -215,6 +224,10 @@ let ContractXValidationService = class ContractXValidationService {
|
|
|
215
224
|
*/
|
|
216
225
|
getExpectedPermissionsForRoles(roles) {
|
|
217
226
|
const allPermissions = new Set();
|
|
227
|
+
// Handle undefined or non-array roles
|
|
228
|
+
if (!Array.isArray(roles)) {
|
|
229
|
+
return [];
|
|
230
|
+
}
|
|
218
231
|
for (const role of roles) {
|
|
219
232
|
const rolePermissions = contractx_permissions_constants_1.ODS_ROLE_PERMISSIONS[role];
|
|
220
233
|
if (rolePermissions) {
|
|
@@ -269,6 +282,10 @@ let ContractXValidationService = class ContractXValidationService {
|
|
|
269
282
|
validateJwtPayload(payload) {
|
|
270
283
|
const errors = [];
|
|
271
284
|
const warnings = [];
|
|
285
|
+
if (!payload || typeof payload !== 'object') {
|
|
286
|
+
errors.push('Invalid payload: must be an object');
|
|
287
|
+
return { isValid: false, errors, warnings };
|
|
288
|
+
}
|
|
272
289
|
// Required fields
|
|
273
290
|
if (!payload.sub) {
|
|
274
291
|
errors.push('Missing required field: sub (user ID)');
|
|
@@ -3,13 +3,24 @@ import { JwtPayload } from '../interfaces';
|
|
|
3
3
|
* Request-scoped service to manage current user context
|
|
4
4
|
* Provides convenient methods to access user information and check permissions
|
|
5
5
|
*/
|
|
6
|
+
interface RequestWithUser {
|
|
7
|
+
user?: any;
|
|
8
|
+
tenant?: any;
|
|
9
|
+
}
|
|
6
10
|
export declare class UserContextService {
|
|
11
|
+
private readonly request;
|
|
7
12
|
private user;
|
|
13
|
+
private autoInitialized;
|
|
14
|
+
constructor(request: RequestWithUser);
|
|
8
15
|
/**
|
|
9
16
|
* Set the current user context
|
|
10
17
|
* This is typically called by the authentication guard
|
|
11
18
|
*/
|
|
12
19
|
setUser(user: JwtPayload): void;
|
|
20
|
+
/**
|
|
21
|
+
* Auto-initialize user from request if not manually set
|
|
22
|
+
*/
|
|
23
|
+
private tryAutoInitialize;
|
|
13
24
|
/**
|
|
14
25
|
* Get the current authenticated user
|
|
15
26
|
*/
|
|
@@ -30,6 +41,11 @@ export declare class UserContextService {
|
|
|
30
41
|
* Get the current user's client ID
|
|
31
42
|
*/
|
|
32
43
|
getClientId(): string | null;
|
|
44
|
+
/**
|
|
45
|
+
* Get the tenant key (key_client) for multi-tenant operations
|
|
46
|
+
* Tries multiple sources: user.key_client, user.clientId, tenant.key_client
|
|
47
|
+
*/
|
|
48
|
+
getTenantKey(): string | null;
|
|
33
49
|
/**
|
|
34
50
|
* Get the current user's session ID
|
|
35
51
|
*/
|
|
@@ -49,11 +65,11 @@ export declare class UserContextService {
|
|
|
49
65
|
/**
|
|
50
66
|
* Check if user has any of the specified roles
|
|
51
67
|
*/
|
|
52
|
-
hasAnyRole(roles: string[]): boolean;
|
|
68
|
+
hasAnyRole(roles: readonly string[] | string[]): boolean;
|
|
53
69
|
/**
|
|
54
70
|
* Check if user has all of the specified roles
|
|
55
71
|
*/
|
|
56
|
-
hasAllRoles(roles: string[]): boolean;
|
|
72
|
+
hasAllRoles(roles: readonly string[] | string[]): boolean;
|
|
57
73
|
/**
|
|
58
74
|
* Check if user has a specific permission
|
|
59
75
|
*/
|
|
@@ -111,4 +127,5 @@ export declare class UserContextService {
|
|
|
111
127
|
clientId: string | null;
|
|
112
128
|
};
|
|
113
129
|
}
|
|
130
|
+
export {};
|
|
114
131
|
//# sourceMappingURL=user-context.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-context.service.d.ts","sourceRoot":"","sources":["../../src/services/user-context.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"user-context.service.d.ts","sourceRoot":"","sources":["../../src/services/user-context.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C;;;GAGG;AACH,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,MAAM,CAAC,EAAE,GAAG,CAAC;CACd;AAED,qBACa,kBAAkB;IAKV,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJ3C,OAAO,CAAC,IAAI,CAA2B;IACvC,OAAO,CAAC,eAAe,CAAS;gBAGI,OAAO,EAAE,eAAe;IAG5D;;;OAGG;IACH,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAI/B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA4EzB;;OAEG;IACH,OAAO,IAAI,UAAU,GAAG,IAAI;IAK5B;;OAEG;IACH,SAAS,IAAI,MAAM,GAAG,IAAI;IAM1B;;OAEG;IACH,eAAe,IAAI,MAAM,GAAG,IAAI;IAMhC;;OAEG;IACH,YAAY,IAAI,MAAM,GAAG,IAAI;IAM7B;;OAEG;IACH,WAAW,IAAI,MAAM,GAAG,IAAI;IAM5B;;;OAGG;IACH,YAAY,IAAI,MAAM,GAAG,IAAI;IAsC7B;;OAEG;IACH,YAAY,IAAI,MAAM,GAAG,IAAI;IAM7B;;OAEG;IACH,YAAY,IAAI,MAAM,EAAE;IAKxB;;OAEG;IACH,kBAAkB,IAAI,MAAM,EAAE;IAK9B;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI9B;;OAEG;IACH,UAAU,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO;IAKxD;;OAEG;IACH,WAAW,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO;IAKzD;;OAEG;IACH,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAI1C;;OAEG;IACH,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO;IAKhD;;OAEG;IACH,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO;IAKjD;;OAEG;IACH,eAAe,IAAI,OAAO;IAK1B;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;OAEG;IACH,cAAc,IAAI,OAAO;IAIzB;;OAEG;IACH,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAOxC;;OAEG;IACH,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE;IAM9C;;OAEG;IACH,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAIzD;;OAEG;IACH,cAAc,IAAI;QAChB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;QAClB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,eAAe,EAAE,MAAM,CAAC;QACxB,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;KACzB;CAWF"}
|
|
@@ -5,16 +5,22 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
8
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
15
|
exports.UserContextService = void 0;
|
|
10
16
|
const common_1 = require("@nestjs/common");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* Provides convenient methods to access user information and check permissions
|
|
14
|
-
*/
|
|
17
|
+
const core_1 = require("@nestjs/core");
|
|
18
|
+
const contractx_roles_constants_1 = require("../constants/contractx-roles.constants");
|
|
15
19
|
let UserContextService = class UserContextService {
|
|
16
|
-
constructor() {
|
|
20
|
+
constructor(request) {
|
|
21
|
+
this.request = request;
|
|
17
22
|
this.user = null;
|
|
23
|
+
this.autoInitialized = false;
|
|
18
24
|
}
|
|
19
25
|
/**
|
|
20
26
|
* Set the current user context
|
|
@@ -23,52 +29,176 @@ let UserContextService = class UserContextService {
|
|
|
23
29
|
setUser(user) {
|
|
24
30
|
this.user = user;
|
|
25
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Auto-initialize user from request if not manually set
|
|
34
|
+
*/
|
|
35
|
+
tryAutoInitialize() {
|
|
36
|
+
if (this.autoInitialized || this.user !== null) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
this.autoInitialized = true;
|
|
40
|
+
// Try to get user from request.user (populated by JWT middleware)
|
|
41
|
+
if (this.request?.user) {
|
|
42
|
+
try {
|
|
43
|
+
// Handle different user object formats
|
|
44
|
+
const requestUser = this.request.user;
|
|
45
|
+
// Convert to JwtPayload format
|
|
46
|
+
const payload = {
|
|
47
|
+
sub: requestUser.sub || requestUser.id || requestUser.user_id,
|
|
48
|
+
role: requestUser.role || requestUser.roles || [],
|
|
49
|
+
permissions: requestUser.permissions || [],
|
|
50
|
+
fullName: requestUser.fullName || requestUser.full_name || requestUser.username || '',
|
|
51
|
+
email: requestUser.email,
|
|
52
|
+
clientId: Array.isArray(requestUser.clientId)
|
|
53
|
+
? requestUser.clientId[0]
|
|
54
|
+
: (requestUser.clientId || requestUser.client_id),
|
|
55
|
+
sessionId: requestUser.sessionId || requestUser.session_id,
|
|
56
|
+
iat: requestUser.iat,
|
|
57
|
+
exp: requestUser.exp,
|
|
58
|
+
iss: requestUser.iss,
|
|
59
|
+
aud: requestUser.aud,
|
|
60
|
+
};
|
|
61
|
+
// Copy any additional properties
|
|
62
|
+
Object.keys(requestUser).forEach(key => {
|
|
63
|
+
if (!(key in payload)) {
|
|
64
|
+
payload[key] = requestUser[key];
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
this.user = payload;
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
// If parsing fails, continue to try request.tenant
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// Fallback: try to get user from request.tenant (if populated by custom middleware)
|
|
75
|
+
if (this.request?.tenant) {
|
|
76
|
+
try {
|
|
77
|
+
const tenant = this.request.tenant;
|
|
78
|
+
const payload = {
|
|
79
|
+
sub: tenant.user_id || tenant.sub || tenant.id,
|
|
80
|
+
role: tenant.roles || [tenant.role].filter(Boolean),
|
|
81
|
+
permissions: tenant.permissions || [],
|
|
82
|
+
fullName: tenant.fullName || tenant.full_name || tenant.username || '',
|
|
83
|
+
email: tenant.email,
|
|
84
|
+
clientId: Array.isArray(tenant.clientId)
|
|
85
|
+
? tenant.clientId[0]
|
|
86
|
+
: (tenant.clientId || tenant.client_id),
|
|
87
|
+
sessionId: tenant.sessionId || tenant.session_id,
|
|
88
|
+
};
|
|
89
|
+
// Copy additional properties
|
|
90
|
+
Object.keys(tenant).forEach(key => {
|
|
91
|
+
if (!(key in payload)) {
|
|
92
|
+
payload[key] = tenant[key];
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
this.user = payload;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
// If parsing fails, user remains null
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
26
103
|
/**
|
|
27
104
|
* Get the current authenticated user
|
|
28
105
|
*/
|
|
29
106
|
getUser() {
|
|
107
|
+
this.tryAutoInitialize();
|
|
30
108
|
return this.user;
|
|
31
109
|
}
|
|
32
110
|
/**
|
|
33
111
|
* Get the current user's ID
|
|
34
112
|
*/
|
|
35
113
|
getUserId() {
|
|
36
|
-
|
|
114
|
+
this.tryAutoInitialize();
|
|
115
|
+
if (this.user?.sub === undefined || this.user?.sub === null)
|
|
116
|
+
return null;
|
|
117
|
+
return String(this.user.sub);
|
|
37
118
|
}
|
|
38
119
|
/**
|
|
39
120
|
* Get the current user's full name
|
|
40
121
|
*/
|
|
41
122
|
getUserFullName() {
|
|
42
|
-
|
|
123
|
+
this.tryAutoInitialize();
|
|
124
|
+
if (this.user?.fullName === undefined || this.user?.fullName === null)
|
|
125
|
+
return null;
|
|
126
|
+
return this.user.fullName;
|
|
43
127
|
}
|
|
44
128
|
/**
|
|
45
129
|
* Get the current user's email
|
|
46
130
|
*/
|
|
47
131
|
getUserEmail() {
|
|
48
|
-
|
|
132
|
+
this.tryAutoInitialize();
|
|
133
|
+
if (this.user?.email === undefined || this.user?.email === null)
|
|
134
|
+
return null;
|
|
135
|
+
return this.user.email;
|
|
49
136
|
}
|
|
50
137
|
/**
|
|
51
138
|
* Get the current user's client ID
|
|
52
139
|
*/
|
|
53
140
|
getClientId() {
|
|
54
|
-
|
|
141
|
+
this.tryAutoInitialize();
|
|
142
|
+
if (this.user?.clientId === undefined || this.user?.clientId === null)
|
|
143
|
+
return null;
|
|
144
|
+
return Array.isArray(this.user.clientId) ? this.user.clientId[0] : this.user.clientId;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Get the tenant key (key_client) for multi-tenant operations
|
|
148
|
+
* Tries multiple sources: user.key_client, user.clientId, tenant.key_client
|
|
149
|
+
*/
|
|
150
|
+
getTenantKey() {
|
|
151
|
+
this.tryAutoInitialize();
|
|
152
|
+
// Try to get from user object first
|
|
153
|
+
if (this.user) {
|
|
154
|
+
// Check for key_client property
|
|
155
|
+
const keyClient = this.user.key_client;
|
|
156
|
+
if (keyClient) {
|
|
157
|
+
return Array.isArray(keyClient) ? keyClient[0] : keyClient;
|
|
158
|
+
}
|
|
159
|
+
// Fallback to clientId
|
|
160
|
+
if (this.user.clientId) {
|
|
161
|
+
return Array.isArray(this.user.clientId) ? this.user.clientId[0] : this.user.clientId;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
// Try to get from request.tenant directly
|
|
165
|
+
if (this.request?.tenant?.key_client) {
|
|
166
|
+
const tenantKeyClient = this.request.tenant.key_client;
|
|
167
|
+
return Array.isArray(tenantKeyClient) ? tenantKeyClient[0] : tenantKeyClient;
|
|
168
|
+
}
|
|
169
|
+
// Try to get from request.user directly (in case of format differences)
|
|
170
|
+
if (this.request?.user?.key_client) {
|
|
171
|
+
const userKeyClient = this.request.user.key_client;
|
|
172
|
+
return Array.isArray(userKeyClient) ? userKeyClient[0] : userKeyClient;
|
|
173
|
+
}
|
|
174
|
+
// Try to get clientId from request.user directly
|
|
175
|
+
if (this.request?.user?.clientId) {
|
|
176
|
+
const userClientId = this.request.user.clientId;
|
|
177
|
+
return Array.isArray(userClientId) ? userClientId[0] : userClientId;
|
|
178
|
+
}
|
|
179
|
+
return null;
|
|
55
180
|
}
|
|
56
181
|
/**
|
|
57
182
|
* Get the current user's session ID
|
|
58
183
|
*/
|
|
59
184
|
getSessionId() {
|
|
60
|
-
|
|
185
|
+
this.tryAutoInitialize();
|
|
186
|
+
if (this.user?.sessionId === undefined || this.user?.sessionId === null)
|
|
187
|
+
return null;
|
|
188
|
+
return this.user.sessionId;
|
|
61
189
|
}
|
|
62
190
|
/**
|
|
63
191
|
* Get all user roles
|
|
64
192
|
*/
|
|
65
193
|
getUserRoles() {
|
|
194
|
+
this.tryAutoInitialize();
|
|
66
195
|
return this.user?.role || [];
|
|
67
196
|
}
|
|
68
197
|
/**
|
|
69
198
|
* Get all user permissions
|
|
70
199
|
*/
|
|
71
200
|
getUserPermissions() {
|
|
201
|
+
this.tryAutoInitialize();
|
|
72
202
|
return this.user?.permissions || [];
|
|
73
203
|
}
|
|
74
204
|
/**
|
|
@@ -115,49 +245,32 @@ let UserContextService = class UserContextService {
|
|
|
115
245
|
* Check if user is authenticated
|
|
116
246
|
*/
|
|
117
247
|
isAuthenticated() {
|
|
248
|
+
this.tryAutoInitialize();
|
|
118
249
|
return this.user !== null;
|
|
119
250
|
}
|
|
120
251
|
/**
|
|
121
252
|
* Check if user is a superadmin
|
|
122
253
|
*/
|
|
123
254
|
isSuperAdmin() {
|
|
124
|
-
return this.hasRole(
|
|
255
|
+
return this.hasRole(contractx_roles_constants_1.CONTRACTX_ROLES.SUPERADMIN);
|
|
125
256
|
}
|
|
126
257
|
/**
|
|
127
258
|
* Check if user has admin privileges (superadmin or contract admin)
|
|
128
259
|
*/
|
|
129
260
|
isAdmin() {
|
|
130
|
-
return this.hasAnyRole(
|
|
131
|
-
'superadmin',
|
|
132
|
-
'client_contract_admin',
|
|
133
|
-
'provider_contract_admin',
|
|
134
|
-
]);
|
|
261
|
+
return this.hasAnyRole(contractx_roles_constants_1.CONTRACTX_ROLE_GROUPS.ADMIN_ROLES);
|
|
135
262
|
}
|
|
136
263
|
/**
|
|
137
264
|
* Check if user has client-side role
|
|
138
265
|
*/
|
|
139
266
|
isClientUser() {
|
|
140
|
-
return this.hasAnyRole(
|
|
141
|
-
'client_contract_admin',
|
|
142
|
-
'client_performance_manager',
|
|
143
|
-
'client_finance_manager',
|
|
144
|
-
'client_reports_manager',
|
|
145
|
-
'client_relationship_manager',
|
|
146
|
-
'client_risk_manager',
|
|
147
|
-
]);
|
|
267
|
+
return this.hasAnyRole(contractx_roles_constants_1.CONTRACTX_ROLE_GROUPS.CLIENT_ROLES);
|
|
148
268
|
}
|
|
149
269
|
/**
|
|
150
270
|
* Check if user has provider-side role
|
|
151
271
|
*/
|
|
152
272
|
isProviderUser() {
|
|
153
|
-
return this.hasAnyRole(
|
|
154
|
-
'provider_contract_admin',
|
|
155
|
-
'provider_performance_manager',
|
|
156
|
-
'provider_finance_manager',
|
|
157
|
-
'provider_reports_manager',
|
|
158
|
-
'provider_relationship_manager',
|
|
159
|
-
'provider_risk_manager',
|
|
160
|
-
]);
|
|
273
|
+
return this.hasAnyRole(contractx_roles_constants_1.CONTRACTX_ROLE_GROUPS.PROVIDER_ROLES);
|
|
161
274
|
}
|
|
162
275
|
/**
|
|
163
276
|
* Check if user can access a specific module based on permissions
|
|
@@ -195,5 +308,7 @@ let UserContextService = class UserContextService {
|
|
|
195
308
|
};
|
|
196
309
|
exports.UserContextService = UserContextService;
|
|
197
310
|
exports.UserContextService = UserContextService = __decorate([
|
|
198
|
-
(0, common_1.Injectable)({ scope: common_1.Scope.REQUEST })
|
|
311
|
+
(0, common_1.Injectable)({ scope: common_1.Scope.REQUEST }),
|
|
312
|
+
__param(0, (0, common_1.Inject)(core_1.REQUEST)),
|
|
313
|
+
__metadata("design:paramtypes", [Object])
|
|
199
314
|
], UserContextService);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "permissions-contractx",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Enterprise-grade authentication and authorization package for NestJS microservices with role-based and permission-based access control",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -44,6 +44,10 @@
|
|
|
44
44
|
"bugs": {
|
|
45
45
|
"url": "https://github.com/your-org/permissions-contractx/issues"
|
|
46
46
|
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=16.0.0",
|
|
49
|
+
"npm": ">=7.0.0"
|
|
50
|
+
},
|
|
47
51
|
"peerDependencies": {
|
|
48
52
|
"@nestjs/common": "^11.1.6",
|
|
49
53
|
"@nestjs/config": "^4.0.2",
|
|
@@ -54,352 +58,25 @@
|
|
|
54
58
|
"rxjs": "^7.0.0"
|
|
55
59
|
},
|
|
56
60
|
"devDependencies": {
|
|
61
|
+
"@nestjs/platform-express": "^11.1.6",
|
|
57
62
|
"@nestjs/testing": "^11.1.6",
|
|
58
63
|
"@types/express": "^5.0.3",
|
|
59
|
-
"@types/jest": "^
|
|
64
|
+
"@types/jest": "^25.1.0",
|
|
60
65
|
"@types/jsonwebtoken": "^9.0.0",
|
|
61
66
|
"@types/node": "^20.0.0",
|
|
62
67
|
"@types/supertest": "^2.0.12",
|
|
63
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
64
|
-
"@typescript-eslint/parser": "^
|
|
65
|
-
"eslint": "^
|
|
66
|
-
"jest": "^
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^8.43.0",
|
|
69
|
+
"@typescript-eslint/parser": "^8.43.0",
|
|
70
|
+
"eslint": "^9.35.0",
|
|
71
|
+
"jest": "^30.1.3",
|
|
67
72
|
"rimraf": "^5.0.0",
|
|
68
73
|
"supertest": "^6.3.0",
|
|
69
|
-
"ts-jest": "^
|
|
74
|
+
"ts-jest": "^28.0.5",
|
|
70
75
|
"ts-node": "^10.9.0",
|
|
71
76
|
"typescript": "^5.0.0"
|
|
72
77
|
},
|
|
73
|
-
"engines": {
|
|
74
|
-
"node": ">=16.0.0",
|
|
75
|
-
"npm": ">=7.0.0"
|
|
76
|
-
},
|
|
77
78
|
"directories": {
|
|
78
79
|
"example": "examples",
|
|
79
80
|
"test": "test"
|
|
80
|
-
},
|
|
81
|
-
"dependencies": {
|
|
82
|
-
"acorn": "^8.15.0",
|
|
83
|
-
"acorn-jsx": "^5.3.2",
|
|
84
|
-
"acorn-walk": "^8.3.4",
|
|
85
|
-
"ajv": "^6.12.6",
|
|
86
|
-
"ansi-escapes": "^4.3.2",
|
|
87
|
-
"ansi-regex": "^5.0.1",
|
|
88
|
-
"ansi-styles": "^4.3.0",
|
|
89
|
-
"anymatch": "^3.1.3",
|
|
90
|
-
"arg": "^4.1.3",
|
|
91
|
-
"argparse": "^2.0.1",
|
|
92
|
-
"array-union": "^2.1.0",
|
|
93
|
-
"asap": "^2.0.6",
|
|
94
|
-
"asynckit": "^0.4.0",
|
|
95
|
-
"babel-jest": "^29.7.0",
|
|
96
|
-
"babel-plugin-istanbul": "^6.1.1",
|
|
97
|
-
"babel-plugin-jest-hoist": "^29.6.3",
|
|
98
|
-
"babel-preset-current-node-syntax": "^1.2.0",
|
|
99
|
-
"babel-preset-jest": "^29.6.3",
|
|
100
|
-
"balanced-match": "^1.0.2",
|
|
101
|
-
"brace-expansion": "^2.0.2",
|
|
102
|
-
"braces": "^3.0.3",
|
|
103
|
-
"browserslist": "^4.25.2",
|
|
104
|
-
"bs-logger": "^0.2.6",
|
|
105
|
-
"bser": "^2.1.1",
|
|
106
|
-
"buffer-equal-constant-time": "^1.0.1",
|
|
107
|
-
"buffer-from": "^1.1.2",
|
|
108
|
-
"call-bind-apply-helpers": "^1.0.2",
|
|
109
|
-
"call-bound": "^1.0.4",
|
|
110
|
-
"callsites": "^3.1.0",
|
|
111
|
-
"camelcase": "^5.3.1",
|
|
112
|
-
"caniuse-lite": "^1.0.30001733",
|
|
113
|
-
"chalk": "^4.1.2",
|
|
114
|
-
"char-regex": "^1.0.2",
|
|
115
|
-
"ci-info": "^3.9.0",
|
|
116
|
-
"cjs-module-lexer": "^1.4.3",
|
|
117
|
-
"cliui": "^8.0.1",
|
|
118
|
-
"co": "^4.6.0",
|
|
119
|
-
"collect-v8-coverage": "^1.0.2",
|
|
120
|
-
"color-convert": "^2.0.1",
|
|
121
|
-
"color-name": "^1.1.4",
|
|
122
|
-
"combined-stream": "^1.0.8",
|
|
123
|
-
"component-emitter": "^1.3.1",
|
|
124
|
-
"concat-map": "^0.0.1",
|
|
125
|
-
"consola": "^3.4.2",
|
|
126
|
-
"convert-source-map": "^2.0.0",
|
|
127
|
-
"cookiejar": "^2.1.4",
|
|
128
|
-
"create-jest": "^29.7.0",
|
|
129
|
-
"create-require": "^1.1.1",
|
|
130
|
-
"cross-spawn": "^7.0.6",
|
|
131
|
-
"debug": "^4.4.1",
|
|
132
|
-
"dedent": "^1.6.0",
|
|
133
|
-
"deep-is": "^0.1.4",
|
|
134
|
-
"deepmerge": "^4.3.1",
|
|
135
|
-
"delayed-stream": "^1.0.0",
|
|
136
|
-
"detect-newline": "^3.1.0",
|
|
137
|
-
"dezalgo": "^1.0.4",
|
|
138
|
-
"diff": "^4.0.2",
|
|
139
|
-
"diff-sequences": "^29.6.3",
|
|
140
|
-
"dir-glob": "^3.0.1",
|
|
141
|
-
"doctrine": "^3.0.0",
|
|
142
|
-
"dotenv": "^16.4.7",
|
|
143
|
-
"dotenv-expand": "^12.0.1",
|
|
144
|
-
"dunder-proto": "^1.0.1",
|
|
145
|
-
"eastasianwidth": "^0.2.0",
|
|
146
|
-
"ecdsa-sig-formatter": "^1.0.11",
|
|
147
|
-
"electron-to-chromium": "^1.5.199",
|
|
148
|
-
"emittery": "^0.13.1",
|
|
149
|
-
"emoji-regex": "^8.0.0",
|
|
150
|
-
"error-ex": "^1.3.2",
|
|
151
|
-
"es-define-property": "^1.0.1",
|
|
152
|
-
"es-errors": "^1.3.0",
|
|
153
|
-
"es-object-atoms": "^1.1.1",
|
|
154
|
-
"es-set-tostringtag": "^2.1.0",
|
|
155
|
-
"escalade": "^3.2.0",
|
|
156
|
-
"escape-string-regexp": "^4.0.0",
|
|
157
|
-
"eslint-scope": "^7.2.2",
|
|
158
|
-
"eslint-visitor-keys": "^3.4.3",
|
|
159
|
-
"espree": "^9.6.1",
|
|
160
|
-
"esprima": "^4.0.1",
|
|
161
|
-
"esquery": "^1.6.0",
|
|
162
|
-
"esrecurse": "^4.3.0",
|
|
163
|
-
"estraverse": "^5.3.0",
|
|
164
|
-
"esutils": "^2.0.3",
|
|
165
|
-
"execa": "^5.1.1",
|
|
166
|
-
"exit": "^0.1.2",
|
|
167
|
-
"expect": "^29.7.0",
|
|
168
|
-
"fast-deep-equal": "^3.1.3",
|
|
169
|
-
"fast-glob": "^3.3.3",
|
|
170
|
-
"fast-json-stable-stringify": "^2.1.0",
|
|
171
|
-
"fast-levenshtein": "^2.0.6",
|
|
172
|
-
"fast-safe-stringify": "^2.1.1",
|
|
173
|
-
"fastq": "^1.19.1",
|
|
174
|
-
"fb-watchman": "^2.0.2",
|
|
175
|
-
"fflate": "^0.8.2",
|
|
176
|
-
"file-entry-cache": "^6.0.1",
|
|
177
|
-
"file-type": "^21.0.0",
|
|
178
|
-
"fill-range": "^7.1.1",
|
|
179
|
-
"find-up": "^5.0.0",
|
|
180
|
-
"flat-cache": "^3.2.0",
|
|
181
|
-
"flatted": "^3.3.3",
|
|
182
|
-
"foreground-child": "^3.3.1",
|
|
183
|
-
"form-data": "^4.0.4",
|
|
184
|
-
"formidable": "^2.1.5",
|
|
185
|
-
"fs.realpath": "^1.0.0",
|
|
186
|
-
"function-bind": "^1.1.2",
|
|
187
|
-
"gensync": "^1.0.0-beta.2",
|
|
188
|
-
"get-caller-file": "^2.0.5",
|
|
189
|
-
"get-intrinsic": "^1.3.0",
|
|
190
|
-
"get-package-type": "^0.1.0",
|
|
191
|
-
"get-proto": "^1.0.1",
|
|
192
|
-
"get-stream": "^6.0.1",
|
|
193
|
-
"glob": "^7.2.3",
|
|
194
|
-
"glob-parent": "^6.0.2",
|
|
195
|
-
"globals": "^13.24.0",
|
|
196
|
-
"globby": "^11.1.0",
|
|
197
|
-
"gopd": "^1.2.0",
|
|
198
|
-
"graceful-fs": "^4.2.11",
|
|
199
|
-
"graphemer": "^1.4.0",
|
|
200
|
-
"handlebars": "^4.7.8",
|
|
201
|
-
"has-flag": "^4.0.0",
|
|
202
|
-
"has-symbols": "^1.1.0",
|
|
203
|
-
"has-tostringtag": "^1.0.2",
|
|
204
|
-
"hasown": "^2.0.2",
|
|
205
|
-
"html-escaper": "^2.0.2",
|
|
206
|
-
"human-signals": "^2.1.0",
|
|
207
|
-
"ieee754": "^1.2.1",
|
|
208
|
-
"ignore": "^5.3.2",
|
|
209
|
-
"import-fresh": "^3.3.1",
|
|
210
|
-
"import-local": "^3.2.0",
|
|
211
|
-
"imurmurhash": "^0.1.4",
|
|
212
|
-
"inflight": "^1.0.6",
|
|
213
|
-
"inherits": "^2.0.4",
|
|
214
|
-
"is-arrayish": "^0.2.1",
|
|
215
|
-
"is-core-module": "^2.16.1",
|
|
216
|
-
"is-extglob": "^2.1.1",
|
|
217
|
-
"is-fullwidth-code-point": "^3.0.0",
|
|
218
|
-
"is-generator-fn": "^2.1.0",
|
|
219
|
-
"is-glob": "^4.0.3",
|
|
220
|
-
"is-number": "^7.0.0",
|
|
221
|
-
"is-path-inside": "^3.0.3",
|
|
222
|
-
"is-stream": "^2.0.1",
|
|
223
|
-
"isexe": "^2.0.0",
|
|
224
|
-
"istanbul-lib-coverage": "^3.2.2",
|
|
225
|
-
"istanbul-lib-instrument": "^6.0.3",
|
|
226
|
-
"istanbul-lib-report": "^3.0.1",
|
|
227
|
-
"istanbul-lib-source-maps": "^4.0.1",
|
|
228
|
-
"istanbul-reports": "^3.1.7",
|
|
229
|
-
"iterare": "^1.2.1",
|
|
230
|
-
"jackspeak": "^3.4.3",
|
|
231
|
-
"jest-changed-files": "^29.7.0",
|
|
232
|
-
"jest-circus": "^29.7.0",
|
|
233
|
-
"jest-cli": "^29.7.0",
|
|
234
|
-
"jest-config": "^29.7.0",
|
|
235
|
-
"jest-diff": "^29.7.0",
|
|
236
|
-
"jest-docblock": "^29.7.0",
|
|
237
|
-
"jest-each": "^29.7.0",
|
|
238
|
-
"jest-environment-node": "^29.7.0",
|
|
239
|
-
"jest-get-type": "^29.6.3",
|
|
240
|
-
"jest-haste-map": "^29.7.0",
|
|
241
|
-
"jest-leak-detector": "^29.7.0",
|
|
242
|
-
"jest-matcher-utils": "^29.7.0",
|
|
243
|
-
"jest-message-util": "^29.7.0",
|
|
244
|
-
"jest-mock": "^29.7.0",
|
|
245
|
-
"jest-pnp-resolver": "^1.2.3",
|
|
246
|
-
"jest-regex-util": "^29.6.3",
|
|
247
|
-
"jest-resolve": "^29.7.0",
|
|
248
|
-
"jest-resolve-dependencies": "^29.7.0",
|
|
249
|
-
"jest-runner": "^29.7.0",
|
|
250
|
-
"jest-runtime": "^29.7.0",
|
|
251
|
-
"jest-snapshot": "^29.7.0",
|
|
252
|
-
"jest-util": "^29.7.0",
|
|
253
|
-
"jest-validate": "^29.7.0",
|
|
254
|
-
"jest-watcher": "^29.7.0",
|
|
255
|
-
"jest-worker": "^29.7.0",
|
|
256
|
-
"js-tokens": "^4.0.0",
|
|
257
|
-
"js-yaml": "^4.1.0",
|
|
258
|
-
"jsesc": "^3.1.0",
|
|
259
|
-
"json-buffer": "^3.0.1",
|
|
260
|
-
"json-parse-even-better-errors": "^2.3.1",
|
|
261
|
-
"json-schema-traverse": "^0.4.1",
|
|
262
|
-
"json-stable-stringify-without-jsonify": "^1.0.1",
|
|
263
|
-
"json5": "^2.2.3",
|
|
264
|
-
"jsonwebtoken": "^9.0.2",
|
|
265
|
-
"jwa": "^1.4.2",
|
|
266
|
-
"jws": "^3.2.2",
|
|
267
|
-
"keyv": "^4.5.4",
|
|
268
|
-
"kleur": "^3.0.3",
|
|
269
|
-
"leven": "^3.1.0",
|
|
270
|
-
"levn": "^0.4.1",
|
|
271
|
-
"lines-and-columns": "^1.2.4",
|
|
272
|
-
"load-esm": "^1.0.2",
|
|
273
|
-
"locate-path": "^6.0.0",
|
|
274
|
-
"lodash": "^4.17.21",
|
|
275
|
-
"lodash.includes": "^4.3.0",
|
|
276
|
-
"lodash.isboolean": "^3.0.3",
|
|
277
|
-
"lodash.isinteger": "^4.0.4",
|
|
278
|
-
"lodash.isnumber": "^3.0.3",
|
|
279
|
-
"lodash.isplainobject": "^4.0.6",
|
|
280
|
-
"lodash.isstring": "^4.0.1",
|
|
281
|
-
"lodash.memoize": "^4.1.2",
|
|
282
|
-
"lodash.merge": "^4.6.2",
|
|
283
|
-
"lodash.once": "^4.1.1",
|
|
284
|
-
"lru-cache": "^5.1.1",
|
|
285
|
-
"make-dir": "^4.0.0",
|
|
286
|
-
"make-error": "^1.3.6",
|
|
287
|
-
"makeerror": "^1.0.12",
|
|
288
|
-
"math-intrinsics": "^1.1.0",
|
|
289
|
-
"merge-stream": "^2.0.0",
|
|
290
|
-
"merge2": "^1.4.1",
|
|
291
|
-
"methods": "^1.1.2",
|
|
292
|
-
"micromatch": "^4.0.8",
|
|
293
|
-
"mime": "^2.6.0",
|
|
294
|
-
"mime-db": "^1.52.0",
|
|
295
|
-
"mime-types": "^2.1.35",
|
|
296
|
-
"mimic-fn": "^2.1.0",
|
|
297
|
-
"minimatch": "^9.0.3",
|
|
298
|
-
"minimist": "^1.2.8",
|
|
299
|
-
"minipass": "^7.1.2",
|
|
300
|
-
"ms": "^2.1.3",
|
|
301
|
-
"natural-compare": "^1.4.0",
|
|
302
|
-
"neo-async": "^2.6.2",
|
|
303
|
-
"node-int64": "^0.4.0",
|
|
304
|
-
"node-releases": "^2.0.19",
|
|
305
|
-
"normalize-path": "^3.0.0",
|
|
306
|
-
"npm-run-path": "^4.0.1",
|
|
307
|
-
"object-inspect": "^1.13.4",
|
|
308
|
-
"once": "^1.4.0",
|
|
309
|
-
"onetime": "^5.1.2",
|
|
310
|
-
"optionator": "^0.9.4",
|
|
311
|
-
"p-limit": "^3.1.0",
|
|
312
|
-
"p-locate": "^5.0.0",
|
|
313
|
-
"p-try": "^2.2.0",
|
|
314
|
-
"package-json-from-dist": "^1.0.1",
|
|
315
|
-
"parent-module": "^1.0.1",
|
|
316
|
-
"parse-json": "^5.2.0",
|
|
317
|
-
"path-exists": "^4.0.0",
|
|
318
|
-
"path-is-absolute": "^1.0.1",
|
|
319
|
-
"path-key": "^3.1.1",
|
|
320
|
-
"path-parse": "^1.0.7",
|
|
321
|
-
"path-scurry": "^1.11.1",
|
|
322
|
-
"path-to-regexp": "^8.2.0",
|
|
323
|
-
"path-type": "^4.0.0",
|
|
324
|
-
"picocolors": "^1.1.1",
|
|
325
|
-
"picomatch": "^2.3.1",
|
|
326
|
-
"pirates": "^4.0.7",
|
|
327
|
-
"pkg-dir": "^4.2.0",
|
|
328
|
-
"prelude-ls": "^1.2.1",
|
|
329
|
-
"pretty-format": "^29.7.0",
|
|
330
|
-
"prompts": "^2.4.2",
|
|
331
|
-
"punycode": "^2.3.1",
|
|
332
|
-
"pure-rand": "^6.1.0",
|
|
333
|
-
"qs": "^6.14.0",
|
|
334
|
-
"queue-microtask": "^1.2.3",
|
|
335
|
-
"react-is": "^18.3.1",
|
|
336
|
-
"reflect-metadata": "^0.1.14",
|
|
337
|
-
"require-directory": "^2.1.1",
|
|
338
|
-
"resolve": "^1.22.10",
|
|
339
|
-
"resolve-cwd": "^3.0.0",
|
|
340
|
-
"resolve-from": "^4.0.0",
|
|
341
|
-
"resolve.exports": "^2.0.3",
|
|
342
|
-
"reusify": "^1.1.0",
|
|
343
|
-
"run-parallel": "^1.2.0",
|
|
344
|
-
"rxjs": "^7.8.2",
|
|
345
|
-
"safe-buffer": "^5.2.1",
|
|
346
|
-
"semver": "^7.7.2",
|
|
347
|
-
"shebang-command": "^2.0.0",
|
|
348
|
-
"shebang-regex": "^3.0.0",
|
|
349
|
-
"side-channel": "^1.1.0",
|
|
350
|
-
"side-channel-list": "^1.0.0",
|
|
351
|
-
"side-channel-map": "^1.0.1",
|
|
352
|
-
"side-channel-weakmap": "^1.0.2",
|
|
353
|
-
"signal-exit": "^3.0.7",
|
|
354
|
-
"sisteransi": "^1.0.5",
|
|
355
|
-
"slash": "^3.0.0",
|
|
356
|
-
"source-map": "^0.6.1",
|
|
357
|
-
"source-map-support": "^0.5.13",
|
|
358
|
-
"sprintf-js": "^1.0.3",
|
|
359
|
-
"stack-utils": "^2.0.6",
|
|
360
|
-
"string-length": "^4.0.2",
|
|
361
|
-
"string-width": "^4.2.3",
|
|
362
|
-
"string-width-cjs": "^4.2.3",
|
|
363
|
-
"strip-ansi": "^6.0.1",
|
|
364
|
-
"strip-ansi-cjs": "^6.0.1",
|
|
365
|
-
"strip-bom": "^4.0.0",
|
|
366
|
-
"strip-final-newline": "^2.0.0",
|
|
367
|
-
"strip-json-comments": "^3.1.1",
|
|
368
|
-
"strtok3": "^10.3.4",
|
|
369
|
-
"superagent": "^8.1.2",
|
|
370
|
-
"supports-color": "^7.2.0",
|
|
371
|
-
"supports-preserve-symlinks-flag": "^1.0.0",
|
|
372
|
-
"test-exclude": "^6.0.0",
|
|
373
|
-
"text-table": "^0.2.0",
|
|
374
|
-
"tmpl": "^1.0.5",
|
|
375
|
-
"to-regex-range": "^5.0.1",
|
|
376
|
-
"token-types": "^6.0.4",
|
|
377
|
-
"ts-api-utils": "^1.4.3",
|
|
378
|
-
"tslib": "^2.8.1",
|
|
379
|
-
"type-check": "^0.4.0",
|
|
380
|
-
"type-detect": "^4.0.8",
|
|
381
|
-
"type-fest": "^0.20.2",
|
|
382
|
-
"uglify-js": "^3.19.3",
|
|
383
|
-
"uid": "^2.0.2",
|
|
384
|
-
"uint8array-extras": "^1.4.0",
|
|
385
|
-
"undici-types": "^6.21.0",
|
|
386
|
-
"update-browserslist-db": "^1.1.3",
|
|
387
|
-
"uri-js": "^4.4.1",
|
|
388
|
-
"v8-compile-cache-lib": "^3.0.1",
|
|
389
|
-
"v8-to-istanbul": "^9.3.0",
|
|
390
|
-
"walker": "^1.0.8",
|
|
391
|
-
"which": "^2.0.2",
|
|
392
|
-
"word-wrap": "^1.2.5",
|
|
393
|
-
"wordwrap": "^1.0.0",
|
|
394
|
-
"wrap-ansi": "^7.0.0",
|
|
395
|
-
"wrap-ansi-cjs": "^7.0.0",
|
|
396
|
-
"wrappy": "^1.0.2",
|
|
397
|
-
"write-file-atomic": "^4.0.2",
|
|
398
|
-
"y18n": "^5.0.8",
|
|
399
|
-
"yallist": "^3.1.1",
|
|
400
|
-
"yargs": "^17.7.2",
|
|
401
|
-
"yargs-parser": "^21.1.1",
|
|
402
|
-
"yn": "^3.1.1",
|
|
403
|
-
"yocto-queue": "^0.1.0"
|
|
404
81
|
}
|
|
405
82
|
}
|