cordova-plugin-unvired-universal-sdk 1.0.6 → 1.0.8

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 (76) hide show
  1. package/package.json +1 -1
  2. package/plugin.xml +1 -13
  3. package/www/kernel.js +38344 -1243
  4. package/aar/README.md +0 -3
  5. package/aar/Unvired_Kernel_Android.aar +0 -0
  6. package/aar/Unvired_Kernel_HTML5_Android.aar +0 -0
  7. package/src/android/build.gradle +0 -35
  8. package/src/android/xml/provider_paths.xml +0 -21
  9. package/src/browser/UnviredPluginProxy.js +0 -2430
  10. package/src/browser/bootstrap.min.js +0 -17
  11. package/src/browser/codemirror.js +0 -9755
  12. package/src/browser/jquery-3.2.1.js +0 -10253
  13. package/src/browser/sql-wasm.wasm +0 -0
  14. package/src/browser/sql.js +0 -203
  15. package/src/browser/src_index_worker_js.unvired-db-worker.js +0 -231
  16. package/src/browser/unvired-db-worker.js +0 -166
  17. package/src/browser/vendors-node_modules_comlink_dist_esm_comlink_mjs.unvired-db-worker.js +0 -22
  18. package/src/ios/AttachmentPlugin.h +0 -21
  19. package/src/ios/AttachmentPlugin.m +0 -180
  20. package/src/ios/DataStructureHelper.h +0 -28
  21. package/src/ios/DataStructureHelper.m +0 -188
  22. package/src/ios/IOSAuthPlugin.h +0 -14
  23. package/src/ios/IOSAuthPlugin.m +0 -13
  24. package/src/ios/IOSDatabasePlugin.h +0 -28
  25. package/src/ios/IOSDatabasePlugin.m +0 -253
  26. package/src/ios/IOSFWSettingsPlugin.h +0 -65
  27. package/src/ios/IOSFWSettingsPlugin.m +0 -363
  28. package/src/ios/IOSLoggerPlugin.h +0 -34
  29. package/src/ios/IOSLoggerPlugin.m +0 -198
  30. package/src/ios/IOSLoginPlugin.h +0 -29
  31. package/src/ios/IOSLoginPlugin.m +0 -480
  32. package/src/ios/IOSProxyPlugin.h +0 -21
  33. package/src/ios/IOSProxyPlugin.m +0 -172
  34. package/src/ios/IOSSyncEnginePlugin.h +0 -54
  35. package/src/ios/IOSSyncEnginePlugin.m +0 -847
  36. package/src/ios/PluginConstants.h +0 -195
  37. package/src/ios/PluginHelper.h +0 -29
  38. package/src/ios/PluginHelper.m +0 -74
  39. package/src/ios/SyncHTML5Response.h +0 -50
  40. package/src/ios/SyncHTML5Response.m +0 -68
  41. package/www/applicationMeta/applicationMetadataParser.ts +0 -285
  42. package/www/applicationMeta/fieldConstants.ts +0 -92
  43. package/www/attachment/attachmentHelper.ts +0 -326
  44. package/www/attachment/attachmentQHelper.ts +0 -158
  45. package/www/attachment/attachmentService.ts +0 -259
  46. package/www/authenticationService.ts +0 -751
  47. package/www/database/appDatabaseManager.ts +0 -54
  48. package/www/database/databaseManager.ts +0 -616
  49. package/www/helper/dbCreateTablesManager.ts +0 -354
  50. package/www/helper/frameworkHelper.ts +0 -127
  51. package/www/helper/frameworkSettingsManager.ts +0 -287
  52. package/www/helper/getMessageTimerManager.ts +0 -81
  53. package/www/helper/httpConnection.ts +0 -1051
  54. package/www/helper/logger.ts +0 -312
  55. package/www/helper/notificationListnerHelper.ts +0 -56
  56. package/www/helper/passcodeGenerator.ts +0 -61
  57. package/www/helper/reconciler.ts +0 -1062
  58. package/www/helper/serverResponseHandler.ts +0 -677
  59. package/www/helper/serviceConstants.ts +0 -254
  60. package/www/helper/settingsHelper.ts +0 -386
  61. package/www/helper/status.ts +0 -83
  62. package/www/helper/syncInputDataManager.ts +0 -205
  63. package/www/helper/unviredAccount.ts +0 -104
  64. package/www/helper/unviredAccountManager.ts +0 -120
  65. package/www/helper/urlService.ts +0 -43
  66. package/www/helper/userSettingsManager.ts +0 -172
  67. package/www/helper/utils.ts +0 -110
  68. package/www/inbox/downloadMessageService.ts +0 -270
  69. package/www/inbox/inboxHelper.ts +0 -132
  70. package/www/inbox/inboxService.ts +0 -223
  71. package/www/outbox/outboxAttachmentManager.ts +0 -152
  72. package/www/outbox/outboxHelper.ts +0 -67
  73. package/www/outbox/outboxService.ts +0 -519
  74. package/www/subtract.ts +0 -5
  75. package/www/sum.ts +0 -4
  76. package/www/syncEngine.ts +0 -687
@@ -1,166 +0,0 @@
1
- /*
2
- * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
3
- * This devtool is neither made for production nor for readable output files.
4
- * It uses "eval()" calls to create a separate source file in the browser devtools.
5
- * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
6
- * or disable the default devtool with "devtool: false".
7
- * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
8
- */
9
- /******/ (() => { // webpackBootstrap
10
- /******/ "use strict";
11
- /******/ var __webpack_modules__ = ({
12
-
13
- /***/ "./src/index.js":
14
- /*!**********************!*\
15
- !*** ./src/index.js ***!
16
- \**********************/
17
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
18
-
19
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! comlink */ \"./node_modules/comlink/dist/esm/comlink.mjs\");\n\n\nasync function init_db_worker() {\n let worker = new Worker(new URL(/* worker import */ __webpack_require__.p + __webpack_require__.u(\"src_index_worker_js\"), __webpack_require__.b));\n const api = (0,comlink__WEBPACK_IMPORTED_MODULE_0__.wrap)(worker);\n window.unvired_db_worker = api;\n}\n\ninit_db_worker();\n\n\n//# sourceURL=webpack://unvired-db-worker/./src/index.js?");
20
-
21
- /***/ }),
22
-
23
- /***/ "./node_modules/comlink/dist/esm/comlink.mjs":
24
- /*!***************************************************!*\
25
- !*** ./node_modules/comlink/dist/esm/comlink.mjs ***!
26
- \***************************************************/
27
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
28
-
29
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"createEndpoint\": () => (/* binding */ createEndpoint),\n/* harmony export */ \"expose\": () => (/* binding */ expose),\n/* harmony export */ \"proxy\": () => (/* binding */ proxy),\n/* harmony export */ \"proxyMarker\": () => (/* binding */ proxyMarker),\n/* harmony export */ \"releaseProxy\": () => (/* binding */ releaseProxy),\n/* harmony export */ \"transfer\": () => (/* binding */ transfer),\n/* harmony export */ \"transferHandlers\": () => (/* binding */ transferHandlers),\n/* harmony export */ \"windowEndpoint\": () => (/* binding */ windowEndpoint),\n/* harmony export */ \"wrap\": () => (/* binding */ wrap)\n/* harmony export */ });\n/**\r\n * Copyright 2019 Google Inc. All Rights Reserved.\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst proxyMarker = Symbol(\"Comlink.proxy\");\r\nconst createEndpoint = Symbol(\"Comlink.endpoint\");\r\nconst releaseProxy = Symbol(\"Comlink.releaseProxy\");\r\nconst throwMarker = Symbol(\"Comlink.thrown\");\r\nconst isObject = (val) => (typeof val === \"object\" && val !== null) || typeof val === \"function\";\r\n/**\r\n * Internal transfer handle to handle objects marked to proxy.\r\n */\r\nconst proxyTransferHandler = {\r\n canHandle: (val) => isObject(val) && val[proxyMarker],\r\n serialize(obj) {\r\n const { port1, port2 } = new MessageChannel();\r\n expose(obj, port1);\r\n return [port2, [port2]];\r\n },\r\n deserialize(port) {\r\n port.start();\r\n return wrap(port);\r\n },\r\n};\r\n/**\r\n * Internal transfer handler to handle thrown exceptions.\r\n */\r\nconst throwTransferHandler = {\r\n canHandle: (value) => isObject(value) && throwMarker in value,\r\n serialize({ value }) {\r\n let serialized;\r\n if (value instanceof Error) {\r\n serialized = {\r\n isError: true,\r\n value: {\r\n message: value.message,\r\n name: value.name,\r\n stack: value.stack,\r\n },\r\n };\r\n }\r\n else {\r\n serialized = { isError: false, value };\r\n }\r\n return [serialized, []];\r\n },\r\n deserialize(serialized) {\r\n if (serialized.isError) {\r\n throw Object.assign(new Error(serialized.value.message), serialized.value);\r\n }\r\n throw serialized.value;\r\n },\r\n};\r\n/**\r\n * Allows customizing the serialization of certain values.\r\n */\r\nconst transferHandlers = new Map([\r\n [\"proxy\", proxyTransferHandler],\r\n [\"throw\", throwTransferHandler],\r\n]);\r\nfunction expose(obj, ep = self) {\r\n ep.addEventListener(\"message\", function callback(ev) {\r\n if (!ev || !ev.data) {\r\n return;\r\n }\r\n const { id, type, path } = Object.assign({ path: [] }, ev.data);\r\n const argumentList = (ev.data.argumentList || []).map(fromWireValue);\r\n let returnValue;\r\n try {\r\n const parent = path.slice(0, -1).reduce((obj, prop) => obj[prop], obj);\r\n const rawValue = path.reduce((obj, prop) => obj[prop], obj);\r\n switch (type) {\r\n case \"GET\" /* GET */:\r\n {\r\n returnValue = rawValue;\r\n }\r\n break;\r\n case \"SET\" /* SET */:\r\n {\r\n parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\r\n returnValue = true;\r\n }\r\n break;\r\n case \"APPLY\" /* APPLY */:\r\n {\r\n returnValue = rawValue.apply(parent, argumentList);\r\n }\r\n break;\r\n case \"CONSTRUCT\" /* CONSTRUCT */:\r\n {\r\n const value = new rawValue(...argumentList);\r\n returnValue = proxy(value);\r\n }\r\n break;\r\n case \"ENDPOINT\" /* ENDPOINT */:\r\n {\r\n const { port1, port2 } = new MessageChannel();\r\n expose(obj, port2);\r\n returnValue = transfer(port1, [port1]);\r\n }\r\n break;\r\n case \"RELEASE\" /* RELEASE */:\r\n {\r\n returnValue = undefined;\r\n }\r\n break;\r\n default:\r\n return;\r\n }\r\n }\r\n catch (value) {\r\n returnValue = { value, [throwMarker]: 0 };\r\n }\r\n Promise.resolve(returnValue)\r\n .catch((value) => {\r\n return { value, [throwMarker]: 0 };\r\n })\r\n .then((returnValue) => {\r\n const [wireValue, transferables] = toWireValue(returnValue);\r\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\r\n if (type === \"RELEASE\" /* RELEASE */) {\r\n // detach and deactive after sending release response above.\r\n ep.removeEventListener(\"message\", callback);\r\n closeEndPoint(ep);\r\n }\r\n });\r\n });\r\n if (ep.start) {\r\n ep.start();\r\n }\r\n}\r\nfunction isMessagePort(endpoint) {\r\n return endpoint.constructor.name === \"MessagePort\";\r\n}\r\nfunction closeEndPoint(endpoint) {\r\n if (isMessagePort(endpoint))\r\n endpoint.close();\r\n}\r\nfunction wrap(ep, target) {\r\n return createProxy(ep, [], target);\r\n}\r\nfunction throwIfProxyReleased(isReleased) {\r\n if (isReleased) {\r\n throw new Error(\"Proxy has been released and is not useable\");\r\n }\r\n}\r\nfunction createProxy(ep, path = [], target = function () { }) {\r\n let isProxyReleased = false;\r\n const proxy = new Proxy(target, {\r\n get(_target, prop) {\r\n throwIfProxyReleased(isProxyReleased);\r\n if (prop === releaseProxy) {\r\n return () => {\r\n return requestResponseMessage(ep, {\r\n type: \"RELEASE\" /* RELEASE */,\r\n path: path.map((p) => p.toString()),\r\n }).then(() => {\r\n closeEndPoint(ep);\r\n isProxyReleased = true;\r\n });\r\n };\r\n }\r\n if (prop === \"then\") {\r\n if (path.length === 0) {\r\n return { then: () => proxy };\r\n }\r\n const r = requestResponseMessage(ep, {\r\n type: \"GET\" /* GET */,\r\n path: path.map((p) => p.toString()),\r\n }).then(fromWireValue);\r\n return r.then.bind(r);\r\n }\r\n return createProxy(ep, [...path, prop]);\r\n },\r\n set(_target, prop, rawValue) {\r\n throwIfProxyReleased(isProxyReleased);\r\n // FIXME: ES6 Proxy Handler `set` methods are supposed to return a\r\n // boolean. To show good will, we return true asynchronously ¯\\_(ツ)_/¯\r\n const [value, transferables] = toWireValue(rawValue);\r\n return requestResponseMessage(ep, {\r\n type: \"SET\" /* SET */,\r\n path: [...path, prop].map((p) => p.toString()),\r\n value,\r\n }, transferables).then(fromWireValue);\r\n },\r\n apply(_target, _thisArg, rawArgumentList) {\r\n throwIfProxyReleased(isProxyReleased);\r\n const last = path[path.length - 1];\r\n if (last === createEndpoint) {\r\n return requestResponseMessage(ep, {\r\n type: \"ENDPOINT\" /* ENDPOINT */,\r\n }).then(fromWireValue);\r\n }\r\n // We just pretend that `bind()` didn’t happen.\r\n if (last === \"bind\") {\r\n return createProxy(ep, path.slice(0, -1));\r\n }\r\n const [argumentList, transferables] = processArguments(rawArgumentList);\r\n return requestResponseMessage(ep, {\r\n type: \"APPLY\" /* APPLY */,\r\n path: path.map((p) => p.toString()),\r\n argumentList,\r\n }, transferables).then(fromWireValue);\r\n },\r\n construct(_target, rawArgumentList) {\r\n throwIfProxyReleased(isProxyReleased);\r\n const [argumentList, transferables] = processArguments(rawArgumentList);\r\n return requestResponseMessage(ep, {\r\n type: \"CONSTRUCT\" /* CONSTRUCT */,\r\n path: path.map((p) => p.toString()),\r\n argumentList,\r\n }, transferables).then(fromWireValue);\r\n },\r\n });\r\n return proxy;\r\n}\r\nfunction myFlat(arr) {\r\n return Array.prototype.concat.apply([], arr);\r\n}\r\nfunction processArguments(argumentList) {\r\n const processed = argumentList.map(toWireValue);\r\n return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];\r\n}\r\nconst transferCache = new WeakMap();\r\nfunction transfer(obj, transfers) {\r\n transferCache.set(obj, transfers);\r\n return obj;\r\n}\r\nfunction proxy(obj) {\r\n return Object.assign(obj, { [proxyMarker]: true });\r\n}\r\nfunction windowEndpoint(w, context = self, targetOrigin = \"*\") {\r\n return {\r\n postMessage: (msg, transferables) => w.postMessage(msg, targetOrigin, transferables),\r\n addEventListener: context.addEventListener.bind(context),\r\n removeEventListener: context.removeEventListener.bind(context),\r\n };\r\n}\r\nfunction toWireValue(value) {\r\n for (const [name, handler] of transferHandlers) {\r\n if (handler.canHandle(value)) {\r\n const [serializedValue, transferables] = handler.serialize(value);\r\n return [\r\n {\r\n type: \"HANDLER\" /* HANDLER */,\r\n name,\r\n value: serializedValue,\r\n },\r\n transferables,\r\n ];\r\n }\r\n }\r\n return [\r\n {\r\n type: \"RAW\" /* RAW */,\r\n value,\r\n },\r\n transferCache.get(value) || [],\r\n ];\r\n}\r\nfunction fromWireValue(value) {\r\n switch (value.type) {\r\n case \"HANDLER\" /* HANDLER */:\r\n return transferHandlers.get(value.name).deserialize(value.value);\r\n case \"RAW\" /* RAW */:\r\n return value.value;\r\n }\r\n}\r\nfunction requestResponseMessage(ep, msg, transfers) {\r\n return new Promise((resolve) => {\r\n const id = generateUUID();\r\n ep.addEventListener(\"message\", function l(ev) {\r\n if (!ev.data || !ev.data.id || ev.data.id !== id) {\r\n return;\r\n }\r\n ep.removeEventListener(\"message\", l);\r\n resolve(ev.data);\r\n });\r\n if (ep.start) {\r\n ep.start();\r\n }\r\n ep.postMessage(Object.assign({ id }, msg), transfers);\r\n });\r\n}\r\nfunction generateUUID() {\r\n return new Array(4)\r\n .fill(0)\r\n .map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))\r\n .join(\"-\");\r\n}\n\n\n//# sourceMappingURL=comlink.mjs.map\n\n\n//# sourceURL=webpack://unvired-db-worker/./node_modules/comlink/dist/esm/comlink.mjs?");
30
-
31
- /***/ })
32
-
33
- /******/ });
34
- /************************************************************************/
35
- /******/ // The module cache
36
- /******/ var __webpack_module_cache__ = {};
37
- /******/
38
- /******/ // The require function
39
- /******/ function __webpack_require__(moduleId) {
40
- /******/ // Check if module is in cache
41
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
42
- /******/ if (cachedModule !== undefined) {
43
- /******/ return cachedModule.exports;
44
- /******/ }
45
- /******/ // Create a new module (and put it into the cache)
46
- /******/ var module = __webpack_module_cache__[moduleId] = {
47
- /******/ // no module.id needed
48
- /******/ // no module.loaded needed
49
- /******/ exports: {}
50
- /******/ };
51
- /******/
52
- /******/ // Execute the module function
53
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
54
- /******/
55
- /******/ // Return the exports of the module
56
- /******/ return module.exports;
57
- /******/ }
58
- /******/
59
- /******/ // expose the modules object (__webpack_modules__)
60
- /******/ __webpack_require__.m = __webpack_modules__;
61
- /******/
62
- /************************************************************************/
63
- /******/ /* webpack/runtime/define property getters */
64
- /******/ (() => {
65
- /******/ // define getter functions for harmony exports
66
- /******/ __webpack_require__.d = (exports, definition) => {
67
- /******/ for(var key in definition) {
68
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
69
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
70
- /******/ }
71
- /******/ }
72
- /******/ };
73
- /******/ })();
74
- /******/
75
- /******/ /* webpack/runtime/get javascript chunk filename */
76
- /******/ (() => {
77
- /******/ // This function allow to reference async chunks
78
- /******/ __webpack_require__.u = (chunkId) => {
79
- /******/ // return url for filenames based on template
80
- /******/ return "" + chunkId + ".unvired-db-worker.js";
81
- /******/ };
82
- /******/ })();
83
- /******/
84
- /******/ /* webpack/runtime/global */
85
- /******/ (() => {
86
- /******/ __webpack_require__.g = (function() {
87
- /******/ if (typeof globalThis === 'object') return globalThis;
88
- /******/ try {
89
- /******/ return this || new Function('return this')();
90
- /******/ } catch (e) {
91
- /******/ if (typeof window === 'object') return window;
92
- /******/ }
93
- /******/ })();
94
- /******/ })();
95
- /******/
96
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
97
- /******/ (() => {
98
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
99
- /******/ })();
100
- /******/
101
- /******/ /* webpack/runtime/make namespace object */
102
- /******/ (() => {
103
- /******/ // define __esModule on exports
104
- /******/ __webpack_require__.r = (exports) => {
105
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
106
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
107
- /******/ }
108
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
109
- /******/ };
110
- /******/ })();
111
- /******/
112
- /******/ /* webpack/runtime/publicPath */
113
- /******/ (() => {
114
- /******/ var scriptUrl;
115
- /******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
116
- /******/ var document = __webpack_require__.g.document;
117
- /******/ if (!scriptUrl && document) {
118
- /******/ if (document.currentScript)
119
- /******/ scriptUrl = document.currentScript.src
120
- /******/ if (!scriptUrl) {
121
- /******/ var scripts = document.getElementsByTagName("script");
122
- /******/ if(scripts.length) scriptUrl = scripts[scripts.length - 1].src
123
- /******/ }
124
- /******/ }
125
- /******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
126
- /******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
127
- /******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
128
- /******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
129
- /******/ __webpack_require__.p = scriptUrl;
130
- /******/ })();
131
- /******/
132
- /******/ /* webpack/runtime/jsonp chunk loading */
133
- /******/ (() => {
134
- /******/ __webpack_require__.b = document.baseURI || self.location.href;
135
- /******/
136
- /******/ // object to store loaded and loading chunks
137
- /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
138
- /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
139
- /******/ var installedChunks = {
140
- /******/ "main": 0
141
- /******/ };
142
- /******/
143
- /******/ // no chunk on demand loading
144
- /******/
145
- /******/ // no prefetching
146
- /******/
147
- /******/ // no preloaded
148
- /******/
149
- /******/ // no HMR
150
- /******/
151
- /******/ // no HMR manifest
152
- /******/
153
- /******/ // no on chunks loaded
154
- /******/
155
- /******/ // no jsonp function
156
- /******/ })();
157
- /******/
158
- /************************************************************************/
159
- /******/
160
- /******/ // startup
161
- /******/ // Load entry module and return exports
162
- /******/ // This entry module can't be inlined because the eval devtool is used.
163
- /******/ var __webpack_exports__ = __webpack_require__("./src/index.js");
164
- /******/
165
- /******/ })()
166
- ;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- /*
3
- * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
4
- * This devtool is neither made for production nor for readable output files.
5
- * It uses "eval()" calls to create a separate source file in the browser devtools.
6
- * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
7
- * or disable the default devtool with "devtool: false".
8
- * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
9
- */
10
- (self["webpackChunkunvired_db_worker"] = self["webpackChunkunvired_db_worker"] || []).push([["vendors-node_modules_comlink_dist_esm_comlink_mjs"],{
11
-
12
- /***/ "./node_modules/comlink/dist/esm/comlink.mjs":
13
- /*!***************************************************!*\
14
- !*** ./node_modules/comlink/dist/esm/comlink.mjs ***!
15
- \***************************************************/
16
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
17
-
18
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"createEndpoint\": () => (/* binding */ createEndpoint),\n/* harmony export */ \"expose\": () => (/* binding */ expose),\n/* harmony export */ \"proxy\": () => (/* binding */ proxy),\n/* harmony export */ \"proxyMarker\": () => (/* binding */ proxyMarker),\n/* harmony export */ \"releaseProxy\": () => (/* binding */ releaseProxy),\n/* harmony export */ \"transfer\": () => (/* binding */ transfer),\n/* harmony export */ \"transferHandlers\": () => (/* binding */ transferHandlers),\n/* harmony export */ \"windowEndpoint\": () => (/* binding */ windowEndpoint),\n/* harmony export */ \"wrap\": () => (/* binding */ wrap)\n/* harmony export */ });\n/**\r\n * Copyright 2019 Google Inc. All Rights Reserved.\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst proxyMarker = Symbol(\"Comlink.proxy\");\r\nconst createEndpoint = Symbol(\"Comlink.endpoint\");\r\nconst releaseProxy = Symbol(\"Comlink.releaseProxy\");\r\nconst throwMarker = Symbol(\"Comlink.thrown\");\r\nconst isObject = (val) => (typeof val === \"object\" && val !== null) || typeof val === \"function\";\r\n/**\r\n * Internal transfer handle to handle objects marked to proxy.\r\n */\r\nconst proxyTransferHandler = {\r\n canHandle: (val) => isObject(val) && val[proxyMarker],\r\n serialize(obj) {\r\n const { port1, port2 } = new MessageChannel();\r\n expose(obj, port1);\r\n return [port2, [port2]];\r\n },\r\n deserialize(port) {\r\n port.start();\r\n return wrap(port);\r\n },\r\n};\r\n/**\r\n * Internal transfer handler to handle thrown exceptions.\r\n */\r\nconst throwTransferHandler = {\r\n canHandle: (value) => isObject(value) && throwMarker in value,\r\n serialize({ value }) {\r\n let serialized;\r\n if (value instanceof Error) {\r\n serialized = {\r\n isError: true,\r\n value: {\r\n message: value.message,\r\n name: value.name,\r\n stack: value.stack,\r\n },\r\n };\r\n }\r\n else {\r\n serialized = { isError: false, value };\r\n }\r\n return [serialized, []];\r\n },\r\n deserialize(serialized) {\r\n if (serialized.isError) {\r\n throw Object.assign(new Error(serialized.value.message), serialized.value);\r\n }\r\n throw serialized.value;\r\n },\r\n};\r\n/**\r\n * Allows customizing the serialization of certain values.\r\n */\r\nconst transferHandlers = new Map([\r\n [\"proxy\", proxyTransferHandler],\r\n [\"throw\", throwTransferHandler],\r\n]);\r\nfunction expose(obj, ep = self) {\r\n ep.addEventListener(\"message\", function callback(ev) {\r\n if (!ev || !ev.data) {\r\n return;\r\n }\r\n const { id, type, path } = Object.assign({ path: [] }, ev.data);\r\n const argumentList = (ev.data.argumentList || []).map(fromWireValue);\r\n let returnValue;\r\n try {\r\n const parent = path.slice(0, -1).reduce((obj, prop) => obj[prop], obj);\r\n const rawValue = path.reduce((obj, prop) => obj[prop], obj);\r\n switch (type) {\r\n case \"GET\" /* GET */:\r\n {\r\n returnValue = rawValue;\r\n }\r\n break;\r\n case \"SET\" /* SET */:\r\n {\r\n parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\r\n returnValue = true;\r\n }\r\n break;\r\n case \"APPLY\" /* APPLY */:\r\n {\r\n returnValue = rawValue.apply(parent, argumentList);\r\n }\r\n break;\r\n case \"CONSTRUCT\" /* CONSTRUCT */:\r\n {\r\n const value = new rawValue(...argumentList);\r\n returnValue = proxy(value);\r\n }\r\n break;\r\n case \"ENDPOINT\" /* ENDPOINT */:\r\n {\r\n const { port1, port2 } = new MessageChannel();\r\n expose(obj, port2);\r\n returnValue = transfer(port1, [port1]);\r\n }\r\n break;\r\n case \"RELEASE\" /* RELEASE */:\r\n {\r\n returnValue = undefined;\r\n }\r\n break;\r\n default:\r\n return;\r\n }\r\n }\r\n catch (value) {\r\n returnValue = { value, [throwMarker]: 0 };\r\n }\r\n Promise.resolve(returnValue)\r\n .catch((value) => {\r\n return { value, [throwMarker]: 0 };\r\n })\r\n .then((returnValue) => {\r\n const [wireValue, transferables] = toWireValue(returnValue);\r\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\r\n if (type === \"RELEASE\" /* RELEASE */) {\r\n // detach and deactive after sending release response above.\r\n ep.removeEventListener(\"message\", callback);\r\n closeEndPoint(ep);\r\n }\r\n });\r\n });\r\n if (ep.start) {\r\n ep.start();\r\n }\r\n}\r\nfunction isMessagePort(endpoint) {\r\n return endpoint.constructor.name === \"MessagePort\";\r\n}\r\nfunction closeEndPoint(endpoint) {\r\n if (isMessagePort(endpoint))\r\n endpoint.close();\r\n}\r\nfunction wrap(ep, target) {\r\n return createProxy(ep, [], target);\r\n}\r\nfunction throwIfProxyReleased(isReleased) {\r\n if (isReleased) {\r\n throw new Error(\"Proxy has been released and is not useable\");\r\n }\r\n}\r\nfunction createProxy(ep, path = [], target = function () { }) {\r\n let isProxyReleased = false;\r\n const proxy = new Proxy(target, {\r\n get(_target, prop) {\r\n throwIfProxyReleased(isProxyReleased);\r\n if (prop === releaseProxy) {\r\n return () => {\r\n return requestResponseMessage(ep, {\r\n type: \"RELEASE\" /* RELEASE */,\r\n path: path.map((p) => p.toString()),\r\n }).then(() => {\r\n closeEndPoint(ep);\r\n isProxyReleased = true;\r\n });\r\n };\r\n }\r\n if (prop === \"then\") {\r\n if (path.length === 0) {\r\n return { then: () => proxy };\r\n }\r\n const r = requestResponseMessage(ep, {\r\n type: \"GET\" /* GET */,\r\n path: path.map((p) => p.toString()),\r\n }).then(fromWireValue);\r\n return r.then.bind(r);\r\n }\r\n return createProxy(ep, [...path, prop]);\r\n },\r\n set(_target, prop, rawValue) {\r\n throwIfProxyReleased(isProxyReleased);\r\n // FIXME: ES6 Proxy Handler `set` methods are supposed to return a\r\n // boolean. To show good will, we return true asynchronously ¯\\_(ツ)_/¯\r\n const [value, transferables] = toWireValue(rawValue);\r\n return requestResponseMessage(ep, {\r\n type: \"SET\" /* SET */,\r\n path: [...path, prop].map((p) => p.toString()),\r\n value,\r\n }, transferables).then(fromWireValue);\r\n },\r\n apply(_target, _thisArg, rawArgumentList) {\r\n throwIfProxyReleased(isProxyReleased);\r\n const last = path[path.length - 1];\r\n if (last === createEndpoint) {\r\n return requestResponseMessage(ep, {\r\n type: \"ENDPOINT\" /* ENDPOINT */,\r\n }).then(fromWireValue);\r\n }\r\n // We just pretend that `bind()` didn’t happen.\r\n if (last === \"bind\") {\r\n return createProxy(ep, path.slice(0, -1));\r\n }\r\n const [argumentList, transferables] = processArguments(rawArgumentList);\r\n return requestResponseMessage(ep, {\r\n type: \"APPLY\" /* APPLY */,\r\n path: path.map((p) => p.toString()),\r\n argumentList,\r\n }, transferables).then(fromWireValue);\r\n },\r\n construct(_target, rawArgumentList) {\r\n throwIfProxyReleased(isProxyReleased);\r\n const [argumentList, transferables] = processArguments(rawArgumentList);\r\n return requestResponseMessage(ep, {\r\n type: \"CONSTRUCT\" /* CONSTRUCT */,\r\n path: path.map((p) => p.toString()),\r\n argumentList,\r\n }, transferables).then(fromWireValue);\r\n },\r\n });\r\n return proxy;\r\n}\r\nfunction myFlat(arr) {\r\n return Array.prototype.concat.apply([], arr);\r\n}\r\nfunction processArguments(argumentList) {\r\n const processed = argumentList.map(toWireValue);\r\n return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];\r\n}\r\nconst transferCache = new WeakMap();\r\nfunction transfer(obj, transfers) {\r\n transferCache.set(obj, transfers);\r\n return obj;\r\n}\r\nfunction proxy(obj) {\r\n return Object.assign(obj, { [proxyMarker]: true });\r\n}\r\nfunction windowEndpoint(w, context = self, targetOrigin = \"*\") {\r\n return {\r\n postMessage: (msg, transferables) => w.postMessage(msg, targetOrigin, transferables),\r\n addEventListener: context.addEventListener.bind(context),\r\n removeEventListener: context.removeEventListener.bind(context),\r\n };\r\n}\r\nfunction toWireValue(value) {\r\n for (const [name, handler] of transferHandlers) {\r\n if (handler.canHandle(value)) {\r\n const [serializedValue, transferables] = handler.serialize(value);\r\n return [\r\n {\r\n type: \"HANDLER\" /* HANDLER */,\r\n name,\r\n value: serializedValue,\r\n },\r\n transferables,\r\n ];\r\n }\r\n }\r\n return [\r\n {\r\n type: \"RAW\" /* RAW */,\r\n value,\r\n },\r\n transferCache.get(value) || [],\r\n ];\r\n}\r\nfunction fromWireValue(value) {\r\n switch (value.type) {\r\n case \"HANDLER\" /* HANDLER */:\r\n return transferHandlers.get(value.name).deserialize(value.value);\r\n case \"RAW\" /* RAW */:\r\n return value.value;\r\n }\r\n}\r\nfunction requestResponseMessage(ep, msg, transfers) {\r\n return new Promise((resolve) => {\r\n const id = generateUUID();\r\n ep.addEventListener(\"message\", function l(ev) {\r\n if (!ev.data || !ev.data.id || ev.data.id !== id) {\r\n return;\r\n }\r\n ep.removeEventListener(\"message\", l);\r\n resolve(ev.data);\r\n });\r\n if (ep.start) {\r\n ep.start();\r\n }\r\n ep.postMessage(Object.assign({ id }, msg), transfers);\r\n });\r\n}\r\nfunction generateUUID() {\r\n return new Array(4)\r\n .fill(0)\r\n .map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))\r\n .join(\"-\");\r\n}\n\n\n//# sourceMappingURL=comlink.mjs.map\n\n\n//# sourceURL=webpack://unvired-db-worker/./node_modules/comlink/dist/esm/comlink.mjs?");
19
-
20
- /***/ })
21
-
22
- }]);
@@ -1,21 +0,0 @@
1
- //
2
- // AttachmentPlugin.h
3
- // UnviredCordovaSDK
4
- //
5
- // Created by Srinidhi Rao on 20/11/17.
6
- // Copyright © 2017 Unvired Software India Pvt. Ltd. All rights reserved.
7
- //
8
-
9
- #import <Cordova/CDV.h>
10
-
11
- @interface AttachmentPlugin : CDVPlugin
12
-
13
- - (void)createAttachmentItem:(CDVInvokedUrlCommand *)command;
14
-
15
- - (void)uploadAttachment:(CDVInvokedUrlCommand *)command;
16
-
17
- - (void)downloadAttachment:(CDVInvokedUrlCommand *)command;
18
-
19
- - (void)getAttachmentFolderPath:(CDVInvokedUrlCommand *)command;
20
-
21
- @end
@@ -1,180 +0,0 @@
1
- //
2
- // AttachmentPlugin.m
3
- // UnviredCordovaSDK
4
- //
5
- // Created by Srinidhi Rao on 20/11/17.
6
- // Copyright © 2017 Unvired Software India Pvt. Ltd. All rights reserved.
7
- //
8
-
9
- #import "AttachmentPlugin.h"
10
- #import "PluginConstants.h"
11
- #import "PluginHelper.h"
12
- #import "Attachment.h"
13
- #import "AttachmentItem.h"
14
- #import "ApplicationManager.h"
15
- #import "IDataManager.h"
16
- #import "DataStructureHelper.h"
17
- #import "PathManager.h"
18
-
19
- @implementation AttachmentPlugin
20
-
21
- - (void)getAttachmentFolderPath:(CDVInvokedUrlCommand *)command {
22
- [self.commandDelegate runInBackground: ^{
23
- NSString *attachmentPath = [[PathManager sharedManager] pathForType:PathTypeAttachmentFolder];
24
- [PluginHelper sendListenerCallback:self.commandDelegate
25
- callbackId:command.callbackId
26
- type:success_result
27
- data:attachmentPath
28
- message:@""
29
- error:@""
30
- errorDetail:@""];
31
- }];
32
- }
33
-
34
- - (void)createAttachmentItem:(CDVInvokedUrlCommand *)command {
35
- [self.commandDelegate runInBackground: ^{
36
- CDVPluginResult *pluginResult = nil;
37
- NSError *error = NULL;
38
- NSDictionary *dataObjects = [command.arguments objectAtIndex:0];
39
- NSString *tableName = dataObjects[TABLE_NAME];
40
- NSMutableDictionary *fieldObject = dataObjects[FIELDS];
41
-
42
- NSString *fileName = fieldObject[ATTACHMENT_ITEM_FILE_NAME];
43
- if (fileName.length == 0) {
44
- [PluginHelper sendListenerCallback:self.commandDelegate
45
- callbackId:command.callbackId
46
- type:error_result
47
- data:nil
48
- message:@""
49
- error:@"File Name is null or empty"
50
- errorDetail:@""];
51
- return;
52
- }
53
-
54
- NSString *mimeType = fieldObject[ATTACHMENT_ITEM_MIME_TYPE];
55
- if (fileName.length == 0) {
56
- [PluginHelper sendListenerCallback:self.commandDelegate
57
- callbackId:command.callbackId
58
- type:error_result
59
- data:nil
60
- message:@""
61
- error:@"MIME type is null or empty"
62
- errorDetail:@""];
63
- return;
64
- }
65
-
66
- NSString *localPath = fieldObject[ATTACHMENT_ITEM_LOCAL_PATH];
67
- if (localPath.length == 0) {
68
- [PluginHelper sendListenerCallback:self.commandDelegate
69
- callbackId:command.callbackId
70
- type:error_result
71
- data:nil
72
- message:@""
73
- error:@"File Name is null or empty"
74
- errorDetail:@""];
75
- return;
76
- }
77
-
78
- NSData *attachmentData = [NSData dataWithContentsOfFile:localPath];
79
- if (attachmentData.length == 0) {
80
- [PluginHelper sendListenerCallback:self.commandDelegate
81
- callbackId:command.callbackId
82
- type:error_result
83
- data:nil
84
- message:@""
85
- error:[NSString stringWithFormat:@"Attachment file could not be read at the location: %@", localPath]
86
- errorDetail:@""];
87
- return;
88
- }
89
-
90
- AttachmentItem *item = [Attachment saveAttachmentForUploadWithAttachmentTableName:tableName
91
- fileName:fileName
92
- mimeType:mimeType
93
- andAttachmentBytes:attachmentData
94
- error:&error];
95
- if (item == nil) {
96
- [PluginHelper sendListenerCallback:self.commandDelegate
97
- callbackId:command.callbackId
98
- type:error_result
99
- data:nil
100
- message:@""
101
- error:[NSString stringWithFormat:@"There was an error creating attachment item: %@", [error localizedDescription]]
102
- errorDetail:@""];
103
- return;
104
- }
105
-
106
- // Set other fields for the attachment item.
107
- [fieldObject enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull fieldName, id _Nonnull fieldValue, BOOL * _Nonnull stop) {
108
- if (![fieldName isEqualToString:ATTACHMENT_ITEM_UID] ||
109
- ![fieldName isEqualToString:ATTACHMENT_ITEM_MIME_TYPE] ||
110
- ![fieldName isEqualToString:ATTACHMENT_ITEM_LOCAL_PATH] ||
111
- ![fieldName isEqualToString:ATTACHMENT_ITEM_ATTACHMENT_STATUS]) {
112
-
113
- [item setField:fieldName value:fieldValue];
114
- }
115
- }];
116
-
117
- // Save the attachment item in DB.
118
- id <IDataManager> dataManager = [[ApplicationManager sharedInstance] getDataManagerWithError:&error];
119
- BOOL insertStatus = [dataManager insert:item error:&error];
120
- if (insertStatus) {
121
- [PluginHelper sendListenerCallback:self.commandDelegate
122
- callbackId:command.callbackId
123
- type:success_result
124
- data:[DataStructureHelper getJsonFromDataStructure:@[item]]
125
- message:@""
126
- error:@""
127
- errorDetail:@""];
128
- return;
129
- }
130
-
131
- [PluginHelper sendListenerCallback:self.commandDelegate
132
- callbackId:command.callbackId
133
- type:error_result
134
- data:nil
135
- message:@""
136
- error:[NSString stringWithFormat:@"There was an error saving the created attachment in DB: %@", [error localizedDescription]]
137
- errorDetail:@""];
138
- return;
139
- }];
140
- }
141
-
142
- - (void)uploadAttachment:(CDVInvokedUrlCommand *)command {
143
- // TODO:
144
-
145
- }
146
-
147
- - (void)downloadAttachment:(CDVInvokedUrlCommand *)command {
148
- [self.commandDelegate runInBackground: ^{
149
- CDVPluginResult *pluginResult = nil;
150
- NSError *error = NULL;
151
- NSDictionary *dataObjects = [command.arguments objectAtIndex:0];
152
- NSString *tableName = dataObjects[TABLE_NAME];
153
- NSMutableDictionary *fieldObject = dataObjects[FIELDS];
154
-
155
- AttachmentItem *item = (AttachmentItem * )[DataStructureHelper getDataStructureFromJSON:dataObjects];
156
-
157
- BOOL status = [Attachment queueForDownload:item withPriority:1 error:&error];
158
- if (status) {
159
- [PluginHelper sendListenerCallback:self.commandDelegate
160
- callbackId:command.callbackId
161
- type:success_result
162
- data:[DataStructureHelper getJsonFromDataStructure:@[item]]
163
- message:@""
164
- error:@""
165
- errorDetail:@""];
166
- return;
167
- }
168
-
169
- [PluginHelper sendListenerCallback:self.commandDelegate
170
- callbackId:command.callbackId
171
- type:error_result
172
- data:nil
173
- message:@""
174
- error:[NSString stringWithFormat:@"There was an error saving the created attachment in DB: %@", [error localizedDescription]]
175
- errorDetail:@""];
176
- return;
177
- }];
178
- }
179
-
180
- @end
@@ -1,28 +0,0 @@
1
- //
2
- // DataStructureHelper.h
3
- // HTML5_KERNEL_iOS
4
- //
5
- // Created by Srinidhi Anand Rao on 03/10/12.
6
- // Copyright (c) 2012 Unvired Software India Pvt. Ltd. All rights reserved.
7
- //
8
-
9
- #import <Foundation/Foundation.h>
10
- #import "DataStructure.h"
11
-
12
- @interface DataStructureHelper : NSObject
13
-
14
- + (DataStructure *)getDataStructureFromJSON:(NSDictionary *)jsonDictionary;
15
-
16
- + (NSMutableArray *)getJsonFromDataStructure:(NSArray *)dataStructures;
17
-
18
- + (DataStructure *)createJSDataStructure:(NSDictionary *)jsonDictionary
19
- tableName:(NSString *)tableName
20
- andIsHeader:(BOOL)isHeader;
21
-
22
- + (NSArray *)getHeaderDataStructureTableName:(NSString *)itemTableName
23
- andItemObjects:(NSArray *)itemObjects;
24
-
25
-
26
-
27
-
28
- @end
@@ -1,188 +0,0 @@
1
- //
2
- // DataStructureHelper.m
3
- // HTML5_KERNEL_iOS
4
- //
5
- // Created by Srinidhi Anand Rao on 03/10/12.
6
- // Copyright (c) 2012 Unvired Software India Pvt. Ltd. All rights reserved.
7
- //
8
-
9
- #import "DataStructureHelper.h"
10
- #import "Logger.h"
11
- #import "PluginConstants.h"
12
- #import "AttachmentItem.h"
13
-
14
- @implementation DataStructureHelper
15
-
16
- + (NSArray *)getHeaderDataStructureTableName:(NSString *)itemTableName
17
- andItemObjects:(NSArray *)itemObjects {
18
- NSMutableArray *jsDataStructures = [[NSMutableArray alloc] initWithCapacity:[itemObjects count]];
19
-
20
- @try {
21
- for (NSDictionary *dataStructureDictionary in itemObjects) {
22
- DataStructure *dataStructure = nil;
23
- if ([itemTableName hasSuffix:@"_ATTACHMENT"]) {
24
- dataStructure = [[AttachmentItem alloc] initWithTableName:itemTableName andisHeader:false];
25
- }
26
- else {
27
- dataStructure = [[DataStructure alloc] init:itemTableName isHeader:false];
28
- }
29
-
30
- NSEnumerator *enumerator = [dataStructureDictionary keyEnumerator];
31
- NSString *key;
32
-
33
- while ((key = [enumerator nextObject])) {
34
- id value = dataStructureDictionary[key];
35
-
36
- if (value) {
37
- /* code that uses the returned key */
38
- [dataStructure setField:key value:value];
39
- }
40
- }
41
-
42
- // Add this to the Array of Data Structures
43
- [jsDataStructures addObject:dataStructure];
44
- }
45
- }
46
- @catch (NSException *exception)
47
- {
48
- [Logger loggerWithlog:LEVEL_ERROR
49
- ClassName:[self class]
50
- MethodName:NSStringFromSelector(_cmd)
51
- msg:[NSString stringWithFormat:@"Caught Exception while Constructing Header Data Structure Object. Exception: %@", [exception reason]]];
52
- }
53
-
54
- return jsDataStructures;
55
- }
56
-
57
- + (DataStructure *)getDataStructureFromJSON:(NSDictionary *)jsonDictionary {
58
- NSString *tableName = nil;
59
- BOOL isHeader = true;
60
- DataStructure *dataStructure = nil;
61
- NSDictionary *colNameValuePair = nil;
62
-
63
- @try {
64
- tableName = jsonDictionary[TABLE_NAME];
65
- isHeader = [(NSString *)jsonDictionary[IS_HEADER] boolValue]; // Boolean is sent from JS as String '0' or '1'. So Treating it as a String and converting appropriately.
66
- colNameValuePair = jsonDictionary[FIELDS];
67
-
68
- // Create JSDataStructure Object
69
- if ([tableName hasSuffix:@"_ATTACHMENT"]) {
70
- dataStructure = [[AttachmentItem alloc] initWithTableName:tableName andisHeader:isHeader];
71
- }
72
- else {
73
- dataStructure = [[DataStructure alloc] init:tableName isHeader:isHeader];
74
- }
75
-
76
- NSEnumerator *enumerator = [colNameValuePair keyEnumerator];
77
- NSString *key;
78
-
79
- while ((key = [enumerator nextObject])) {
80
- id value = colNameValuePair[key];
81
-
82
- if (value) {
83
-
84
- if ([key isEqualToString:CUSTOM_FIELD_LID]) {
85
- [dataStructure setLid:value];
86
- }
87
- else {
88
-
89
- /* code that uses the returned key */
90
- [dataStructure setField:key value:value];
91
- }
92
- }
93
- }
94
- }
95
- @catch (NSException *exception)
96
- {
97
- [Logger loggerWithlog:LEVEL_ERROR
98
- ClassName:[self class]
99
- MethodName:NSStringFromSelector(_cmd)
100
- msg:[NSString stringWithFormat:@"Caught Exception while Parsing Json Data. Exception: %@", [exception reason]]];
101
- }
102
-
103
- return dataStructure;
104
- }
105
-
106
- + (NSMutableArray *)getJsonFromDataStructure:(NSArray *)dataStructures {
107
- NSMutableArray *jsonDataStructures = [[NSMutableArray alloc] init];
108
-
109
- // Create a Json Object Containg all data Structures
110
- for (DataStructure *dataStructure in dataStructures) {
111
- // Get the Table Name
112
- NSMutableDictionary *jsonDataStructure = [[NSMutableDictionary alloc] init];
113
- NSString *tableName = [dataStructure getTableName];
114
- BOOL isHeader = [dataStructure isHeader];
115
- NSString *headerString = nil;
116
-
117
- if (isHeader) {
118
- headerString = @"true";
119
- }
120
- else {
121
- headerString = @"false";
122
- }
123
-
124
- NSEnumerator *fieldNames = [dataStructure getFieldNames];
125
- NSMutableDictionary *fieldsDictionary = [[NSMutableDictionary alloc] init];
126
-
127
- NSString *key = nil;
128
-
129
- while ((key = [fieldNames nextObject])) {
130
- // Get the value
131
- NSString *value = [dataStructure getField:key];
132
-
133
- if (value) {
134
- [fieldsDictionary setObject:value forKey:key];
135
- }
136
- }
137
-
138
- [jsonDataStructure setObject:tableName forKey:TABLE_NAME];
139
- [jsonDataStructure setObject:headerString forKey:IS_HEADER];
140
- [jsonDataStructure setObject:fieldsDictionary forKey:FIELDS];
141
- [jsonDataStructures addObject:jsonDataStructure];
142
- }
143
- return jsonDataStructures;
144
- }
145
-
146
- + (DataStructure *)createJSDataStructure:(NSDictionary *)jsonDictionary tableName:(NSString *)tableName andIsHeader:(BOOL)isHeader {
147
- DataStructure *jsDataStructure = nil;
148
- @try {
149
-
150
- if ([tableName hasSuffix:@"_ATTACHMENT"]) {
151
- jsDataStructure = [[AttachmentItem alloc] initWithTableName:tableName andisHeader:isHeader];
152
- }
153
- else {
154
- jsDataStructure = [[DataStructure alloc] init:tableName isHeader:isHeader];
155
- }
156
-
157
- if (!jsonDictionary) {
158
- return nil;
159
- }
160
-
161
- NSLog(@"Before Enumerating Keys & Objects");
162
- [jsonDictionary enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull value, BOOL * _Nonnull stop) {
163
- NSLog(@"Key: %@, Value: %@", key, value);
164
- if (value) {
165
- if ([key isEqualToString:CUSTOM_FIELD_LID]) {
166
- [jsDataStructure setLid:value];
167
- }
168
- else {
169
-
170
- /* code that uses the returned key */
171
- [jsDataStructure setField:key value:value];
172
- }
173
- }
174
- }];
175
- NSLog(@"After Enumerating Keys & Objects");
176
- }
177
- @catch (NSException *exception)
178
- {
179
- [Logger loggerWithlog:LEVEL_ERROR
180
- ClassName:[self class]
181
- MethodName:NSStringFromSelector(_cmd)
182
- msg:[NSString stringWithFormat:@"Caught Exception while Parsing Json Data. Exception: %@", [exception reason]]];
183
- }
184
-
185
- return jsDataStructure;
186
- }
187
-
188
- @end