@saihu/common 1.1.76 → 1.1.78

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.
@@ -1,12 +1,5 @@
1
- import { CanActivate, ExecutionContext } from '@nestjs/common';
2
- import { JwtService } from '@nestjs/jwt';
3
- import { Reflector } from '@nestjs/core';
4
- export declare class AuthGuard implements CanActivate {
5
- private jwtService;
6
- private readonly jwtSecret;
7
- private reflector;
8
- constructor(jwtService: JwtService, jwtSecret: string, reflector: Reflector);
9
- canActivate(context: ExecutionContext): Promise<boolean>;
10
- private extractTokenFromHeader;
1
+ declare const JwtAuthGuard_base: import("@nestjs/passport").Type<import("@nestjs/passport").IAuthGuard>;
2
+ export declare class JwtAuthGuard extends JwtAuthGuard_base {
11
3
  }
4
+ export {};
12
5
  //# sourceMappingURL=auth-guard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth-guard.d.ts","sourceRoot":"","sources":["../../src/auth/auth-guard.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,gBAAgB,EAIjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,qBACa,SAAU,YAAW,WAAW;IAEzC,OAAO,CAAC,UAAU;IACI,OAAO,CAAC,QAAQ,CAAC,SAAS;IAChD,OAAO,CAAC,SAAS;gBAFT,UAAU,EAAE,UAAU,EACS,SAAS,EAAE,MAAM,EAChD,SAAS,EAAE,SAAS;IAGxB,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IA4B9D,OAAO,CAAC,sBAAsB;CAI/B"}
1
+ {"version":3,"file":"auth-guard.d.ts","sourceRoot":"","sources":["../../src/auth/auth-guard.ts"],"names":[],"mappings":";AAGA,qBACa,YAAa,SAAQ,iBAAgB;CAAG"}
@@ -5,61 +5,13 @@ 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
- };
14
8
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.AuthGuard = void 0;
9
+ exports.JwtAuthGuard = void 0;
16
10
  const common_1 = require("@nestjs/common");
17
- const jwt_1 = require("@nestjs/jwt");
18
- const core_1 = require("@nestjs/core");
19
- const decorators_1 = require("./decorators");
20
- const dto_1 = require("../dto");
21
- let AuthGuard = class AuthGuard {
22
- constructor(jwtService, jwtSecret, reflector) {
23
- this.jwtService = jwtService;
24
- this.jwtSecret = jwtSecret;
25
- this.reflector = reflector;
26
- }
27
- async canActivate(context) {
28
- const isPublic = this.reflector.getAllAndOverride(decorators_1.IS_PUBLIC_KEY, [
29
- context.getHandler(),
30
- context.getClass(),
31
- ]);
32
- if (isPublic) {
33
- // 💡 See this condition
34
- return true;
35
- }
36
- const request = context.switchToHttp().getRequest();
37
- const token = this.extractTokenFromHeader(request);
38
- if (!token) {
39
- throw new dto_1.BaseError(dto_1.BaseResponseDto.CODE_NOT_FOUND, '令牌缺失');
40
- }
41
- try {
42
- const payload = await this.jwtService.verifyAsync(token, {
43
- secret: this.jwtSecret,
44
- });
45
- // 💡 We're assigning the payload to the request object here
46
- // so that we can access it in our route handlers
47
- request.user = payload;
48
- }
49
- catch (_a) {
50
- throw new dto_1.BaseError(dto_1.BaseResponseDto.CODE_UNAUTHORIZED, '令牌无效');
51
- }
52
- return true;
53
- }
54
- extractTokenFromHeader(request) {
55
- var _a, _b;
56
- const [type, token] = (_b = (_a = request.headers.authorization) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
57
- return type === 'Bearer' ? token : undefined;
58
- }
11
+ const passport_1 = require("@nestjs/passport");
12
+ let JwtAuthGuard = class JwtAuthGuard extends (0, passport_1.AuthGuard)('jwt') {
59
13
  };
60
- exports.AuthGuard = AuthGuard;
61
- exports.AuthGuard = AuthGuard = __decorate([
62
- (0, common_1.Injectable)(),
63
- __param(1, (0, common_1.Inject)('JWT_SECRET')),
64
- __metadata("design:paramtypes", [jwt_1.JwtService, String, core_1.Reflector])
65
- ], AuthGuard);
14
+ exports.JwtAuthGuard = JwtAuthGuard;
15
+ exports.JwtAuthGuard = JwtAuthGuard = __decorate([
16
+ (0, common_1.Injectable)()
17
+ ], JwtAuthGuard);
@@ -0,0 +1,14 @@
1
+ export interface AuthUser {
2
+ /** JWT subject – the canonical user id across services */
3
+ sub: string;
4
+ /** Optional common claims */
5
+ username?: string;
6
+ roles?: string[];
7
+ tenantId?: string;
8
+ orgId?: string;
9
+ /** Who minted the token / which side it’s for */
10
+ service?: 'im' | 'scm' | string;
11
+ /** Allow extra claims without breaking */
12
+ [k: string]: unknown;
13
+ }
14
+ //# sourceMappingURL=auth.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.types.d.ts","sourceRoot":"","sources":["../../src/auth/auth.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,0DAA0D;IAC1D,GAAG,EAAE,MAAM,CAAC;IAEZ,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,iDAAiD;IACjD,OAAO,CAAC,EAAE,IAAI,GAAG,KAAK,GAAG,MAAM,CAAC;IAEhC,0CAA0C;IAC1C,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +1,9 @@
1
+ import { AuthUser } from './auth.types';
1
2
  export declare const IS_PUBLIC_KEY = "isPublic";
2
3
  export declare const Public: () => import("@nestjs/common").CustomDecorator<string>;
3
4
  export declare const PERMS_KEY = "perms";
4
5
  export declare const Perms: (perms: string[]) => import("@nestjs/common").CustomDecorator<string>;
5
6
  export declare const ROLES_KEY = "roles";
6
7
  export declare const Roles: (roles: string[]) => import("@nestjs/common").CustomDecorator<string>;
8
+ export declare const User: (...dataOrPipes: (import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>> | keyof AuthUser | undefined)[]) => ParameterDecorator;
7
9
  //# sourceMappingURL=decorators.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../src/auth/decorators.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,aAAa,CAAC;AACxC,eAAO,MAAM,MAAM,wDAAyC,CAAC;AAG7D,eAAO,MAAM,SAAS,UAAU,CAAC;AACjC,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,EAAE,qDAAkC,CAAC;AAExE,eAAO,MAAM,SAAS,UAAU,CAAC;AACjC,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,EAAE,qDAAkC,CAAC"}
1
+ {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../src/auth/decorators.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,eAAO,MAAM,aAAa,aAAa,CAAC;AACxC,eAAO,MAAM,MAAM,wDAAyC,CAAC;AAG7D,eAAO,MAAM,SAAS,UAAU,CAAC;AACjC,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,EAAE,qDAAkC,CAAC;AAExE,eAAO,MAAM,SAAS,UAAU,CAAC;AACjC,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,EAAE,qDAAkC,CAAC;AAExE,eAAO,MAAM,IAAI,6MAShB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Roles = exports.ROLES_KEY = exports.Perms = exports.PERMS_KEY = exports.Public = exports.IS_PUBLIC_KEY = void 0;
3
+ exports.User = exports.Roles = exports.ROLES_KEY = exports.Perms = exports.PERMS_KEY = exports.Public = exports.IS_PUBLIC_KEY = void 0;
4
4
  const common_1 = require("@nestjs/common");
5
5
  exports.IS_PUBLIC_KEY = 'isPublic';
6
6
  const Public = () => (0, common_1.SetMetadata)(exports.IS_PUBLIC_KEY, true);
@@ -12,3 +12,11 @@ exports.Perms = Perms;
12
12
  exports.ROLES_KEY = 'roles';
13
13
  const Roles = (roles) => (0, common_1.SetMetadata)(exports.ROLES_KEY, roles);
14
14
  exports.Roles = Roles;
15
+ exports.User = (0, common_1.createParamDecorator)((data, ctx) => {
16
+ const req = ctx.switchToHttp().getRequest();
17
+ const user = req.user;
18
+ if (!user)
19
+ return undefined;
20
+ // Support both @User() and @User('orgId')
21
+ return data ? user[data] : user;
22
+ });
@@ -1,5 +1,4 @@
1
- export * from "./auth-guard";
2
- export * from "./custom-request";
3
- export * from "./guards/permission.guard";
4
- export { Public, Perms, Roles } from "./decorators";
1
+ export * from './auth-guard';
2
+ export * from './decorators';
3
+ export * from './auth.types';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
@@ -14,11 +14,6 @@ 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
- exports.Roles = exports.Perms = exports.Public = void 0;
18
17
  __exportStar(require("./auth-guard"), exports);
19
- __exportStar(require("./custom-request"), exports);
20
- __exportStar(require("./guards/permission.guard"), exports);
21
- var decorators_1 = require("./decorators");
22
- Object.defineProperty(exports, "Public", { enumerable: true, get: function () { return decorators_1.Public; } });
23
- Object.defineProperty(exports, "Perms", { enumerable: true, get: function () { return decorators_1.Perms; } });
24
- Object.defineProperty(exports, "Roles", { enumerable: true, get: function () { return decorators_1.Roles; } });
18
+ __exportStar(require("./decorators"), exports);
19
+ __exportStar(require("./auth.types"), exports);
@@ -4,7 +4,7 @@ export interface Operlog {
4
4
  request_method: string;
5
5
  user_agent: string;
6
6
  oper_name: string;
7
- dept_name: string;
7
+ org_id: string;
8
8
  oper_url: string;
9
9
  oper_ip: string;
10
10
  oper_param: string;
@@ -1 +1 @@
1
- {"version":3,"file":"operlog.dto.d.ts","sourceRoot":"","sources":["../../src/dto/operlog.dto.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IAEtB,KAAK,EAAE,MAAM,CAAC;IAEd,MAAM,EAAE,MAAM,CAAC;IAEf,cAAc,EAAE,MAAM,CAAC;IAEvB,UAAU,EAAE,MAAM,CAAC;IAEnB,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,MAAM,CAAC;IAElB,QAAQ,EAAE,MAAM,CAAC;IAEjB,OAAO,EAAE,MAAM,CAAC;IAEhB,UAAU,EAAE,MAAM,CAAC;IAEnB,WAAW,EAAE,MAAM,CAAC;IAEpB,MAAM,EAAE,MAAM,CAAC;IAEf,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,MAAM,CAAC;CACnB"}
1
+ {"version":3,"file":"operlog.dto.d.ts","sourceRoot":"","sources":["../../src/dto/operlog.dto.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IAEtB,KAAK,EAAE,MAAM,CAAC;IAEd,MAAM,EAAE,MAAM,CAAC;IAEf,cAAc,EAAE,MAAM,CAAC;IAEvB,UAAU,EAAE,MAAM,CAAC;IAEnB,SAAS,EAAE,MAAM,CAAC;IAElB,MAAM,EAAE,MAAM,CAAC;IAEf,QAAQ,EAAE,MAAM,CAAC;IAEjB,OAAO,EAAE,MAAM,CAAC;IAEhB,UAAU,EAAE,MAAM,CAAC;IAEnB,WAAW,EAAE,MAAM,CAAC;IAEpB,MAAM,EAAE,MAAM,CAAC;IAEf,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -66,8 +66,8 @@ let OperlogInterceptor = OperlogInterceptor_1 = class OperlogInterceptor {
66
66
  method: controllerClass + '.' + handler.name,
67
67
  request_method: method,
68
68
  user_agent: userAgent,
69
- oper_name: (user === null || user === void 0 ? void 0 : user.name) || (user === null || user === void 0 ? void 0 : user.moniker) || '',
70
- dept_name: (user === null || user === void 0 ? void 0 : user.dept_id) || '',
69
+ oper_name: (user === null || user === void 0 ? void 0 : user.username) || '',
70
+ org_id: (user === null || user === void 0 ? void 0 : user.orgId) || '',
71
71
  oper_url: url,
72
72
  oper_ip: clientIp,
73
73
  oper_param: JSON.stringify(requestParams),
@@ -7,13 +7,15 @@ export declare enum Exchanges {
7
7
  MASTER_DATA = "master.data",
8
8
  OPER_LOG_EXCHANGE = "oper_log_exchange",
9
9
  SCM_DATA = "scm.data",
10
+ SCM_PROCUREMENT_ORDER = "scm.procurement.order",
10
11
  IM_PROCUREMENT_ORDER_DLX = "im.procurement.order.dlx",
11
12
  IM_INVENTORY_DLX = "im.inventory.dlx",
12
13
  IM_SALES_ORDER_DLX = "im.sales.order.dlx",
13
14
  IM_DATA_DLX = "im.data.dlx",
14
15
  MASTER_DATA_DLX = "master.data.dlx",
15
16
  OPER_LOG_EXCHANGE_DLX = "oper_log_exchange.dlx",
16
- SCM_DATA_DLX = "scm.data.dlx"
17
+ SCM_DATA_DLX = "scm.data.dlx",
18
+ SCM_PROCUREMENT_ORDER_DLX = "scm.procurement.order.dlx"
17
19
  }
18
20
  export declare const RoutingKeys: {
19
21
  readonly "im.procurement.order": {
@@ -78,6 +80,14 @@ export declare const RoutingKeys: {
78
80
  readonly SCM_GOOD_UPSERTED: "scm.good.upserted.dlq";
79
81
  readonly SCM_GOOD_DELETED: "scm.good.deleted.dlq";
80
82
  };
83
+ readonly "scm.procurement.order": {
84
+ readonly SCM_PROCUREMENT_ORDER_RECEIVED: "scm.procurement.order.received";
85
+ readonly SCM_PROCUREMENT_ORDER_DELETED: "scm.procurement.order.deleted";
86
+ };
87
+ readonly "scm.procurement.order.dlx": {
88
+ readonly SCM_PROCUREMENT_ORDER_RECEIVED: "scm.procurement.order.received.dlq";
89
+ readonly SCM_PROCUREMENT_ORDER_DELETED: "scm.procurement.order.deleted.dlq";
90
+ };
81
91
  readonly oper_log_exchange: {
82
92
  readonly OPER_LOG_CREATED: "oper.log.created";
83
93
  };
@@ -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,WAAW,gBAAgB;IAC3B,iBAAiB,sBAAsB;IACvC,QAAQ,aAAa;IAGrB,wBAAwB,6BAA6B;IACrD,gBAAgB,qBAAqB;IACrC,kBAAkB,uBAAuB;IACzC,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;IACnC,qBAAqB,0BAA0B;IAC/C,YAAY,iBAAiB;CAC9B;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqEd,CAAC;AAEX,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,SAAS,IACpD,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzD,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,SAAS,EAAE,YAAY,CAiBzD,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,MAAM,CAClC,SAAS,EACT;IACE,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAiBF,CAAC;AAEF,eAAO,MAAM,CAAC,GAAI,SAAS,MAAM,EAAE,IAAI,MAAM,WAAyB,CAAC"}
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,WAAW,gBAAgB;IAC3B,iBAAiB,sBAAsB;IACvC,QAAQ,aAAa;IACrB,qBAAqB,0BAA0B;IAG/C,wBAAwB,6BAA6B;IACrD,gBAAgB,qBAAqB;IACrC,kBAAkB,uBAAuB;IACzC,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;IACnC,qBAAqB,0BAA0B;IAC/C,YAAY,iBAAiB;IAC7B,yBAAyB,8BAA8B;CACxD;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Ed,CAAC;AAEX,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,SAAS,IACpD,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzD,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,SAAS,EAAE,YAAY,CAmBzD,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,MAAM,CAClC,SAAS,EACT;IACE,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAmBF,CAAC;AAEF,eAAO,MAAM,CAAC,GAAI,SAAS,MAAM,EAAE,IAAI,MAAM,WAAyB,CAAC"}
@@ -10,6 +10,7 @@ var Exchanges;
10
10
  Exchanges["MASTER_DATA"] = "master.data";
11
11
  Exchanges["OPER_LOG_EXCHANGE"] = "oper_log_exchange";
12
12
  Exchanges["SCM_DATA"] = "scm.data";
13
+ Exchanges["SCM_PROCUREMENT_ORDER"] = "scm.procurement.order";
13
14
  // DLX versions
14
15
  Exchanges["IM_PROCUREMENT_ORDER_DLX"] = "im.procurement.order.dlx";
15
16
  Exchanges["IM_INVENTORY_DLX"] = "im.inventory.dlx";
@@ -18,6 +19,7 @@ var Exchanges;
18
19
  Exchanges["MASTER_DATA_DLX"] = "master.data.dlx";
19
20
  Exchanges["OPER_LOG_EXCHANGE_DLX"] = "oper_log_exchange.dlx";
20
21
  Exchanges["SCM_DATA_DLX"] = "scm.data.dlx";
22
+ Exchanges["SCM_PROCUREMENT_ORDER_DLX"] = "scm.procurement.order.dlx";
21
23
  })(Exchanges || (exports.Exchanges = Exchanges = {}));
22
24
  exports.RoutingKeys = {
23
25
  [Exchanges.IM_PROCUREMENT_ORDER]: {
@@ -82,6 +84,14 @@ exports.RoutingKeys = {
82
84
  SCM_GOOD_UPSERTED: 'scm.good.upserted.dlq',
83
85
  SCM_GOOD_DELETED: 'scm.good.deleted.dlq',
84
86
  },
87
+ [Exchanges.SCM_PROCUREMENT_ORDER]: {
88
+ SCM_PROCUREMENT_ORDER_RECEIVED: 'scm.procurement.order.received',
89
+ SCM_PROCUREMENT_ORDER_DELETED: 'scm.procurement.order.deleted',
90
+ },
91
+ [Exchanges.SCM_PROCUREMENT_ORDER_DLX]: {
92
+ SCM_PROCUREMENT_ORDER_RECEIVED: 'scm.procurement.order.received.dlq',
93
+ SCM_PROCUREMENT_ORDER_DELETED: 'scm.procurement.order.deleted.dlq',
94
+ },
85
95
  [Exchanges.OPER_LOG_EXCHANGE]: {
86
96
  OPER_LOG_CREATED: 'oper.log.created',
87
97
  },
@@ -98,6 +108,7 @@ exports.ExchangeTypes = {
98
108
  [Exchanges.OPER_LOG_EXCHANGE]: 'topic',
99
109
  [Exchanges.IM_SALES_ORDER]: 'topic',
100
110
  [Exchanges.SCM_DATA]: 'topic',
111
+ [Exchanges.SCM_PROCUREMENT_ORDER]: 'topic',
101
112
  [Exchanges.IM_PROCUREMENT_ORDER_DLX]: 'topic',
102
113
  [Exchanges.IM_INVENTORY_DLX]: 'topic',
103
114
  [Exchanges.IM_SALES_ORDER_DLX]: 'topic',
@@ -105,6 +116,7 @@ exports.ExchangeTypes = {
105
116
  [Exchanges.MASTER_DATA_DLX]: 'topic',
106
117
  [Exchanges.OPER_LOG_EXCHANGE_DLX]: 'topic',
107
118
  [Exchanges.SCM_DATA_DLX]: 'topic',
119
+ [Exchanges.SCM_PROCUREMENT_ORDER_DLX]: 'topic',
108
120
  };
109
121
  exports.ExchangeOptions = {
110
122
  [Exchanges.IM_PROCUREMENT_ORDER]: { durable: true },
@@ -114,6 +126,7 @@ exports.ExchangeOptions = {
114
126
  [Exchanges.OPER_LOG_EXCHANGE]: { durable: true, messageTtl: 86400000 },
115
127
  [Exchanges.IM_SALES_ORDER]: { durable: true },
116
128
  [Exchanges.SCM_DATA]: { durable: true },
129
+ [Exchanges.SCM_PROCUREMENT_ORDER]: { durable: true },
117
130
  [Exchanges.IM_PROCUREMENT_ORDER_DLX]: { durable: true },
118
131
  [Exchanges.IM_INVENTORY_DLX]: { durable: true },
119
132
  [Exchanges.IM_SALES_ORDER_DLX]: { durable: true },
@@ -121,6 +134,7 @@ exports.ExchangeOptions = {
121
134
  [Exchanges.MASTER_DATA_DLX]: { durable: true },
122
135
  [Exchanges.OPER_LOG_EXCHANGE_DLX]: { durable: true },
123
136
  [Exchanges.SCM_DATA_DLX]: { durable: true },
137
+ [Exchanges.SCM_PROCUREMENT_ORDER_DLX]: { durable: true },
124
138
  };
125
139
  const q = (service, rk) => `q.${rk}.${service}`; // e.g. q.procurement.order.delivered.imjobs
126
140
  exports.q = q;
@@ -1,5 +1,5 @@
1
- import { DynamicModule } from "@nestjs/common";
2
- import { CommonModuleAsyncOptions, CommonModuleOptions } from "./interfaces/options.interface";
1
+ import { DynamicModule } from '@nestjs/common';
2
+ import { CommonModuleAsyncOptions, CommonModuleOptions } from './interfaces/options.interface';
3
3
  export declare class SaihuCommonModule {
4
4
  static forRoot(options: CommonModuleOptions): DynamicModule;
5
5
  static forRootAsync(options: CommonModuleAsyncOptions): DynamicModule;
@@ -1 +1 @@
1
- {"version":3,"file":"saihu-common.module.d.ts","sourceRoot":"","sources":["../src/saihu-common.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,aAAa,EAAY,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,gCAAgC,CAAC;AAYxC,qBACa,iBAAiB;IAC5B,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,mBAAmB,GAAG,aAAa;IAmC3D,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,wBAAwB,GAAG,aAAa;IAgCrE,MAAM,CAAC,sBAAsB,IAAI,aAAa;CAa/C"}
1
+ {"version":3,"file":"saihu-common.module.d.ts","sourceRoot":"","sources":["../src/saihu-common.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,aAAa,EAAY,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,gCAAgC,CAAC;AAWxC,qBACa,iBAAiB;IAC5B,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,mBAAmB,GAAG,aAAa;IA6B3D,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,wBAAwB,GAAG,aAAa;IA0BrE,MAAM,CAAC,sBAAsB,IAAI,aAAa;CAa/C"}
@@ -14,7 +14,6 @@ const common_consts_1 = require("./consts/common.consts");
14
14
  const rabbitmq_service_1 = require("./services/rabbitmq.service");
15
15
  const core_1 = require("@nestjs/core");
16
16
  const interceptors_1 = require("./interceptors");
17
- const auth_1 = require("./auth");
18
17
  const config_1 = require("@nestjs/config");
19
18
  let SaihuCommonModule = SaihuCommonModule_1 = class SaihuCommonModule {
20
19
  static forRoot(options) {
@@ -31,7 +30,6 @@ let SaihuCommonModule = SaihuCommonModule_1 = class SaihuCommonModule {
31
30
  provide: common_consts_1.RABBITMQ_SERVICE,
32
31
  useClass: rabbitmq_service_1.RabbitmqServiceImpl,
33
32
  },
34
- auth_1.PermissionGuard,
35
33
  ];
36
34
  const useOperlog = options.useOperlog !== false;
37
35
  if (useOperlog) {
@@ -43,12 +41,7 @@ let SaihuCommonModule = SaihuCommonModule_1 = class SaihuCommonModule {
43
41
  return {
44
42
  module: SaihuCommonModule_1,
45
43
  providers,
46
- exports: [
47
- common_consts_1.COMMON_MODULE_OPTIONS,
48
- auth_1.PermissionGuard,
49
- common_consts_1.REDIS_SERVICE,
50
- common_consts_1.RABBITMQ_SERVICE,
51
- ],
44
+ exports: [common_consts_1.COMMON_MODULE_OPTIONS, common_consts_1.REDIS_SERVICE, common_consts_1.RABBITMQ_SERVICE],
52
45
  global: true,
53
46
  };
54
47
  }
@@ -67,18 +60,12 @@ let SaihuCommonModule = SaihuCommonModule_1 = class SaihuCommonModule {
67
60
  provide: common_consts_1.RABBITMQ_SERVICE,
68
61
  useClass: rabbitmq_service_1.RabbitmqServiceImpl,
69
62
  },
70
- auth_1.PermissionGuard,
71
63
  ];
72
64
  return {
73
65
  module: SaihuCommonModule_1,
74
66
  imports: [config_1.ConfigModule, ...(options.imports || [])],
75
67
  providers,
76
- exports: [
77
- common_consts_1.COMMON_MODULE_OPTIONS,
78
- auth_1.PermissionGuard,
79
- common_consts_1.REDIS_SERVICE,
80
- common_consts_1.RABBITMQ_SERVICE,
81
- ],
68
+ exports: [common_consts_1.COMMON_MODULE_OPTIONS, common_consts_1.REDIS_SERVICE, common_consts_1.RABBITMQ_SERVICE],
82
69
  global: true, // 设置为全局模块
83
70
  };
84
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saihu/common",
3
- "version": "1.1.76",
3
+ "version": "1.1.78",
4
4
  "description": "Common utilities for NestJS applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -26,6 +26,7 @@
26
26
  "@types/amqplib": "^0.10.7",
27
27
  "@types/express": "^5.0.1",
28
28
  "@types/node": "^22.14.1",
29
+ "@types/passport": "^1.0.17",
29
30
  "typescript": "^5.8.3"
30
31
  },
31
32
  "dependencies": {
@@ -34,6 +35,7 @@
34
35
  "@nestjs/core": "^11.1.1",
35
36
  "@nestjs/jwt": "^11.0.0",
36
37
  "@nestjs/microservices": "^11.1.6",
38
+ "@nestjs/passport": "^11.0.5",
37
39
  "amqp-connection-manager": "^5.0.0",
38
40
  "amqplib": "^0.10.9",
39
41
  "class-transformer": "^0.5.1",