plac-micro-common 1.0.16 → 1.0.18

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.
@@ -40,7 +40,7 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, p
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  exports.AllExceptionsFilter = void 0;
42
42
  const common_1 = require("@nestjs/common");
43
- const utils_1 = require("../utils");
43
+ const utils_1 = require("../../utils");
44
44
  let AllExceptionsFilter = (() => {
45
45
  let _classDecorators = [(0, common_1.Catch)()];
46
46
  let _classDescriptor;
@@ -0,0 +1,2 @@
1
+ export * from "./exceptions.filter";
2
+ export * from "./response.interceptor";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./exceptions.filter"), exports);
18
+ __exportStar(require("./response.interceptor"), exports);
@@ -41,7 +41,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
41
41
  exports.ResponseTransformInterceptor = void 0;
42
42
  const common_1 = require("@nestjs/common");
43
43
  const operators_1 = require("rxjs/operators");
44
- const utils_1 = require("../utils");
44
+ const utils_1 = require("../../utils");
45
45
  let ResponseTransformInterceptor = (() => {
46
46
  let _classDecorators = [(0, common_1.Injectable)()];
47
47
  let _classDescriptor;
@@ -0,0 +1 @@
1
+ export declare const ClientCtx: (...dataOrPipes: unknown[]) => ParameterDecorator;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientCtx = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ exports.ClientCtx = (0, common_1.createParamDecorator)((_data, ctx) => {
6
+ const req = ctx.switchToHttp().getRequest();
7
+ const x_forwarded_for = req.headers["x-forwarded-for"];
8
+ const ip_address = (Array.isArray(x_forwarded_for)
9
+ ? x_forwarded_for[0]
10
+ : x_forwarded_for?.split(",")[0]) ||
11
+ req.socket?.remoteAddress ||
12
+ req.ip;
13
+ return {
14
+ ip_address,
15
+ user_agent: req.headers["user-agent"],
16
+ request_id: req.headers["x-request-id"],
17
+ origin: req.headers["origin"],
18
+ referer: req.headers["referer"],
19
+ };
20
+ });
@@ -0,0 +1 @@
1
+ export declare const CurrentApp: (...dataOrPipes: unknown[]) => ParameterDecorator;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CurrentApp = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ exports.CurrentApp = (0, common_1.createParamDecorator)((_data, ctx) => {
6
+ const req = ctx.switchToHttp().getRequest();
7
+ return req.current_app;
8
+ });
@@ -0,0 +1 @@
1
+ export declare const CurrentClient: (...dataOrPipes: unknown[]) => ParameterDecorator;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CurrentClient = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ exports.CurrentClient = (0, common_1.createParamDecorator)((_data, ctx) => {
6
+ const req = ctx.switchToHttp().getRequest();
7
+ return req.current_client;
8
+ });
@@ -0,0 +1,3 @@
1
+ export * from "./client_ctx.decorator";
2
+ export * from "./current_app.decorator";
3
+ export * from "./current_client.decorator";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client_ctx.decorator"), exports);
18
+ __exportStar(require("./current_app.decorator"), exports);
19
+ __exportStar(require("./current_client.decorator"), exports);
@@ -1,2 +1,3 @@
1
- export * from "./exceptions.filter";
2
- export * from "./response.interceptor";
1
+ export * from "./common";
2
+ export * from "./decorators";
3
+ export * from "./types";
@@ -14,5 +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
- __exportStar(require("./exceptions.filter"), exports);
18
- __exportStar(require("./response.interceptor"), exports);
17
+ __exportStar(require("./common"), exports);
18
+ __exportStar(require("./decorators"), exports);
19
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,16 @@
1
+ export interface ClientContext {
2
+ ip_address?: string;
3
+ user_agent?: string;
4
+ request_id?: string;
5
+ origin?: string;
6
+ referer?: string;
7
+ }
8
+ export interface CurrentAppInfo {
9
+ app_id?: string;
10
+ app_code?: string;
11
+ }
12
+ export interface CurrentClientInfo {
13
+ app_client_id?: string;
14
+ client_id?: string;
15
+ partner_id?: string | null;
16
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plac-micro-common",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {