@saihu/common 1.4.1 → 1.4.3
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/auth/auth.types.d.ts +8 -11
- package/dist/auth/auth.types.d.ts.map +1 -1
- package/dist/auth/rbac.guard.d.ts.map +1 -1
- package/dist/auth/rbac.guard.js +1 -4
- package/dist/auth/rbac.interface.d.ts +1 -1
- package/dist/auth/rbac.interface.d.ts.map +1 -1
- package/dist/messaging/topology.d.ts +4 -0
- package/dist/messaging/topology.d.ts.map +1 -1
- package/dist/messaging/topology.js +4 -0
- package/package.json +1 -1
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
export interface AuthUser {
|
|
2
|
-
sub: string;
|
|
3
|
-
mobile: string;
|
|
4
|
-
name: string;
|
|
5
|
-
roles?: (string | number)[];
|
|
6
|
-
orgId?: string | number;
|
|
7
|
-
[k: string]: unknown;
|
|
8
|
-
}
|
|
9
1
|
export interface BaseAuthUser {
|
|
10
2
|
sub: string;
|
|
11
3
|
userType: 'STAFF' | 'CUSTOMER';
|
|
12
4
|
[k: string]: unknown;
|
|
13
5
|
}
|
|
14
|
-
export interface
|
|
6
|
+
export interface AuthUser extends BaseAuthUser {
|
|
15
7
|
userType: 'STAFF';
|
|
16
8
|
mobile: string;
|
|
17
9
|
name: string;
|
|
18
|
-
roles: (string | number)[];
|
|
19
10
|
orgId: string | number;
|
|
11
|
+
roles: string[];
|
|
12
|
+
perms: string[];
|
|
13
|
+
dataScope: string;
|
|
14
|
+
shopIds: number[];
|
|
15
|
+
deptId: string | null;
|
|
16
|
+
activePositionId?: string;
|
|
20
17
|
}
|
|
21
18
|
export interface CustomerAuthUser extends BaseAuthUser {
|
|
22
19
|
userType: 'CUSTOMER';
|
|
@@ -25,5 +22,5 @@ export interface CustomerAuthUser extends BaseAuthUser {
|
|
|
25
22
|
phone?: string;
|
|
26
23
|
memberLevel?: number;
|
|
27
24
|
}
|
|
28
|
-
export type AppAuthUser =
|
|
25
|
+
export type AppAuthUser = AuthUser | CustomerAuthUser;
|
|
29
26
|
//# sourceMappingURL=auth.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.types.d.ts","sourceRoot":"","sources":["../../src/auth/auth.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"auth.types.d.ts","sourceRoot":"","sources":["../../src/auth/auth.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,OAAO,GAAG,UAAU,CAAC;IAC/B,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,QAAS,SAAQ,YAAY;IAC5C,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAGvB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAGhB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAGtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,QAAQ,EAAE,UAAU,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rbac.guard.d.ts","sourceRoot":"","sources":["../../src/auth/rbac.guard.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,gBAAgB,EAGjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAwB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE7E,qBACa,SAAU,YAAW,WAAW;IAEzC,OAAO,CAAC,SAAS;IACa,OAAO,CAAC,SAAS;gBADvC,SAAS,EAAE,SAAS,EACU,SAAS,EAAE,mBAAmB;IAEhE,WAAW,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"rbac.guard.d.ts","sourceRoot":"","sources":["../../src/auth/rbac.guard.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,gBAAgB,EAGjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAwB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE7E,qBACa,SAAU,YAAW,WAAW;IAEzC,OAAO,CAAC,SAAS;IACa,OAAO,CAAC,SAAS;gBADvC,SAAS,EAAE,SAAS,EACU,SAAS,EAAE,mBAAmB;IAEhE,WAAW,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;CAiB3D"}
|
package/dist/auth/rbac.guard.js
CHANGED
|
@@ -26,10 +26,7 @@ let RbacGuard = class RbacGuard {
|
|
|
26
26
|
var _a, _b, _c, _d, _e, _f;
|
|
27
27
|
const h = ctx.getHandler(), c = ctx.getClass();
|
|
28
28
|
const reqPerms = (_a = this.reflector.getAllAndOverride(decorators_1.PERMS_KEY, [h, c])) !== null && _a !== void 0 ? _a : [];
|
|
29
|
-
const reqRoles = (_b = this.reflector.getAllAndOverride(decorators_1.ROLES_KEY, [
|
|
30
|
-
h,
|
|
31
|
-
c,
|
|
32
|
-
])) !== null && _b !== void 0 ? _b : [];
|
|
29
|
+
const reqRoles = (_b = this.reflector.getAllAndOverride(decorators_1.ROLES_KEY, [h, c])) !== null && _b !== void 0 ? _b : [];
|
|
33
30
|
if (!reqPerms.length && !reqRoles.length)
|
|
34
31
|
return true;
|
|
35
32
|
const req = ctx.switchToHttp().getRequest();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface PermissionEvaluator {
|
|
2
|
-
hasRoles?(user: any, required:
|
|
2
|
+
hasRoles?(user: any, required: string[]): Promise<boolean> | boolean;
|
|
3
3
|
hasPerms?(user: any, required: string[]): Promise<boolean> | boolean;
|
|
4
4
|
}
|
|
5
5
|
export declare const PERMISSION_EVALUATOR: unique symbol;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rbac.interface.d.ts","sourceRoot":"","sources":["../../src/auth/rbac.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"rbac.interface.d.ts","sourceRoot":"","sources":["../../src/auth/rbac.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACrE,QAAQ,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;CACtE;AACD,eAAO,MAAM,oBAAoB,eAAiC,CAAC"}
|
|
@@ -96,6 +96,8 @@ export declare const RoutingKeys: {
|
|
|
96
96
|
readonly EMPLOYEE_BANK_ACCOUNT_UPSERTED: "employee.bank.account.upserted";
|
|
97
97
|
readonly EMPLOYEE_BANK_ACCOUNT_DELETED: "employee.bank.account.deleted";
|
|
98
98
|
readonly EMPLOYEE_POSITIONS_UPSERTED: "employee.positions.upserted";
|
|
99
|
+
readonly DEPARTMENT_UPSERTED: "department.upserted";
|
|
100
|
+
readonly POSITION_UPSERTED: "position.upserted";
|
|
99
101
|
};
|
|
100
102
|
readonly "im.data.dlx": {
|
|
101
103
|
readonly APPROVAL_COMPLETED: "approval.completed.dlq";
|
|
@@ -123,6 +125,8 @@ export declare const RoutingKeys: {
|
|
|
123
125
|
readonly EMPLOYEE_BANK_ACCOUNT_UPSERTED: "employee.bank.account.upserted.dlq";
|
|
124
126
|
readonly EMPLOYEE_BANK_ACCOUNT_DELETED: "employee.bank.account.deleted.dlq";
|
|
125
127
|
readonly EMPLOYEE_POSITIONS_UPSERTED: "employee.positions.upserted.dlq";
|
|
128
|
+
readonly DEPARTMENT_UPSERTED: "department.upserted.dlq";
|
|
129
|
+
readonly POSITION_UPSERTED: "position.upserted.dlq";
|
|
126
130
|
};
|
|
127
131
|
readonly "scm.data": {
|
|
128
132
|
readonly SCM_GOOD_UPSERTED: "scm.good.upserted";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topology.d.ts","sourceRoot":"","sources":["../../src/messaging/topology.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAErE,oBAAY,SAAS;IACnB,oBAAoB,yBAAyB;IAC7C,YAAY,iBAAiB;IAC7B,cAAc,mBAAmB;IACjC,OAAO,YAAY;IACnB,iBAAiB,sBAAsB;IACvC,QAAQ,aAAa;IACrB,qBAAqB,0BAA0B;IAC/C,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,MAAM,WAAW;IAGjB,wBAAwB,6BAA6B;IACrD,gBAAgB,qBAAqB;IACrC,kBAAkB,uBAAuB;IACzC,WAAW,gBAAgB;IAC3B,qBAAqB,0BAA0B;IAC/C,YAAY,iBAAiB;IAC7B,yBAAyB,8BAA8B;IACvD,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,UAAU,eAAe;CAC1B;AAED,eAAO,MAAM,WAAW
|
|
1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CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAsBF,CAAC;AAEF,eAAO,MAAM,CAAC,GAAI,SAAS,MAAM,EAAE,IAAI,MAAM,WAAyB,CAAC"}
|
|
@@ -100,6 +100,8 @@ exports.RoutingKeys = {
|
|
|
100
100
|
EMPLOYEE_BANK_ACCOUNT_UPSERTED: 'employee.bank.account.upserted',
|
|
101
101
|
EMPLOYEE_BANK_ACCOUNT_DELETED: 'employee.bank.account.deleted',
|
|
102
102
|
EMPLOYEE_POSITIONS_UPSERTED: 'employee.positions.upserted',
|
|
103
|
+
DEPARTMENT_UPSERTED: 'department.upserted',
|
|
104
|
+
POSITION_UPSERTED: 'position.upserted',
|
|
103
105
|
},
|
|
104
106
|
[Exchanges.IM_DATA_DLX]: {
|
|
105
107
|
APPROVAL_COMPLETED: 'approval.completed.dlq',
|
|
@@ -127,6 +129,8 @@ exports.RoutingKeys = {
|
|
|
127
129
|
EMPLOYEE_BANK_ACCOUNT_UPSERTED: 'employee.bank.account.upserted.dlq',
|
|
128
130
|
EMPLOYEE_BANK_ACCOUNT_DELETED: 'employee.bank.account.deleted.dlq',
|
|
129
131
|
EMPLOYEE_POSITIONS_UPSERTED: 'employee.positions.upserted.dlq',
|
|
132
|
+
DEPARTMENT_UPSERTED: 'department.upserted.dlq',
|
|
133
|
+
POSITION_UPSERTED: 'position.upserted.dlq',
|
|
130
134
|
},
|
|
131
135
|
[Exchanges.SCM_DATA]: {
|
|
132
136
|
SCM_GOOD_UPSERTED: 'scm.good.upserted',
|