@unvired/react-native-unvired-sdk 0.0.12 → 0.0.14

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 (58) hide show
  1. package/BuildNo.txt +1 -1
  2. package/README.md +884 -255
  3. package/dist/database/Database.d.ts +71 -0
  4. package/dist/database/Database.js +156 -0
  5. package/dist/database/DatabaseManager.d.ts +12 -0
  6. package/dist/database/DatabaseManager.js +18 -0
  7. package/dist/database/index.d.ts +6 -0
  8. package/dist/database/index.js +5 -0
  9. package/dist/database/services/DatabaseNative.d.ts +8 -0
  10. package/dist/database/services/DatabaseNative.js +149 -0
  11. package/dist/database/services/DatabaseWeb.d.ts +13 -0
  12. package/dist/database/services/DatabaseWeb.js +138 -0
  13. package/dist/database/types.d.ts +94 -0
  14. package/dist/database/types.js +4 -0
  15. package/dist/device-info/BaseDeviceInfo.d.ts +39 -0
  16. package/dist/device-info/BaseDeviceInfo.js +116 -0
  17. package/dist/device-info/DeviceInfo.d.ts +9 -0
  18. package/dist/device-info/DeviceInfo.js +11 -0
  19. package/dist/device-info/DeviceInfo.types.d.ts +11 -0
  20. package/dist/device-info/DeviceInfo.types.js +3 -0
  21. package/dist/device-info/index.d.ts +3 -0
  22. package/dist/device-info/index.js +3 -0
  23. package/dist/file-system/BaseFileSystem.d.ts +61 -0
  24. package/dist/file-system/BaseFileSystem.js +164 -0
  25. package/dist/file-system/FileSystem.d.ts +9 -0
  26. package/dist/file-system/FileSystem.js +11 -0
  27. package/dist/file-system/FileSystem.types.d.ts +11 -0
  28. package/dist/file-system/FileSystem.types.js +3 -0
  29. package/dist/file-system/index.d.ts +3 -0
  30. package/dist/file-system/index.js +3 -0
  31. package/dist/file-system/services/FileSystemNative.d.ts +17 -0
  32. package/dist/file-system/services/FileSystemNative.js +73 -0
  33. package/dist/file-system/services/FileSystemWeb.d.ts +16 -0
  34. package/dist/file-system/services/FileSystemWeb.js +41 -0
  35. package/dist/local-storage/index.d.ts +1 -0
  36. package/dist/local-storage/index.js +2 -0
  37. package/dist/local-storage/localStorage.d.ts +49 -0
  38. package/dist/local-storage/localStorage.js +128 -0
  39. package/dist/local-storage/services/StorageNative.d.ts +10 -0
  40. package/dist/local-storage/services/StorageNative.js +27 -0
  41. package/dist/local-storage/services/StorageWeb.d.ts +10 -0
  42. package/dist/local-storage/services/StorageWeb.js +26 -0
  43. package/dist/logger/{Logger.js → index.js} +1 -4
  44. package/dist/main.d.ts +11 -0
  45. package/dist/main.js +24 -0
  46. package/dist/push-notification/BasePushNotification.d.ts +52 -0
  47. package/dist/push-notification/BasePushNotification.js +180 -0
  48. package/dist/push-notification/PushNotification.d.ts +9 -0
  49. package/dist/push-notification/PushNotification.js +11 -0
  50. package/dist/push-notification/PushNotification.types.d.ts +12 -0
  51. package/dist/push-notification/PushNotification.types.js +3 -0
  52. package/dist/push-notification/index.d.ts +3 -0
  53. package/dist/push-notification/index.js +3 -0
  54. package/example/USAGE_EXAMPLE.ts +167 -0
  55. package/package.json +17 -6
  56. package/dist/index.d.ts +0 -3
  57. package/dist/index.js +0 -4
  58. /package/dist/logger/{Logger.d.ts → index.d.ts} +0 -0
@@ -0,0 +1,167 @@
1
+ import { PlatformInterface, IDeviceInfo, IFileEntry, IDatabaseAdapter, IPushNotificationAdapter, ILoggerAdapter, DatabaseType } from './PlatformInterface';
2
+ import { logger, LogLevel } from '@unvired/react-native-unvired-sdk';
3
+ export class ReactNativePlatformAdapter implements PlatformInterface {
4
+
5
+ getDeviceInfo(): IDeviceInfo {
6
+ // TODO: Implement device info retrieval
7
+ return {
8
+ platform: 'unknown',
9
+ model: '',
10
+ version: '',
11
+ isMobile: true
12
+ };
13
+ }
14
+
15
+ getPlatform(): string {
16
+ // TODO: Implement platform retrieval
17
+ return "";
18
+ }
19
+
20
+ getFrontendType(): string {
21
+ // TODO: Implement frontend type retrieval
22
+ // Refer CordovaPlatformAdapter.ts for reference to return values
23
+ return "";
24
+ }
25
+
26
+ getDocumentDirectory(): string {
27
+ // TODO: Implement document directory retrieval
28
+ return "";
29
+ }
30
+
31
+ resolveLocalFileSystemURL(url: string): Promise<IFileEntry> {
32
+ // TODO: Implement local file system URL resolution
33
+ return Promise.resolve({} as IFileEntry);
34
+ }
35
+
36
+ async getFolderBasedOnUserId(userId: string): Promise<string> {
37
+ // TODO: Implement folder retrieval based on user ID
38
+ return "";
39
+ }
40
+
41
+ async deleteUserFolder(userId: string): Promise<void> {
42
+ // TODO: Implement user folder deletion
43
+ }
44
+
45
+ getDatabaseAdapter(): IDatabaseAdapter {
46
+ // TODO: Implement database adapter
47
+ return {
48
+ create: (options, successCallback, errorCallback) => {
49
+ // TODO: Implement database creation
50
+ },
51
+ execute: (options, successCallback, errorCallback) => {
52
+ // TODO: Implement SQL execution
53
+ },
54
+ executeStatementOnPath: (dbPath, sqlQuery, callback) => {
55
+ // TODO: Implement SQL execution on specific path
56
+ callback([]);
57
+ },
58
+ selectFromPath: (dbPath, sqlQuery, callback) => {
59
+ // TODO: Implement SELECT query
60
+ callback([]);
61
+ },
62
+ createDatabase: (dbPath, callback) => {
63
+ // TODO: Implement database creation
64
+ callback();
65
+ },
66
+ getDBFilePath: (options, callback) => {
67
+ // TODO: Implement database file path retrieval
68
+ callback("");
69
+ },
70
+ saveWebDB: (options, callback, errorCallback) => {
71
+ // TODO: Implement web database save
72
+ callback({});
73
+ },
74
+ exportWebDB: (options, callback, errorCallback) => {
75
+ // TODO: Implement web database export
76
+ callback({});
77
+ },
78
+ deleteUserData: (options, callback, errorCallback) => {
79
+ // TODO: Implement user data deletion
80
+ callback();
81
+ }
82
+ };
83
+ }
84
+
85
+ getPushNotificationAdapter(): IPushNotificationAdapter | null {
86
+ try {
87
+ return {
88
+ requestPermission: async (options = { forceShow: false }) => {
89
+ //TODO: Implement push notification permission request
90
+ },
91
+ getToken: async () => {
92
+ //TODO: Implement push notification token retrieval
93
+ return "";
94
+ },
95
+ onTokenRefresh: (callback) => {
96
+ //TODO: Implement push notification token refresh
97
+ },
98
+ onMessage: (callback) => {
99
+ //TODO: Implement push notification message handling
100
+ },
101
+ onBackgroundMessage: (callback) => {
102
+ //TODO: Implement push notification background message handling
103
+ }
104
+ };
105
+ } catch (error) {
106
+ return null;
107
+ }
108
+ }
109
+
110
+ getLoggerAdapter(): ILoggerAdapter {
111
+ return {
112
+ logDebug: (sourceClass, method, message) => {
113
+ console.log(`[DEBUG] ${sourceClass}.${method}: ${message}`);
114
+ logger.logDebug(sourceClass, method, message);
115
+ // TODO: Implement log file writing
116
+ },
117
+ logError: (sourceClass, method, message) => {
118
+ console.error(`[ERROR] ${sourceClass}.${method}: ${message}`);
119
+ logger.logError(sourceClass, method, message);
120
+ // TODO: Implement log file writing
121
+ },
122
+ logInfo: (sourceClass, method, message) => {
123
+ console.info(`[INFO] ${sourceClass}.${method}: ${message}`);
124
+ logger.logInfo(sourceClass, method, message);
125
+ // TODO: Implement log file writing
126
+ },
127
+ setLogLevel: (logLevel: LogLevel) => {
128
+ // TODO: Implement log level setting
129
+ console.log(`Setting log level to: ${logLevel}`);
130
+ logger.setLogLevel(logLevel);
131
+ },
132
+ getLogFileURL: async () => {
133
+ // TODO: Implement log file URL retrieval
134
+ return logger.getLogFileURL();
135
+ },
136
+ getLogFileContent: async () => {
137
+ // TODO: Implement log file content retrieval
138
+ return logger.getLogFileContent();
139
+ },
140
+ getBackupLogFileContent: async () => {
141
+ // TODO: Implement backup log file content retrieval
142
+ return logger.getBackupLogFileContent();
143
+ },
144
+ clearLogFile: async () => {
145
+ // TODO: Implement log file clearing
146
+ logger.clearLogFile();
147
+ }
148
+ };
149
+ }
150
+
151
+ getStorageAdapter() {
152
+ return {
153
+ getItem: (key: string) => {
154
+ return null;
155
+ },
156
+ setItem: (key: string, value: string) => {
157
+ // Dummy implementation
158
+ },
159
+ removeItem: (key: string) => {
160
+ // Dummy implementation
161
+ },
162
+ clear: () => {
163
+ // Dummy implementation
164
+ }
165
+ };
166
+ }
167
+ }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@unvired/react-native-unvired-sdk",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "Unvired SDK for React Native with logging, database, notifications, and file system support",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
5
+ "main": "dist/main.js",
6
+ "types": "dist/main.d.ts",
7
7
  "scripts": {
8
8
  "build": "tsc --project tsconfig.json",
9
9
  "prepare": "npm run build",
@@ -25,22 +25,33 @@
25
25
  "license": "UNLICENSED",
26
26
  "peerDependencies": {
27
27
  "@dr.pogodin/react-native-fs": "^2.36.2",
28
+ "@react-native-firebase/messaging": "^21.8.1",
28
29
  "react": ">=16.8.0",
29
30
  "react-native": ">=0.60.0",
31
+ "react-native-device-info": "^14.1.1",
32
+ "react-native-sqlite-storage": "^6.0.1",
30
33
  "react-native-zip-archive": "^7.0.2"
31
34
  },
32
- "peerDependenciesMeta": {},
35
+ "peerDependenciesMeta": {
36
+ "@react-native-firebase/messaging": {
37
+ "optional": true
38
+ }
39
+ },
33
40
  "devDependencies": {
34
41
  "@types/react": "^18.0.0",
35
42
  "@types/react-native": "^0.72.0",
43
+ "@types/react-native-sqlite-storage": "^6.0.5",
44
+ "@types/sql.js": "^1.4.9",
36
45
  "eslint": "^8.0.0",
37
46
  "jest": "^29.0.0",
38
47
  "prettier": "^3.0.0",
39
48
  "typescript": "^5.0.0"
40
49
  },
41
50
  "dependencies": {
51
+ "@react-native-async-storage/async-storage": "^2.2.0",
42
52
  "@types/pako": "^2.0.4",
43
- "pako": "^2.1.0"
53
+ "pako": "^2.1.0",
54
+ "sql.js": "^1.10.3"
44
55
  },
45
56
  "repository": {},
46
57
  "bugs": {},
@@ -50,4 +61,4 @@
50
61
  "publishConfig": {
51
62
  "access": "public"
52
63
  }
53
- }
64
+ }
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export { Logger, logger } from './logger/Logger';
2
- export type { LogLevel, ILogger, ILoggerImplementation, } from './logger/Logger';
3
- export { default } from './logger/Logger';
package/dist/index.js DELETED
@@ -1,4 +0,0 @@
1
- // Export main logger class and instance
2
- export { Logger, logger } from './logger/Logger';
3
- // Default export (logger instance)
4
- export { default } from './logger/Logger';
File without changes