@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.
Files changed (42) hide show
  1. package/dist/UnviredWrapper.d.ts +25 -22
  2. package/dist/UnviredWrapper.d.ts.map +1 -1
  3. package/dist/UnviredWrapper.js +32 -48
  4. package/dist/lib/auth/AuthBuilder.d.ts.map +1 -0
  5. package/dist/lib/auth/AuthService.d.ts +27 -0
  6. package/dist/lib/auth/AuthService.d.ts.map +1 -0
  7. package/dist/lib/auth/AuthService.js +46 -0
  8. package/dist/lib/database/DatabaseService.d.ts +43 -0
  9. package/dist/lib/database/DatabaseService.d.ts.map +1 -0
  10. package/dist/lib/database/DatabaseService.js +34 -0
  11. package/dist/lib/file/FileService.d.ts +48 -0
  12. package/dist/lib/file/FileService.d.ts.map +1 -0
  13. package/dist/lib/file/FileService.js +156 -0
  14. package/dist/lib/logger/LoggerService.d.ts +45 -0
  15. package/dist/lib/logger/LoggerService.d.ts.map +1 -0
  16. package/dist/lib/logger/LoggerService.js +65 -0
  17. package/dist/lib/notification/NotificationService.d.ts +28 -0
  18. package/dist/lib/notification/NotificationService.d.ts.map +1 -0
  19. package/dist/lib/notification/NotificationService.js +47 -0
  20. package/dist/lib/settings/SettingsService.d.ts +44 -0
  21. package/dist/lib/settings/SettingsService.d.ts.map +1 -0
  22. package/dist/lib/settings/SettingsService.js +120 -0
  23. package/dist/lib/storage/StorageService.d.ts +13 -0
  24. package/dist/lib/storage/StorageService.d.ts.map +1 -0
  25. package/dist/lib/storage/StorageService.js +19 -0
  26. package/dist/lib/sync/SyncService.d.ts +96 -0
  27. package/dist/lib/sync/SyncService.d.ts.map +1 -0
  28. package/dist/lib/sync/SyncService.js +139 -0
  29. package/package.json +11 -6
  30. package/src/UnviredWrapper.ts +34 -52
  31. package/src/lib/auth/AuthService.ts +45 -0
  32. package/src/lib/database/DatabaseService.ts +53 -0
  33. package/src/lib/file/FileService.ts +166 -0
  34. package/src/lib/logger/LoggerService.ts +70 -0
  35. package/src/lib/notification/NotificationService.ts +45 -0
  36. package/src/lib/settings/SettingsService.ts +150 -0
  37. package/src/lib/storage/StorageService.ts +27 -0
  38. package/src/lib/sync/SyncService.ts +160 -0
  39. package/dist/lib/AuthBuilder.d.ts.map +0 -1
  40. /package/dist/lib/{AuthBuilder.d.ts → auth/AuthBuilder.d.ts} +0 -0
  41. /package/dist/lib/{AuthBuilder.js → auth/AuthBuilder.js} +0 -0
  42. /package/src/lib/{AuthBuilder.ts → auth/AuthBuilder.ts} +0 -0
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LoggerService = void 0;
4
+ const unvired_ts_core_sdk_1 = require("@unvired/unvired-ts-core-sdk");
5
+ class LoggerService {
6
+ /**
7
+ * Log Information
8
+ * @param className Class Name
9
+ * @param methodName Method Name
10
+ * @param message Message
11
+ */
12
+ info(className, methodName, message) {
13
+ unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().logInfo(className, methodName, message);
14
+ }
15
+ /**
16
+ * Log Error
17
+ * @param className Class Name
18
+ * @param methodName Method Name
19
+ * @param message Message
20
+ */
21
+ error(className, methodName, message) {
22
+ unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().logError(className, methodName, message);
23
+ }
24
+ /**
25
+ * Log Debug
26
+ * @param className Class Name
27
+ * @param methodName Method Name
28
+ * @param message Message
29
+ */
30
+ debug(className, methodName, message) {
31
+ unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().logDebug(className, methodName, message);
32
+ }
33
+ /**
34
+ * Set Log Level
35
+ * @param level Log Level
36
+ */
37
+ setLogLevel(level) {
38
+ unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().setLogLevel(level);
39
+ }
40
+ /**
41
+ * Get Log File URL
42
+ */
43
+ async getLogFileURL() {
44
+ return unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().getLogFileURL();
45
+ }
46
+ /**
47
+ * Get Log File Content
48
+ */
49
+ async getLogFileContent() {
50
+ return unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().getLogFileContent();
51
+ }
52
+ /**
53
+ * Get Backup Log File Content
54
+ */
55
+ async getBackupLogFileContent() {
56
+ return unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().getBackupLogFileContent();
57
+ }
58
+ /**
59
+ * Clear Log File
60
+ */
61
+ async clearLogFile() {
62
+ return unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getLoggerAdapter().clearLogFile();
63
+ }
64
+ }
65
+ exports.LoggerService = LoggerService;
@@ -0,0 +1,28 @@
1
+ export declare class NotificationService {
2
+ private get adapter();
3
+ /**
4
+ * Requests permission and gets token
5
+ */
6
+ requestPermission(options?: {
7
+ forceShow: boolean;
8
+ }): Promise<void>;
9
+ /**
10
+ * Gets the push token
11
+ */
12
+ getToken(): Promise<string | undefined>;
13
+ /**
14
+ * Sets callback for token refresh
15
+ */
16
+ onTokenRefresh(callback: (token: string) => void): void;
17
+ /**
18
+ * Sets listener for incoming notifications (foreground)
19
+ * @param onMessage Callback when a notification is received
20
+ */
21
+ onNotificationReceived(onMessage: (data: any) => void): void;
22
+ /**
23
+ * Sets listener for incoming notifications (background)
24
+ * @param onMessage Callback when a notification is received
25
+ */
26
+ onBackgroundNotificationReceived(onMessage: (data: any) => void): void;
27
+ }
28
+ //# sourceMappingURL=NotificationService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationService.d.ts","sourceRoot":"","sources":["../../../src/lib/notification/NotificationService.ts"],"names":[],"mappings":"AAEA,qBAAa,mBAAmB;IAE5B,OAAO,KAAK,OAAO,GAElB;IAED;;OAEG;IACG,iBAAiB,CAAC,OAAO,CAAC,EAAE;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxE;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAI7C;;OAEG;IACH,cAAc,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAIvD;;;OAGG;IACH,sBAAsB,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;IAI5D;;;OAGG;IACH,gCAAgC,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;CAGzE"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotificationService = void 0;
4
+ const unvired_ts_core_sdk_1 = require("@unvired/unvired-ts-core-sdk");
5
+ class NotificationService {
6
+ get adapter() {
7
+ return unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getPushNotificationAdapter();
8
+ }
9
+ /**
10
+ * Requests permission and gets token
11
+ */
12
+ async requestPermission(options) {
13
+ var _a;
14
+ return (_a = this.adapter) === null || _a === void 0 ? void 0 : _a.requestPermission(options);
15
+ }
16
+ /**
17
+ * Gets the push token
18
+ */
19
+ async getToken() {
20
+ var _a;
21
+ return (_a = this.adapter) === null || _a === void 0 ? void 0 : _a.getToken();
22
+ }
23
+ /**
24
+ * Sets callback for token refresh
25
+ */
26
+ onTokenRefresh(callback) {
27
+ var _a;
28
+ (_a = this.adapter) === null || _a === void 0 ? void 0 : _a.onTokenRefresh(callback);
29
+ }
30
+ /**
31
+ * Sets listener for incoming notifications (foreground)
32
+ * @param onMessage Callback when a notification is received
33
+ */
34
+ onNotificationReceived(onMessage) {
35
+ var _a;
36
+ (_a = this.adapter) === null || _a === void 0 ? void 0 : _a.onMessage(onMessage);
37
+ }
38
+ /**
39
+ * Sets listener for incoming notifications (background)
40
+ * @param onMessage Callback when a notification is received
41
+ */
42
+ onBackgroundNotificationReceived(onMessage) {
43
+ var _a;
44
+ (_a = this.adapter) === null || _a === void 0 ? void 0 : _a.onBackgroundMessage(onMessage);
45
+ }
46
+ }
47
+ exports.NotificationService = NotificationService;
@@ -0,0 +1,44 @@
1
+ export declare class SettingsService {
2
+ /**
3
+ * Get current log level
4
+ */
5
+ getLogLevel(): Promise<string>;
6
+ getDeviceInfo(): string;
7
+ getPlatform(): string;
8
+ getFrontendType(): string;
9
+ /**
10
+ * Set log level
11
+ * @param logLevel Log Level
12
+ */
13
+ setLogLevel(logLevel: string): Promise<void>;
14
+ /**
15
+ * Send logs to server
16
+ */
17
+ sendLogToServer(): Promise<void>;
18
+ /**
19
+ * Create and get Log Zip path (for email etc)
20
+ */
21
+ getLogZipPath(): Promise<string>;
22
+ /**
23
+ * Test Push Notification
24
+ */
25
+ testPushNotification(): Promise<void>;
26
+ /**
27
+ * Get list of Info Messages
28
+ */
29
+ getInfoMessages(headerName: string, lid: string): Promise<any[]>;
30
+ /**
31
+ * Get User Settings / Current Account Information
32
+ */
33
+ getUserSettings(): Promise<any>;
34
+ /**
35
+ * Set Auth Token
36
+ * @param token JWT Token
37
+ */
38
+ setAuthToken(token: string): Promise<void>;
39
+ /**
40
+ * Get Auth Token Validity (remaining seconds)
41
+ */
42
+ getAuthTokenValidity(): Promise<number>;
43
+ }
44
+ //# sourceMappingURL=SettingsService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SettingsService.d.ts","sourceRoot":"","sources":["../../../src/lib/settings/SettingsService.ts"],"names":[],"mappings":"AAYA,qBAAa,eAAe;IAC1B;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAIpC,aAAa,IAAI,MAAM;IAKvB,WAAW,IAAI,MAAM;IAKrB,eAAe,IAAI,MAAM;IAIzB;;;OAGG;IACG,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlD;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAItC;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAItC;;OAEG;IACG,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3C;;OAEG;IACG,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAItE;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC;IA4CrC;;;OAGG;IACG,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKhD;;OAEG;IACG,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC;CAoB9C"}
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SettingsService = void 0;
4
+ const unvired_ts_core_sdk_1 = require("@unvired/unvired-ts-core-sdk");
5
+ class SettingsService {
6
+ /**
7
+ * Get current log level
8
+ */
9
+ async getLogLevel() {
10
+ return unvired_ts_core_sdk_1.FrameworkSettingsManager.getInstance().getFieldValue(unvired_ts_core_sdk_1.FrameworkSettingsFields.logLevel);
11
+ }
12
+ getDeviceInfo() {
13
+ // @ts-ignore
14
+ return unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getDeviceInfo();
15
+ }
16
+ getPlatform() {
17
+ // @ts-ignore
18
+ return unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getPlatform();
19
+ }
20
+ getFrontendType() {
21
+ // @ts-ignore
22
+ return unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getFrontendType();
23
+ }
24
+ /**
25
+ * Set log level
26
+ * @param logLevel Log Level
27
+ */
28
+ async setLogLevel(logLevel) {
29
+ return unvired_ts_core_sdk_1.SettingsHelper.setLogLevel(logLevel);
30
+ }
31
+ /**
32
+ * Send logs to server
33
+ */
34
+ async sendLogToServer() {
35
+ return unvired_ts_core_sdk_1.SettingsHelper.sendLogsToServer();
36
+ }
37
+ /**
38
+ * Create and get Log Zip path (for email etc)
39
+ */
40
+ async getLogZipPath() {
41
+ return unvired_ts_core_sdk_1.SettingsHelper.createAndGetLogZipPath();
42
+ }
43
+ /**
44
+ * Test Push Notification
45
+ */
46
+ async testPushNotification() {
47
+ return unvired_ts_core_sdk_1.SettingsHelper.testPushNotification();
48
+ }
49
+ /**
50
+ * Get list of Info Messages
51
+ */
52
+ async getInfoMessages(headerName, lid) {
53
+ return unvired_ts_core_sdk_1.SettingsHelper.getInfoMessages(headerName, lid);
54
+ }
55
+ /**
56
+ * Get User Settings / Current Account Information
57
+ */
58
+ async getUserSettings() {
59
+ const unviredAccount = unvired_ts_core_sdk_1.UnviredAccountManager.getInstance().getLastLoggedInAccount();
60
+ if (!unviredAccount) {
61
+ throw new Error('No account found');
62
+ }
63
+ let jwtToken = unvired_ts_core_sdk_1.AuthenticationService.instance.jwtToken;
64
+ // Fallback or re-fetch token logic
65
+ if (!jwtToken) {
66
+ jwtToken = unviredAccount.getJwtToken();
67
+ }
68
+ const serverType = await unvired_ts_core_sdk_1.FrameworkSettingsManager.getInstance().getFieldValue(unvired_ts_core_sdk_1.FrameworkSettingsFields.serverType);
69
+ const emailId = await unvired_ts_core_sdk_1.FrameworkSettingsManager.getInstance().getFieldValue(unvired_ts_core_sdk_1.FrameworkSettingsFields.email);
70
+ const unviredUserId = await unvired_ts_core_sdk_1.UserSettingsManager.getInstance().getFieldValue(unvired_ts_core_sdk_1.UserSettingsFields.unviredUserId);
71
+ const unviredPassword = await unvired_ts_core_sdk_1.UserSettingsManager.getInstance().getFieldValue(unvired_ts_core_sdk_1.UserSettingsFields.unviredPassword);
72
+ // Accessing loginParameters from AuthenticationService might need cast if it's protected/private or simply public
73
+ // index.d.ts says: loginParameters: any;
74
+ const loginParams = unvired_ts_core_sdk_1.AuthenticationService.instance.loginParameters || {};
75
+ return {
76
+ UNVIRED_ID: unviredUserId,
77
+ USER_ID: loginParams.username || unviredUserId,
78
+ FIRST_NAME: unviredAccount.getFirstName(),
79
+ LAST_NAME: unviredAccount.getLastName(),
80
+ FULL_NAME: `${unviredAccount.getFirstName()} ${unviredAccount.getLastName()}`,
81
+ EMAIL: emailId || '',
82
+ SERVER_URL: unviredAccount.getServerURL(),
83
+ SERVER_TYPE: serverType || '',
84
+ LOGIN_TYPE: loginParams.loginType,
85
+ UNVIRED_PASSWORD: unviredPassword || '',
86
+ JWT_TOKEN: jwtToken,
87
+ };
88
+ }
89
+ /**
90
+ * Set Auth Token
91
+ * @param token JWT Token
92
+ */
93
+ async setAuthToken(token) {
94
+ unvired_ts_core_sdk_1.AuthenticationService.instance.jwtToken = token;
95
+ await unvired_ts_core_sdk_1.UserSettingsManager.getInstance().setFieldValue(unvired_ts_core_sdk_1.UserSettingsFields.jwtToken, token);
96
+ }
97
+ /**
98
+ * Get Auth Token Validity (remaining seconds)
99
+ */
100
+ async getAuthTokenValidity() {
101
+ const token = await unvired_ts_core_sdk_1.UserSettingsManager.getInstance().getFieldValue(unvired_ts_core_sdk_1.UserSettingsFields.jwtToken);
102
+ if (!token)
103
+ return 0;
104
+ try {
105
+ const parts = token.split('.');
106
+ if (parts.length !== 3)
107
+ return 0;
108
+ const payload = JSON.parse(atob(parts[1]));
109
+ if (!payload.exp)
110
+ return 0;
111
+ const now = Math.floor(Date.now() / 1000);
112
+ const remaining = payload.exp - now;
113
+ return remaining > 0 ? remaining : 0;
114
+ }
115
+ catch (e) {
116
+ return 0;
117
+ }
118
+ }
119
+ }
120
+ exports.SettingsService = SettingsService;
@@ -0,0 +1,13 @@
1
+ export interface IStorageAdapter {
2
+ getItem(key: string): void;
3
+ setItem(key: string, value: string): void;
4
+ removeItem(key: string): void;
5
+ clear(): void;
6
+ }
7
+ export declare class StorageService {
8
+ getItem(key: string): void;
9
+ setItem(key: string, value: string): void;
10
+ removeItem(key: string): void;
11
+ clear(): void;
12
+ }
13
+ //# sourceMappingURL=StorageService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageService.d.ts","sourceRoot":"","sources":["../../../src/lib/storage/StorageService.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC5B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,KAAK,IAAI,IAAI,CAAC;CACjB;AAED,qBAAa,cAAc;IAEvB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI1B,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAIzC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI7B,KAAK,IAAI,IAAI;CAGhB"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StorageService = void 0;
4
+ const unvired_ts_core_sdk_1 = require("@unvired/unvired-ts-core-sdk");
5
+ class StorageService {
6
+ getItem(key) {
7
+ unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getStorageAdapter().getItem(key);
8
+ }
9
+ setItem(key, value) {
10
+ unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getStorageAdapter().setItem(key, value);
11
+ }
12
+ removeItem(key) {
13
+ unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getStorageAdapter().removeItem(key);
14
+ }
15
+ clear() {
16
+ unvired_ts_core_sdk_1.PlatformManager.getInstance().getPlatformAdapter().getStorageAdapter().clear();
17
+ }
18
+ }
19
+ exports.StorageService = StorageService;
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Service for handling Synchronization with Unvired Server
3
+ */
4
+ export declare class SyncService {
5
+ /**
6
+ * Submit data to UMP server in sync mode (Foreground)
7
+ * @param reqType Request Type (RQST/PULL/PUSH/QUERY/REQ)
8
+ * @param header Header Data Structure
9
+ * @param customData Custom data string (optional)
10
+ * @param paFunction Process Agent Function Name
11
+ * @param autoSave Whether to auto-save data in DB
12
+ */
13
+ syncForeground(reqType: any, header: any, customData: string | undefined, paFunction: string, autoSave: boolean): Promise<any>;
14
+ /**
15
+ * Submit data to UMP server in async mode (Background)
16
+ * @param reqType Request Type
17
+ * @param header Header Data Structure
18
+ * @param customData Custom data string (optional)
19
+ * @param paFunction Process Agent Function Name
20
+ * @param beName Business Entity Name
21
+ */
22
+ syncBackground(reqType: any, header: any, customData: string | undefined, paFunction: string, beName: string): Promise<any>;
23
+ /**
24
+ * Sends request for initial data download
25
+ * @param functions List of functions to execute
26
+ */
27
+ sendInitialDataDownloadRequest(functions?: any[]): Promise<void>;
28
+ /**
29
+ * Gets synchronization state
30
+ * @param callback Callback to receive state updates
31
+ */
32
+ getSynchronizationState(callback: (state: string) => void): void;
33
+ /**
34
+ * Starts Inbox Handler
35
+ */
36
+ startInboxHandler(): void;
37
+ /**
38
+ * Starts Data Sender (Outbox Handler)
39
+ */
40
+ startDataSender(): void;
41
+ /**
42
+ * Request for downloading messages from server
43
+ */
44
+ getMessages(): void;
45
+ /**
46
+ * Register for Data Sender notifications
47
+ * @param callback Callback function
48
+ */
49
+ registerDataSenderListener(callback: (data: any) => void): void;
50
+ /**
51
+ * Unregister Data Sender notifications
52
+ */
53
+ unRegisterDataSenderListener(): void;
54
+ /**
55
+ * Register for Sync Items count updates
56
+ * @param callback Callback function
57
+ */
58
+ registerSyncItemsCountListener(callback: (count: any) => void): void;
59
+ /**
60
+ * Check if a BE is in the Outbox queue
61
+ * @param beLid BE Header LID
62
+ */
63
+ isInOutBox(beLid: string): Promise<boolean>;
64
+ /**
65
+ * Check if a BE is in Sent Items
66
+ * @param beLid BE Header LID
67
+ */
68
+ isInSentItem(beLid: string): Promise<boolean>;
69
+ /**
70
+ * Get count of items in Outbox
71
+ */
72
+ outBoxItemCount(): Promise<number>;
73
+ /**
74
+ * Get count of items in Sent Items
75
+ */
76
+ sentItemCount(): Promise<number>;
77
+ /**
78
+ * Get count of items in Inbox
79
+ */
80
+ inBoxItemCount(): Promise<number>;
81
+ /**
82
+ * Delete an entry from Outbox
83
+ * @param beLid BE Header LID
84
+ */
85
+ deleteOutBoxEntry(beLid: string): Promise<any>;
86
+ /**
87
+ * Lock Data Sender for a specific BE
88
+ * @param beLid BE LID
89
+ */
90
+ lockDataSender(beLid: string): Promise<any>;
91
+ /**
92
+ * Unlock Data Sender
93
+ */
94
+ unlockDataSender(): Promise<any>;
95
+ }
96
+ //# sourceMappingURL=SyncService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SyncService.d.ts","sourceRoot":"","sources":["../../../src/lib/sync/SyncService.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,qBAAa,WAAW;IAEpB;;;;;;;OAOG;IACG,cAAc,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,YAAK,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;IAI7H;;;;;;;OAOG;IACG,cAAc,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,YAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAI1H;;;OAGG;IACG,8BAA8B,CAAC,SAAS,GAAE,GAAG,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1E;;;OAGG;IACH,uBAAuB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAMhE;;OAEG;IACH,iBAAiB,IAAI,IAAI;IAKzB;;OAEG;IACH,eAAe,IAAI,IAAI;IAIvB;;OAEG;IACH,WAAW,IAAI,IAAI;IAInB;;;OAGG;IACH,0BAA0B,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;IAI/D;;OAEG;IACH,4BAA4B,IAAI,IAAI;IAIpC;;;OAGG;IACH,8BAA8B,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;IAIpE;;;OAGG;IACG,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIjD;;;OAGG;IACG,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAInD;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;IAIxC;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAItC;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAIvC;;;OAGG;IACG,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAIpD;;;OAGG;IACG,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAIjD;;OAEG;IACG,gBAAgB,IAAI,OAAO,CAAC,GAAG,CAAC;CAGzC"}
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SyncService = void 0;
4
+ const unvired_ts_core_sdk_1 = require("@unvired/unvired-ts-core-sdk");
5
+ /**
6
+ * Service for handling Synchronization with Unvired Server
7
+ */
8
+ class SyncService {
9
+ /**
10
+ * Submit data to UMP server in sync mode (Foreground)
11
+ * @param reqType Request Type (RQST/PULL/PUSH/QUERY/REQ)
12
+ * @param header Header Data Structure
13
+ * @param customData Custom data string (optional)
14
+ * @param paFunction Process Agent Function Name
15
+ * @param autoSave Whether to auto-save data in DB
16
+ */
17
+ async syncForeground(reqType, header, customData = "", paFunction, autoSave) {
18
+ return unvired_ts_core_sdk_1.SyncEngine.syncForeground(reqType, header, customData, paFunction, autoSave);
19
+ }
20
+ /**
21
+ * Submit data to UMP server in async mode (Background)
22
+ * @param reqType Request Type
23
+ * @param header Header Data Structure
24
+ * @param customData Custom data string (optional)
25
+ * @param paFunction Process Agent Function Name
26
+ * @param beName Business Entity Name
27
+ */
28
+ async syncBackground(reqType, header, customData = "", paFunction, beName) {
29
+ return unvired_ts_core_sdk_1.SyncEngine.syncBackground(reqType, header, customData, paFunction, beName);
30
+ }
31
+ /**
32
+ * Sends request for initial data download
33
+ * @param functions List of functions to execute
34
+ */
35
+ async sendInitialDataDownloadRequest(functions = []) {
36
+ return unvired_ts_core_sdk_1.SettingsHelper.requestInitialDataDownload(functions);
37
+ }
38
+ /**
39
+ * Gets synchronization state
40
+ * @param callback Callback to receive state updates
41
+ */
42
+ getSynchronizationState(callback) {
43
+ unvired_ts_core_sdk_1.NotificationListenerHelper.synchronizationStateListener = callback;
44
+ // Initial state
45
+ callback("idle");
46
+ }
47
+ /**
48
+ * Starts Inbox Handler
49
+ */
50
+ startInboxHandler() {
51
+ // Correct usage of SyncEngine as per SDK definition
52
+ unvired_ts_core_sdk_1.SyncEngine.startInboxHandler();
53
+ }
54
+ /**
55
+ * Starts Data Sender (Outbox Handler)
56
+ */
57
+ startDataSender() {
58
+ unvired_ts_core_sdk_1.OutboxService.getInstance().start();
59
+ }
60
+ /**
61
+ * Request for downloading messages from server
62
+ */
63
+ getMessages() {
64
+ unvired_ts_core_sdk_1.SyncEngine.getMessages();
65
+ }
66
+ /**
67
+ * Register for Data Sender notifications
68
+ * @param callback Callback function
69
+ */
70
+ registerDataSenderListener(callback) {
71
+ unvired_ts_core_sdk_1.NotificationListenerHelper.dataSenderListener = callback;
72
+ }
73
+ /**
74
+ * Unregister Data Sender notifications
75
+ */
76
+ unRegisterDataSenderListener() {
77
+ unvired_ts_core_sdk_1.NotificationListenerHelper.dataSenderListener = null;
78
+ }
79
+ /**
80
+ * Register for Sync Items count updates
81
+ * @param callback Callback function
82
+ */
83
+ registerSyncItemsCountListener(callback) {
84
+ unvired_ts_core_sdk_1.NotificationListenerHelper.syncItemsCountListener = callback;
85
+ }
86
+ /**
87
+ * Check if a BE is in the Outbox queue
88
+ * @param beLid BE Header LID
89
+ */
90
+ async isInOutBox(beLid) {
91
+ return unvired_ts_core_sdk_1.SettingsHelper.isInOutBoxQueue(beLid);
92
+ }
93
+ /**
94
+ * Check if a BE is in Sent Items
95
+ * @param beLid BE Header LID
96
+ */
97
+ async isInSentItem(beLid) {
98
+ return unvired_ts_core_sdk_1.SettingsHelper.isInSentItems(beLid);
99
+ }
100
+ /**
101
+ * Get count of items in Outbox
102
+ */
103
+ async outBoxItemCount() {
104
+ return unvired_ts_core_sdk_1.SettingsHelper.getOutboxCount();
105
+ }
106
+ /**
107
+ * Get count of items in Sent Items
108
+ */
109
+ async sentItemCount() {
110
+ return unvired_ts_core_sdk_1.SettingsHelper.getSentItemsCount();
111
+ }
112
+ /**
113
+ * Get count of items in Inbox
114
+ */
115
+ async inBoxItemCount() {
116
+ return unvired_ts_core_sdk_1.SettingsHelper.getInboxCount();
117
+ }
118
+ /**
119
+ * Delete an entry from Outbox
120
+ * @param beLid BE Header LID
121
+ */
122
+ async deleteOutBoxEntry(beLid) {
123
+ return unvired_ts_core_sdk_1.SyncEngine.removeOutObjectBasedOnLid(beLid);
124
+ }
125
+ /**
126
+ * Lock Data Sender for a specific BE
127
+ * @param beLid BE LID
128
+ */
129
+ async lockDataSender(beLid) {
130
+ return unvired_ts_core_sdk_1.SyncEngine.lockDataSender(beLid);
131
+ }
132
+ /**
133
+ * Unlock Data Sender
134
+ */
135
+ async unlockDataSender() {
136
+ return unvired_ts_core_sdk_1.SyncEngine.unlockDataSender();
137
+ }
138
+ }
139
+ exports.SyncService = SyncService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unvired/react-native-wrapper-sdk",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "description": "Unvired SDK for React Native - Enterprise mobile platform SDK with authentication, sync, and offline database",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -23,19 +23,24 @@
23
23
  "author": "Unvired Inc.",
24
24
  "license": "UNLICENSED",
25
25
  "peerDependencies": {
26
- "react": ">=16.8.0",
27
- "react-native": ">=0.60.0"
26
+ "@op-engineering/op-sqlite": "^15.2.5",
27
+ "@react-native-async-storage/async-storage": "^2.2.0",
28
+ "@react-native-firebase/messaging": "^21.8.1",
29
+ "react": ">=18",
30
+ "react-native": ">=0.73",
31
+ "react-native-device-info": "^15.0.1",
32
+ "react-native-fs": "^2.20.0",
33
+ "react-native-zip-archive": "^7.0.2"
28
34
  },
29
35
  "dependencies": {
30
- "@unvired/react-native-unvired-sdk": "^0.0.12",
31
- "@unvired/unvired-ts-core-sdk": "^0.0.14",
36
+ "@unvired/unvired-ts-core-sdk": "^0.0.21",
32
37
  "axios": "^1.6.5",
33
38
  "crypto-js": "^4.2.0",
34
39
  "uuid": "^9.0.1"
35
40
  },
36
41
  "devDependencies": {
37
42
  "@types/crypto-js": "^4.2.2",
38
- "@types/react": "^18.2.0",
43
+ "@types/react": "^19.2.10",
39
44
  "@types/react-native": "^0.73.0",
40
45
  "@types/uuid": "^9.0.7",
41
46
  "typescript": "^5.3.3"