@unvired/react-native-unvired-sdk 0.0.20 → 0.0.22
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/BuildNo.txt +1 -1
- package/dist/database/DatabaseManager.d.ts +1 -1
- package/dist/database/DatabaseManager.js +2 -4
- package/package.json +19 -46
- package/ts-core/ReactNativePlatformAdapter.ts +39 -68
- package/dist/database/services/DatabaseWeb.d.ts +0 -13
- package/dist/database/services/DatabaseWeb.js +0 -138
package/BuildNo.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
R-0.000.
|
|
1
|
+
R-0.000.0022
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DatabaseNative } from './services/DatabaseNative';
|
|
3
|
-
import { DatabaseWeb } from './services/DatabaseWeb';
|
|
1
|
+
import { DatabaseNative } from "./services/DatabaseNative";
|
|
4
2
|
// Select database implementation based on platform
|
|
5
|
-
const dbImpl =
|
|
3
|
+
const dbImpl = new DatabaseNative();
|
|
6
4
|
/**
|
|
7
5
|
* DatabaseManager - Manages database operations across platforms
|
|
8
6
|
* - iOS/Android/Windows: Uses @op-engineering/op-sqlite
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unvired/react-native-unvired-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"description": "Unvired SDK for React Native with logging, database, notifications, and file system support",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"types": "dist/main.d.ts",
|
|
@@ -11,27 +11,15 @@
|
|
|
11
11
|
"lint": "eslint src/",
|
|
12
12
|
"format": "prettier --write \"src/**/*.{js,ts,tsx}\""
|
|
13
13
|
},
|
|
14
|
-
"keywords": [
|
|
15
|
-
"react-native",
|
|
16
|
-
"unvired",
|
|
17
|
-
"sdk",
|
|
18
|
-
"mobile",
|
|
19
|
-
"logger",
|
|
20
|
-
"database",
|
|
21
|
-
"notifications",
|
|
22
|
-
"file-system"
|
|
23
|
-
],
|
|
24
|
-
"author": "Unvired",
|
|
25
|
-
"license": "UNLICENSED",
|
|
26
14
|
"peerDependencies": {
|
|
27
|
-
"react": "19.2.0",
|
|
28
|
-
"react-native": "0.83.1",
|
|
29
|
-
"react-native-fs": "^2.20.0",
|
|
30
|
-
"react-native-device-info": "^15.0.1",
|
|
31
15
|
"@op-engineering/op-sqlite": "^15.2.5",
|
|
32
|
-
"react-native-
|
|
16
|
+
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
33
17
|
"@react-native-firebase/messaging": "^21.8.1",
|
|
34
|
-
"
|
|
18
|
+
"react": ">=18",
|
|
19
|
+
"react-native": ">=0.73",
|
|
20
|
+
"react-native-device-info": "^15.0.1",
|
|
21
|
+
"react-native-fs": "^2.20.0",
|
|
22
|
+
"react-native-zip-archive": "^7.0.2"
|
|
35
23
|
},
|
|
36
24
|
"peerDependenciesMeta": {
|
|
37
25
|
"@react-native-firebase/messaging": {
|
|
@@ -51,46 +39,31 @@
|
|
|
51
39
|
},
|
|
52
40
|
"react-native-fs": {
|
|
53
41
|
"optional": true
|
|
54
|
-
},
|
|
55
|
-
"react": {
|
|
56
|
-
"optional": true
|
|
57
|
-
},
|
|
58
|
-
"react-native": {
|
|
59
|
-
"optional": true
|
|
60
42
|
}
|
|
61
43
|
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"pako": "^2.1.0"
|
|
46
|
+
},
|
|
62
47
|
"devDependencies": {
|
|
48
|
+
"@op-engineering/op-sqlite": "^15.2.5",
|
|
49
|
+
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
50
|
+
"@react-native-firebase/messaging": "^21.8.1",
|
|
63
51
|
"@types/pako": "^2.0.4",
|
|
64
|
-
"@types/react": ">=
|
|
52
|
+
"@types/react": ">=18",
|
|
65
53
|
"@types/react-native": "^0.73.0",
|
|
66
|
-
"@types/sql.js": "^1.4.9",
|
|
67
54
|
"eslint": "^8.0.0",
|
|
68
55
|
"jest": "^29.0.0",
|
|
69
56
|
"prettier": "^3.0.0",
|
|
70
|
-
"typescript": "^5.0.0",
|
|
71
57
|
"react": "19.2.0",
|
|
72
58
|
"react-native": "0.83.1",
|
|
73
|
-
"@react-native-firebase/app": "21.14.0"
|
|
74
|
-
},
|
|
75
|
-
"engines": {
|
|
76
|
-
"node": ">=22.0.0"
|
|
77
|
-
},
|
|
78
|
-
"dependencies": {
|
|
79
|
-
"react-native-fs": "^2.20.0",
|
|
80
|
-
"@op-engineering/op-sqlite": "^15.2.5",
|
|
81
|
-
"react-native-zip-archive": "^7.0.2",
|
|
82
|
-
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
83
59
|
"react-native-device-info": "^15.0.1",
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"sql.js": "^1.10.3"
|
|
60
|
+
"react-native-fs": "^2.20.0",
|
|
61
|
+
"typescript": "^5.0.0"
|
|
87
62
|
},
|
|
88
|
-
"
|
|
89
|
-
|
|
90
|
-
"volta": {
|
|
91
|
-
"node": "25.2.1"
|
|
63
|
+
"engines": {
|
|
64
|
+
"node": ">=18"
|
|
92
65
|
},
|
|
93
66
|
"publishConfig": {
|
|
94
67
|
"access": "public"
|
|
95
68
|
}
|
|
96
|
-
}
|
|
69
|
+
}
|
|
@@ -1,32 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { FileSystem } from '../src/file-system/FileSystem';
|
|
1
|
+
import { DeviceInfo, DatabaseManager, LocalStorage, logger, LogLevel, PushNotification, FileSystem } from '@unvired/react-native-unvired-sdk';
|
|
2
|
+
import { PlatformInterface, IDeviceInfo, IFileEntry, IDatabaseAdapter, IPushNotificationAdapter, ILoggerAdapter, IStorageAdapter } from './PlatformInterface';
|
|
3
|
+
|
|
5
4
|
export class ReactNativePlatformAdapter implements PlatformInterface {
|
|
6
5
|
|
|
7
|
-
getDeviceInfo(): IDeviceInfo {
|
|
8
|
-
|
|
9
|
-
return {
|
|
10
|
-
platform: 'unknown',
|
|
11
|
-
model: '',
|
|
12
|
-
version: '',
|
|
13
|
-
isMobile: true
|
|
14
|
-
};
|
|
6
|
+
async getDeviceInfo(): Promise<IDeviceInfo> {
|
|
7
|
+
return await DeviceInfo.getDeviceInfo();
|
|
15
8
|
}
|
|
16
9
|
|
|
17
10
|
getPlatform(): string {
|
|
18
|
-
|
|
19
|
-
return "";
|
|
11
|
+
return DeviceInfo.getPlatform();
|
|
20
12
|
}
|
|
21
13
|
|
|
22
14
|
getFrontendType(): string {
|
|
23
|
-
|
|
24
|
-
// Refer CordovaPlatformAdapter.ts for reference to return values
|
|
25
|
-
return "";
|
|
15
|
+
return DeviceInfo.getFrontendType();
|
|
26
16
|
}
|
|
27
17
|
|
|
28
18
|
getDocumentDirectory(): string {
|
|
29
|
-
// Return the document directory path for React Native
|
|
30
19
|
return FileSystem.getDocumentDirectory();
|
|
31
20
|
}
|
|
32
21
|
|
|
@@ -35,71 +24,66 @@ export class ReactNativePlatformAdapter implements PlatformInterface {
|
|
|
35
24
|
}
|
|
36
25
|
|
|
37
26
|
async getFolderBasedOnUserId(userId: string): Promise<string> {
|
|
38
|
-
return FileSystem.getFolderBasedOnUserId(userId);
|
|
27
|
+
return await FileSystem.getFolderBasedOnUserId(userId);
|
|
39
28
|
}
|
|
40
29
|
|
|
41
30
|
async deleteUserFolder(userId: string): Promise<void> {
|
|
42
|
-
|
|
31
|
+
await FileSystem.deleteUserFolder(userId);
|
|
43
32
|
}
|
|
44
33
|
|
|
45
34
|
getDatabaseAdapter(): IDatabaseAdapter {
|
|
46
|
-
// TODO: Implement database adapter
|
|
47
35
|
return {
|
|
48
|
-
create: (options, successCallback, errorCallback) => {
|
|
49
|
-
//
|
|
36
|
+
create: (options: { userId: string }, successCallback, errorCallback) => {
|
|
37
|
+
// Map userId to dbName or pass appropriate options
|
|
38
|
+
DatabaseManager.getDatabaseAdapter().create({ name: options.userId }, successCallback, errorCallback);
|
|
50
39
|
},
|
|
51
|
-
execute: (options, successCallback, errorCallback) => {
|
|
52
|
-
|
|
40
|
+
execute: (options: any, successCallback, errorCallback) => {
|
|
41
|
+
DatabaseManager.getDatabaseAdapter().execute(options, successCallback, errorCallback);
|
|
53
42
|
},
|
|
54
43
|
executeStatementOnPath: (dbPath, sqlQuery, callback) => {
|
|
55
|
-
|
|
56
|
-
callback([]);
|
|
44
|
+
DatabaseManager.getDatabaseAdapter().executeStatementOnPath(dbPath, sqlQuery, callback);
|
|
57
45
|
},
|
|
58
46
|
selectFromPath: (dbPath, sqlQuery, callback) => {
|
|
59
|
-
|
|
60
|
-
callback([]);
|
|
47
|
+
DatabaseManager.getDatabaseAdapter().selectFromPath(dbPath, sqlQuery, callback);
|
|
61
48
|
},
|
|
62
49
|
createDatabase: (dbPath, callback) => {
|
|
63
|
-
|
|
64
|
-
callback();
|
|
50
|
+
DatabaseManager.getDatabaseAdapter().createDatabase(dbPath, callback);
|
|
65
51
|
},
|
|
66
|
-
getDBFilePath: (options, callback) => {
|
|
67
|
-
|
|
68
|
-
callback("");
|
|
52
|
+
getDBFilePath: (options: { dbType: string }, callback) => {
|
|
53
|
+
DatabaseManager.getDatabaseAdapter().getDBFilePath({ name: options.dbType }, callback);
|
|
69
54
|
},
|
|
70
|
-
saveWebDB: (options, callback, errorCallback) => {
|
|
71
|
-
|
|
72
|
-
|
|
55
|
+
saveWebDB: (options: { userId: string }, callback, errorCallback) => {
|
|
56
|
+
const dbName = options.userId;
|
|
57
|
+
const data = (options as any).data || {};
|
|
58
|
+
DatabaseManager.getDatabaseAdapter().saveWebDB({ dbName, data }, callback, errorCallback);
|
|
73
59
|
},
|
|
74
|
-
exportWebDB: (options, callback, errorCallback) => {
|
|
75
|
-
|
|
76
|
-
callback({});
|
|
60
|
+
exportWebDB: (options: { userId: string }, callback, errorCallback) => {
|
|
61
|
+
DatabaseManager.getDatabaseAdapter().exportWebDB({ dbName: options.userId }, callback, errorCallback);
|
|
77
62
|
},
|
|
78
|
-
deleteUserData: (options, callback, errorCallback) => {
|
|
79
|
-
|
|
80
|
-
callback();
|
|
63
|
+
deleteUserData: (options: { userId: string }, callback, errorCallback) => {
|
|
64
|
+
DatabaseManager.getDatabaseAdapter().deleteUserData({ dbName: options.userId, userId: options.userId }, callback, errorCallback);
|
|
81
65
|
}
|
|
82
66
|
};
|
|
83
67
|
}
|
|
84
68
|
|
|
85
69
|
getPushNotificationAdapter(): IPushNotificationAdapter | null {
|
|
86
70
|
try {
|
|
71
|
+
const pushNotification = new PushNotification();
|
|
87
72
|
return {
|
|
88
73
|
requestPermission: async (options = { forceShow: false }) => {
|
|
89
|
-
|
|
74
|
+
await pushNotification.requestPermission(options);
|
|
90
75
|
},
|
|
91
76
|
getToken: async () => {
|
|
92
|
-
|
|
93
|
-
return "";
|
|
77
|
+
return await pushNotification.getToken();
|
|
94
78
|
},
|
|
95
79
|
onTokenRefresh: (callback) => {
|
|
96
|
-
|
|
80
|
+
pushNotification.onTokenRefresh(callback);
|
|
97
81
|
},
|
|
98
82
|
onMessage: (callback) => {
|
|
99
|
-
|
|
83
|
+
pushNotification.onMessage(callback);
|
|
100
84
|
},
|
|
101
85
|
onBackgroundMessage: (callback) => {
|
|
102
|
-
|
|
86
|
+
pushNotification.onBackgroundMessage(callback);
|
|
103
87
|
}
|
|
104
88
|
};
|
|
105
89
|
} catch (error) {
|
|
@@ -110,58 +94,45 @@ export class ReactNativePlatformAdapter implements PlatformInterface {
|
|
|
110
94
|
getLoggerAdapter(): ILoggerAdapter {
|
|
111
95
|
return {
|
|
112
96
|
logDebug: (sourceClass, method, message) => {
|
|
113
|
-
console.log(`[DEBUG] ${sourceClass}.${method}: ${message}`);
|
|
114
97
|
logger.logDebug(sourceClass, method, message);
|
|
115
|
-
// TODO: Implement log file writing
|
|
116
98
|
},
|
|
117
99
|
logError: (sourceClass, method, message) => {
|
|
118
|
-
console.error(`[ERROR] ${sourceClass}.${method}: ${message}`);
|
|
119
100
|
logger.logError(sourceClass, method, message);
|
|
120
|
-
// TODO: Implement log file writing
|
|
121
101
|
},
|
|
122
102
|
logInfo: (sourceClass, method, message) => {
|
|
123
|
-
console.info(`[INFO] ${sourceClass}.${method}: ${message}`);
|
|
124
103
|
logger.logInfo(sourceClass, method, message);
|
|
125
|
-
// TODO: Implement log file writing
|
|
126
104
|
},
|
|
127
105
|
setLogLevel: (logLevel: LogLevel) => {
|
|
128
|
-
// TODO: Implement log level setting
|
|
129
|
-
console.log(`Setting log level to: ${logLevel}`);
|
|
130
106
|
logger.setLogLevel(logLevel);
|
|
131
107
|
},
|
|
132
108
|
getLogFileURL: async () => {
|
|
133
|
-
// TODO: Implement log file URL retrieval
|
|
134
109
|
return logger.getLogFileURL();
|
|
135
110
|
},
|
|
136
111
|
getLogFileContent: async () => {
|
|
137
|
-
// TODO: Implement log file content retrieval
|
|
138
112
|
return logger.getLogFileContent();
|
|
139
113
|
},
|
|
140
114
|
getBackupLogFileContent: async () => {
|
|
141
|
-
|
|
142
|
-
const content = await logger.getBackupLogFileContent();
|
|
143
|
-
return content || '';
|
|
115
|
+
return logger.getBackupLogFileContent();
|
|
144
116
|
},
|
|
145
117
|
clearLogFile: async () => {
|
|
146
|
-
// TODO: Implement log file clearing
|
|
147
118
|
logger.clearLogFile();
|
|
148
119
|
}
|
|
149
120
|
};
|
|
150
121
|
}
|
|
151
122
|
|
|
152
|
-
getStorageAdapter() {
|
|
123
|
+
getStorageAdapter(): IStorageAdapter {
|
|
153
124
|
return {
|
|
154
125
|
getItem: (key: string) => {
|
|
155
|
-
return
|
|
126
|
+
return LocalStorage.getItem(key);
|
|
156
127
|
},
|
|
157
128
|
setItem: (key: string, value: string) => {
|
|
158
|
-
|
|
129
|
+
return LocalStorage.setItem(key, value);
|
|
159
130
|
},
|
|
160
131
|
removeItem: (key: string) => {
|
|
161
|
-
|
|
132
|
+
return LocalStorage.removeItem(key);
|
|
162
133
|
},
|
|
163
134
|
clear: () => {
|
|
164
|
-
|
|
135
|
+
return LocalStorage.clear();
|
|
165
136
|
}
|
|
166
137
|
};
|
|
167
138
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { IDatabaseAdapter } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* DatabaseWeb - Web database implementation using sql.js
|
|
4
|
-
* Uses SQLite compiled to WebAssembly for full SQLite compatibility in browsers
|
|
5
|
-
*/
|
|
6
|
-
export declare class DatabaseWeb {
|
|
7
|
-
private databases;
|
|
8
|
-
private SQL;
|
|
9
|
-
private initSQL;
|
|
10
|
-
private getDatabase;
|
|
11
|
-
private executeQuery;
|
|
12
|
-
getAdapter(): IDatabaseAdapter;
|
|
13
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import initSqlJs from 'sql.js';
|
|
2
|
-
/**
|
|
3
|
-
* DatabaseWeb - Web database implementation using sql.js
|
|
4
|
-
* Uses SQLite compiled to WebAssembly for full SQLite compatibility in browsers
|
|
5
|
-
*/
|
|
6
|
-
export class DatabaseWeb {
|
|
7
|
-
constructor() {
|
|
8
|
-
this.databases = new Map();
|
|
9
|
-
this.SQL = null;
|
|
10
|
-
}
|
|
11
|
-
async initSQL() {
|
|
12
|
-
if (!this.SQL) {
|
|
13
|
-
this.SQL = await initSqlJs({
|
|
14
|
-
locateFile: (file) => `https://sql.js.org/dist/${file}`
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return this.SQL;
|
|
18
|
-
}
|
|
19
|
-
async getDatabase(name) {
|
|
20
|
-
if (this.databases.has(name)) {
|
|
21
|
-
return this.databases.get(name);
|
|
22
|
-
}
|
|
23
|
-
const SQL = await this.initSQL();
|
|
24
|
-
const db = new SQL.Database();
|
|
25
|
-
this.databases.set(name, db);
|
|
26
|
-
return db;
|
|
27
|
-
}
|
|
28
|
-
executeQuery(db, query, params = []) {
|
|
29
|
-
const results = [];
|
|
30
|
-
const stmt = db.prepare(query);
|
|
31
|
-
stmt.bind(params);
|
|
32
|
-
while (stmt.step()) {
|
|
33
|
-
const row = stmt.getAsObject();
|
|
34
|
-
results.push(row);
|
|
35
|
-
}
|
|
36
|
-
stmt.free();
|
|
37
|
-
return results;
|
|
38
|
-
}
|
|
39
|
-
getAdapter() {
|
|
40
|
-
return {
|
|
41
|
-
create: async (options, successCallback, errorCallback) => {
|
|
42
|
-
try {
|
|
43
|
-
await this.getDatabase(options.name);
|
|
44
|
-
successCallback({ success: true, database: options.name });
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
errorCallback(error instanceof Error ? error.message : String(error));
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
execute: async (options, successCallback, errorCallback) => {
|
|
51
|
-
try {
|
|
52
|
-
const db = await this.getDatabase(options.dbName);
|
|
53
|
-
const results = this.executeQuery(db, options.query, options.params);
|
|
54
|
-
successCallback(results);
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
errorCallback(error instanceof Error ? error.message : String(error));
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
executeStatementOnPath: async (dbPath, sqlQuery, callback) => {
|
|
61
|
-
var _a;
|
|
62
|
-
try {
|
|
63
|
-
const dbName = ((_a = dbPath.split('/').pop()) === null || _a === void 0 ? void 0 : _a.replace('.db', '')) || 'default';
|
|
64
|
-
const db = await this.getDatabase(dbName);
|
|
65
|
-
const results = this.executeQuery(db, sqlQuery);
|
|
66
|
-
callback(results);
|
|
67
|
-
}
|
|
68
|
-
catch (error) {
|
|
69
|
-
callback([]);
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
selectFromPath: async (dbPath, sqlQuery, callback) => {
|
|
73
|
-
var _a;
|
|
74
|
-
try {
|
|
75
|
-
const dbName = ((_a = dbPath.split('/').pop()) === null || _a === void 0 ? void 0 : _a.replace('.db', '')) || 'default';
|
|
76
|
-
const db = await this.getDatabase(dbName);
|
|
77
|
-
const results = this.executeQuery(db, sqlQuery);
|
|
78
|
-
callback(results);
|
|
79
|
-
}
|
|
80
|
-
catch (error) {
|
|
81
|
-
callback([]);
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
createDatabase: async (dbPath, callback) => {
|
|
85
|
-
var _a;
|
|
86
|
-
try {
|
|
87
|
-
const dbName = ((_a = dbPath.split('/').pop()) === null || _a === void 0 ? void 0 : _a.replace('.db', '')) || 'default';
|
|
88
|
-
await this.getDatabase(dbName);
|
|
89
|
-
callback();
|
|
90
|
-
}
|
|
91
|
-
catch (error) {
|
|
92
|
-
callback();
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
getDBFilePath: async (options, callback) => {
|
|
96
|
-
callback(`sqljs://${options.name}`);
|
|
97
|
-
},
|
|
98
|
-
saveWebDB: async (options, callback, errorCallback) => {
|
|
99
|
-
try {
|
|
100
|
-
const db = await this.getDatabase(options.dbName);
|
|
101
|
-
if (Array.isArray(options.data)) {
|
|
102
|
-
for (const item of options.data) {
|
|
103
|
-
if (item.query && item.params) {
|
|
104
|
-
db.run(item.query, item.params);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
callback({ success: true });
|
|
109
|
-
}
|
|
110
|
-
catch (error) {
|
|
111
|
-
errorCallback(error instanceof Error ? error.message : String(error));
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
exportWebDB: async (options, callback, errorCallback) => {
|
|
115
|
-
try {
|
|
116
|
-
const db = await this.getDatabase(options.dbName);
|
|
117
|
-
const tables = this.executeQuery(db, "SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'");
|
|
118
|
-
callback({ success: true, tables: tables.map(t => t.name) });
|
|
119
|
-
}
|
|
120
|
-
catch (error) {
|
|
121
|
-
errorCallback(error instanceof Error ? error.message : String(error));
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
deleteUserData: async (options, callback, errorCallback) => {
|
|
125
|
-
try {
|
|
126
|
-
const db = await this.getDatabase(options.dbName);
|
|
127
|
-
const query = options.userId ? 'DELETE FROM user_data WHERE user_id = ?' : 'DELETE FROM user_data';
|
|
128
|
-
const params = options.userId ? [options.userId] : [];
|
|
129
|
-
db.run(query, params);
|
|
130
|
-
callback();
|
|
131
|
-
}
|
|
132
|
-
catch (error) {
|
|
133
|
-
errorCallback(error instanceof Error ? error.message : String(error));
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
}
|