@konplit-services/common 1.0.155 → 1.0.157

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.
@@ -95,12 +95,14 @@ declare class AppConfigs {
95
95
  getActivityLogDBURI(): string;
96
96
  getAccountDBURI(): string;
97
97
  getMerchantDBURI(): string;
98
+ getTransferDBURI(): string;
98
99
  getVirtualAccountDBURI(): string;
99
100
  getWalletDBURI(): string;
100
101
  getNATSURI(): string;
101
102
  getWebsiteDBURI(): string;
102
103
  getNATSPassword(): string;
103
104
  getNATSUsername(): string;
105
+ getSettlementInterval(): string;
104
106
  getNodeMAilDetails(): {
105
107
  host: string;
106
108
  port: number;
@@ -41,6 +41,12 @@ class AppConfigs {
41
41
  }
42
42
  return this.env.MONGO_URI_MERCHANT;
43
43
  }
44
+ getTransferDBURI() {
45
+ if (!this.env.MONGO_URI_TRANSFER) {
46
+ throw new Error("MONGO_URI_TRANSFER is required");
47
+ }
48
+ return this.env.MONGO_URI_TRANSFER;
49
+ }
44
50
  getVirtualAccountDBURI() {
45
51
  if (!this.env.MONGO_URI_VIRTUAL_ACCOUNT) {
46
52
  throw new Error("MONGO_URI_VIRTUAL_ACCOUNT is required");
@@ -77,6 +83,12 @@ class AppConfigs {
77
83
  }
78
84
  return this.env.NATS_USERNAME;
79
85
  }
86
+ getSettlementInterval() {
87
+ if (!this.env.SETTLEMENT_INTERVAL) {
88
+ throw new Error("SETTLEMENT_INTERVAL is required");
89
+ }
90
+ return this.env.SETTLEMENT_INTERVAL;
91
+ }
80
92
  getNodeMAilDetails() {
81
93
  if (!this.env.MAIL_HOST) {
82
94
  throw new Error("MAIL_HOST is required");
@@ -81,26 +81,33 @@ class Listener {
81
81
  });
82
82
  }
83
83
  listenForRequests() {
84
- var e_1, _a;
85
- var _b;
84
+ var _a, e_1, _b, _c;
85
+ var _d;
86
86
  return __awaiter(this, void 0, void 0, function* () {
87
- const subscription = (_b = this.nc) === null || _b === void 0 ? void 0 : _b.subscribe(this.subject);
87
+ const subscription = (_d = this.nc) === null || _d === void 0 ? void 0 : _d.subscribe(this.subject);
88
88
  try {
89
- for (var subscription_1 = __asyncValues(subscription), subscription_1_1; subscription_1_1 = yield subscription_1.next(), !subscription_1_1.done;) {
90
- const msg = subscription_1_1.value;
91
- // Decode the request data
92
- const decodedRequest = this.jc.decode(msg.data);
93
- console.log("Received Request:", decodedRequest);
94
- const response = yield this.onMessageResponse(decodedRequest, msg);
95
- console.log("Respons comming here", response);
96
- // Send a reply back
97
- msg.respond(this.jc.encode({ data: response }));
89
+ for (var _e = true, subscription_1 = __asyncValues(subscription), subscription_1_1; subscription_1_1 = yield subscription_1.next(), _a = subscription_1_1.done, !_a;) {
90
+ _c = subscription_1_1.value;
91
+ _e = false;
92
+ try {
93
+ const msg = _c;
94
+ // Decode the request data
95
+ const decodedRequest = this.jc.decode(msg.data);
96
+ console.log("Received Request:", decodedRequest);
97
+ const response = yield this.onMessageResponse(decodedRequest, msg);
98
+ console.log("Respons comming here", response);
99
+ // Send a reply back
100
+ msg.respond(this.jc.encode({ data: response }));
101
+ }
102
+ finally {
103
+ _e = true;
104
+ }
98
105
  }
99
106
  }
100
107
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
101
108
  finally {
102
109
  try {
103
- if (subscription_1_1 && !subscription_1_1.done && (_a = subscription_1.return)) yield _a.call(subscription_1);
110
+ if (!_e && !_a && (_b = subscription_1.return)) yield _b.call(subscription_1);
104
111
  }
105
112
  finally { if (e_1) throw e_1.error; }
106
113
  }
@@ -1,6 +1,6 @@
1
1
  import { Usage } from "../../../helper";
2
2
  import { StreamEvent, StreamName, Subjects } from "../../subjects";
3
- export declare type DurationTypes = "2hours" | "1day" | "now" | "2days" | "custom";
3
+ export type DurationTypes = "2hours" | "1day" | "now" | "2days" | "custom";
4
4
  export interface KeyUpdateTimerEvent {
5
5
  subject: Subjects.KeysUpdated;
6
6
  streamName: StreamName.name;
@@ -1,6 +1,6 @@
1
1
  import { PLAN_INTERVAL } from "./plan-types";
2
2
  export declare const formatDate: (dataString: string) => string;
3
3
  export declare const formatDateTime: (dataString: string) => string;
4
- declare type PlanInterval = keyof typeof PLAN_INTERVAL;
4
+ type PlanInterval = keyof typeof PLAN_INTERVAL;
5
5
  export declare const getDuration: (duration: PlanInterval) => number;
6
6
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konplit-services/common",
3
- "version": "1.0.155",
3
+ "version": "1.0.157",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",