cordova-plugin-unvired-universal-sdk 1.0.1
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/README.md +59 -0
- package/aar/README.md +3 -0
- package/aar/Unvired_Kernel_Android.aar +0 -0
- package/aar/Unvired_Kernel_HTML5_Android.aar +0 -0
- package/package.json +69 -0
- package/plugin.xml +23 -0
- package/src/android/build.gradle +35 -0
- package/src/android/xml/provider_paths.xml +21 -0
- package/src/browser/UnviredPluginProxy.js +2430 -0
- package/src/browser/bootstrap.min.js +17 -0
- package/src/browser/codemirror.js +9755 -0
- package/src/browser/jquery-3.2.1.js +10253 -0
- package/src/browser/sql-wasm.wasm +0 -0
- package/src/browser/sql.js +203 -0
- package/src/browser/src_index_worker_js.unvired-db-worker.js +231 -0
- package/src/browser/unvired-db-worker.js +166 -0
- package/src/browser/vendors-node_modules_comlink_dist_esm_comlink_mjs.unvired-db-worker.js +22 -0
- package/src/ios/AttachmentPlugin.h +21 -0
- package/src/ios/AttachmentPlugin.m +180 -0
- package/src/ios/DataStructureHelper.h +28 -0
- package/src/ios/DataStructureHelper.m +188 -0
- package/src/ios/IOSAuthPlugin.h +14 -0
- package/src/ios/IOSAuthPlugin.m +13 -0
- package/src/ios/IOSDatabasePlugin.h +28 -0
- package/src/ios/IOSDatabasePlugin.m +253 -0
- package/src/ios/IOSFWSettingsPlugin.h +65 -0
- package/src/ios/IOSFWSettingsPlugin.m +363 -0
- package/src/ios/IOSLoggerPlugin.h +34 -0
- package/src/ios/IOSLoggerPlugin.m +198 -0
- package/src/ios/IOSLoginPlugin.h +29 -0
- package/src/ios/IOSLoginPlugin.m +480 -0
- package/src/ios/IOSProxyPlugin.h +21 -0
- package/src/ios/IOSProxyPlugin.m +172 -0
- package/src/ios/IOSSyncEnginePlugin.h +54 -0
- package/src/ios/IOSSyncEnginePlugin.m +847 -0
- package/src/ios/PluginConstants.h +195 -0
- package/src/ios/PluginHelper.h +29 -0
- package/src/ios/PluginHelper.m +74 -0
- package/src/ios/SyncHTML5Response.h +50 -0
- package/src/ios/SyncHTML5Response.m +68 -0
- package/www/applicationMeta/applicationMetadataParser.ts +285 -0
- package/www/applicationMeta/fieldConstants.ts +92 -0
- package/www/attachment/attachmentHelper.ts +326 -0
- package/www/attachment/attachmentQHelper.ts +158 -0
- package/www/attachment/attachmentService.ts +259 -0
- package/www/authenticationService.ts +746 -0
- package/www/bootstrap.min.js +17 -0
- package/www/codemirror.js +9755 -0
- package/www/database/appDatabaseManager.ts +54 -0
- package/www/database/databaseManager.ts +616 -0
- package/www/helper/dbCreateTablesManager.ts +354 -0
- package/www/helper/frameworkHelper.ts +127 -0
- package/www/helper/frameworkSettingsManager.ts +287 -0
- package/www/helper/getMessageTimerManager.ts +81 -0
- package/www/helper/httpConnection.ts +1051 -0
- package/www/helper/logger.ts +312 -0
- package/www/helper/notificationListnerHelper.ts +56 -0
- package/www/helper/passcodeGenerator.ts +61 -0
- package/www/helper/reconciler.ts +1062 -0
- package/www/helper/serverResponseHandler.ts +677 -0
- package/www/helper/serviceConstants.ts +254 -0
- package/www/helper/settingsHelper.ts +386 -0
- package/www/helper/status.ts +83 -0
- package/www/helper/syncInputDataManager.ts +205 -0
- package/www/helper/unviredAccount.ts +104 -0
- package/www/helper/unviredAccountManager.ts +120 -0
- package/www/helper/urlService.ts +43 -0
- package/www/helper/userSettingsManager.ts +172 -0
- package/www/helper/utils.ts +110 -0
- package/www/inbox/downloadMessageService.ts +270 -0
- package/www/inbox/inboxHelper.ts +132 -0
- package/www/inbox/inboxService.ts +223 -0
- package/www/jquery-3.2.1.js +10253 -0
- package/www/kernel.js +1380 -0
- package/www/outbox/outboxAttachmentManager.ts +152 -0
- package/www/outbox/outboxHelper.ts +67 -0
- package/www/outbox/outboxService.ts +519 -0
- package/www/sql-wasm.wasm +0 -0
- package/www/sql.js +209 -0
- package/www/subtract.ts +5 -0
- package/www/sum.ts +4 -0
- package/www/syncEngine.ts +687 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
export const FrameworkVersionNumber = "1.1.2";
|
|
2
|
+
export const FrameworkBuildNumber = "105";
|
|
3
|
+
export const FrameworkRevisionNumber =
|
|
4
|
+
"f4444dd36a88188c063db5fe24a4eaa8b7d22106";
|
|
5
|
+
export const FrameworkRevisionUrl = "";
|
|
6
|
+
|
|
7
|
+
export const ApplicationRevisionNumber = "99.99";
|
|
8
|
+
|
|
9
|
+
// Header Constants
|
|
10
|
+
export const HeaderConstantConversationId = "X-UNVIRED-CONVERSATION-ID";
|
|
11
|
+
export const HeaderConstantRequestType = "REQUEST_TYPE";
|
|
12
|
+
export const HeaderConstantNumberOfPendingMessages =
|
|
13
|
+
"X-UNVIRED-NUMBER-OF-PENDING-MESSAGES";
|
|
14
|
+
export const HeaderConstantPullMode = "x-pull-mode";
|
|
15
|
+
export const HeaderConstantMessageType = "x-unvired-message-type";
|
|
16
|
+
|
|
17
|
+
// Send Logs/Data api params
|
|
18
|
+
export const ParamCompanyNamespace = "COMPANY_NAMESPACE";
|
|
19
|
+
export const ParamCompanyAlias = "COMPANY_ALIAS";
|
|
20
|
+
export const ParamAction = "ACTION";
|
|
21
|
+
export const ParamJwtToken = "JWT_TOKEN";
|
|
22
|
+
export const ParamOneTimeLoginToken = "X-ONE-TIME-LOGIN-TOKEN";
|
|
23
|
+
export const ParamApplication = "APPLICATION";
|
|
24
|
+
export const ParamAttachmentGuid = "X_ATTACHMENT_GUID";
|
|
25
|
+
export const ParamMimeType = "MIME_TYPE";
|
|
26
|
+
export const ParamServerId = "SERVER_ID";
|
|
27
|
+
export const ParamServerUserId = "MUSID";
|
|
28
|
+
export const ParamFeUserId = "FEUSERID";
|
|
29
|
+
export const ParamPassword = "PWD";
|
|
30
|
+
export const ParamOneTimeToken = "onetimetoken";
|
|
31
|
+
export const ParamMessageTime = "messagetime";
|
|
32
|
+
export const ParamLoginType = "LOGIN_TYPE";
|
|
33
|
+
export const ParamDeviceType = "DEVICE_TYPE";
|
|
34
|
+
export const ParamAppVersion = "cltAppVer";
|
|
35
|
+
export const ParamFrameworkVersion = "cltFwkVer";
|
|
36
|
+
export const ParamDeviceOsVersion = "devOS";
|
|
37
|
+
export const ParamDeviceModel = "devModel";
|
|
38
|
+
export const ParamDeviceState = "X-DEVICE-STATE";
|
|
39
|
+
|
|
40
|
+
// Send Logs/Data api ACTION param values
|
|
41
|
+
export const ActionUploadLogs = "UPLOAD_LOG";
|
|
42
|
+
export const ActionUploadData = "UPLOAD_DATA";
|
|
43
|
+
|
|
44
|
+
// endpoints
|
|
45
|
+
export const ServiceApiVersion = "API/v3/";
|
|
46
|
+
export const ServiceSession = "session";
|
|
47
|
+
export const ServiceApplications = "applications";
|
|
48
|
+
export const ServiceActivate = "activate";
|
|
49
|
+
export const ServiceLocal = "?local";
|
|
50
|
+
export const ServiceExecute = "execute";
|
|
51
|
+
export const ServiceMessage = "message";
|
|
52
|
+
export const ServiceAttachments = "attachments";
|
|
53
|
+
export const ServiceAttachment = "attachment";
|
|
54
|
+
export const ServiceAdminServices = "adminservices";
|
|
55
|
+
export const ServicePasswordLess = "passwordless";
|
|
56
|
+
export const ServiceStatus = "status";
|
|
57
|
+
|
|
58
|
+
export const AdminServicePing = "ping";
|
|
59
|
+
export const AdminServiceTestNotif = "testnotify";
|
|
60
|
+
export const AdminServiceInitialDownload = "initialdownload";
|
|
61
|
+
export const AdminServiceAuthBackend = "authbackend";
|
|
62
|
+
|
|
63
|
+
// route
|
|
64
|
+
export const ServiceFrontendUsers = "frontendusers";
|
|
65
|
+
export const ServiceConversation = "conversation";
|
|
66
|
+
export const ServiceMessages = "messages";
|
|
67
|
+
|
|
68
|
+
// Query Params
|
|
69
|
+
export const QueryParamFrontendUser = "frontendUser";
|
|
70
|
+
export const QueryParamInputMessage = "inputMessage";
|
|
71
|
+
export const QueryParamMessageFormat = "messageFormat";
|
|
72
|
+
export const QueryParamQueuedExecute = "queuedExecute";
|
|
73
|
+
export const QueryParamExternalReference = "externalReference";
|
|
74
|
+
export const QueryParamRequestType = "requestType";
|
|
75
|
+
export const QueryParamFile = "file";
|
|
76
|
+
export const QueryParamSensitive = "sensitive";
|
|
77
|
+
export const QueryParamCredentials = "credentials";
|
|
78
|
+
|
|
79
|
+
// Message Types
|
|
80
|
+
export const MessageTypeStandard = "standard";
|
|
81
|
+
export const MessageTypeCustom = "custom";
|
|
82
|
+
|
|
83
|
+
export const LoginTypeUnviredId = "UNVIRED-USER";
|
|
84
|
+
export const LoginTypeSAP = "SAP";
|
|
85
|
+
export const LoginTypeEmail = "EMAIL";
|
|
86
|
+
export const LoginTypeADS = "ACTIVE-DIRECTORY";
|
|
87
|
+
// export const LoginTypeLDAP = "LDAP";
|
|
88
|
+
export const LoginTypeCustom = "CUSTOM";
|
|
89
|
+
// export const LoginTypeSAML2 = "SAML2";
|
|
90
|
+
|
|
91
|
+
// Session Api response keys
|
|
92
|
+
export const KeyUnviredId = "unviredId";
|
|
93
|
+
export const KeyUnviredMd5Pwd = "md5Pwd";
|
|
94
|
+
export const KeySessionId = "sessionId";
|
|
95
|
+
export const KeyUsers = "users";
|
|
96
|
+
export const KeyFrontendType = "frontendType";
|
|
97
|
+
export const KeyApplications = "applications";
|
|
98
|
+
export const KeyName = "name";
|
|
99
|
+
export const KeyError = "error";
|
|
100
|
+
export const KeyToken = "token";
|
|
101
|
+
export const KeySettings = "settings";
|
|
102
|
+
export const KeyLocation = "location";
|
|
103
|
+
export const KeyLocationTracking = "tracking";
|
|
104
|
+
export const KeyLocationInterval = "interval";
|
|
105
|
+
export const KeyLocationUploadInterval = "uploadInterval";
|
|
106
|
+
export const KeyLocationDays = "days";
|
|
107
|
+
export const KeyLocationStart = "start";
|
|
108
|
+
export const KeyLocationEnd = "end";
|
|
109
|
+
export const KeySystems = "systems";
|
|
110
|
+
export const KeySystemsName = "name";
|
|
111
|
+
export const KeySystemsPortName = "portName";
|
|
112
|
+
export const KeySystemsPortType = "portType";
|
|
113
|
+
export const KeySystemsPortDesc = "portDescr";
|
|
114
|
+
export const KeySystemsDesc = "systemDescr";
|
|
115
|
+
|
|
116
|
+
// PA response keys
|
|
117
|
+
export const KeyMeta = "Meta";
|
|
118
|
+
export const KeyActionAttribute = "a";
|
|
119
|
+
export const KeyMetadataDelete = "d";
|
|
120
|
+
export const KeyBeName = "BEName";
|
|
121
|
+
export const KeyInfoMessage = "InfoMessage";
|
|
122
|
+
|
|
123
|
+
// Info Message Keys
|
|
124
|
+
export const KeyInfoMessageType = "type";
|
|
125
|
+
export const KeyInfoMessageSubtype = "subtype";
|
|
126
|
+
export const KeyInfoMessageCategory = "category";
|
|
127
|
+
export const KeyInfoMessageMessage = "message";
|
|
128
|
+
export const KeyInfoMessageBeName = "bename";
|
|
129
|
+
export const KeyInfoMessageBeLid = "belid";
|
|
130
|
+
export const KeyInfoMessageMessageDetails = "messagedetails";
|
|
131
|
+
|
|
132
|
+
// PA response header key
|
|
133
|
+
export const KeyJwtToken = "jwttoken";
|
|
134
|
+
export const PullModeDelete = "DELETE";
|
|
135
|
+
|
|
136
|
+
// Attachment response keys
|
|
137
|
+
export const KeyAttachmentResponse = "AttachmentResponse";
|
|
138
|
+
export const KeyMessage_ = "message";
|
|
139
|
+
|
|
140
|
+
// Action Type
|
|
141
|
+
export const ActionTypeA = "A";
|
|
142
|
+
export const ActionTypeM = "M";
|
|
143
|
+
export const ActionTypeD = "D";
|
|
144
|
+
|
|
145
|
+
// Attachment
|
|
146
|
+
export const AttachmentBE = "_ATTACHMENT";
|
|
147
|
+
|
|
148
|
+
// Attachment Status
|
|
149
|
+
export const AttachmentStatusDefault = "DEFAULT";
|
|
150
|
+
export const AttachmentStatusQueuedForDownload = "QUEUED_FOR_DOWNLOAD";
|
|
151
|
+
export const AttachmentStatusDownloaded = "DOWNLOADED";
|
|
152
|
+
export const AttachmentStatusErrorInDownload = "ERROR_IN_DOWNLOAD";
|
|
153
|
+
export const AttachmentStatusSavedForUpload = "SAVED_FOR_UPLOAD";
|
|
154
|
+
export const AttachmentStatusUploaded = "UPLOADED";
|
|
155
|
+
export const AttachmentStatusErrorInUpload = "ERROR_IN_UPLOAD";
|
|
156
|
+
export const AttachmentStatusMarkedForDelete = "MARKED_FOR_DELETE";
|
|
157
|
+
export const FwAttachmentForceDownloadPriority = 1;
|
|
158
|
+
export const FwAttachmentAutoDownloadPriority = 2;
|
|
159
|
+
|
|
160
|
+
// Attachment Item Fields
|
|
161
|
+
export const AttachmentItemFieldUid = "UID";
|
|
162
|
+
export const AttachmentItemFieldMimeType = "MIME_TYPE";
|
|
163
|
+
export const AttachmentItemFieldFileName = "FILE_NAME";
|
|
164
|
+
export const AttachmentItemFieldDescription = "DESCRIPTION";
|
|
165
|
+
export const AttachmentItemFieldUrl = "URL";
|
|
166
|
+
export const AttachmentItemFieldExternalUrl = "EXTERNAL_URL";
|
|
167
|
+
export const AttachmentItemFieldLocalPath = "LOCAL_PATH";
|
|
168
|
+
export const AttachmentItemFieldAutoDownload = "AUTO_DOWNLOAD";
|
|
169
|
+
export const AttachmentItemFieldAttachmentStatus = "ATTACHMENT_STATUS";
|
|
170
|
+
export const AttachmentItemFieldErrorMessage = "ERROR_MESSAGE";
|
|
171
|
+
export const AttachmentItemFieldMessage = "MESSAGE";
|
|
172
|
+
|
|
173
|
+
export const Type = "type";
|
|
174
|
+
export const Subtype = "subtype";
|
|
175
|
+
export const ServerId = "serverId";
|
|
176
|
+
export const ApplicationId = "applicationId";
|
|
177
|
+
export const AppName = "appName";
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Messages for the application.
|
|
181
|
+
*/
|
|
182
|
+
export const MESSAGE_TYPE_APPLICATION = 8000;
|
|
183
|
+
/**
|
|
184
|
+
* Messages for the system / framework.
|
|
185
|
+
*/
|
|
186
|
+
export const MESSAGE_TYPE_SYSTEM = 9000;
|
|
187
|
+
/**
|
|
188
|
+
* Message to clear all the data in the application.
|
|
189
|
+
*/
|
|
190
|
+
export const MESSAGE_TYPE_WIPE = 5000;
|
|
191
|
+
/**
|
|
192
|
+
* Messages for authentication.
|
|
193
|
+
*/
|
|
194
|
+
export const MESSAGE_TYPE_AUTHENTICATION = 4000;
|
|
195
|
+
|
|
196
|
+
export const MESSAGE_SUBTYPE_SYSTEM_PING = 100;
|
|
197
|
+
export const MESSAGE_SUBTYPE_SYSTEM_LOG = 200;
|
|
198
|
+
export const MESSAGE_SUBTYPE_SYSTEM_LOG_RESET = 210;
|
|
199
|
+
export const MESSAGE_SUBTYPE_SYSTEM_LOG_SET_ERROR = 220;
|
|
200
|
+
export const MESSAGE_SUBTYPE_SYSTEM_LOG_SET_DEBUG = 230;
|
|
201
|
+
export const MESSAGE_SUBTYPE_SYSTEM_DATA_DUMP = 300;
|
|
202
|
+
export const MESSAGE_SUBTYPE_SYSTEM_INITIAL_DATA = 400;
|
|
203
|
+
export const MESSAGE_SUBTYPE_SYSTEM_APPLICATION_ASSIGN = 410;
|
|
204
|
+
export const MESSAGE_SUBTYPE_SYSTEM_APPLICATION_UNASSIGN = 430;
|
|
205
|
+
export const MESSAGE_SUBTYPE_SYSTEM_FRAMEWORK_SETTINGS = 500;
|
|
206
|
+
export const MESSAGE_SUBTYPE_SYSTEM_RESET_DATA = 700;
|
|
207
|
+
export const MESSAGE_SUBTYPE_SYSTEM_ACTIVATION = 800;
|
|
208
|
+
export const MESSAGE_SUBTYPE_SYSTEM_MULTIPLE_FRONTEND_USERS = 810;
|
|
209
|
+
export const MESSAGE_SUBTYPE_SYSTEM_ERROR = 900;
|
|
210
|
+
export const MESSAGE_SUBTYPE_SYSTEM_INFO = 1000;
|
|
211
|
+
export const MESSAGE_SUBTYPE_SYSTEM_INITIATE_PULL = 440;
|
|
212
|
+
export const MESSAGE_SUBTYPE_SYSTEM_PULL_COMPLETE = 450;
|
|
213
|
+
export const MESSAGE_SUBTYPE_SYSTEM_SEND_PUSH_NOTIFICATION_ID = 610;
|
|
214
|
+
|
|
215
|
+
export const MESSAGE_SUBTYPE_AUTHENTICATION = 100;
|
|
216
|
+
export const MESSAGE_SUBTYPE_AUTHENTICATION_AND_ACTIVATE = 200;
|
|
217
|
+
export const MESSAGE_SUBTYPE_SAP_AUTHENTICATE = 300;
|
|
218
|
+
export const MESSAGE_SUBTYPE_CHANGE_PASSWORD = 400;
|
|
219
|
+
export const MESSAGE_SUBTYPE_FORGOT_PASSWORD = 500;
|
|
220
|
+
export const MESSAGE_SUBTYPE_REGISTER_USER = 600;
|
|
221
|
+
export const MESSAGE_SUBTYPE_GET_LOGIN_TOKEN = 700;
|
|
222
|
+
|
|
223
|
+
export const MESSAGE_SUBTYPE_APPLICATION_USER_SETTNGS_UPDATE = 625;
|
|
224
|
+
export const MESSAGE_SUBTYPE_LOCATION_INFORMATION = 1100;
|
|
225
|
+
export const MESSAGE_SUBTYPE_CHECK_FOR_APP_UPGRADE = 1300;
|
|
226
|
+
export const MESSAGE_SUBTYPE_TEST_PUSH = 110;
|
|
227
|
+
|
|
228
|
+
export const logError = "ERROR";
|
|
229
|
+
export const logDebug = "DEBUG";
|
|
230
|
+
export const logImportant = "IMPORTANT";
|
|
231
|
+
|
|
232
|
+
//Network connections
|
|
233
|
+
export const online = "Online";
|
|
234
|
+
export const offline = "Offline";
|
|
235
|
+
|
|
236
|
+
export const DefaultHttpTimeout = 300; // in seconds
|
|
237
|
+
|
|
238
|
+
export enum RequestType {
|
|
239
|
+
RQST = "RQST",
|
|
240
|
+
PULL = "PULL",
|
|
241
|
+
PUSH = "PUSH",
|
|
242
|
+
QUERY = "QUERY",
|
|
243
|
+
REQ = "REQ",
|
|
244
|
+
PULLD = "PULLD",
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export enum SyncType { ASYNC = "ASYNC", SYNC = "SYNC" }
|
|
248
|
+
|
|
249
|
+
export enum OutObjectStatus {
|
|
250
|
+
none,
|
|
251
|
+
lockedForModify,
|
|
252
|
+
lockedForSending,
|
|
253
|
+
errorOnProcessing
|
|
254
|
+
}
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import AttachmentQHelper from "../attachment/attachmentQHelper";
|
|
2
|
+
import { AuthenticationService } from "../authenticationService";
|
|
3
|
+
import DatabaseManager, { DatabaseType } from "../database/databaseManager";
|
|
4
|
+
import InboxHelper from "../inbox/inboxHelper";
|
|
5
|
+
import OutBoxHelper from "../outbox/outboxHelper";
|
|
6
|
+
import OutboxService from "../outbox/outboxService";
|
|
7
|
+
import { SyncEngine } from "../syncEngine";
|
|
8
|
+
import FrameworkHelper from "./frameworkHelper";
|
|
9
|
+
import { FrameworkSettingsFields, FrameworkSettingsManager } from "./frameworkSettingsManager";
|
|
10
|
+
import { HttpConnection } from "./httpConnection";
|
|
11
|
+
import { Logger, LogLevel } from "./logger";
|
|
12
|
+
import * as ServiceConstants from "./serviceConstants";
|
|
13
|
+
import { UserSettingsFields, UserSettingsManager } from "./userSettingsManager";
|
|
14
|
+
import { ObjectStatus, SyncStatus } from "./utils";
|
|
15
|
+
|
|
16
|
+
class SettingsHelper {
|
|
17
|
+
static async getFrameworkVersionNumber(): Promise<string> {
|
|
18
|
+
return ServiceConstants.FrameworkVersionNumber;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static async getFrameworkBuildNumber(): Promise<string> {
|
|
22
|
+
return ServiceConstants.FrameworkBuildNumber;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static async getApplicationName(): Promise<string> {
|
|
26
|
+
return AuthenticationService.instance.loginParameters.appName;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static async getApplicationVersionNumber(): Promise<string> {
|
|
30
|
+
return ServiceConstants.ApplicationRevisionNumber;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static async getFrameworkRevisionNumber(): Promise<string> {
|
|
34
|
+
return ServiceConstants.FrameworkRevisionNumber;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static async getApplicationRevisionNumber(): Promise<string> {
|
|
38
|
+
return ServiceConstants.ApplicationRevisionNumber;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static async getApplicationDBVersion(): Promise<string> {
|
|
42
|
+
const databaseManager = DatabaseManager.getInstance();
|
|
43
|
+
const allAppMetas = await databaseManager.select(DatabaseType.FrameworkDb, "ApplicationMeta");
|
|
44
|
+
if (allAppMetas.length === 0) {
|
|
45
|
+
return "";
|
|
46
|
+
}
|
|
47
|
+
return allAppMetas[0].version;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static async getApplicationBuildNumber(): Promise<string> {
|
|
51
|
+
return ""
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static async getInboxCount(): Promise<number> {
|
|
55
|
+
return await DatabaseManager.getInstance().count(DatabaseType.FrameworkDb, "InObject");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static async getOutboxCount(): Promise<number> {
|
|
59
|
+
return await DatabaseManager.getInstance().count(DatabaseType.FrameworkDb, "OutObject");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static async getSentItemsCount(): Promise<number> {
|
|
63
|
+
return await DatabaseManager.getInstance().count(DatabaseType.FrameworkDb, "SentItems");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static async getAttachmentCount(): Promise<number> {
|
|
67
|
+
return await DatabaseManager.getInstance().count(DatabaseType.FrameworkDb, "AttachmentQObject");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static async isInOutBoxQueue(beHeaderLid: string): Promise<boolean> {
|
|
71
|
+
const outObject = await OutBoxHelper.checkIsInOutBox(beHeaderLid);
|
|
72
|
+
return outObject !== null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
static async isInSentItems(beHeaderLid: string): Promise<boolean> {
|
|
76
|
+
const sentItem = await OutBoxHelper.checkIsInSentItems(beHeaderLid);
|
|
77
|
+
return sentItem !== null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
static async sendLogsToServer(): Promise<void> {
|
|
81
|
+
// TODO: Implement this method
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static async createAndGetLogZipPath(): Promise<String> {
|
|
85
|
+
// TODO: Implement this method
|
|
86
|
+
return "";
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
static async sendAppDbToServer(): Promise<void> {
|
|
90
|
+
// TODO: Implement this method
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static async deleteLogs(): Promise<void> {
|
|
94
|
+
// TODO: Implement this method
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
static async requestInitialDataDownload(functions: Array<{ [key: string]: any }> = []): Promise<void> {
|
|
98
|
+
const serverId = await FrameworkSettingsManager.getInstance().getFieldValue(FrameworkSettingsFields.serverId);
|
|
99
|
+
const applicationId = await FrameworkSettingsManager.getInstance().getFieldValue(FrameworkSettingsFields.applicationId);
|
|
100
|
+
const namespace = await FrameworkSettingsManager.getInstance().getFieldValue(FrameworkSettingsFields.namespace);
|
|
101
|
+
|
|
102
|
+
const dataObject = {
|
|
103
|
+
[FrameworkSettingsFields.companyAlias]: AuthenticationService.instance.loginParameters.company,
|
|
104
|
+
[FrameworkSettingsFields.serverId]: serverId,
|
|
105
|
+
[FrameworkSettingsFields.applicationId]: applicationId,
|
|
106
|
+
[FrameworkSettingsFields.namespace]: namespace,
|
|
107
|
+
"applicationName": AuthenticationService.instance.loginParameters.appName,
|
|
108
|
+
"type": 9000,
|
|
109
|
+
"subtype": 400,
|
|
110
|
+
"functions": functions
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const inputJson = {
|
|
114
|
+
QueryParamInputMessage: JSON.stringify(dataObject)
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const dataString = Object.keys(dataObject).length === 0 ? "" : JSON.stringify(inputJson);
|
|
118
|
+
|
|
119
|
+
const outObjectData = {
|
|
120
|
+
lid: FrameworkHelper.getUUID(),
|
|
121
|
+
timestamp: Date.now(),
|
|
122
|
+
objectStatus: ObjectStatus.global,
|
|
123
|
+
syncStatus: SyncStatus.none,
|
|
124
|
+
functionName: ServiceConstants.AdminServiceInitialDownload,
|
|
125
|
+
beName: "",
|
|
126
|
+
beHeaderLid: "",
|
|
127
|
+
requestType: "",
|
|
128
|
+
syncType: ServiceConstants.SyncType.SYNC.toString(),
|
|
129
|
+
conversationId: "",
|
|
130
|
+
messageJson: dataString,
|
|
131
|
+
companyNameSpace: "",
|
|
132
|
+
sendStatus: "",
|
|
133
|
+
fieldOutObjectStatus: ServiceConstants.OutObjectStatus.none.toString(),
|
|
134
|
+
isAdminServices: true
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
try {
|
|
138
|
+
const databaseManager = DatabaseManager.getInstance();
|
|
139
|
+
await databaseManager.insert(DatabaseType.FrameworkDb, "OutObject", outObjectData, true);
|
|
140
|
+
await Logger.logInfo("SettingsHelper", "requestInitialDataDownload", "Starting Outbox Service");
|
|
141
|
+
OutboxService.getInstance().start();
|
|
142
|
+
} catch (e) {
|
|
143
|
+
throw e;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
static async testPushNotification(): Promise<void> {
|
|
148
|
+
// TODO: Implement this method
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
static async getCompleteLogs(): Promise<string> {
|
|
152
|
+
// TODO: Implement this method
|
|
153
|
+
return "";
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
static async getInfoMessages(): Promise<any[]> {
|
|
157
|
+
try {
|
|
158
|
+
const databaseManager = DatabaseManager.getInstance();
|
|
159
|
+
const infoMessages = await databaseManager.select(DatabaseType.FrameworkDb, "InfoMessage");
|
|
160
|
+
Logger.logDebug("SettingsHelper", "getApplicationVersion", "Info Messages: " + infoMessages);
|
|
161
|
+
return infoMessages;
|
|
162
|
+
} catch (e) {
|
|
163
|
+
Logger.logError("SettingsHelper", "getApplicationVersion", e);
|
|
164
|
+
return [];
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
static async setRequestTimeout(timeout: number): Promise<void> {
|
|
169
|
+
try {
|
|
170
|
+
Logger.logDebug("SettingsHelper", "setRequestTimeout", "Setting request timeout to " + timeout);
|
|
171
|
+
await UserSettingsManager.getInstance().setFieldValue(UserSettingsFields.requestTimeout, timeout);
|
|
172
|
+
} catch (e) {
|
|
173
|
+
Logger.logError("SettingsHelper", "setRequestTimeout", e);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
static async getRequestTimeout(): Promise<number> {
|
|
178
|
+
try {
|
|
179
|
+
const requestTimeout = await UserSettingsManager.getInstance().getFieldValue(UserSettingsFields.requestTimeout);
|
|
180
|
+
return parseInt(requestTimeout);
|
|
181
|
+
} catch (e) {
|
|
182
|
+
Logger.logError("SettingsHelper", "getRequestTimeout", e);
|
|
183
|
+
return 0;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
static async setLogLevel(logLevel: string): Promise<void> {
|
|
188
|
+
await Logger.logDebug(
|
|
189
|
+
"SettingsHelper", "setLogLevel", `logLevel: ${logLevel}`);
|
|
190
|
+
let logNumber = "";
|
|
191
|
+
switch (logLevel) {
|
|
192
|
+
case LogLevel.Info:
|
|
193
|
+
case "7":
|
|
194
|
+
logNumber = "7";
|
|
195
|
+
Logger.setLogLevel(LogLevel.Info);
|
|
196
|
+
break;
|
|
197
|
+
case LogLevel.Error:
|
|
198
|
+
case "8":
|
|
199
|
+
logNumber = "8";
|
|
200
|
+
Logger.setLogLevel(LogLevel.Error);
|
|
201
|
+
break;
|
|
202
|
+
case LogLevel.Debug:
|
|
203
|
+
case "9":
|
|
204
|
+
logNumber = "9";
|
|
205
|
+
Logger.setLogLevel(LogLevel.Debug);
|
|
206
|
+
break;
|
|
207
|
+
default:
|
|
208
|
+
// Handle default case if needed
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
await FrameworkSettingsManager.getInstance()
|
|
212
|
+
.setFieldValue(FrameworkSettingsFields.logLevel, logNumber);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
static async getLogLevel(): Promise<string> {
|
|
216
|
+
try {
|
|
217
|
+
const logLevel = await FrameworkSettingsManager.getInstance().getFieldValue(FrameworkSettingsFields.logLevel);
|
|
218
|
+
switch (logLevel) {
|
|
219
|
+
case "7":
|
|
220
|
+
return ServiceConstants.logImportant;
|
|
221
|
+
case "8":
|
|
222
|
+
return ServiceConstants.logError;
|
|
223
|
+
case "9":
|
|
224
|
+
return ServiceConstants.logDebug;
|
|
225
|
+
default:
|
|
226
|
+
return "";
|
|
227
|
+
}
|
|
228
|
+
} catch (e) {
|
|
229
|
+
Logger.logError("SettingsHelper", "getLogLevel", e);
|
|
230
|
+
return "";
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
static async getFetchInterval(): Promise<number> {
|
|
235
|
+
try {
|
|
236
|
+
const fetchInterval = await UserSettingsManager.getInstance().getFieldValue(UserSettingsFields.fetchInterval);
|
|
237
|
+
return fetchInterval ? parseInt(fetchInterval) : 0;
|
|
238
|
+
} catch (e) {
|
|
239
|
+
Logger.logError("SettingsHelper", "getFetchInterval", e);
|
|
240
|
+
return 0;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
static async clearData() {
|
|
245
|
+
await AuthenticationService.instance.clearData();
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
static async queuePingToOutbox(): Promise<void> {
|
|
249
|
+
let outObjectData = {
|
|
250
|
+
lid: FrameworkHelper.getUUID(),
|
|
251
|
+
timestamp: Date.now(),
|
|
252
|
+
objectStatus: ObjectStatus.global,
|
|
253
|
+
syncStatus: SyncStatus.none,
|
|
254
|
+
functionName: "",
|
|
255
|
+
beName: "",
|
|
256
|
+
beHeaderLid: "",
|
|
257
|
+
requestType: "",
|
|
258
|
+
syncType: ServiceConstants.SyncType.ASYNC.toString(),
|
|
259
|
+
conversationId: "",
|
|
260
|
+
messageJson: ServiceConstants.AdminServicePing,
|
|
261
|
+
companyNameSpace: "",
|
|
262
|
+
sendStatus: "",
|
|
263
|
+
fieldOutObjectStatus: ServiceConstants.OutObjectStatus.none.toString(),
|
|
264
|
+
isAdminServices: true
|
|
265
|
+
}
|
|
266
|
+
await new SyncEngine().checkInOutBoxAndQueue(outObjectData);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
private async getAdditionalInfo(): Promise<string> {
|
|
271
|
+
let infoMessageString = "";
|
|
272
|
+
|
|
273
|
+
const databaseManager = DatabaseManager.getInstance();
|
|
274
|
+
const infoMessages = await databaseManager.select(DatabaseType.FrameworkDb, "InfoMessage");
|
|
275
|
+
infoMessageString += "Framework Version: BUILD 6\n";
|
|
276
|
+
if (infoMessages.length > 0) {
|
|
277
|
+
// Add the Info Message to the end of Data.
|
|
278
|
+
|
|
279
|
+
for (let i = 0; i < infoMessages.length; i++) {
|
|
280
|
+
if (i === 0) {
|
|
281
|
+
infoMessageString += "********ALL INFO MESSAGES********";
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const infoMessage = infoMessages[i];
|
|
285
|
+
const category = infoMessage.category;
|
|
286
|
+
const message = infoMessage.message;
|
|
287
|
+
const beName = infoMessage.bename;
|
|
288
|
+
const beLID = infoMessage.belid;
|
|
289
|
+
infoMessageString += `\n${i + 1}`;
|
|
290
|
+
infoMessageString += `\n${message}`;
|
|
291
|
+
infoMessageString += `\n${category}`;
|
|
292
|
+
infoMessageString += `\n${beName}`;
|
|
293
|
+
infoMessageString += `\n${beLID}`;
|
|
294
|
+
infoMessageString += "\n";
|
|
295
|
+
if (i === infoMessages.length - 1) {
|
|
296
|
+
infoMessageString += "********END OF INFO MESSAGES********\n";
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// Display All the Contents from ApplicationVersion.txt.
|
|
301
|
+
infoMessageString += "********VERSION INFORMATION********\n";
|
|
302
|
+
|
|
303
|
+
// TODO: Get the version and build number from the package info.
|
|
304
|
+
const version = "";
|
|
305
|
+
const buildNumber = "";
|
|
306
|
+
|
|
307
|
+
infoMessageString += `Version: ${version}`;
|
|
308
|
+
infoMessageString += `\tBuild: ${buildNumber}`;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
infoMessageString += "\n";
|
|
312
|
+
|
|
313
|
+
// Add inbox items, outbox items and sent items details
|
|
314
|
+
const inboxItems = await databaseManager.select(DatabaseType.FrameworkDb, "InObject");
|
|
315
|
+
if (inboxItems.length > 0) {
|
|
316
|
+
let inboxStr = "***** INBOX *****\n";
|
|
317
|
+
for (const inObj of inboxItems) {
|
|
318
|
+
const currentDate = new Date(inObj.timestamp);
|
|
319
|
+
const formatter = new Intl.DateTimeFormat('en-US', {
|
|
320
|
+
day: '2-digit',
|
|
321
|
+
month: '2-digit',
|
|
322
|
+
year: 'numeric',
|
|
323
|
+
hour: '2-digit',
|
|
324
|
+
minute: '2-digit',
|
|
325
|
+
second: '2-digit'
|
|
326
|
+
});
|
|
327
|
+
const finalDate = formatter.format(currentDate);
|
|
328
|
+
inboxStr += `${finalDate} | ${inObj.conversationId}\n`;
|
|
329
|
+
}
|
|
330
|
+
inboxStr += "\n";
|
|
331
|
+
infoMessageString += inboxStr;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
const outboxItems = await databaseManager.select(DatabaseType.FrameworkDb, "OutObject");
|
|
335
|
+
if (outboxItems.length > 0) {
|
|
336
|
+
let outboxStr = "***** OUTBOX *****\n";
|
|
337
|
+
for (const outObj of outboxItems) {
|
|
338
|
+
const currentDate = new Date(outObj.timestamp);
|
|
339
|
+
const formatter = new Intl.DateTimeFormat('en-US', {
|
|
340
|
+
day: '2-digit',
|
|
341
|
+
month: '2-digit',
|
|
342
|
+
year: 'numeric',
|
|
343
|
+
hour: '2-digit',
|
|
344
|
+
minute: '2-digit',
|
|
345
|
+
second: '2-digit'
|
|
346
|
+
});
|
|
347
|
+
const finalDate = formatter.format(currentDate);
|
|
348
|
+
outboxStr += `${finalDate} | ${outObj.conversationId}\n`;
|
|
349
|
+
}
|
|
350
|
+
outboxStr += "\n";
|
|
351
|
+
infoMessageString += outboxStr;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
const sentItems = await databaseManager.select(DatabaseType.FrameworkDb, "SentItems");
|
|
355
|
+
if (sentItems.length > 0) {
|
|
356
|
+
let sentItemsStr = "***** SENT ITEMS *****\n";
|
|
357
|
+
for (const sentItem of sentItems) {
|
|
358
|
+
const currentDate = new Date(sentItem.timestamp);
|
|
359
|
+
const formatter = new Intl.DateTimeFormat('en-US', {
|
|
360
|
+
day: '2-digit',
|
|
361
|
+
month: '2-digit',
|
|
362
|
+
year: 'numeric',
|
|
363
|
+
hour: '2-digit',
|
|
364
|
+
minute: '2-digit',
|
|
365
|
+
second: '2-digit'
|
|
366
|
+
});
|
|
367
|
+
const finalDate = formatter.format(currentDate);
|
|
368
|
+
sentItemsStr += `${finalDate} | ${sentItem.conversationId}\n`;
|
|
369
|
+
}
|
|
370
|
+
sentItemsStr += "\n";
|
|
371
|
+
infoMessageString += sentItemsStr;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return infoMessageString;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
convertMapToBase64(map: { [key: string]: any }): string {
|
|
378
|
+
return btoa(JSON.stringify(map));
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
convertBase64ToMap(base64String: string): { [key: string]: any } {
|
|
382
|
+
return JSON.parse(atob(base64String));
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export default SettingsHelper;
|