plac-micro-common 1.2.3 → 1.2.5

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.
@@ -28,6 +28,8 @@ let RequestContextAlsInterceptor = class RequestContextAlsInterceptor {
28
28
  origin: req.headers["origin"],
29
29
  referer: req.headers["referer"],
30
30
  },
31
+ roles: req?.current_roles ?? [],
32
+ permissions: req?.current_permissions ?? [],
31
33
  };
32
34
  return (0, rxjs_1.defer)(() => request_context_store_1.RequestContext.run(initial, () => next.handle()));
33
35
  }
@@ -23,6 +23,8 @@ export interface RequestContextData {
23
23
  app?: CurrentAppInfo;
24
24
  app_client?: CurrentAppClientInfo;
25
25
  client_context?: ClientContext;
26
+ roles?: string[];
27
+ permissions?: string[];
26
28
  }
27
29
  export type CurrentUserInfo = {
28
30
  id: string;
@@ -1,5 +1,21 @@
1
+ import { HttpStatusCode } from "axios";
1
2
  export declare enum ErrorCode {
2
3
  AccessTokenExpired = "ACCESS_TOKEN_EXPIRED",
3
4
  InvalidToken = "INVALID_TOKEN",
4
5
  PermissionDenied = "PERMISSION_DENIED"
5
6
  }
7
+ export type HttpSuccessResponse<T> = {
8
+ success: true;
9
+ statusCode: HttpStatusCode;
10
+ data: T;
11
+ trace_id: string;
12
+ timestamp: string;
13
+ };
14
+ export type HttpErrorResponse = {
15
+ success: false;
16
+ statusCode: HttpStatusCode;
17
+ message: string;
18
+ trace_id?: string;
19
+ timestamp?: string;
20
+ };
21
+ export type HttpResponse<T> = HttpSuccessResponse<T> | HttpErrorResponse;
@@ -1,14 +1,25 @@
1
1
  export declare enum PermissionAction {
2
2
  Approve = "approve",
3
+ Accept = "accept",
3
4
  Create = "create",
5
+ Calculate = "calculate",
4
6
  Delete = "delete",
7
+ Deny = "deny",
5
8
  Export = "export",
9
+ Generate = "generate",
10
+ Import = "import",
11
+ Modify = "modify",
6
12
  Read = "read",
13
+ Reject = "reject",
7
14
  Update = "update"
8
15
  }
9
16
  export declare const PermissionResource: {
17
+ readonly Application: "application";
18
+ readonly Claim: "claim";
10
19
  readonly Permission: "permission";
20
+ readonly Policy: "policy";
11
21
  readonly Quotation: "quotation";
22
+ readonly Role: "role";
12
23
  readonly User: "user";
13
24
  };
14
25
  export type PermissionResource = (typeof PermissionResource)[keyof typeof PermissionResource];
@@ -4,15 +4,26 @@ exports.PermissionModule = exports.PermissionResource = exports.PermissionAction
4
4
  var PermissionAction;
5
5
  (function (PermissionAction) {
6
6
  PermissionAction["Approve"] = "approve";
7
+ PermissionAction["Accept"] = "accept";
7
8
  PermissionAction["Create"] = "create";
9
+ PermissionAction["Calculate"] = "calculate";
8
10
  PermissionAction["Delete"] = "delete";
11
+ PermissionAction["Deny"] = "deny";
9
12
  PermissionAction["Export"] = "export";
13
+ PermissionAction["Generate"] = "generate";
14
+ PermissionAction["Import"] = "import";
15
+ PermissionAction["Modify"] = "modify";
10
16
  PermissionAction["Read"] = "read";
17
+ PermissionAction["Reject"] = "reject";
11
18
  PermissionAction["Update"] = "update";
12
19
  })(PermissionAction || (exports.PermissionAction = PermissionAction = {}));
13
20
  exports.PermissionResource = {
21
+ Application: "application",
22
+ Claim: "claim",
14
23
  Permission: "permission",
24
+ Policy: "policy",
15
25
  Quotation: "quotation",
26
+ Role: "role",
16
27
  User: "user",
17
28
  };
18
29
  var PermissionModule;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plac-micro-common",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -28,8 +28,9 @@
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@nestjs/common": "^11.1.9",
31
- "@nestjs/core": "^11.1.9",
32
31
  "@nestjs/config": "^4.0.2",
32
+ "@nestjs/core": "^11.1.9",
33
+ "axios": "^1.13.2",
33
34
  "express": "^5.2.1",
34
35
  "ioredis": "^5.9.1",
35
36
  "jsonwebtoken": "^9.0.3",