@stashfin/mysql2 1.4.659 → 1.4.661
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.
- package/index.d.ts +4 -4
- package/index.js +8 -27
- package/models/EQXCustomerModels.d.ts +24 -0
- package/models/EQXCustomerModels.js +2 -0
- package/models/EqxDeviceBindings.d.ts +22 -0
- package/models/EqxDeviceBindings.js +13 -0
- package/models/LocCustomersUpdate.d.ts +1 -1
- package/models/RewardsOffer.d.ts +33 -0
- package/models/RewardsOffer.js +2 -0
- package/models/TopupOffers.d.ts +1 -1
- package/models/WealthWebhook.d.ts +14 -0
- package/models/WealthWebhook.js +2 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -15,11 +15,11 @@ export declare class MysqlConnector {
|
|
|
15
15
|
insertData(tableName: string, data: Record<string, string | number>): Promise<ResultSetHeader>;
|
|
16
16
|
updateData(tableName: string, data: Record<string, any>, condition: string, conditionValues?: Array<string | number>): Promise<ResultSetHeader>;
|
|
17
17
|
close(): Promise<void>;
|
|
18
|
-
beginTransaction(): Promise<
|
|
18
|
+
beginTransaction(): Promise<any>;
|
|
19
19
|
commitTransaction(connection: any): Promise<void>;
|
|
20
20
|
rollbackTransaction(connection: any): Promise<void>;
|
|
21
21
|
executeInTransaction<T>(callback: (connection: any) => Promise<T>): Promise<T>;
|
|
22
|
-
executeResultInTransaction(connection: any, sql: string, values?: unknown[]): Promise<ResultSetHeader>;
|
|
23
|
-
insertDataInTransaction(connection: any, tableName: string, data: Record<string, string | number
|
|
24
|
-
updateDataInTransaction(connection: any, tableName: string, data: Record<string, any>, condition: string, conditionValues?: Array<string | number
|
|
22
|
+
executeResultInTransaction(connection: any, sql: string, values?: unknown[], timeoutMs?: number): Promise<ResultSetHeader>;
|
|
23
|
+
insertDataInTransaction(connection: any, tableName: string, data: Record<string, string | number>, timeoutMs?: number): Promise<ResultSetHeader>;
|
|
24
|
+
updateDataInTransaction(connection: any, tableName: string, data: Record<string, any>, condition: string, conditionValues?: Array<string | number>, timeoutMs?: number): Promise<ResultSetHeader>;
|
|
25
25
|
}
|
package/index.js
CHANGED
|
@@ -128,48 +128,29 @@ class MysqlConnector {
|
|
|
128
128
|
throw error;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
async executeResultInTransaction(connection, sql, values) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
reject(err);
|
|
136
|
-
else
|
|
137
|
-
resolve(results || undefined);
|
|
138
|
-
});
|
|
139
|
-
});
|
|
131
|
+
async executeResultInTransaction(connection, sql, values, timeoutMs) {
|
|
132
|
+
const options = timeoutMs ? { sql, values, timeout: timeoutMs } : sql;
|
|
133
|
+
const [result] = await connection.query(options, timeoutMs ? undefined : values);
|
|
134
|
+
return result || undefined;
|
|
140
135
|
}
|
|
141
|
-
async insertDataInTransaction(connection, tableName, data) {
|
|
136
|
+
async insertDataInTransaction(connection, tableName, data, timeoutMs) {
|
|
142
137
|
const keys = Object.keys(data);
|
|
143
138
|
const values = Object.values(data);
|
|
144
139
|
const sql = `INSERT INTO ${tableName} (${keys.join(', ')}) VALUES (${keys
|
|
145
140
|
.map(() => '?')
|
|
146
141
|
.join(', ')})`;
|
|
147
|
-
return
|
|
148
|
-
connection.query(sql, values, function (err, results, fields) {
|
|
149
|
-
if (err)
|
|
150
|
-
reject(err);
|
|
151
|
-
else
|
|
152
|
-
resolve(results || undefined);
|
|
153
|
-
});
|
|
154
|
-
});
|
|
142
|
+
return this.executeResultInTransaction(connection, sql, values, timeoutMs);
|
|
155
143
|
}
|
|
156
144
|
async updateDataInTransaction(connection, tableName,
|
|
157
145
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
158
|
-
data, condition, conditionValues) {
|
|
146
|
+
data, condition, conditionValues, timeoutMs) {
|
|
159
147
|
const keys = Object.keys(data);
|
|
160
148
|
const values = Object.values(data);
|
|
161
149
|
const sql = `UPDATE ${tableName} SET ${keys
|
|
162
150
|
.map((key) => `${key} = ?`)
|
|
163
151
|
.join(', ')} WHERE ${condition}`;
|
|
164
152
|
const finalValues = [...values, ...(conditionValues || [])];
|
|
165
|
-
return
|
|
166
|
-
connection.query(sql, finalValues, function (err, results, fields) {
|
|
167
|
-
if (err)
|
|
168
|
-
reject(err);
|
|
169
|
-
else
|
|
170
|
-
resolve(results || undefined);
|
|
171
|
-
});
|
|
172
|
-
});
|
|
153
|
+
return this.executeResultInTransaction(connection, sql, finalValues, timeoutMs);
|
|
173
154
|
}
|
|
174
155
|
}
|
|
175
156
|
exports.MysqlConnector = MysqlConnector;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { RowDataPacket } from "mysql2";
|
|
2
|
+
interface EqxCustomersTable {
|
|
3
|
+
id: number;
|
|
4
|
+
mobile: string;
|
|
5
|
+
first_name?: string;
|
|
6
|
+
last_name?: string;
|
|
7
|
+
upi_number?: string;
|
|
8
|
+
upi_onboarding_status?: boolean;
|
|
9
|
+
device_id?: string;
|
|
10
|
+
push_id?: string;
|
|
11
|
+
login_ip?: string;
|
|
12
|
+
vpa?: string;
|
|
13
|
+
referral_code?: string;
|
|
14
|
+
token?: string;
|
|
15
|
+
email?: string;
|
|
16
|
+
biometric_enabled?: boolean;
|
|
17
|
+
status?: string;
|
|
18
|
+
is_deleted?: boolean;
|
|
19
|
+
created_at?: Date;
|
|
20
|
+
updated_at?: Date;
|
|
21
|
+
}
|
|
22
|
+
export interface EqxCustomerModel extends EqxCustomersTable, RowDataPacket {
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RowDataPacket } from "mysql2";
|
|
2
|
+
export declare enum StatusEnum {
|
|
3
|
+
Pending = "pending",
|
|
4
|
+
Success = "success"
|
|
5
|
+
}
|
|
6
|
+
export declare enum YesNoEnum {
|
|
7
|
+
Y = "Y",
|
|
8
|
+
N = "N"
|
|
9
|
+
}
|
|
10
|
+
export interface DeviceBindingTable {
|
|
11
|
+
id: number;
|
|
12
|
+
customer_id: number;
|
|
13
|
+
device_id: string;
|
|
14
|
+
sim_no?: string | null;
|
|
15
|
+
sim_network?: string | null;
|
|
16
|
+
status: StatusEnum;
|
|
17
|
+
is_active: YesNoEnum;
|
|
18
|
+
created_at?: Date | null;
|
|
19
|
+
updated_at?: Date | null;
|
|
20
|
+
}
|
|
21
|
+
export interface DeviceBindingModel extends DeviceBindingTable, RowDataPacket {
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.YesNoEnum = exports.StatusEnum = void 0;
|
|
4
|
+
var StatusEnum;
|
|
5
|
+
(function (StatusEnum) {
|
|
6
|
+
StatusEnum["Pending"] = "pending";
|
|
7
|
+
StatusEnum["Success"] = "success";
|
|
8
|
+
})(StatusEnum || (exports.StatusEnum = StatusEnum = {}));
|
|
9
|
+
var YesNoEnum;
|
|
10
|
+
(function (YesNoEnum) {
|
|
11
|
+
YesNoEnum["Y"] = "Y";
|
|
12
|
+
YesNoEnum["N"] = "N";
|
|
13
|
+
})(YesNoEnum || (exports.YesNoEnum = YesNoEnum = {}));
|
|
@@ -15,7 +15,7 @@ export interface LocCustomersUpdate {
|
|
|
15
15
|
update_date?: Date;
|
|
16
16
|
admin_id?: number;
|
|
17
17
|
status?: number;
|
|
18
|
-
can_reload_card?:
|
|
18
|
+
can_reload_card?: number;
|
|
19
19
|
max_withdrawable_amount?: number;
|
|
20
20
|
minimum_request_amount?: number;
|
|
21
21
|
request_amount_increment_step?: number;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { RowDataPacket } from 'mysql2';
|
|
2
|
+
interface Offers {
|
|
3
|
+
id: number;
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
offer_code: string;
|
|
7
|
+
category_id: number;
|
|
8
|
+
total_limit: number;
|
|
9
|
+
user_daily_limit: number;
|
|
10
|
+
user_weekly_limit: number;
|
|
11
|
+
user_monthly_limit: number;
|
|
12
|
+
backup_offer_id: number | null;
|
|
13
|
+
tier: number | null;
|
|
14
|
+
reward_type_id: number;
|
|
15
|
+
reward_nature: string;
|
|
16
|
+
min_value: number;
|
|
17
|
+
max_value: number;
|
|
18
|
+
probability: JSON;
|
|
19
|
+
created_at: Date;
|
|
20
|
+
updated_at: Date;
|
|
21
|
+
}
|
|
22
|
+
interface OfferCodeUsage {
|
|
23
|
+
id: number;
|
|
24
|
+
offer_id: number;
|
|
25
|
+
user_id: number;
|
|
26
|
+
created_at: Date;
|
|
27
|
+
updated_at: Date;
|
|
28
|
+
}
|
|
29
|
+
export interface OffersModel extends Offers, RowDataPacket {
|
|
30
|
+
}
|
|
31
|
+
export interface OfferCodeUsageModel extends OfferCodeUsage, RowDataPacket {
|
|
32
|
+
}
|
|
33
|
+
export {};
|
package/models/TopupOffers.d.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RowDataPacket } from 'mysql2';
|
|
2
|
+
export interface WealthWebhookTable {
|
|
3
|
+
id?: number;
|
|
4
|
+
customer_id?: number;
|
|
5
|
+
gateway_id?: string;
|
|
6
|
+
event_type?: string;
|
|
7
|
+
event_property?: string;
|
|
8
|
+
event_status?: string;
|
|
9
|
+
webhook_data?: string;
|
|
10
|
+
created_at?: Date;
|
|
11
|
+
updated_at?: Date;
|
|
12
|
+
}
|
|
13
|
+
export interface WealthWebhookModel extends WealthWebhookTable, RowDataPacket {
|
|
14
|
+
}
|