@unvired/react-native-wrapper-sdk 0.0.13 → 0.0.15
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 +86 -0
- package/dist/lib/database/DatabaseService.d.ts.map +1 -0
- package/dist/lib/database/DatabaseService.js +134 -0
- package/dist/lib/file/FileService.d.ts +72 -0
- package/dist/lib/file/FileService.d.ts.map +1 -0
- package/dist/lib/file/FileService.js +136 -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 +41 -0
- package/dist/lib/settings/SettingsService.d.ts.map +1 -0
- package/dist/lib/settings/SettingsService.js +108 -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 +3 -3
- package/src/UnviredWrapper.ts +34 -52
- package/src/lib/auth/AuthService.ts +45 -0
- package/src/lib/database/DatabaseService.ts +148 -0
- package/src/lib/file/FileService.ts +149 -0
- package/src/lib/logger/LoggerService.ts +70 -0
- package/src/lib/notification/NotificationService.ts +45 -0
- package/src/lib/settings/SettingsService.ts +126 -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,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,OAAO,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AAO,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,86 @@
|
|
|
1
|
+
export declare class DatabaseService {
|
|
2
|
+
private db;
|
|
3
|
+
constructor();
|
|
4
|
+
/**
|
|
5
|
+
* Selects data from the database
|
|
6
|
+
* @param tableName Name of the table
|
|
7
|
+
* @param whereClause Optional SQL where clause
|
|
8
|
+
*/
|
|
9
|
+
select(tableName: string, whereClause?: string): Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* Inserts data into the database
|
|
12
|
+
* @param tableName Name of the table
|
|
13
|
+
* @param structureObject Data object to insert
|
|
14
|
+
* @param isHeader Whether the data is a header or an item
|
|
15
|
+
*/
|
|
16
|
+
insert(tableName: string, structureObject: any, isHeader: boolean): Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* Inserts or updates data in the database
|
|
19
|
+
* @param tableName Name of the table
|
|
20
|
+
* @param structureObject Data object to insert or update
|
|
21
|
+
* @param isHeader Whether the data is a header or an item
|
|
22
|
+
*/
|
|
23
|
+
insertOrUpdate(tableName: string, structureObject: any, isHeader: boolean): Promise<any>;
|
|
24
|
+
/**
|
|
25
|
+
* Deletes data from the database
|
|
26
|
+
* @param tableName Name of the table
|
|
27
|
+
* @param whereClause Optional SQL where clause
|
|
28
|
+
*/
|
|
29
|
+
delete(tableName: string, whereClause?: string): Promise<any>;
|
|
30
|
+
/**
|
|
31
|
+
* Updates data in the database
|
|
32
|
+
* @param tableName Name of the table
|
|
33
|
+
* @param updatedObject Object with updated values
|
|
34
|
+
* @param whereClause SQL where clause identifying rows to update
|
|
35
|
+
*/
|
|
36
|
+
update(tableName: string, updatedObject: any, whereClause: any): Promise<any>;
|
|
37
|
+
/**
|
|
38
|
+
* Executes a raw SQL statement
|
|
39
|
+
* @param query SQL query
|
|
40
|
+
*/
|
|
41
|
+
executeStatement(query: string): Promise<any>;
|
|
42
|
+
/**
|
|
43
|
+
* Begins a transaction
|
|
44
|
+
*/
|
|
45
|
+
beginTransaction(): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Ends (commits) a transaction
|
|
48
|
+
*/
|
|
49
|
+
endTransaction(): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Rolls back a transaction
|
|
52
|
+
*/
|
|
53
|
+
rollbackTransaction(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Creates a save point
|
|
56
|
+
* @param savePoint Name of the save point
|
|
57
|
+
*/
|
|
58
|
+
createSavePoint(savePoint: string): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Releases a save point
|
|
61
|
+
* @param savePoint Name of the save point
|
|
62
|
+
*/
|
|
63
|
+
releaseSavePoint(savePoint: string): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Rolls back to a save point
|
|
66
|
+
* @param savePoint Name of the save point
|
|
67
|
+
*/
|
|
68
|
+
rollbackToSavePoint(savePoint: string): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Saves Web Data (Browser only)
|
|
71
|
+
*/
|
|
72
|
+
saveWebData(): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Exports Web Data
|
|
75
|
+
*/
|
|
76
|
+
exportWebData(): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Prepares database for export
|
|
79
|
+
*/
|
|
80
|
+
prepareDatabaseForExport(): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Gets the database directory path
|
|
83
|
+
*/
|
|
84
|
+
getDatabasePath(): Promise<string>;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=DatabaseService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatabaseService.d.ts","sourceRoot":"","sources":["../../../src/lib/database/DatabaseService.ts"],"names":[],"mappings":"AAEA,qBAAa,eAAe;IACxB,OAAO,CAAC,EAAE,CAAqB;;IAM/B;;;;OAIG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAInE;;;;;OAKG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;IAItF;;;;;OAKG;IACG,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;IAI9F;;;;OAIG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAInE;;;;;OAKG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAInF;;;OAGG;IACG,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAInD;;OAEG;IACG,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIvC;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrC;;OAEG;IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C;;;OAGG;IACG,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvD;;;OAGG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxD;;;OAGG;IACG,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3D;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAMlC;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAIpC;;OAEG;IACG,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/C;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;CAW3C"}
|
|
@@ -0,0 +1,134 @@
|
|
|
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
|
+
constructor() {
|
|
7
|
+
this.db = unvired_ts_core_sdk_1.AppDatabaseManager.getInstance();
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Selects data from the database
|
|
11
|
+
* @param tableName Name of the table
|
|
12
|
+
* @param whereClause Optional SQL where clause
|
|
13
|
+
*/
|
|
14
|
+
async select(tableName, whereClause) {
|
|
15
|
+
return this.db.select(tableName, whereClause);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Inserts data into the database
|
|
19
|
+
* @param tableName Name of the table
|
|
20
|
+
* @param structureObject Data object to insert
|
|
21
|
+
* @param isHeader Whether the data is a header or an item
|
|
22
|
+
*/
|
|
23
|
+
async insert(tableName, structureObject, isHeader) {
|
|
24
|
+
return this.db.insert(tableName, structureObject, isHeader);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Inserts or updates data in the database
|
|
28
|
+
* @param tableName Name of the table
|
|
29
|
+
* @param structureObject Data object to insert or update
|
|
30
|
+
* @param isHeader Whether the data is a header or an item
|
|
31
|
+
*/
|
|
32
|
+
async insertOrUpdate(tableName, structureObject, isHeader) {
|
|
33
|
+
return this.db.insertOrUpdate(tableName, structureObject, isHeader);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Deletes data from the database
|
|
37
|
+
* @param tableName Name of the table
|
|
38
|
+
* @param whereClause Optional SQL where clause
|
|
39
|
+
*/
|
|
40
|
+
async delete(tableName, whereClause) {
|
|
41
|
+
return this.db.delete(tableName, whereClause);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Updates data in the database
|
|
45
|
+
* @param tableName Name of the table
|
|
46
|
+
* @param updatedObject Object with updated values
|
|
47
|
+
* @param whereClause SQL where clause identifying rows to update
|
|
48
|
+
*/
|
|
49
|
+
async update(tableName, updatedObject, whereClause) {
|
|
50
|
+
return this.db.update(tableName, updatedObject, whereClause);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Executes a raw SQL statement
|
|
54
|
+
* @param query SQL query
|
|
55
|
+
*/
|
|
56
|
+
async executeStatement(query) {
|
|
57
|
+
return this.db.executeStatement(query);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Begins a transaction
|
|
61
|
+
*/
|
|
62
|
+
async beginTransaction() {
|
|
63
|
+
return this.db.beginTransaction();
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Ends (commits) a transaction
|
|
67
|
+
*/
|
|
68
|
+
async endTransaction() {
|
|
69
|
+
return this.db.endTransaction();
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Rolls back a transaction
|
|
73
|
+
*/
|
|
74
|
+
async rollbackTransaction() {
|
|
75
|
+
return this.db.rollbackTransaction();
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Creates a save point
|
|
79
|
+
* @param savePoint Name of the save point
|
|
80
|
+
*/
|
|
81
|
+
async createSavePoint(savePoint) {
|
|
82
|
+
return this.db.createSavePoint(savePoint);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Releases a save point
|
|
86
|
+
* @param savePoint Name of the save point
|
|
87
|
+
*/
|
|
88
|
+
async releaseSavePoint(savePoint) {
|
|
89
|
+
return this.db.releaseSavePoint(savePoint);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Rolls back to a save point
|
|
93
|
+
* @param savePoint Name of the save point
|
|
94
|
+
*/
|
|
95
|
+
async rollbackToSavePoint(savePoint) {
|
|
96
|
+
return this.db.rollbackToSavePoint(savePoint);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Saves Web Data (Browser only)
|
|
100
|
+
*/
|
|
101
|
+
async saveWebData() {
|
|
102
|
+
if (unvired_ts_core_sdk_1.FrameworkHelper.getPlatform() === 'browser') {
|
|
103
|
+
return unvired_ts_core_sdk_1.DatabaseManager.getInstance().saveWebData();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Exports Web Data
|
|
108
|
+
*/
|
|
109
|
+
async exportWebData() {
|
|
110
|
+
return unvired_ts_core_sdk_1.DatabaseManager.getInstance().exportWebData();
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Prepares database for export
|
|
114
|
+
*/
|
|
115
|
+
async prepareDatabaseForExport() {
|
|
116
|
+
return unvired_ts_core_sdk_1.SettingsHelper.prepareDatabaseForExport();
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Gets the database directory path
|
|
120
|
+
*/
|
|
121
|
+
async getDatabasePath() {
|
|
122
|
+
return new Promise((resolve, reject) => {
|
|
123
|
+
try {
|
|
124
|
+
const adapter = unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getDatabaseAdapter();
|
|
125
|
+
// @ts-ignore - The type might be mismatch in d.ts but logical flow is correct
|
|
126
|
+
adapter.getDBFilePath({ dbType: unvired_ts_core_sdk_1.DatabaseType.AppDb }, (path) => resolve(path));
|
|
127
|
+
}
|
|
128
|
+
catch (e) {
|
|
129
|
+
reject(e);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.DatabaseService = DatabaseService;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export declare class FileService {
|
|
2
|
+
/**
|
|
3
|
+
* Gets the directory used for storing attachments
|
|
4
|
+
*/
|
|
5
|
+
getAttachmentDirectory(): Promise<string>;
|
|
6
|
+
/**
|
|
7
|
+
* Adds an attachment
|
|
8
|
+
* @param attachmentName Name of the attachment
|
|
9
|
+
* @param attachmentData Data as ArrayBuffer
|
|
10
|
+
*/
|
|
11
|
+
addAttachment(attachmentName: string, attachmentData: ArrayBuffer): Promise<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Gets an attachment's data
|
|
14
|
+
* @param attachmentName Name of the attachment
|
|
15
|
+
*/
|
|
16
|
+
getAttachment(attachmentName: string): Promise<ArrayBuffer>;
|
|
17
|
+
/**
|
|
18
|
+
* Deletes an attachment
|
|
19
|
+
* @param attachmentName Name of the attachment
|
|
20
|
+
*/
|
|
21
|
+
deleteAttachment(attachmentName: string): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Gets the file system path of an attachment
|
|
24
|
+
* @param attachmentName Name of the attachment
|
|
25
|
+
*/
|
|
26
|
+
getAttachmentPath(attachmentName: string): Promise<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Reads a file from the filesystem as ArrayBuffer
|
|
29
|
+
* @param filePath Absolute path to the file
|
|
30
|
+
*/
|
|
31
|
+
readFileAsArrayBuffer(filePath: string): Promise<ArrayBuffer>;
|
|
32
|
+
/**
|
|
33
|
+
* Checks if a file exists
|
|
34
|
+
* @param filePath Absolute path to the file
|
|
35
|
+
*/
|
|
36
|
+
fileExists(filePath: string): Promise<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* Reads an external file
|
|
39
|
+
* @param filePath Absolute path to the file
|
|
40
|
+
*/
|
|
41
|
+
readExternalFile(filePath: string): Promise<ArrayBuffer>;
|
|
42
|
+
/**
|
|
43
|
+
* Writes data to an external file
|
|
44
|
+
* @param filePath Parent directory path
|
|
45
|
+
* @param fileName File name
|
|
46
|
+
* @param data Data to write
|
|
47
|
+
*/
|
|
48
|
+
writeExternalFile(filePath: string, fileName: string, data: ArrayBuffer): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Deletes an external file
|
|
51
|
+
* @param filePath Absolute path to the file
|
|
52
|
+
*/
|
|
53
|
+
deleteExternalFile(filePath: string): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Create Attachment Item - Copies file to attachment folder and inserts record in DB
|
|
56
|
+
* @param tableName Table name for attachment
|
|
57
|
+
* @param structureObject Attachment item object
|
|
58
|
+
*/
|
|
59
|
+
createAttachmentItem(tableName: string, structureObject: any): Promise<any>;
|
|
60
|
+
/**
|
|
61
|
+
* Queues an attachment for download
|
|
62
|
+
* @param tableName Table name
|
|
63
|
+
* @param structureObject Structure object
|
|
64
|
+
*/
|
|
65
|
+
downloadAttachment(tableName: string, structureObject: any): Promise<any>;
|
|
66
|
+
/**
|
|
67
|
+
* Downloads an attachment synchronously (waits for completion)
|
|
68
|
+
* @param structureObject Structure object with UID and FileName
|
|
69
|
+
*/
|
|
70
|
+
downloadAttachmentSync(structureObject: any): Promise<any>;
|
|
71
|
+
}
|
|
72
|
+
//# 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,qBAAa,WAAW;IAKpB;;OAEG;IACG,sBAAsB,IAAI,OAAO,CAAC,MAAM,CAAC;IAQ/C;;;;OAIG;IACG,aAAa,CAAC,cAAc,EAAE,MAAM,EAAE,cA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