@unvired/react-native-wrapper-sdk 0.0.23 → 0.0.24
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/dist/UnviredWrapper.d.ts +25 -22
- package/dist/UnviredWrapper.d.ts.map +1 -1
- package/dist/UnviredWrapper.js +32 -48
- package/dist/lib/auth/AuthBuilder.d.ts.map +1 -0
- package/dist/lib/auth/AuthService.d.ts +27 -0
- package/dist/lib/auth/AuthService.d.ts.map +1 -0
- package/dist/lib/auth/AuthService.js +46 -0
- package/dist/lib/database/DatabaseService.d.ts +43 -0
- package/dist/lib/database/DatabaseService.d.ts.map +1 -0
- package/dist/lib/database/DatabaseService.js +34 -0
- package/dist/lib/file/FileService.d.ts +48 -0
- package/dist/lib/file/FileService.d.ts.map +1 -0
- package/dist/lib/file/FileService.js +156 -0
- package/dist/lib/logger/LoggerService.d.ts +45 -0
- package/dist/lib/logger/LoggerService.d.ts.map +1 -0
- package/dist/lib/logger/LoggerService.js +65 -0
- package/dist/lib/notification/NotificationService.d.ts +28 -0
- package/dist/lib/notification/NotificationService.d.ts.map +1 -0
- package/dist/lib/notification/NotificationService.js +47 -0
- package/dist/lib/settings/SettingsService.d.ts +44 -0
- package/dist/lib/settings/SettingsService.d.ts.map +1 -0
- package/dist/lib/settings/SettingsService.js +120 -0
- package/dist/lib/storage/StorageService.d.ts +13 -0
- package/dist/lib/storage/StorageService.d.ts.map +1 -0
- package/dist/lib/storage/StorageService.js +19 -0
- package/dist/lib/sync/SyncService.d.ts +96 -0
- package/dist/lib/sync/SyncService.d.ts.map +1 -0
- package/dist/lib/sync/SyncService.js +139 -0
- package/package.json +11 -6
- package/src/UnviredWrapper.ts +34 -52
- package/src/lib/auth/AuthService.ts +45 -0
- package/src/lib/database/DatabaseService.ts +53 -0
- package/src/lib/file/FileService.ts +166 -0
- package/src/lib/logger/LoggerService.ts +70 -0
- package/src/lib/notification/NotificationService.ts +45 -0
- package/src/lib/settings/SettingsService.ts +150 -0
- package/src/lib/storage/StorageService.ts +27 -0
- package/src/lib/sync/SyncService.ts +160 -0
- package/dist/lib/AuthBuilder.d.ts.map +0 -1
- /package/dist/lib/{AuthBuilder.d.ts → auth/AuthBuilder.d.ts} +0 -0
- /package/dist/lib/{AuthBuilder.js → auth/AuthBuilder.js} +0 -0
- /package/src/lib/{AuthBuilder.ts → auth/AuthBuilder.ts} +0 -0
package/dist/UnviredWrapper.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AuthService } from './lib/auth/AuthService';
|
|
2
|
+
import { DatabaseService } from './lib/database/DatabaseService';
|
|
3
|
+
import { FileService } from './lib/file/FileService';
|
|
4
|
+
import { NotificationService } from './lib/notification/NotificationService';
|
|
5
|
+
import { SyncService } from './lib/sync/SyncService';
|
|
6
|
+
import { SettingsService } from './lib/settings/SettingsService';
|
|
7
|
+
import { LoggerService } from './lib/logger/LoggerService';
|
|
2
8
|
/**
|
|
3
9
|
* React Native Wrapper for Unvired Core SDK
|
|
4
10
|
* Provides a clean, fluent API for React Native applications
|
|
@@ -6,36 +12,33 @@ import AuthBuilder from './lib/AuthBuilder';
|
|
|
6
12
|
export declare class UnviredWrapper {
|
|
7
13
|
constructor();
|
|
8
14
|
/**
|
|
9
|
-
*
|
|
10
|
-
* Can be awaited directly: await sdk.login().setAppName("my-app")
|
|
15
|
+
* Access Authentication operations
|
|
11
16
|
*/
|
|
12
|
-
|
|
17
|
+
auth(): AuthService;
|
|
13
18
|
/**
|
|
14
|
-
*
|
|
15
|
-
* Can be awaited directly: await sdk.authenticateAndActivate().setUsername("demo")
|
|
19
|
+
* Access Database operations
|
|
16
20
|
*/
|
|
17
|
-
|
|
21
|
+
database(): DatabaseService;
|
|
18
22
|
/**
|
|
19
|
-
*
|
|
20
|
-
* Can be awaited directly: await sdk.authenticateLocal().setUsername("demo")
|
|
23
|
+
* Access File/Attachment operations
|
|
21
24
|
*/
|
|
22
|
-
|
|
25
|
+
file(): FileService;
|
|
23
26
|
/**
|
|
24
|
-
*
|
|
27
|
+
* Access Notification operations
|
|
25
28
|
*/
|
|
26
|
-
|
|
29
|
+
notification(): NotificationService;
|
|
27
30
|
/**
|
|
28
|
-
*
|
|
31
|
+
* Access Synchronization operations
|
|
29
32
|
*/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
sync(): SyncService;
|
|
34
|
+
/**
|
|
35
|
+
* Access Settings and Utility operations
|
|
36
|
+
*/
|
|
37
|
+
settings(): SettingsService;
|
|
38
|
+
/**
|
|
39
|
+
* Access Logger operations
|
|
40
|
+
*/
|
|
41
|
+
logger(): LoggerService;
|
|
39
42
|
}
|
|
40
43
|
export default UnviredWrapper;
|
|
41
44
|
//# sourceMappingURL=UnviredWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnviredWrapper.d.ts","sourceRoot":"","sources":["../src/UnviredWrapper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UnviredWrapper.d.ts","sourceRoot":"","sources":["../src/UnviredWrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D;;;GAGG;AACH,qBAAa,cAAc;;IAKzB;;OAEG;IACH,IAAI,IAAI,WAAW;IAInB;;OAEG;IACH,QAAQ,IAAI,eAAe;IAI3B;;OAEG;IACH,IAAI,IAAI,WAAW;IAInB;;OAEG;IACH,YAAY,IAAI,mBAAmB;IAInC;;OAEG;IACH,IAAI,IAAI,WAAW;IAInB;;OAEG;IACH,QAAQ,IAAI,eAAe;IAI3B;;OAEG;IACH,MAAM,IAAI,aAAa;CAIxB;AAED,eAAe,cAAc,CAAC"}
|
package/dist/UnviredWrapper.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.UnviredWrapper = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
4
|
+
const AuthService_1 = require("./lib/auth/AuthService");
|
|
5
|
+
const DatabaseService_1 = require("./lib/database/DatabaseService");
|
|
6
|
+
const FileService_1 = require("./lib/file/FileService");
|
|
7
|
+
const NotificationService_1 = require("./lib/notification/NotificationService");
|
|
8
|
+
const SyncService_1 = require("./lib/sync/SyncService");
|
|
9
|
+
const SettingsService_1 = require("./lib/settings/SettingsService");
|
|
10
|
+
const LoggerService_1 = require("./lib/logger/LoggerService");
|
|
9
11
|
/**
|
|
10
12
|
* React Native Wrapper for Unvired Core SDK
|
|
11
13
|
* Provides a clean, fluent API for React Native applications
|
|
@@ -15,64 +17,46 @@ class UnviredWrapper {
|
|
|
15
17
|
// AuthenticationService is a singleton, accessed via static instance getter
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
|
-
*
|
|
19
|
-
* Can be awaited directly: await sdk.login().setAppName("my-app")
|
|
20
|
+
* Access Authentication operations
|
|
20
21
|
*/
|
|
21
|
-
|
|
22
|
-
return new
|
|
22
|
+
auth() {
|
|
23
|
+
return new AuthService_1.AuthService();
|
|
23
24
|
}
|
|
24
25
|
/**
|
|
25
|
-
*
|
|
26
|
-
* Can be awaited directly: await sdk.authenticateAndActivate().setUsername("demo")
|
|
26
|
+
* Access Database operations
|
|
27
27
|
*/
|
|
28
|
-
|
|
29
|
-
return new
|
|
28
|
+
database() {
|
|
29
|
+
return new DatabaseService_1.DatabaseService();
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
* Can be awaited directly: await sdk.authenticateLocal().setUsername("demo")
|
|
32
|
+
* Access File/Attachment operations
|
|
34
33
|
*/
|
|
35
|
-
|
|
36
|
-
return new
|
|
34
|
+
file() {
|
|
35
|
+
return new FileService_1.FileService();
|
|
37
36
|
}
|
|
38
37
|
/**
|
|
39
|
-
*
|
|
38
|
+
* Access Notification operations
|
|
40
39
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return authService.logout();
|
|
40
|
+
notification() {
|
|
41
|
+
return new NotificationService_1.NotificationService();
|
|
44
42
|
}
|
|
45
43
|
/**
|
|
46
|
-
*
|
|
44
|
+
* Access Synchronization operations
|
|
47
45
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return authService.clearData();
|
|
46
|
+
sync() {
|
|
47
|
+
return new SyncService_1.SyncService();
|
|
51
48
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().logError(className, methodName, message);
|
|
58
|
-
}
|
|
59
|
-
static logDebug(className, methodName, message) {
|
|
60
|
-
return unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().logDebug(className, methodName, message);
|
|
61
|
-
}
|
|
62
|
-
static setLogLevel(level) {
|
|
63
|
-
return unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().setLogLevel(level);
|
|
64
|
-
}
|
|
65
|
-
static async getLogFileURL() {
|
|
66
|
-
return unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().getLogFileURL();
|
|
67
|
-
}
|
|
68
|
-
static async getLogFileContent() {
|
|
69
|
-
return unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().getLogFileContent();
|
|
70
|
-
}
|
|
71
|
-
static async getBackupLogFileContent() {
|
|
72
|
-
return unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().getBackupLogFileContent();
|
|
49
|
+
/**
|
|
50
|
+
* Access Settings and Utility operations
|
|
51
|
+
*/
|
|
52
|
+
settings() {
|
|
53
|
+
return new SettingsService_1.SettingsService();
|
|
73
54
|
}
|
|
74
|
-
|
|
75
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Access Logger operations
|
|
57
|
+
*/
|
|
58
|
+
logger() {
|
|
59
|
+
return new LoggerService_1.LoggerService();
|
|
76
60
|
}
|
|
77
61
|
}
|
|
78
62
|
exports.UnviredWrapper = UnviredWrapper;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthBuilder.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/AuthBuilder.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,eAAe;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,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,CAAC,YAAY,EAAE,MAAM,GAAG,WAAW;IAKlD,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW;IAK1C,mBAAmB,CAAC,gBAAgB,EAAE,OAAO,GAAG,WAAW;IAK3D,eAAe,CAAC,YAAY,EAAE,OAAO,GAAG,WAAW;IAKnD,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,WAAW;IAK9C,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,WAAW;IAKpD,eAAe,CAAC,YAAY,EAAE,OAAO,GAAG,WAAW;IAKnD,2BAA2B,CAAC,wBAAwB,EAAE,OAAO,GAAG,WAAW;IAK3E,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,WAAW;IAK7C,OAAO,CAAC,OAAO;IAgBf,IAAI,CAAC,QAAQ,GAAG,GAAG,EAAE,QAAQ,GAAG,KAAK,EACjC,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,EACnF,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,GACpF,WAAW,CAAC,QAAQ,GAAG,QAAQ,CAAC;CAGtC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import AuthBuilder from './AuthBuilder';
|
|
2
|
+
/**
|
|
3
|
+
* Service for handling Authentication operations
|
|
4
|
+
*/
|
|
5
|
+
export declare class AuthService {
|
|
6
|
+
/**
|
|
7
|
+
* Returns a builder for login method
|
|
8
|
+
*/
|
|
9
|
+
login(): AuthBuilder;
|
|
10
|
+
/**
|
|
11
|
+
* Returns a builder for authenticateAndActivate method
|
|
12
|
+
*/
|
|
13
|
+
authenticateAndActivate(): AuthBuilder;
|
|
14
|
+
/**
|
|
15
|
+
* Returns a builder for authenticateLocal method
|
|
16
|
+
*/
|
|
17
|
+
authenticateLocal(): AuthBuilder;
|
|
18
|
+
/**
|
|
19
|
+
* Logout method - Logs out the current user
|
|
20
|
+
*/
|
|
21
|
+
logout(): Promise<any>;
|
|
22
|
+
/**
|
|
23
|
+
* Clear all data
|
|
24
|
+
*/
|
|
25
|
+
clearData(): Promise<any>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=AuthService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthService.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/AuthService.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,eAAe,CAAC;AAGxC;;GAEG;AACH,qBAAa,WAAW;IAEpB;;OAEG;IACH,KAAK,IAAI,WAAW;IAIpB;;OAEG;IACH,uBAAuB,IAAI,WAAW;IAItC;;OAEG;IACH,iBAAiB,IAAI,WAAW;IAIhC;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC;IAK5B;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC;CAIlC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
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.AuthService = void 0;
|
|
7
|
+
const AuthBuilder_1 = __importDefault(require("./AuthBuilder"));
|
|
8
|
+
const unvired_ts_core_sdk_1 = require("@unvired/unvired-ts-core-sdk");
|
|
9
|
+
/**
|
|
10
|
+
* Service for handling Authentication operations
|
|
11
|
+
*/
|
|
12
|
+
class AuthService {
|
|
13
|
+
/**
|
|
14
|
+
* Returns a builder for login method
|
|
15
|
+
*/
|
|
16
|
+
login() {
|
|
17
|
+
return new AuthBuilder_1.default('login');
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Returns a builder for authenticateAndActivate method
|
|
21
|
+
*/
|
|
22
|
+
authenticateAndActivate() {
|
|
23
|
+
return new AuthBuilder_1.default('authenticateAndActivate');
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Returns a builder for authenticateLocal method
|
|
27
|
+
*/
|
|
28
|
+
authenticateLocal() {
|
|
29
|
+
return new AuthBuilder_1.default('authenticateLocal');
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Logout method - Logs out the current user
|
|
33
|
+
*/
|
|
34
|
+
async logout() {
|
|
35
|
+
const authService = unvired_ts_core_sdk_1.AuthenticationService.instance;
|
|
36
|
+
return authService.logout();
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Clear all data
|
|
40
|
+
*/
|
|
41
|
+
async clearData() {
|
|
42
|
+
const authService = unvired_ts_core_sdk_1.AuthenticationService.instance;
|
|
43
|
+
return authService.clearData();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.AuthService = AuthService;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface IDatabaseAdapter {
|
|
2
|
+
create(options: {
|
|
3
|
+
userId: string;
|
|
4
|
+
}, successCallback: (result: any) => void, errorCallback: (error: any) => void): void;
|
|
5
|
+
execute(options: any, successCallback: (result: any) => void, errorCallback: (error: any) => void): void;
|
|
6
|
+
executeStatementOnPath(dbPath: string, sqlQuery: string, callback: (result: any) => void): void;
|
|
7
|
+
selectFromPath(dbPath: string, sqlQuery: string, callback: (result: any) => void): void;
|
|
8
|
+
createDatabase(dbPath: string, callback: () => void): void;
|
|
9
|
+
getDBFilePath(options: {
|
|
10
|
+
dbType: string;
|
|
11
|
+
}, callback: (path: string) => void): void;
|
|
12
|
+
saveWebDB(options: {
|
|
13
|
+
userId: string;
|
|
14
|
+
}, callback: (result: any) => void, errorCallback: (error: any) => void): void;
|
|
15
|
+
exportWebDB(options: {
|
|
16
|
+
userId: string;
|
|
17
|
+
}, callback: (result: any) => void, errorCallback: (error: any) => void): void;
|
|
18
|
+
deleteUserData(options: {
|
|
19
|
+
userId: string;
|
|
20
|
+
}, callback: () => void, errorCallback: (error: any) => void): void;
|
|
21
|
+
}
|
|
22
|
+
export declare class DatabaseService {
|
|
23
|
+
create(options: {
|
|
24
|
+
userId: string;
|
|
25
|
+
}, successCallback: (result: any) => void, errorCallback: (error: any) => void): void;
|
|
26
|
+
execute(options: any, successCallback: (result: any) => void, errorCallback: (error: any) => void): void;
|
|
27
|
+
executeStatementOnPath(dbPath: string, sqlQuery: string, callback: (result: any) => void): void;
|
|
28
|
+
selectFromPath(dbPath: string, sqlQuery: string, callback: (result: any) => void): void;
|
|
29
|
+
createDatabase(dbPath: string, callback: () => void): void;
|
|
30
|
+
getDBFilePath(options: {
|
|
31
|
+
dbType: string;
|
|
32
|
+
}, callback: (path: string) => void): void;
|
|
33
|
+
saveWebDB(options: {
|
|
34
|
+
userId: string;
|
|
35
|
+
}, callback: (result: any) => void, errorCallback: (error: any) => void): void;
|
|
36
|
+
exportWebDB(options: {
|
|
37
|
+
userId: string;
|
|
38
|
+
}, callback: (result: any) => void, errorCallback: (error: any) => void): void;
|
|
39
|
+
deleteUserData(options: {
|
|
40
|
+
userId: string;
|
|
41
|
+
}, callback: () => void, errorCallback: (error: any) => void): void;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=DatabaseService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatabaseService.d.ts","sourceRoot":"","sources":["../../../src/lib/database/DatabaseService.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,gBAAgB;IAC7B,MAAM,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,eAAe,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,EAAE,aAAa,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAAC;IACvH,OAAO,CAA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AM,EAAE,MAAM,CAAA;KAAE,EAAE,QAAQ,EAAE,MAAM,IAAI,EAAE,aAAa,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;CAG/G"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DatabaseService = void 0;
|
|
4
|
+
const unvired_ts_core_sdk_1 = require("@unvired/unvired-ts-core-sdk");
|
|
5
|
+
class DatabaseService {
|
|
6
|
+
create(options, successCallback, errorCallback) {
|
|
7
|
+
unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getDatabaseAdapter().create(options, successCallback, errorCallback);
|
|
8
|
+
}
|
|
9
|
+
execute(options, successCallback, errorCallback) {
|
|
10
|
+
unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getDatabaseAdapter().execute(options, successCallback, errorCallback);
|
|
11
|
+
}
|
|
12
|
+
executeStatementOnPath(dbPath, sqlQuery, callback) {
|
|
13
|
+
unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getDatabaseAdapter().executeStatementOnPath(dbPath, sqlQuery, callback);
|
|
14
|
+
}
|
|
15
|
+
selectFromPath(dbPath, sqlQuery, callback) {
|
|
16
|
+
unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getDatabaseAdapter().selectFromPath(dbPath, sqlQuery, callback);
|
|
17
|
+
}
|
|
18
|
+
createDatabase(dbPath, callback) {
|
|
19
|
+
unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getDatabaseAdapter().createDatabase(dbPath, callback);
|
|
20
|
+
}
|
|
21
|
+
getDBFilePath(options, callback) {
|
|
22
|
+
unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getDatabaseAdapter().getDBFilePath(options, callback);
|
|
23
|
+
}
|
|
24
|
+
saveWebDB(options, callback, errorCallback) {
|
|
25
|
+
unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getDatabaseAdapter().saveWebDB(options, callback, errorCallback);
|
|
26
|
+
}
|
|
27
|
+
exportWebDB(options, callback, errorCallback) {
|
|
28
|
+
unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getDatabaseAdapter().exportWebDB(options, callback, errorCallback);
|
|
29
|
+
}
|
|
30
|
+
deleteUserData(options, callback, errorCallback) {
|
|
31
|
+
unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getDatabaseAdapter().deleteUserData(options, callback, errorCallback);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.DatabaseService = DatabaseService;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export interface IDirectoryReader {
|
|
2
|
+
readEntries(successCallback: (entries: IFileEntry[]) => void, errorCallback: (error: any) => void): void;
|
|
3
|
+
}
|
|
4
|
+
export interface IFileEntry {
|
|
5
|
+
fullPath: string;
|
|
6
|
+
nativeURL: string;
|
|
7
|
+
isDirectory?: boolean;
|
|
8
|
+
remove(callback: () => void, errorCallback: (error: any) => void): void;
|
|
9
|
+
removeRecursively(callback: () => void, errorCallback: (error: any) => void): void;
|
|
10
|
+
createReader(): IDirectoryReader;
|
|
11
|
+
getDirectory?(path: string, options: {
|
|
12
|
+
create: boolean;
|
|
13
|
+
}, callback: (entry: IFileEntry) => void, errorCallback: (error: any) => void): void;
|
|
14
|
+
getFile?(path: string, options: {
|
|
15
|
+
create: boolean;
|
|
16
|
+
}, callback: (entry: IFileEntry) => void, errorCallback: (error: any) => void): void;
|
|
17
|
+
file?(callback: (file: File) => void, errorCallback: (error: any) => void): void;
|
|
18
|
+
createWriter?(callback: (writer: any) => void, errorCallback: (error: any) => void): void;
|
|
19
|
+
}
|
|
20
|
+
export declare class FileService {
|
|
21
|
+
getDocumentDirectory(): string;
|
|
22
|
+
resolveLocalFileSystemURL(url: string): Promise<IFileEntry>;
|
|
23
|
+
getFolderBasedOnUserId(userId: string): Promise<string>;
|
|
24
|
+
deleteUserFolder(userId: string): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Reads an external file as ArrayBuffer using IFileEntry API
|
|
27
|
+
* @param filePath Absolute path to the file
|
|
28
|
+
*/
|
|
29
|
+
readExternalFile(filePath: string): Promise<ArrayBuffer>;
|
|
30
|
+
/**
|
|
31
|
+
* Writes data to an external file using IFileEntry API
|
|
32
|
+
* @param filePath Parent directory path
|
|
33
|
+
* @param fileName File name
|
|
34
|
+
* @param data Data to write (ArrayBuffer or string)
|
|
35
|
+
*/
|
|
36
|
+
writeExternalFile(filePath: string, fileName: string, data: ArrayBuffer | string): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Deletes an external file using IFileEntry API
|
|
39
|
+
* @param filePath Absolute path to the file
|
|
40
|
+
*/
|
|
41
|
+
deleteExternalFile(filePath: string): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Checks if a file exists using IFileEntry API
|
|
44
|
+
* @param filePath Absolute path to the file
|
|
45
|
+
*/
|
|
46
|
+
fileExists(filePath: string): Promise<boolean>;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=FileService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileService.d.ts","sourceRoot":"","sources":["../../../src/lib/file/FileService.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC7B,WAAW,CAAC,eAAe,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,EAAE,aAAa,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAAC;CAC5G;AAED,MAAM,WAAW,UAAU;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,aAAa,EAAE,CAAC,KAAK,EAAE,G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AE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAgC9D;;;;;OAKG;IACG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsDtG;;;OAGG;IACG,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWzD;;;OAGG;IACG,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CASvD"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.FileService = void 0;
|
|
37
|
+
const unvired_ts_core_sdk_1 = require("@unvired/unvired-ts-core-sdk");
|
|
38
|
+
class FileService {
|
|
39
|
+
getDocumentDirectory() {
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
return unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getDocumentDirectory();
|
|
42
|
+
}
|
|
43
|
+
resolveLocalFileSystemURL(url) {
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
return unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().resolveLocalFileSystemURL(url);
|
|
46
|
+
}
|
|
47
|
+
async getFolderBasedOnUserId(userId) {
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
return await unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getFolderBasedOnUserId(userId);
|
|
50
|
+
}
|
|
51
|
+
async deleteUserFolder(userId) {
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
await unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().deleteUserFolder(userId);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Reads an external file as ArrayBuffer using IFileEntry API
|
|
57
|
+
* @param filePath Absolute path to the file
|
|
58
|
+
*/
|
|
59
|
+
async readExternalFile(filePath) {
|
|
60
|
+
// Get the file entry
|
|
61
|
+
const fileEntry = await this.resolveLocalFileSystemURL(filePath);
|
|
62
|
+
return new Promise((resolve, reject) => {
|
|
63
|
+
// Use the file() method to read the file
|
|
64
|
+
if (!fileEntry.file) {
|
|
65
|
+
reject(new Error('file() method not available on entry'));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
fileEntry.file(async (fileMetadata) => {
|
|
69
|
+
try {
|
|
70
|
+
// Read the file using react-native-fs
|
|
71
|
+
const RNFS = await Promise.resolve().then(() => __importStar(require('react-native-fs')));
|
|
72
|
+
const content = await RNFS.readFile(fileMetadata.path, 'utf8');
|
|
73
|
+
// Convert string to ArrayBuffer
|
|
74
|
+
const encoder = new TextEncoder();
|
|
75
|
+
resolve(encoder.encode(content).buffer);
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
reject(error);
|
|
79
|
+
}
|
|
80
|
+
}, (error) => {
|
|
81
|
+
reject(error);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Writes data to an external file using IFileEntry API
|
|
87
|
+
* @param filePath Parent directory path
|
|
88
|
+
* @param fileName File name
|
|
89
|
+
* @param data Data to write (ArrayBuffer or string)
|
|
90
|
+
*/
|
|
91
|
+
async writeExternalFile(filePath, fileName, data) {
|
|
92
|
+
// Convert data to string if it's ArrayBuffer
|
|
93
|
+
let content;
|
|
94
|
+
if (data instanceof ArrayBuffer) {
|
|
95
|
+
const decoder = new TextDecoder();
|
|
96
|
+
content = decoder.decode(data);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
content = data;
|
|
100
|
+
}
|
|
101
|
+
// Get the directory entry
|
|
102
|
+
const dirEntry = await this.resolveLocalFileSystemURL(filePath);
|
|
103
|
+
return new Promise((resolve, reject) => {
|
|
104
|
+
// Get or create the file
|
|
105
|
+
if (!dirEntry.getFile) {
|
|
106
|
+
reject(new Error('getFile() method not available on directory entry'));
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
dirEntry.getFile(fileName, { create: true }, (fileEntry) => {
|
|
110
|
+
// Create a writer
|
|
111
|
+
if (!fileEntry.createWriter) {
|
|
112
|
+
reject(new Error('createWriter() method not available on file entry'));
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
fileEntry.createWriter((writer) => {
|
|
116
|
+
writer.onwriteend = () => {
|
|
117
|
+
resolve();
|
|
118
|
+
};
|
|
119
|
+
writer.onerror = (error) => {
|
|
120
|
+
reject(error);
|
|
121
|
+
};
|
|
122
|
+
// Write the content
|
|
123
|
+
writer.write(content);
|
|
124
|
+
}, (error) => {
|
|
125
|
+
reject(error);
|
|
126
|
+
});
|
|
127
|
+
}, (error) => {
|
|
128
|
+
reject(error);
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Deletes an external file using IFileEntry API
|
|
134
|
+
* @param filePath Absolute path to the file
|
|
135
|
+
*/
|
|
136
|
+
async deleteExternalFile(filePath) {
|
|
137
|
+
const fileEntry = await this.resolveLocalFileSystemURL(filePath);
|
|
138
|
+
return new Promise((resolve, reject) => {
|
|
139
|
+
fileEntry.remove(() => resolve(), (error) => reject(error));
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Checks if a file exists using IFileEntry API
|
|
144
|
+
* @param filePath Absolute path to the file
|
|
145
|
+
*/
|
|
146
|
+
async fileExists(filePath) {
|
|
147
|
+
try {
|
|
148
|
+
await this.resolveLocalFileSystemURL(filePath);
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
exports.FileService = FileService;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export declare class LoggerService {
|
|
2
|
+
/**
|
|
3
|
+
* Log Information
|
|
4
|
+
* @param className Class Name
|
|
5
|
+
* @param methodName Method Name
|
|
6
|
+
* @param message Message
|
|
7
|
+
*/
|
|
8
|
+
info(className: string, methodName: string, message: string): void;
|
|
9
|
+
/**
|
|
10
|
+
* Log Error
|
|
11
|
+
* @param className Class Name
|
|
12
|
+
* @param methodName Method Name
|
|
13
|
+
* @param message Message
|
|
14
|
+
*/
|
|
15
|
+
error(className: string, methodName: string, message: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* Log Debug
|
|
18
|
+
* @param className Class Name
|
|
19
|
+
* @param methodName Method Name
|
|
20
|
+
* @param message Message
|
|
21
|
+
*/
|
|
22
|
+
debug(className: string, methodName: string, message: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* Set Log Level
|
|
25
|
+
* @param level Log Level
|
|
26
|
+
*/
|
|
27
|
+
setLogLevel(level: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* Get Log File URL
|
|
30
|
+
*/
|
|
31
|
+
getLogFileURL(): Promise<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Get Log File Content
|
|
34
|
+
*/
|
|
35
|
+
getLogFileContent(): Promise<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Get Backup Log File Content
|
|
38
|
+
*/
|
|
39
|
+
getBackupLogFileContent(): Promise<string>;
|
|
40
|
+
/**
|
|
41
|
+
* Clear Log File
|
|
42
|
+
*/
|
|
43
|
+
clearLogFile(): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=LoggerService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoggerService.d.ts","sourceRoot":"","sources":["../../../src/lib/logger/LoggerService.ts"],"names":[],"mappings":"AAEA,qBAAa,aAAa;IAEtB;;;;;OAKG;IACH,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAIlE;;;;;OAKG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAInE;;;;;OAKG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAInE;;;OAGG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIhC;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAItC;;OAEG;IACG,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC;IAI1C;;OAEG;IACG,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC;IAIhD;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAGtC"}
|