law-common 2.6.0 → 2.6.1-beta.0

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.
@@ -13,3 +13,6 @@ export declare enum BillingActionsEnum {
13
13
  WRITE_OFF = "writeOff",
14
14
  TDS = "tds"
15
15
  }
16
+ export declare namespace BillingActionsEnum {
17
+ function getLabel(action: BillingActionsEnum): string;
18
+ }
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BillingActionsEnum = void 0;
4
+ const error_key_enum_1 = require("../../enums/error.key.enum");
5
+ const exceptions_1 = require("../../exceptions");
4
6
  var BillingActionsEnum;
5
7
  (function (BillingActionsEnum) {
6
8
  BillingActionsEnum["APPROVE"] = "approve";
@@ -17,3 +19,37 @@ var BillingActionsEnum;
17
19
  BillingActionsEnum["WRITE_OFF"] = "writeOff";
18
20
  BillingActionsEnum["TDS"] = "tds";
19
21
  })(BillingActionsEnum || (exports.BillingActionsEnum = BillingActionsEnum = {}));
22
+ (function (BillingActionsEnum) {
23
+ const actionLabelMap = {
24
+ [BillingActionsEnum.APPROVE]: "Approve",
25
+ [BillingActionsEnum.REJECT]: "Reject",
26
+ [BillingActionsEnum.EDIT]: "Edit",
27
+ [BillingActionsEnum.REQUEST_FOR_CHANGES]: "Request for Changes",
28
+ [BillingActionsEnum.SENT_FOR_APPROVAL]: "Sent for Approval",
29
+ [BillingActionsEnum.SEND_FOR_CLIENT_REVIEW]: "Send for Client Review",
30
+ [BillingActionsEnum.CLIENT_REVISION]: "Client Revision",
31
+ [BillingActionsEnum.SEND_INVOICE]: "Send Invoice",
32
+ [BillingActionsEnum.APPROVAL]: "Approval",
33
+ [BillingActionsEnum.UPDATE_PAYMENT]: "Update Payment",
34
+ [BillingActionsEnum.CREDIT_NOTE]: "Credit Note",
35
+ [BillingActionsEnum.WRITE_OFF]: "Write Off",
36
+ [BillingActionsEnum.TDS]: "TDS",
37
+ };
38
+ function getLabel(action) {
39
+ if (!Object.values(BillingActionsEnum).includes(action)) {
40
+ throw new exceptions_1.AppBadRequestException({
41
+ key: error_key_enum_1.ErrorKeyEnum.BILLING_FLOW_ACTION,
42
+ message: ["Invalid action value"],
43
+ });
44
+ }
45
+ const label = actionLabelMap[action];
46
+ if (!label) {
47
+ throw new exceptions_1.AppBadRequestException({
48
+ key: error_key_enum_1.ErrorKeyEnum.BILLING_FLOW_ACTION,
49
+ message: ["Invalid action value"],
50
+ });
51
+ }
52
+ return label;
53
+ }
54
+ BillingActionsEnum.getLabel = getLabel;
55
+ })(BillingActionsEnum || (exports.BillingActionsEnum = BillingActionsEnum = {}));
@@ -1,5 +1,6 @@
1
1
  export declare enum ErrorKeyEnum {
2
2
  TIME_UNIT = "TIME_UNIT",
3
3
  CURRENCY = "CURRENCY",
4
- TIMESHEET_FLOW_ACTION = "TIMESHEET_FLOW_ACTION"
4
+ TIMESHEET_FLOW_ACTION = "TIMESHEET_FLOW_ACTION",
5
+ BILLING_FLOW_ACTION = "BILLING_FLOW_ACTION"
5
6
  }
@@ -6,4 +6,5 @@ var ErrorKeyEnum;
6
6
  ErrorKeyEnum["TIME_UNIT"] = "TIME_UNIT";
7
7
  ErrorKeyEnum["CURRENCY"] = "CURRENCY";
8
8
  ErrorKeyEnum["TIMESHEET_FLOW_ACTION"] = "TIMESHEET_FLOW_ACTION";
9
+ ErrorKeyEnum["BILLING_FLOW_ACTION"] = "BILLING_FLOW_ACTION";
9
10
  })(ErrorKeyEnum || (exports.ErrorKeyEnum = ErrorKeyEnum = {}));
package/package.json CHANGED
@@ -1,35 +1,35 @@
1
- {
2
- "name": "law-common",
3
- "version": "2.6.0",
4
- "description": "",
5
- "main": "dist/index.js",
6
- "files": [
7
- "dist/**/*"
8
- ],
9
- "scripts": {
10
- "clean": "rm -rf dist",
11
- "build": "npm run clean && tsc",
12
- "publish:beta": "npm version prerelease --preid beta && git push && npm run build && npm publish --tag beta",
13
- "publish:patch": "npm version patch && git push && npm run build && npm publish",
14
- "publish:minor": "npm version minor && git push && npm run build && npm publish",
15
- "publish:major": "npm version major && git push && npm run build && npm publish",
16
- "link": "npm run build && npm link",
17
- "test": "jest"
18
- },
19
- "keywords": [],
20
- "author": "",
21
- "license": "ISC",
22
- "devDependencies": {
23
- "@types/jest": "^29.5.13",
24
- "@types/node": "^22.6.1",
25
- "jest": "^29.7.0",
26
- "ts-jest": "^29.2.5",
27
- "ts-node": "^10.9.2",
28
- "typescript": "^5.6.2"
29
- },
30
- "dependencies": {
31
- "@types/express": "^5.0.0",
32
- "@types/multer": "^1.4.12",
33
- "date-fns": "^4.1.0"
34
- }
35
- }
1
+ {
2
+ "name": "law-common",
3
+ "version": "2.6.1-beta.0",
4
+ "description": "",
5
+ "main": "dist/index.js",
6
+ "files": [
7
+ "dist/**/*"
8
+ ],
9
+ "scripts": {
10
+ "clean": "rm -rf dist",
11
+ "build": "npm run clean && tsc",
12
+ "publish:beta": "npm version prerelease --preid beta && git push && npm run build && npm publish --tag beta",
13
+ "publish:patch": "npm version patch && git push && npm run build && npm publish",
14
+ "publish:minor": "npm version minor && git push && npm run build && npm publish",
15
+ "publish:major": "npm version major && git push && npm run build && npm publish",
16
+ "link": "npm run build && npm link",
17
+ "test": "jest"
18
+ },
19
+ "keywords": [],
20
+ "author": "",
21
+ "license": "ISC",
22
+ "devDependencies": {
23
+ "@types/jest": "^29.5.13",
24
+ "@types/node": "^22.6.1",
25
+ "jest": "^29.7.0",
26
+ "ts-jest": "^29.2.5",
27
+ "ts-node": "^10.9.2",
28
+ "typescript": "^5.6.2"
29
+ },
30
+ "dependencies": {
31
+ "@types/express": "^5.0.0",
32
+ "@types/multer": "^1.4.12",
33
+ "date-fns": "^4.1.0"
34
+ }
35
+ }