@saihu/common 1.4.7 → 1.4.9
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/redis-permission.evaluator.d.ts +2 -3
- package/dist/auth/redis-permission.evaluator.d.ts.map +1 -1
- package/dist/auth/redis-permission.evaluator.js +4 -0
- 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,10 +1,9 @@
|
|
|
1
1
|
import { PermissionEvaluator } from './rbac.interface';
|
|
2
|
+
import { AuthUser } from './auth.types';
|
|
2
3
|
import { RedisService } from '../interfaces/service.interface';
|
|
3
4
|
export declare class RedisPermissionEvaluator implements PermissionEvaluator {
|
|
4
5
|
private readonly redis;
|
|
5
6
|
constructor(redis: RedisService);
|
|
6
|
-
hasPerms(user:
|
|
7
|
-
sub: number;
|
|
8
|
-
}, required: string[]): Promise<boolean>;
|
|
7
|
+
hasPerms(user: AuthUser, required: string[]): Promise<boolean>;
|
|
9
8
|
}
|
|
10
9
|
//# sourceMappingURL=redis-permission.evaluator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redis-permission.evaluator.d.ts","sourceRoot":"","sources":["../../src/auth/redis-permission.evaluator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"redis-permission.evaluator.d.ts","sourceRoot":"","sources":["../../src/auth/redis-permission.evaluator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,qBACa,wBAAyB,YAAW,mBAAmB;IAC/B,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,YAAY;IAEjE,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;CAYrE"}
|
|
@@ -20,8 +20,12 @@ let RedisPermissionEvaluator = class RedisPermissionEvaluator {
|
|
|
20
20
|
this.redis = redis;
|
|
21
21
|
}
|
|
22
22
|
async hasPerms(user, required) {
|
|
23
|
+
var _a;
|
|
23
24
|
if (!required.length)
|
|
24
25
|
return true;
|
|
26
|
+
// Super admin bypass — skip all permission checks
|
|
27
|
+
if ((_a = user.roles) === null || _a === void 0 ? void 0 : _a.includes('admin'))
|
|
28
|
+
return true;
|
|
25
29
|
const cached = await this.redis.get(`auth:perms:staff:${user.sub}`);
|
|
26
30
|
if (!cached)
|
|
27
31
|
return false;
|
|
@@ -30,9 +30,11 @@ export declare const RoutingKeys: {
|
|
|
30
30
|
};
|
|
31
31
|
readonly "scm.job": {
|
|
32
32
|
readonly SCM_EXPORT_REQUESTED: "scm.export.requested";
|
|
33
|
+
readonly SCM_EMAIL_REQUESTED: "scm.email.requested";
|
|
33
34
|
};
|
|
34
35
|
readonly "scm.job.dlx": {
|
|
35
36
|
readonly SCM_EXPORT_REQUESTED: "scm.export.requested.dlq";
|
|
37
|
+
readonly SCM_EMAIL_REQUESTED: "scm.email.requested.dlq";
|
|
36
38
|
};
|
|
37
39
|
readonly "im.procurement.order": {
|
|
38
40
|
readonly ORDER_CREATED: "procurement.order.created";
|
|
@@ -131,6 +133,7 @@ export declare const RoutingKeys: {
|
|
|
131
133
|
readonly "scm.data": {
|
|
132
134
|
readonly SCM_GOOD_UPSERTED: "scm.good.upserted";
|
|
133
135
|
readonly SCM_GOOD_DELETED: "scm.good.deleted";
|
|
136
|
+
readonly CLIENT_ORGANIZATION_UPSERTED: "client.organization.upserted";
|
|
134
137
|
readonly GOOD_UPSERTED: "good.upserted";
|
|
135
138
|
readonly GOOD_DELETED: "good.deleted";
|
|
136
139
|
readonly GOOD_CATEGORY_UPSERTED: "good.category.upserted";
|
|
@@ -147,6 +150,7 @@ export declare const RoutingKeys: {
|
|
|
147
150
|
readonly "scm.data.dlx": {
|
|
148
151
|
readonly SCM_GOOD_UPSERTED: "scm.good.upserted.dlq";
|
|
149
152
|
readonly SCM_GOOD_DELETED: "scm.good.deleted.dlq";
|
|
153
|
+
readonly CLIENT_ORGANIZATION_UPSERTED: "client.organization.upserted.dlq";
|
|
150
154
|
readonly GOOD_UPSERTED: "good.upserted.dlq";
|
|
151
155
|
readonly GOOD_DELETED: "good.deleted.dlq";
|
|
152
156
|
readonly GOOD_CATEGORY_UPSERTED: "good.category.upserted.dlq";
|
|
@@ -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
|
+
{"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;AA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34,11 @@ exports.RoutingKeys = {
|
|
|
34
34
|
},
|
|
35
35
|
[Exchanges.SCM_JOB]: {
|
|
36
36
|
SCM_EXPORT_REQUESTED: 'scm.export.requested',
|
|
37
|
+
SCM_EMAIL_REQUESTED: 'scm.email.requested',
|
|
37
38
|
},
|
|
38
39
|
[Exchanges.SCM_JOB_DLX]: {
|
|
39
40
|
SCM_EXPORT_REQUESTED: 'scm.export.requested.dlq',
|
|
41
|
+
SCM_EMAIL_REQUESTED: 'scm.email.requested.dlq',
|
|
40
42
|
},
|
|
41
43
|
[Exchanges.IM_PROCUREMENT_ORDER]: {
|
|
42
44
|
ORDER_CREATED: 'procurement.order.created',
|
|
@@ -135,6 +137,7 @@ exports.RoutingKeys = {
|
|
|
135
137
|
[Exchanges.SCM_DATA]: {
|
|
136
138
|
SCM_GOOD_UPSERTED: 'scm.good.upserted',
|
|
137
139
|
SCM_GOOD_DELETED: 'scm.good.deleted',
|
|
140
|
+
CLIENT_ORGANIZATION_UPSERTED: 'client.organization.upserted',
|
|
138
141
|
GOOD_UPSERTED: 'good.upserted',
|
|
139
142
|
GOOD_DELETED: 'good.deleted',
|
|
140
143
|
GOOD_CATEGORY_UPSERTED: 'good.category.upserted',
|
|
@@ -151,6 +154,7 @@ exports.RoutingKeys = {
|
|
|
151
154
|
[Exchanges.SCM_DATA_DLX]: {
|
|
152
155
|
SCM_GOOD_UPSERTED: 'scm.good.upserted.dlq',
|
|
153
156
|
SCM_GOOD_DELETED: 'scm.good.deleted.dlq',
|
|
157
|
+
CLIENT_ORGANIZATION_UPSERTED: 'client.organization.upserted.dlq',
|
|
154
158
|
GOOD_UPSERTED: 'good.upserted.dlq',
|
|
155
159
|
GOOD_DELETED: 'good.deleted.dlq',
|
|
156
160
|
GOOD_CATEGORY_UPSERTED: 'good.category.upserted.dlq',
|