@stashfin/mysql2 1.3.0 → 1.3.1
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 copy.d.ts +17 -0
- package/index copy.js +73 -0
- package/index.d.ts +3 -3
- package/index.js +48 -24
- package/indexPromise.d.ts +17 -0
- package/indexPromise.js +73 -0
- package/models/Banners.d.ts +21 -0
- package/models/Banners.js +2 -0
- package/models/Customer.d.ts +87 -54
- package/models/DashboardBlock.d.ts +30 -0
- package/models/DashboardBlock.js +2 -0
- package/models/JourneySteps.d.ts +2 -1
- package/models/Loans.d.ts +43 -0
- package/models/Loans.js +2 -0
- package/models/Offer.d.ts +51 -0
- package/models/Offer.js +2 -0
- package/models/StashCash.d.ts +22 -15
- package/models/UserAuthToken.d.ts +1 -1
- package/models/UserDetails.d.ts +1 -1
- package/package.json +5 -1
package/index copy.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import mysql, { RowDataPacket, PoolOptions, ResultSetHeader } from 'mysql2/promise';
|
|
2
|
+
export interface MysqlConnectorOptions extends PoolOptions {
|
|
3
|
+
}
|
|
4
|
+
export declare class MysqlConnector {
|
|
5
|
+
private pool;
|
|
6
|
+
private credentials;
|
|
7
|
+
constructor(credentials: PoolOptions);
|
|
8
|
+
/** A random method to simulate a step before to get the class methods */
|
|
9
|
+
getConnection(): Promise<mysql.PoolConnection>;
|
|
10
|
+
queryRow<T extends RowDataPacket>(sql: string, values?: Array<string | number>): Promise<T | undefined>;
|
|
11
|
+
queryRows<T extends RowDataPacket>(sql: string, values?: Array<string | number>): Promise<T[]>;
|
|
12
|
+
queryArray<T extends RowDataPacket>(sql: string, values?: Array<string | number>): Promise<T[]>;
|
|
13
|
+
executeResult(sql: string, values?: unknown[]): Promise<ResultSetHeader>;
|
|
14
|
+
insertData(tableName: string, data: Record<string, string | number>): Promise<ResultSetHeader>;
|
|
15
|
+
updateData(tableName: string, data: Record<string, any>, condition: string, conditionValues?: Array<string | number>): Promise<ResultSetHeader>;
|
|
16
|
+
close(): Promise<void>;
|
|
17
|
+
}
|
package/index copy.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MysqlConnector = void 0;
|
|
7
|
+
const promise_1 = __importDefault(require("mysql2/promise"));
|
|
8
|
+
//define class
|
|
9
|
+
class MysqlConnector {
|
|
10
|
+
pool;
|
|
11
|
+
credentials;
|
|
12
|
+
constructor(credentials) {
|
|
13
|
+
this.credentials = credentials;
|
|
14
|
+
this.pool = promise_1.default.createPool(this.credentials);
|
|
15
|
+
}
|
|
16
|
+
/** A random method to simulate a step before to get the class methods */
|
|
17
|
+
getConnection() {
|
|
18
|
+
if (!this?.pool)
|
|
19
|
+
this.pool = promise_1.default.createPool(this.credentials);
|
|
20
|
+
return this.pool.getConnection();
|
|
21
|
+
}
|
|
22
|
+
async queryRow(sql, values) {
|
|
23
|
+
const connection = await this.getConnection();
|
|
24
|
+
const [rows] = await connection.query(sql, values);
|
|
25
|
+
await connection.release();
|
|
26
|
+
return rows[0] || undefined;
|
|
27
|
+
}
|
|
28
|
+
async queryRows(sql, values) {
|
|
29
|
+
const connection = await this.getConnection();
|
|
30
|
+
const [rows] = await connection.query(sql, values);
|
|
31
|
+
await connection.release();
|
|
32
|
+
return rows;
|
|
33
|
+
}
|
|
34
|
+
async queryArray(sql, values) {
|
|
35
|
+
const connection = await this.getConnection();
|
|
36
|
+
const [rows] = await connection.query({
|
|
37
|
+
sql,
|
|
38
|
+
values,
|
|
39
|
+
rowsAsArray: true,
|
|
40
|
+
});
|
|
41
|
+
await connection.release();
|
|
42
|
+
return rows;
|
|
43
|
+
}
|
|
44
|
+
async executeResult(sql, values) {
|
|
45
|
+
const connection = await this.pool.getConnection();
|
|
46
|
+
const [rows] = await connection.query(sql, values);
|
|
47
|
+
await connection.release();
|
|
48
|
+
return rows;
|
|
49
|
+
}
|
|
50
|
+
async insertData(tableName, data) {
|
|
51
|
+
const keys = Object.keys(data);
|
|
52
|
+
const values = Object.values(data);
|
|
53
|
+
const sql = `INSERT INTO ${tableName} (${keys.join(', ')}) VALUES (${keys
|
|
54
|
+
.map(() => '?')
|
|
55
|
+
.join(', ')})`;
|
|
56
|
+
return this.executeResult(sql, values);
|
|
57
|
+
}
|
|
58
|
+
async updateData(tableName,
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
60
|
+
data, condition, conditionValues) {
|
|
61
|
+
const keys = Object.keys(data);
|
|
62
|
+
const values = Object.values(data);
|
|
63
|
+
const sql = `UPDATE ${tableName} SET ${keys
|
|
64
|
+
.map((key) => `${key} = ?`)
|
|
65
|
+
.join(', ')} WHERE ${condition}`;
|
|
66
|
+
const finalValues = [...values, ...(conditionValues || [])];
|
|
67
|
+
return this.executeResult(sql, finalValues);
|
|
68
|
+
}
|
|
69
|
+
async close() {
|
|
70
|
+
await this.pool.end();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.MysqlConnector = MysqlConnector;
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import mysql, { RowDataPacket, PoolOptions, ResultSetHeader } from 'mysql2
|
|
1
|
+
import mysql, { RowDataPacket, PoolOptions, ResultSetHeader } from 'mysql2';
|
|
2
2
|
export interface MysqlConnectorOptions extends PoolOptions {
|
|
3
3
|
}
|
|
4
4
|
export declare class MysqlConnector {
|
|
@@ -6,12 +6,12 @@ export declare class MysqlConnector {
|
|
|
6
6
|
private credentials;
|
|
7
7
|
constructor(credentials: PoolOptions);
|
|
8
8
|
/** A random method to simulate a step before to get the class methods */
|
|
9
|
-
getConnection():
|
|
9
|
+
getConnection(): mysql.Pool;
|
|
10
10
|
queryRow<T extends RowDataPacket>(sql: string, values?: Array<string | number>): Promise<T | undefined>;
|
|
11
11
|
queryRows<T extends RowDataPacket>(sql: string, values?: Array<string | number>): Promise<T[]>;
|
|
12
12
|
queryArray<T extends RowDataPacket>(sql: string, values?: Array<string | number>): Promise<T[]>;
|
|
13
13
|
executeResult(sql: string, values?: unknown[]): Promise<ResultSetHeader>;
|
|
14
14
|
insertData(tableName: string, data: Record<string, string | number>): Promise<ResultSetHeader>;
|
|
15
|
-
updateData(tableName: string, data: Record<string,
|
|
15
|
+
updateData(tableName: string, data: Record<string, any>, condition: string, conditionValues?: Array<string | number>): Promise<ResultSetHeader>;
|
|
16
16
|
close(): Promise<void>;
|
|
17
17
|
}
|
package/index.js
CHANGED
|
@@ -4,47 +4,68 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.MysqlConnector = void 0;
|
|
7
|
-
const
|
|
7
|
+
const mysql2_1 = __importDefault(require("mysql2"));
|
|
8
8
|
//define class
|
|
9
9
|
class MysqlConnector {
|
|
10
10
|
pool;
|
|
11
11
|
credentials;
|
|
12
12
|
constructor(credentials) {
|
|
13
13
|
this.credentials = credentials;
|
|
14
|
-
this.pool =
|
|
14
|
+
this.pool = mysql2_1.default.createPool(this.credentials);
|
|
15
15
|
}
|
|
16
16
|
/** A random method to simulate a step before to get the class methods */
|
|
17
17
|
getConnection() {
|
|
18
18
|
if (!this?.pool)
|
|
19
|
-
this.pool =
|
|
20
|
-
return this.pool
|
|
19
|
+
this.pool = mysql2_1.default.createPool(this.credentials);
|
|
20
|
+
return this.pool;
|
|
21
21
|
}
|
|
22
22
|
async queryRow(sql, values) {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const pool = this.getConnection();
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
pool.query(sql, values, function (err, results, fields) {
|
|
26
|
+
if (err)
|
|
27
|
+
reject(err);
|
|
28
|
+
// Connection is automatically released when query resolves
|
|
29
|
+
else
|
|
30
|
+
resolve(results[0] || undefined);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
26
33
|
}
|
|
27
34
|
async queryRows(sql, values) {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
const pool = this.getConnection();
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
pool.query(sql, values, function (err, results, fields) {
|
|
38
|
+
// Connection is automatically released when query resolves
|
|
39
|
+
if (err)
|
|
40
|
+
reject(err);
|
|
41
|
+
else
|
|
42
|
+
resolve(results);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
32
45
|
}
|
|
33
46
|
async queryArray(sql, values) {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
sql,
|
|
37
|
-
|
|
38
|
-
|
|
47
|
+
const pool = this.getConnection();
|
|
48
|
+
return new Promise((resolve, reject) => {
|
|
49
|
+
pool.query({ sql, values, rowsAsArray: true }, function (err, results, fields) {
|
|
50
|
+
// Connection is automatically released when query resolves
|
|
51
|
+
if (err)
|
|
52
|
+
reject(err);
|
|
53
|
+
else
|
|
54
|
+
resolve(results);
|
|
55
|
+
});
|
|
39
56
|
});
|
|
40
|
-
await connection.release();
|
|
41
|
-
return rows;
|
|
42
57
|
}
|
|
43
58
|
async executeResult(sql, values) {
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
59
|
+
const pool = this.getConnection();
|
|
60
|
+
return new Promise((resolve, reject) => {
|
|
61
|
+
pool.query(sql, values, function (err, results, fields) {
|
|
62
|
+
// Connection is automatically released when query resolves
|
|
63
|
+
if (err)
|
|
64
|
+
reject(err);
|
|
65
|
+
else
|
|
66
|
+
resolve(results || undefined);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
48
69
|
}
|
|
49
70
|
async insertData(tableName, data) {
|
|
50
71
|
const keys = Object.keys(data);
|
|
@@ -54,13 +75,16 @@ class MysqlConnector {
|
|
|
54
75
|
.join(', ')})`;
|
|
55
76
|
return this.executeResult(sql, values);
|
|
56
77
|
}
|
|
57
|
-
async updateData(tableName,
|
|
78
|
+
async updateData(tableName,
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
80
|
+
data, condition, conditionValues) {
|
|
58
81
|
const keys = Object.keys(data);
|
|
59
82
|
const values = Object.values(data);
|
|
60
83
|
const sql = `UPDATE ${tableName} SET ${keys
|
|
61
84
|
.map((key) => `${key} = ?`)
|
|
62
85
|
.join(', ')} WHERE ${condition}`;
|
|
63
|
-
|
|
86
|
+
const finalValues = [...values, ...(conditionValues || [])];
|
|
87
|
+
return this.executeResult(sql, finalValues);
|
|
64
88
|
}
|
|
65
89
|
async close() {
|
|
66
90
|
await this.pool.end();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import mysql, { RowDataPacket, PoolOptions, ResultSetHeader } from 'mysql2/promise';
|
|
2
|
+
export interface MysqlConnectorOptions extends PoolOptions {
|
|
3
|
+
}
|
|
4
|
+
export declare class MysqlConnector {
|
|
5
|
+
private pool;
|
|
6
|
+
private credentials;
|
|
7
|
+
constructor(credentials: PoolOptions);
|
|
8
|
+
/** A random method to simulate a step before to get the class methods */
|
|
9
|
+
getConnection(): Promise<mysql.PoolConnection>;
|
|
10
|
+
queryRow<T extends RowDataPacket>(sql: string, values?: Array<string | number>): Promise<T | undefined>;
|
|
11
|
+
queryRows<T extends RowDataPacket>(sql: string, values?: Array<string | number>): Promise<T[]>;
|
|
12
|
+
queryArray<T extends RowDataPacket>(sql: string, values?: Array<string | number>): Promise<T[]>;
|
|
13
|
+
executeResult(sql: string, values?: unknown[]): Promise<ResultSetHeader>;
|
|
14
|
+
insertData(tableName: string, data: Record<string, string | number>): Promise<ResultSetHeader>;
|
|
15
|
+
updateData(tableName: string, data: Record<string, any>, condition: string, conditionValues?: Array<string | number>): Promise<ResultSetHeader>;
|
|
16
|
+
close(): Promise<void>;
|
|
17
|
+
}
|
package/indexPromise.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MysqlConnector = void 0;
|
|
7
|
+
const promise_1 = __importDefault(require("mysql2/promise"));
|
|
8
|
+
//define class
|
|
9
|
+
class MysqlConnector {
|
|
10
|
+
pool;
|
|
11
|
+
credentials;
|
|
12
|
+
constructor(credentials) {
|
|
13
|
+
this.credentials = credentials;
|
|
14
|
+
this.pool = promise_1.default.createPool(this.credentials);
|
|
15
|
+
}
|
|
16
|
+
/** A random method to simulate a step before to get the class methods */
|
|
17
|
+
getConnection() {
|
|
18
|
+
if (!this?.pool)
|
|
19
|
+
this.pool = promise_1.default.createPool(this.credentials);
|
|
20
|
+
return this.pool.getConnection();
|
|
21
|
+
}
|
|
22
|
+
async queryRow(sql, values) {
|
|
23
|
+
const connection = await this.getConnection();
|
|
24
|
+
const [rows] = await connection.query(sql, values);
|
|
25
|
+
await connection.release();
|
|
26
|
+
return rows[0] || undefined;
|
|
27
|
+
}
|
|
28
|
+
async queryRows(sql, values) {
|
|
29
|
+
const connection = await this.getConnection();
|
|
30
|
+
const [rows] = await connection.query(sql, values);
|
|
31
|
+
await connection.release();
|
|
32
|
+
return rows;
|
|
33
|
+
}
|
|
34
|
+
async queryArray(sql, values) {
|
|
35
|
+
const connection = await this.getConnection();
|
|
36
|
+
const [rows] = await connection.query({
|
|
37
|
+
sql,
|
|
38
|
+
values,
|
|
39
|
+
rowsAsArray: true,
|
|
40
|
+
});
|
|
41
|
+
await connection.release();
|
|
42
|
+
return rows;
|
|
43
|
+
}
|
|
44
|
+
async executeResult(sql, values) {
|
|
45
|
+
const connection = await this.pool.getConnection();
|
|
46
|
+
const [rows] = await connection.query(sql, values);
|
|
47
|
+
await connection.release();
|
|
48
|
+
return rows;
|
|
49
|
+
}
|
|
50
|
+
async insertData(tableName, data) {
|
|
51
|
+
const keys = Object.keys(data);
|
|
52
|
+
const values = Object.values(data);
|
|
53
|
+
const sql = `INSERT INTO ${tableName} (${keys.join(', ')}) VALUES (${keys
|
|
54
|
+
.map(() => '?')
|
|
55
|
+
.join(', ')})`;
|
|
56
|
+
return this.executeResult(sql, values);
|
|
57
|
+
}
|
|
58
|
+
async updateData(tableName,
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
60
|
+
data, condition, conditionValues) {
|
|
61
|
+
const keys = Object.keys(data);
|
|
62
|
+
const values = Object.values(data);
|
|
63
|
+
const sql = `UPDATE ${tableName} SET ${keys
|
|
64
|
+
.map((key) => `${key} = ?`)
|
|
65
|
+
.join(', ')} WHERE ${condition}`;
|
|
66
|
+
const finalValues = [...values, ...(conditionValues || [])];
|
|
67
|
+
return this.executeResult(sql, finalValues);
|
|
68
|
+
}
|
|
69
|
+
async close() {
|
|
70
|
+
await this.pool.end();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.MysqlConnector = MysqlConnector;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RowDataPacket } from 'mysql2';
|
|
2
|
+
export type JSONPrimitive = string | number | boolean | null;
|
|
3
|
+
export type JSONValue = JSONObject | JSONArray;
|
|
4
|
+
export type JSONObject = {
|
|
5
|
+
[member: string]: JSONPrimitive;
|
|
6
|
+
};
|
|
7
|
+
export type JSONArray = Array<JSONValue>;
|
|
8
|
+
export interface BannerTable {
|
|
9
|
+
id: number;
|
|
10
|
+
name: string;
|
|
11
|
+
image_url: string;
|
|
12
|
+
web_url?: string | null;
|
|
13
|
+
landing_page?: string | null;
|
|
14
|
+
api_mode?: string | null;
|
|
15
|
+
app_version: number;
|
|
16
|
+
status: string;
|
|
17
|
+
created_at: Date;
|
|
18
|
+
updated_at: Date;
|
|
19
|
+
}
|
|
20
|
+
export interface BannerModel extends BannerTable, RowDataPacket {
|
|
21
|
+
}
|
package/models/Customer.d.ts
CHANGED
|
@@ -1,65 +1,98 @@
|
|
|
1
1
|
import { RowDataPacket } from 'mysql2';
|
|
2
|
+
export type JSONPrimitive = string | number | boolean | null;
|
|
3
|
+
export type JSONValue = JSONObject | JSONArray;
|
|
4
|
+
export type JSONObject = {
|
|
5
|
+
[member: string]: JSONPrimitive;
|
|
6
|
+
};
|
|
7
|
+
export type JSONArray = Array<JSONValue>;
|
|
2
8
|
export interface CustomerTable {
|
|
3
|
-
id
|
|
9
|
+
id: number;
|
|
4
10
|
mobile: string;
|
|
5
|
-
email?: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
dob?:
|
|
12
|
-
|
|
13
|
-
pincode?: string;
|
|
14
|
-
mpin?: string;
|
|
15
|
-
pan?: string;
|
|
16
|
-
aadhaar?: string;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
ip?: string;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
11
|
+
email?: string | null;
|
|
12
|
+
first_name?: string | null;
|
|
13
|
+
middle_name?: string | null;
|
|
14
|
+
last_name?: string | null;
|
|
15
|
+
father_name?: string | null;
|
|
16
|
+
mother_maiden_name?: string | null;
|
|
17
|
+
dob?: Date | null;
|
|
18
|
+
company_name?: string | null;
|
|
19
|
+
pincode?: string | null;
|
|
20
|
+
mpin?: string | null;
|
|
21
|
+
pan?: string | null;
|
|
22
|
+
aadhaar?: string | null;
|
|
23
|
+
mobile_verified?: number | null;
|
|
24
|
+
email_verified?: number | null;
|
|
25
|
+
ip?: string | null;
|
|
26
|
+
device_id?: string | null;
|
|
27
|
+
is_registered?: number | null;
|
|
28
|
+
mobile_hash?: string | null;
|
|
29
|
+
email_hash?: string | null;
|
|
30
|
+
os_version?: string | null;
|
|
31
|
+
push_id?: string | null;
|
|
32
|
+
auth_token?: string | null;
|
|
33
|
+
app_version?: string | null;
|
|
34
|
+
biometric_enabled?: number | null;
|
|
35
|
+
journey_sequence?: number | null;
|
|
36
|
+
category?: string | null;
|
|
37
|
+
loc_limit?: number | null;
|
|
38
|
+
/** Defaults to: active. */
|
|
39
|
+
status?: 'active' | 'inactive' | null;
|
|
40
|
+
source?: string | null;
|
|
41
|
+
tnc_version?: string | null;
|
|
42
|
+
login_date?: Date | null;
|
|
43
|
+
agent_id?: number | null;
|
|
44
|
+
/** Defaults to: CURRENT_TIMESTAMP. */
|
|
45
|
+
created_at?: Date | null;
|
|
46
|
+
/** Defaults to: CURRENT_TIMESTAMP. */
|
|
47
|
+
updated_at?: Date | null;
|
|
48
|
+
/** Defaults to: 1. */
|
|
49
|
+
is_active?: number | null;
|
|
50
|
+
/** Defaults to: 0. */
|
|
51
|
+
is_deleted?: number | null;
|
|
38
52
|
}
|
|
39
53
|
export interface DemographicsTable {
|
|
40
54
|
id?: number;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
customer_id: number;
|
|
56
|
+
aadhaar_name?: string | null;
|
|
57
|
+
crn?: string | null;
|
|
58
|
+
device?: JSONValue | null;
|
|
59
|
+
gender?: string | null;
|
|
60
|
+
gst_no?: string | null;
|
|
61
|
+
language?: string | null;
|
|
62
|
+
latitude?: number | null;
|
|
63
|
+
longitude?: number | null;
|
|
64
|
+
marital_status?: string | null;
|
|
65
|
+
occupation?: string | null;
|
|
66
|
+
office_addr?: JSONValue | null;
|
|
67
|
+
organization_id?: number | null;
|
|
68
|
+
pan_url?: string | null;
|
|
69
|
+
perm_addr?: JSONValue | null;
|
|
70
|
+
res_addr?: JSONValue | null;
|
|
71
|
+
salary?: number | null;
|
|
72
|
+
salary_date?: Date | null;
|
|
73
|
+
salary_mode?: string | null;
|
|
74
|
+
selfie_url?: string | null;
|
|
75
|
+
/** Defaults to: CURRENT_TIMESTAMP. */
|
|
76
|
+
created_at?: Date | null;
|
|
77
|
+
updated_at?: Date | null;
|
|
78
|
+
}
|
|
79
|
+
export interface CustomerBanksTable {
|
|
80
|
+
id?: number;
|
|
81
|
+
customer_id: number;
|
|
82
|
+
account_number: string;
|
|
83
|
+
address?: string | null;
|
|
84
|
+
bank_name?: string | null;
|
|
85
|
+
ifsc_code?: string | null;
|
|
86
|
+
/** Defaults to: active. */
|
|
87
|
+
status?: 'active' | 'inactive';
|
|
88
|
+
is_primary?: boolean;
|
|
89
|
+
/** Defaults to: CURRENT_TIMESTAMP. */
|
|
90
|
+
created_at?: Date | null;
|
|
91
|
+
updated_at?: Date | null;
|
|
61
92
|
}
|
|
62
93
|
export interface CustomerModel extends CustomerTable, RowDataPacket {
|
|
63
94
|
}
|
|
95
|
+
export interface CustomerBanksModel extends CustomerBanksTable, RowDataPacket {
|
|
96
|
+
}
|
|
64
97
|
export interface DemographicsModel extends DemographicsTable, RowDataPacket {
|
|
65
98
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { RowDataPacket } from 'mysql2';
|
|
2
|
+
export type JSONPrimitive = string | number | boolean | null;
|
|
3
|
+
export type JSONValue = JSONObject | JSONArray;
|
|
4
|
+
export type JSONObject = {
|
|
5
|
+
[member: string]: JSONPrimitive;
|
|
6
|
+
};
|
|
7
|
+
export type JSONArray = Array<JSONValue>;
|
|
8
|
+
export interface DashboardBlock {
|
|
9
|
+
block_name: string;
|
|
10
|
+
block_title: string;
|
|
11
|
+
block_code: string;
|
|
12
|
+
text: string;
|
|
13
|
+
image_url: string;
|
|
14
|
+
video_url?: string;
|
|
15
|
+
video_length?: number;
|
|
16
|
+
action_url?: string;
|
|
17
|
+
landing_page?: string;
|
|
18
|
+
api_mode?: string;
|
|
19
|
+
app_version: string;
|
|
20
|
+
old_customers: boolean;
|
|
21
|
+
is_new?: boolean;
|
|
22
|
+
action_type?: string;
|
|
23
|
+
color1?: string;
|
|
24
|
+
color2?: string;
|
|
25
|
+
image_trailing?: boolean;
|
|
26
|
+
tag?: JSONValue;
|
|
27
|
+
overlay_image?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface DashboardBlockModel extends DashboardBlock, RowDataPacket {
|
|
30
|
+
}
|
package/models/JourneySteps.d.ts
CHANGED
|
@@ -14,9 +14,10 @@ export interface JourneySteps {
|
|
|
14
14
|
category: string;
|
|
15
15
|
step: string;
|
|
16
16
|
data: JSONValue;
|
|
17
|
+
sequence?: number | null;
|
|
18
|
+
fields?: string | null;
|
|
17
19
|
/** Defaults to: CURRENT_TIMESTAMP. */
|
|
18
20
|
created_at?: Date | null;
|
|
19
|
-
/** Defaults to: CURRENT_TIMESTAMP. */
|
|
20
21
|
updated_at?: Date | null;
|
|
21
22
|
}
|
|
22
23
|
export interface JourneyStepsModel extends JourneySteps, RowDataPacket {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { RowDataPacket } from 'mysql2';
|
|
2
|
+
export type JSONPrimitive = string | number | boolean | null;
|
|
3
|
+
export type JSONValue = JSONObject | JSONArray;
|
|
4
|
+
export type JSONObject = {
|
|
5
|
+
[member: string]: JSONPrimitive;
|
|
6
|
+
};
|
|
7
|
+
export type JSONArray = Array<JSONValue>;
|
|
8
|
+
export interface LoansTable {
|
|
9
|
+
id?: number | null;
|
|
10
|
+
customer_id: number | null;
|
|
11
|
+
category?: string | null;
|
|
12
|
+
ref_id: string | null;
|
|
13
|
+
amount?: number | null;
|
|
14
|
+
disbursal_amount?: number | null;
|
|
15
|
+
bill_amount?: number | null;
|
|
16
|
+
bill_date?: Date | null;
|
|
17
|
+
roi?: number | null;
|
|
18
|
+
tenure: number | null;
|
|
19
|
+
fees?: JSONValue;
|
|
20
|
+
daily_roi?: string | null;
|
|
21
|
+
/** Defaults to: processing_fee. */
|
|
22
|
+
disbursal_mode?: 'IMPS' | 'NEFT' | null;
|
|
23
|
+
/** Defaults to: active. */
|
|
24
|
+
status?: 'pending' | 'active' | 'close' | 'restructured' | 'rejected' | 'approved' | 'cancelled' | null;
|
|
25
|
+
source?: 'app' | 'thirdparty' | null;
|
|
26
|
+
ip?: string | null;
|
|
27
|
+
approval_date?: Date | null;
|
|
28
|
+
disbursal_date?: string | null;
|
|
29
|
+
closure_date?: Date | null;
|
|
30
|
+
is_auto_processing?: number | null;
|
|
31
|
+
remarks?: string | null;
|
|
32
|
+
restructure_id?: number | null;
|
|
33
|
+
emi_start_date?: Date | null;
|
|
34
|
+
created_at?: Date | null;
|
|
35
|
+
/** Defaults to: CURRENT_TIMESTAMP. */
|
|
36
|
+
updated_at?: Date | null;
|
|
37
|
+
/** Defaults to: 1. */
|
|
38
|
+
is_active?: number | null;
|
|
39
|
+
/** Defaults to: 0. */
|
|
40
|
+
is_deleted?: number | null;
|
|
41
|
+
}
|
|
42
|
+
export interface LoansModel extends LoansTable, RowDataPacket {
|
|
43
|
+
}
|
package/models/Loans.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { RowDataPacket } from "mysql2";
|
|
2
|
+
interface Rule {
|
|
3
|
+
key: string;
|
|
4
|
+
value: string | number;
|
|
5
|
+
operator: string;
|
|
6
|
+
}
|
|
7
|
+
interface Rules {
|
|
8
|
+
data: Rule[];
|
|
9
|
+
}
|
|
10
|
+
interface MetaData {
|
|
11
|
+
icon: string;
|
|
12
|
+
title: string;
|
|
13
|
+
eligibilityCriteria: string;
|
|
14
|
+
steps: string[];
|
|
15
|
+
}
|
|
16
|
+
interface Stat {
|
|
17
|
+
count: number;
|
|
18
|
+
total: number;
|
|
19
|
+
}
|
|
20
|
+
export interface OfferTable {
|
|
21
|
+
id: number;
|
|
22
|
+
title: string;
|
|
23
|
+
reward_type: string;
|
|
24
|
+
amount: number;
|
|
25
|
+
sc_type: string;
|
|
26
|
+
discount_type: string;
|
|
27
|
+
max_value: number;
|
|
28
|
+
rpu: number;
|
|
29
|
+
budget: number;
|
|
30
|
+
icon: string;
|
|
31
|
+
event_name: string;
|
|
32
|
+
event_sub_type: string;
|
|
33
|
+
description: string;
|
|
34
|
+
redirect_url: string;
|
|
35
|
+
offer_type: string;
|
|
36
|
+
start_required: boolean;
|
|
37
|
+
is_active: boolean;
|
|
38
|
+
deleted: boolean;
|
|
39
|
+
csv_segment: number;
|
|
40
|
+
sc_expiry: Date;
|
|
41
|
+
expiry: Date;
|
|
42
|
+
rules: Rules;
|
|
43
|
+
metaData: MetaData;
|
|
44
|
+
stats: Stat;
|
|
45
|
+
created_at: Date;
|
|
46
|
+
updated_at: Date;
|
|
47
|
+
created_by: string;
|
|
48
|
+
}
|
|
49
|
+
export interface OfferModel extends OfferTable, RowDataPacket {
|
|
50
|
+
}
|
|
51
|
+
export {};
|
package/models/Offer.js
ADDED
package/models/StashCash.d.ts
CHANGED
|
@@ -2,29 +2,36 @@ import { RowDataPacket } from 'mysql2';
|
|
|
2
2
|
export interface StashCashTable {
|
|
3
3
|
id?: number;
|
|
4
4
|
customer_id: number;
|
|
5
|
+
/** Defaults to: 0 */
|
|
5
6
|
locked: number;
|
|
6
7
|
unlocked: number;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
/** Defaults to: CURRENT_TIMESTAMP. */
|
|
9
|
+
created_at?: Date | null;
|
|
10
|
+
updated_at?: Date | null;
|
|
11
|
+
user_guide?: boolean;
|
|
12
|
+
is_active?: boolean;
|
|
13
|
+
is_deleted?: boolean;
|
|
11
14
|
}
|
|
12
15
|
export interface StashCashTrascationTable {
|
|
13
16
|
id?: number;
|
|
14
|
-
customer_id
|
|
15
|
-
campaign_id
|
|
16
|
-
|
|
17
|
+
customer_id?: number;
|
|
18
|
+
campaign_id?: number;
|
|
19
|
+
campaign_name: string;
|
|
20
|
+
txn_id: string;
|
|
17
21
|
sc_type: string;
|
|
18
22
|
amount: number;
|
|
19
|
-
|
|
23
|
+
locked: number;
|
|
24
|
+
unlocked: number;
|
|
20
25
|
remaining: number;
|
|
21
|
-
txn_type:
|
|
22
|
-
status
|
|
23
|
-
expiry
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
txn_type: 'debit' | 'credit' | 'expired' | 'reversal';
|
|
27
|
+
status?: 'pending' | 'success' | 'failure' | 'reversed';
|
|
28
|
+
expiry?: Date | null;
|
|
29
|
+
is_expired: boolean;
|
|
30
|
+
/** Defaults to: CURRENT_TIMESTAMP. */
|
|
31
|
+
created_at?: Date | null;
|
|
32
|
+
updated_at?: Date | null;
|
|
33
|
+
is_active?: boolean;
|
|
34
|
+
is_deleted?: boolean;
|
|
28
35
|
}
|
|
29
36
|
export interface StashCashModel extends StashCashTable, RowDataPacket {
|
|
30
37
|
}
|
package/models/UserDetails.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stashfin/mysql2",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc --build",
|
|
9
|
+
"build:ws": "tsc --build && copy package.json dist/",
|
|
9
10
|
"postbuild": "cp package.json dist/ ",
|
|
10
11
|
"publish:patch": "npm version patch && npm run build && cd dist && npm publish --access public",
|
|
11
12
|
"publish:minor": "npm version minor && npm run build && cd dist && npm publish --access public"
|
|
@@ -15,5 +16,8 @@
|
|
|
15
16
|
"license": "ISC",
|
|
16
17
|
"dependencies": {
|
|
17
18
|
"mysql2": "^3.9.9"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"cpy-cli": "^5.0.0"
|
|
18
22
|
}
|
|
19
23
|
}
|