@wavemaker-ai/variables 1.0.0-rc.309

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 (123) hide show
  1. package/index.d.ts +14 -0
  2. package/index.js +15 -0
  3. package/index.js.map +1 -0
  4. package/npm-shrinkwrap.json +1994 -0
  5. package/package-lock.json +1994 -0
  6. package/package.json +48 -0
  7. package/scripts/build.d.ts +1 -0
  8. package/scripts/build.js +183 -0
  9. package/scripts/build.js.map +1 -0
  10. package/src/advanced-options.d.ts +4 -0
  11. package/src/advanced-options.js +2 -0
  12. package/src/advanced-options.js.map +1 -0
  13. package/src/constants/variables.constants.d.ts +307 -0
  14. package/src/constants/variables.constants.js +334 -0
  15. package/src/constants/variables.constants.js.map +1 -0
  16. package/src/factory/variable-manager.factory.d.ts +3 -0
  17. package/src/factory/variable-manager.factory.js +26 -0
  18. package/src/factory/variable-manager.factory.js.map +1 -0
  19. package/src/manager/action/timer-action.manager.d.ts +4 -0
  20. package/src/manager/action/timer-action.manager.js +38 -0
  21. package/src/manager/action/timer-action.manager.js.map +1 -0
  22. package/src/manager/variable/base-variable.manager.d.ts +24 -0
  23. package/src/manager/variable/base-variable.manager.js +79 -0
  24. package/src/manager/variable/base-variable.manager.js.map +1 -0
  25. package/src/manager/variable/crud-variable.manager.d.ts +85 -0
  26. package/src/manager/variable/crud-variable.manager.js +415 -0
  27. package/src/manager/variable/crud-variable.manager.js.map +1 -0
  28. package/src/manager/variable/live-variable.manager.d.ts +154 -0
  29. package/src/manager/variable/live-variable.manager.js +1078 -0
  30. package/src/manager/variable/live-variable.manager.js.map +1 -0
  31. package/src/manager/variable/model-variable.manager.d.ts +4 -0
  32. package/src/manager/variable/model-variable.manager.js +56 -0
  33. package/src/manager/variable/model-variable.manager.js.map +1 -0
  34. package/src/manager/variable/service-variable.manager.d.ts +113 -0
  35. package/src/manager/variable/service-variable.manager.js +713 -0
  36. package/src/manager/variable/service-variable.manager.js.map +1 -0
  37. package/src/model/action/timer-action.d.ts +12 -0
  38. package/src/model/action/timer-action.js +60 -0
  39. package/src/model/action/timer-action.js.map +1 -0
  40. package/src/model/base-action.d.ts +32 -0
  41. package/src/model/base-action.js +89 -0
  42. package/src/model/base-action.js.map +1 -0
  43. package/src/model/base-variable.d.ts +58 -0
  44. package/src/model/base-variable.js +180 -0
  45. package/src/model/base-variable.js.map +1 -0
  46. package/src/model/crud-create.d.ts +8 -0
  47. package/src/model/crud-create.js +17 -0
  48. package/src/model/crud-create.js.map +1 -0
  49. package/src/model/crud-delete.d.ts +8 -0
  50. package/src/model/crud-delete.js +17 -0
  51. package/src/model/crud-delete.js.map +1 -0
  52. package/src/model/crud-list.d.ts +8 -0
  53. package/src/model/crud-list.js +17 -0
  54. package/src/model/crud-list.js.map +1 -0
  55. package/src/model/crud-update.d.ts +8 -0
  56. package/src/model/crud-update.js +17 -0
  57. package/src/model/crud-update.js.map +1 -0
  58. package/src/model/variable/api-aware-variable.d.ts +23 -0
  59. package/src/model/variable/api-aware-variable.js +25 -0
  60. package/src/model/variable/api-aware-variable.js.map +1 -0
  61. package/src/model/variable/crud-variable.d.ts +30 -0
  62. package/src/model/variable/crud-variable.js +181 -0
  63. package/src/model/variable/crud-variable.js.map +1 -0
  64. package/src/model/variable/live-variable.d.ts +40 -0
  65. package/src/model/variable/live-variable.js +262 -0
  66. package/src/model/variable/live-variable.js.map +1 -0
  67. package/src/model/variable/model-variable.d.ts +11 -0
  68. package/src/model/variable/model-variable.js +83 -0
  69. package/src/model/variable/model-variable.js.map +1 -0
  70. package/src/model/variable/service-variable.d.ts +35 -0
  71. package/src/model/variable/service-variable.js +147 -0
  72. package/src/model/variable/service-variable.js.map +1 -0
  73. package/src/types/date-formatter.d.ts +3 -0
  74. package/src/types/date-formatter.js +2 -0
  75. package/src/types/date-formatter.js.map +1 -0
  76. package/src/types/event-notifier.d.ts +9 -0
  77. package/src/types/event-notifier.js +25 -0
  78. package/src/types/event-notifier.js.map +1 -0
  79. package/src/types/http-client.service.d.ts +8 -0
  80. package/src/types/http-client.service.js +2 -0
  81. package/src/types/http-client.service.js.map +1 -0
  82. package/src/types/types.d.ts +50 -0
  83. package/src/types/types.js +54 -0
  84. package/src/types/types.js.map +1 -0
  85. package/src/util/dataset-util.d.ts +27 -0
  86. package/src/util/dataset-util.js +147 -0
  87. package/src/util/dataset-util.js.map +1 -0
  88. package/src/util/file-upload.util.d.ts +11 -0
  89. package/src/util/file-upload.util.js +183 -0
  90. package/src/util/file-upload.util.js.map +1 -0
  91. package/src/util/inflight-queue.d.ts +35 -0
  92. package/src/util/inflight-queue.js +102 -0
  93. package/src/util/inflight-queue.js.map +1 -0
  94. package/src/util/notify-promise.d.ts +3 -0
  95. package/src/util/notify-promise.js +37 -0
  96. package/src/util/notify-promise.js.map +1 -0
  97. package/src/util/oAuth.utils.d.ts +3 -0
  98. package/src/util/oAuth.utils.js +11 -0
  99. package/src/util/oAuth.utils.js.map +1 -0
  100. package/src/util/utils.d.ts +69 -0
  101. package/src/util/utils.js +364 -0
  102. package/src/util/utils.js.map +1 -0
  103. package/src/util/variable/live-variable.http.utils.d.ts +21 -0
  104. package/src/util/variable/live-variable.http.utils.js +212 -0
  105. package/src/util/variable/live-variable.http.utils.js.map +1 -0
  106. package/src/util/variable/live-variable.utils.d.ts +72 -0
  107. package/src/util/variable/live-variable.utils.js +667 -0
  108. package/src/util/variable/live-variable.utils.js.map +1 -0
  109. package/src/util/variable/pagination.utils.d.ts +91 -0
  110. package/src/util/variable/pagination.utils.js +493 -0
  111. package/src/util/variable/pagination.utils.js.map +1 -0
  112. package/src/util/variable/service-variable.utils.d.ts +17 -0
  113. package/src/util/variable/service-variable.utils.js +394 -0
  114. package/src/util/variable/service-variable.utils.js.map +1 -0
  115. package/src/util/variable/variables.utils.d.ts +120 -0
  116. package/src/util/variable/variables.utils.js +544 -0
  117. package/src/util/variable/variables.utils.js.map +1 -0
  118. package/src/wm-namespace.d.ts +11 -0
  119. package/src/wm-namespace.js +13 -0
  120. package/src/wm-namespace.js.map +1 -0
  121. package/webpack.config.d.ts +21 -0
  122. package/webpack.config.js +28 -0
  123. package/webpack.config.js.map +1 -0
@@ -0,0 +1,102 @@
1
+ var InflightQueue = /** @class */ (function () {
2
+ function InflightQueue() {
3
+ this.requestsQueue = new Map();
4
+ }
5
+ /**
6
+ * pushes the process against a variable in its queue
7
+ * @param variable
8
+ * @param {{resolve: (value?: any) => void; reject: (reason?: any) => void}} param2
9
+ * the resolve callback will be called on
10
+ */
11
+ InflightQueue.prototype.addToQueue = function (variable, param2) {
12
+ if (this.requestsQueue.has(variable)) {
13
+ this.requestsQueue.get(variable).push(param2);
14
+ }
15
+ else {
16
+ var processes = [];
17
+ processes.push({ resolve: param2.resolve, reject: param2.reject, active: false });
18
+ this.requestsQueue.set(variable, processes);
19
+ }
20
+ };
21
+ /**
22
+ * Calls the reject method against the passed process
23
+ * @param process
24
+ */
25
+ InflightQueue.prototype.rejectProcess = function (process) {
26
+ process.reject('PROCESS_REJECTED_IN_QUEUE');
27
+ };
28
+ /**
29
+ * clears the queue against a variable
30
+ * @param variable
31
+ */
32
+ InflightQueue.prototype.clear = function (variable) {
33
+ this.requestsQueue.delete(variable);
34
+ };
35
+ /**
36
+ * executes the n/w calls for a specified variable pushed in its respective queue (pushed while it was inFlight)
37
+ * @param variable
38
+ */
39
+ InflightQueue.prototype.process = function (variable) {
40
+ var processes = this.requestsQueue.get(variable);
41
+ var nextProcess;
42
+ // process request queue for the variable only if it is not empty
43
+ if (!processes || !processes.length) {
44
+ this.clear(variable);
45
+ return;
46
+ }
47
+ // If only one item in queue
48
+ if (processes.length === 1) {
49
+ nextProcess = processes[0];
50
+ if (nextProcess.active) {
51
+ this.clear(variable);
52
+ }
53
+ else {
54
+ nextProcess.active = true;
55
+ nextProcess.resolve();
56
+ }
57
+ return;
58
+ }
59
+ switch (variable.inFlightBehavior) {
60
+ case 'executeLast':
61
+ for (var i = 0; i < processes.length - 2; i++) {
62
+ this.rejectProcess(processes[i]);
63
+ }
64
+ processes.splice(0, processes.length - 1);
65
+ this.process(variable);
66
+ break;
67
+ case 'executeAll':
68
+ nextProcess = processes.splice(0, 1)[0];
69
+ if (nextProcess.active) {
70
+ nextProcess = processes.splice(0, 1)[0];
71
+ }
72
+ nextProcess.active = true;
73
+ nextProcess.resolve();
74
+ break;
75
+ default:
76
+ for (var i = 0; i < processes.length - 1; i++) {
77
+ this.rejectProcess(processes[i]);
78
+ }
79
+ this.clear(variable);
80
+ break;
81
+ }
82
+ };
83
+ /**
84
+ * initializes the queue against a variable and makes the first process call
85
+ * If already initialized and a process in queue is in progress, the queue is not processed.
86
+ * To process the next item in the queue, the process method has to be called from the caller.
87
+ * @param variable
88
+ * @returns {Promise<any>}
89
+ */
90
+ InflightQueue.prototype.submit = function (variable) {
91
+ var _this = this;
92
+ return new Promise(function (resolve, reject) {
93
+ _this.addToQueue(variable, { resolve: resolve, reject: reject });
94
+ if (_this.requestsQueue.get(variable).length === 1) {
95
+ _this.process(variable);
96
+ }
97
+ });
98
+ };
99
+ return InflightQueue;
100
+ }());
101
+ export var $queue = new InflightQueue();
102
+ //# sourceMappingURL=inflight-queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inflight-queue.js","sourceRoot":"./","sources":["src/util/inflight-queue.ts"],"names":[],"mappings":"AAAA;IAAA;QACI,kBAAa,GAAG,IAAI,GAAG,EAAE,CAAC;IAqG9B,CAAC;IAnGG;;;;;OAKG;IACK,kCAAU,GAAlB,UAAmB,QAAa,EAAE,MAA0E;QACxG,IAAI,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClD,CAAC;aAAM,CAAC;YACJ,IAAM,SAAS,GAAG,EAAE,CAAC;YACrB,SAAS,CAAC,IAAI,CAAC,EAAC,OAAO,EAAE,MAAM,CAAC,O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Q,CAAC,CAAC;YAC3B,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IACL,oBAAC;AAAD,CAAC,AAtGD,IAsGC;AAED,MAAM,CAAC,IAAM,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC","sourcesContent":["class InflightQueue {\n requestsQueue = new Map();\n\n /**\n * pushes the process against a variable in its queue\n * @param variable\n * @param {{resolve: (value?: any) => void; reject: (reason?: any) => void}} param2\n * the resolve callback will be called on\n */\n private addToQueue(variable: any, param2: {resolve: (value?: (any)) => void; reject: (reason?: any) => void}) {\n if (this.requestsQueue.has(variable)) {\n this.requestsQueue.get(variable).push(param2);\n } else {\n const processes = [];\n processes.push({resolve: param2.resolve, reject: param2.reject, active: false});\n this.requestsQueue.set(variable, processes);\n }\n }\n\n /**\n * Calls the reject method against the passed process\n * @param process\n */\n private rejectProcess(process: any) {\n process.reject('PROCESS_REJECTED_IN_QUEUE');\n }\n\n /**\n * clears the queue against a variable\n * @param variable\n */\n public clear(variable: any) {\n this.requestsQueue.delete(variable);\n }\n\n /**\n * executes the n/w calls for a specified variable pushed in its respective queue (pushed while it was inFlight)\n * @param variable\n */\n process(variable: any) {\n const processes: [any] = this.requestsQueue.get(variable);\n let nextProcess;\n\n // process request queue for the variable only if it is not empty\n if (!processes || !processes.length) {\n this.clear(variable);\n return;\n }\n\n // If only one item in queue\n if (processes.length === 1) {\n nextProcess = processes[0];\n if (nextProcess.active) {\n this.clear(variable);\n } else {\n nextProcess.active = true;\n nextProcess.resolve();\n }\n return;\n }\n\n switch (variable.inFlightBehavior) {\n case 'executeLast':\n for (let i = 0; i < processes.length - 2; i++) {\n this.rejectProcess(processes[i]);\n }\n processes.splice(0, processes.length - 1);\n this.process(variable);\n break;\n case 'executeAll':\n nextProcess = processes.splice(0, 1)[0];\n if (nextProcess.active) {\n nextProcess = processes.splice(0, 1)[0];\n }\n nextProcess.active = true;\n nextProcess.resolve();\n break;\n default:\n for (let i = 0; i < processes.length - 1; i++) {\n this.rejectProcess(processes[i]);\n }\n this.clear(variable);\n break;\n }\n }\n\n /**\n * initializes the queue against a variable and makes the first process call\n * If already initialized and a process in queue is in progress, the queue is not processed.\n * To process the next item in the queue, the process method has to be called from the caller.\n * @param variable\n * @returns {Promise<any>}\n */\n submit(variable: any) {\n return new Promise((resolve, reject) => {\n this.addToQueue(variable, {resolve: resolve, reject: reject});\n\n if (this.requestsQueue.get(variable).length === 1) {\n this.process(variable);\n }\n });\n }\n}\n\nexport const $queue = new InflightQueue();\n"]}
@@ -0,0 +1,3 @@
1
+ export declare class NotifyPromise {
2
+ constructor(fn: any);
3
+ }
@@ -0,0 +1,37 @@
1
+ var NotifyPromise = /** @class */ (function () {
2
+ function NotifyPromise(fn) {
3
+ var notifyQueue = [], notify = function (status) {
4
+ notifyQueue.forEach(function (fn1) {
5
+ fn1(status);
6
+ });
7
+ };
8
+ var cleanUp = function () {
9
+ notifyQueue.length = 0;
10
+ };
11
+ var p1 = new Promise(function (res, rej) {
12
+ fn(res, rej, notify);
13
+ });
14
+ p1.superThen = p1.then.bind(p1);
15
+ p1.then = function (onResolve, onReject, onNotify) {
16
+ p1.superThen(function (response) {
17
+ onResolve(response);
18
+ cleanUp();
19
+ }, function (reason) {
20
+ onReject(reason);
21
+ cleanUp();
22
+ });
23
+ if (onNotify) {
24
+ notifyQueue.push(onNotify);
25
+ }
26
+ };
27
+ return p1;
28
+ }
29
+ return NotifyPromise;
30
+ }());
31
+ export { NotifyPromise };
32
+ // let newPromise = new PromiseWithNotify((resolve, reject, notify) => {
33
+ // setInterval(notify, 1000);
34
+ // })
35
+ // console.log(newPromise)
36
+ // newPromise.then(undefined, undefined, () => console.log(3));
37
+ //# sourceMappingURL=notify-promise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notify-promise.js","sourceRoot":"./","sources":["src/util/notify-promise.ts"],"names":[],"mappings":"AAAA;IAEI,uBAAY,EAAO;QACf,IAAM,WAAW,GAAQ,EAAE,EACvB,MAAM,GAAG,UAAC,MAAW;YACrB,WAAW,CAAC,OAAO,CAAC,UAAC,GAAQ;gBACzB,GAAG,CAAC,MAAM,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;QAEF,IAAM,OAAO,GAAG;YACZ,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC;QAC3B,CAAC,CAAC;QAEF,IAAM,EAAE,GAAI,IAAI,OAAO,CAAC,UAAC,GAAG,EAAE,GAAG;YAC7B,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QAEF,EAAU,CAAC,SAAS,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACxC,EAAU,CAAC,IAAI,GAAG,UAAC,SAAc,EAAE,QAAa,EAAE,QAAa;YAC3D,EAAU,CAAC,SAAS,CACjB,UAAC,QAAa;gBACV,SAAS,CAAC,QAAQ,CAAC,CAAC;gBACpB,OAAO,EAAE,CAAC;YACd,CAAC,EACD,UAAC,MAAW;gBACR,QAAQ,CAAC,MAAM,CAAC,CAAC;gBACjB,OAAO,EAAE,CAAC;YACd,CAAC,CACJ,CAAC;YACF,IAAI,QAAQ,EAAE,CAAC;gBACX,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC/B,CAAC;QACL,CAAC,CAAC;QACF,OAAO,EAAE,CAAC;IACd,CAAC;IACL,oBAAC;AAAD,CAAC,AApCD,IAoCC;;AAED,wEAAwE;AACxE,iCAAiC;AACjC,KAAK;AACL,0BAA0B;AAC1B,+DAA+D","sourcesContent":["export class NotifyPromise {\n\n constructor(fn: any) {\n const notifyQueue: any = [],\n notify = (status: any) => {\n notifyQueue.forEach((fn1: any) => {\n fn1(status);\n });\n };\n\n const cleanUp = function() {\n notifyQueue.length = 0;\n };\n\n const p1 = new Promise((res, rej) => {\n fn(res, rej, notify);\n });\n\n (p1 as any).superThen = p1.then.bind(p1);\n (p1 as any).then = (onResolve: any, onReject: any, onNotify: any) => {\n (p1 as any).superThen(\n (response: any) => {\n onResolve(response);\n cleanUp();\n },\n (reason: any) => {\n onReject(reason);\n cleanUp();\n }\n );\n if (onNotify) {\n notifyQueue.push(onNotify);\n }\n };\n return p1;\n }\n}\n\n// let newPromise = new PromiseWithNotify((resolve, reject, notify) => {\n// setInterval(notify, 1000);\n// })\n// console.log(newPromise)\n// newPromise.then(undefined, undefined, () => console.log(3));\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const performAuthorization: (url: any, providerId: any, onSuccess: any, onError: any, securityObj?: any) => void;
2
+ export declare const getAccessToken: (provider: any, checkLoaclStorage: any) => any;
3
+ export declare const removeAccessToken: (provider: any) => void;
@@ -0,0 +1,11 @@
1
+ import { oauthService, appManager } from './variable/variables.utils';
2
+ export var performAuthorization = function (url, providerId, onSuccess, onError, securityObj) {
3
+ oauthService === null || oauthService === void 0 ? void 0 : oauthService.perfromOAuthorization(url, providerId, onSuccess, onError, securityObj, appManager.getCustomUrlScheme(), appManager.getDeployedURL());
4
+ };
5
+ export var getAccessToken = function (provider, checkLoaclStorage) {
6
+ return (oauthService === null || oauthService === void 0 ? void 0 : oauthService.getAccessToken) && oauthService.getAccessToken(provider, checkLoaclStorage);
7
+ };
8
+ export var removeAccessToken = function (provider) {
9
+ oauthService.removeAccessToken(provider);
10
+ };
11
+ //# sourceMappingURL=oAuth.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oAuth.utils.js","sourceRoot":"./","sources":["src/util/oAuth.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAEtE,MAAM,CAAC,IAAM,oBAAoB,GAAG,UAAC,GAAQ,EAAE,UAAe,EAAE,SAAc,EAAE,OAAY,EAAE,WAAiB;IAC3G,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,qBAAqB,CAAC,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,CAAC,kBAAkB,EAAE,EAAE,UAAU,CAAC,cAAc,EAAE,CAAC,CAAC;AACxJ,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,cAAc,GAAG,UAAC,QAAa,EAAE,iBAAsB;IAChE,OAAO,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,cAAc,KAAI,YAAY,CAAC,cAAc,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;AACpG,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,iBAAiB,GAAG,UAAC,QAAa;IAC3C,YAAY,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAC7C,CAAC,CAAA","sourcesContent":["import { oauthService, appManager } from './variable/variables.utils';\n\nexport const performAuthorization = (url: any, providerId: any, onSuccess: any, onError: any, securityObj?: any) => {\n oauthService?.perfromOAuthorization(url, providerId, onSuccess, onError, securityObj, appManager.getCustomUrlScheme(), appManager.getDeployedURL());\n};\n\nexport const getAccessToken = (provider: any, checkLoaclStorage: any) => {\n return oauthService?.getAccessToken && oauthService.getAccessToken(provider, checkLoaclStorage);\n};\n\nexport const removeAccessToken = (provider: any) => {\n oauthService.removeAccessToken(provider);\n}\n"]}
@@ -0,0 +1,69 @@
1
+ export declare const DataType: {
2
+ INTEGER: string;
3
+ BIG_INTEGER: string;
4
+ SHORT: string;
5
+ FLOAT: string;
6
+ BIG_DECIMAL: string;
7
+ DOUBLE: string;
8
+ LONG: string;
9
+ BYTE: string;
10
+ STRING: string;
11
+ CHARACTER: string;
12
+ TEXT: string;
13
+ DATE: string;
14
+ TIME: string;
15
+ TIMESTAMP: string;
16
+ DATETIME: string;
17
+ LOCALDATETIME: string;
18
+ BOOLEAN: string;
19
+ LIST: string;
20
+ CLOB: string;
21
+ BLOB: string;
22
+ };
23
+ export declare const DEFAULT_FORMATS: {
24
+ DATE: string;
25
+ TIME: string;
26
+ TIMESTAMP: string;
27
+ DATETIME: string;
28
+ LOCALDATETIME: string;
29
+ DATETIME_ORACLE: string;
30
+ DATE_TIME: string;
31
+ };
32
+ export declare const noop: (...args: any) => void;
33
+ export declare const isValidWebURL: (url: string) => boolean;
34
+ export declare const isPageable: (obj: any) => boolean;
35
+ export declare class IDGenerator {
36
+ private generator;
37
+ constructor(key: string);
38
+ nextUid(): string;
39
+ }
40
+ export declare const hasCordova: () => boolean;
41
+ export declare const removeExtraSlashes: (url: any) => any;
42
+ export declare const isDefined: (v: any) => boolean;
43
+ export declare const isObject: (v: any) => boolean;
44
+ export declare const isNumberType: (type: any) => boolean;
45
+ export declare const extractType: (typeRef: string) => string;
46
+ export declare const isDateTimeType: (type: string) => any;
47
+ export declare const getValidJSON: (content: any) => any;
48
+ export declare const xmlToJson: (xmlString: string) => any;
49
+ export declare const replace: (template: any, map: any, parseError?: boolean) => any;
50
+ /**
51
+ * prepare a blob object based on the content and content type provided
52
+ * if content is blob itself, simply returns it back
53
+ * @param val
54
+ * @param valContentType
55
+ * @returns {*}
56
+ */
57
+ export declare const getBlob: (val: any, valContentType?: any) => any;
58
+ /**
59
+ * Returns a deep cloned replica of the passed object/array
60
+ * @param object object/array to clone
61
+ * @returns a clone of the passed object
62
+ */
63
+ export declare const getClonedObject: (object: any) => any;
64
+ /**
65
+ * this method checks if a given string starts with the given string
66
+ */
67
+ export declare const stringStartsWith: (str: string, startsWith: string, ignoreCase?: boolean) => boolean;
68
+ export declare function triggerFn(fn: any, ...argmnts: any): any;
69
+ export declare const findValueOf: (obj: any, key: any, create?: any) => any;
@@ -0,0 +1,364 @@
1
+ var __generator = (this && this.__generator) || function (thisArg, body) {
2
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
3
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
4
+ function verb(n) { return function (v) { return step([n, v]); }; }
5
+ function step(op) {
6
+ if (f) throw new TypeError("Generator is already executing.");
7
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
8
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
9
+ if (y = 0, t) op = [op[0] & 2, t.value];
10
+ switch (op[0]) {
11
+ case 0: case 1: t = op; break;
12
+ case 4: _.label++; return { value: op[1], done: false };
13
+ case 5: _.label++; y = op[1]; op = [0]; continue;
14
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
15
+ default:
16
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
17
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
18
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
19
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
20
+ if (t[2]) _.ops.pop();
21
+ _.trys.pop(); continue;
22
+ }
23
+ op = body.call(thisArg, _);
24
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
25
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
26
+ }
27
+ };
28
+ // @ts-ignore
29
+ import X2JS from 'x2js';
30
+ import { omit, isEqual, keys, isString, startsWith, includes, toLower, get, cloneDeep, isFunction } from 'lodash-es';
31
+ export var DataType = {
32
+ INTEGER: 'integer',
33
+ BIG_INTEGER: 'big_integer',
34
+ SHORT: 'short',
35
+ FLOAT: 'float',
36
+ BIG_DECIMAL: 'big_decimal',
37
+ DOUBLE: 'double',
38
+ LONG: 'long',
39
+ BYTE: 'byte',
40
+ STRING: 'string',
41
+ CHARACTER: 'character',
42
+ TEXT: 'text',
43
+ DATE: 'date',
44
+ TIME: 'time',
45
+ TIMESTAMP: 'timestamp',
46
+ DATETIME: 'datetime',
47
+ LOCALDATETIME: 'localdatetime',
48
+ BOOLEAN: 'boolean',
49
+ LIST: 'list',
50
+ CLOB: 'clob',
51
+ BLOB: 'blob'
52
+ };
53
+ export var DEFAULT_FORMATS = {
54
+ DATE: "yyyy-MM-dd",
55
+ TIME: "HH:mm:ss",
56
+ TIMESTAMP: "timestamp",
57
+ DATETIME: "yyyy-MM-ddTHH:mm:ss",
58
+ LOCALDATETIME: "yyyy-MM-ddTHH:mm:ss",
59
+ DATETIME_ORACLE: "yyyy-MM-dd HH:mm:ss",
60
+ DATE_TIME: "yyyy-MM-dd HH:mm:ss"
61
+ };
62
+ var REGEX = {
63
+ SNAKE_CASE: /[A-Z]/g,
64
+ ANDROID: /Android/i,
65
+ IPHONE: /iPhone/i,
66
+ IPOD: /iPod/i,
67
+ IPAD: /iPad/i,
68
+ MAC: /Mac/i,
69
+ ANDROID_TABLET: /android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i,
70
+ MOBILE: /Mobile/i,
71
+ WINDOWS: /Windows Phone/i,
72
+ SUPPORTED_IMAGE_FORMAT: /\.(bmp|gif|jpe|jpg|jpeg|tif|tiff|pbm|png|ico)$/i,
73
+ SUPPORTED_FILE_FORMAT: /\.(txt|js|css|html|script|properties|json|java|xml|smd|xmi|sql|log|wsdl|vm|ftl|jrxml|yml|yaml|md|less|jsp)$/i,
74
+ SUPPORTED_AUDIO_FORMAT: /\.(mp3|ogg|webm|wma|3gp|wav|m4a)$/i,
75
+ SUPPORTED_VIDEO_FORMAT: /\.(mp4|ogg|webm|wmv|mpeg|mpg|avi|mov)$/i,
76
+ PAGE_RESOURCE_PATH: /^\/pages\/.*\.(js|css|html|json)$/,
77
+ MIN_PAGE_RESOURCE_PATH: /.*(page.min.html)$/,
78
+ VALID_EMAIL: /^[a-zA-Z][\w.+]+@[a-zA-Z_]+?\.[a-zA-Z.]{1,4}[a-zA-Z]$/,
79
+ VALID_WEB_URL: /^(http[s]?:\/\/)(www\.){0,1}[a-zA-Z0-9=:?\/\.\-]+(\.[a-zA-Z]{2,5}[\.]{0,1})?/,
80
+ VALID_WEBSOCKET_URL: /^(ws[s]?:\/\/)(www\.){0,1}[a-zA-Z0-9=:?\/\.\-]+(\.[a-zA-Z]{2,5}[\.]{0,1})?/,
81
+ VALID_RELATIVE_URL: /^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/,
82
+ REPLACE_PATTERN: /\$\{([^\}]+)\}/g,
83
+ ZIP_FILE: /\.zip$/i,
84
+ EXE_FILE: /\.exe$/i,
85
+ NO_QUOTES_ALLOWED: /^[^'|"]*$/,
86
+ NO_DOUBLE_QUOTES_ALLOWED: /^[^"]*$/,
87
+ VALID_HTML: /<[a-z][\s\S]*>/i,
88
+ VALID_PASSWORD: /^[0-9a-zA-Z-@&*!#$%]+$/,
89
+ SPECIAL_CHARACTERS: /[^A-Z0-9a-z_]+/i,
90
+ APP_SERVER_URL_FORMAT: /^(http[s]?:\/\/)(www\.){0,1}[a-zA-Z0-9\.\-]+([:]?[0-9]{2,5}|\.[a-zA-Z]{2,5}[\.]{0,1})\/+[^?#&=]+$/,
91
+ JSON_DATE_FORMAT: /\d{4}-[0-1]\d-[0-3]\d(T[0-2]\d:[0-5]\d:[0-5]\d.\d{1,3}Z$)?/,
92
+ DATA_URL: /^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i
93
+ };
94
+ var NUMBER_TYPES = ['int', DataType.INTEGER, DataType.FLOAT, DataType.DOUBLE, DataType.LONG, DataType.SHORT, DataType.BYTE, DataType.BIG_INTEGER, DataType.BIG_DECIMAL];
95
+ export var noop = function () {
96
+ var args = [];
97
+ for (var _i = 0; _i < arguments.length; _i++) {
98
+ args[_i] = arguments[_i];
99
+ }
100
+ };
101
+ function idGenerator(token) {
102
+ var id;
103
+ return __generator(this, function (_a) {
104
+ switch (_a.label) {
105
+ case 0:
106
+ id = 1;
107
+ _a.label = 1;
108
+ case 1:
109
+ if (!1) return [3 /*break*/, 3];
110
+ return [4 /*yield*/, "".concat(token).concat(id++)];
111
+ case 2:
112
+ _a.sent();
113
+ return [3 /*break*/, 1];
114
+ case 3: return [2 /*return*/];
115
+ }
116
+ });
117
+ }
118
+ export var isValidWebURL = function (url) {
119
+ return (REGEX.VALID_WEB_URL).test(url);
120
+ };
121
+ /*Function to check whether the specified object is a pageable object or not.*/
122
+ export var isPageable = function (obj) {
123
+ var pageable = {
124
+ 'content': [],
125
+ 'first': true,
126
+ 'last': true,
127
+ 'number': 0,
128
+ 'numberOfElements': 10,
129
+ 'size': 20,
130
+ 'sort': null,
131
+ 'totalElements': 10,
132
+ 'totalPages': 1
133
+ };
134
+ // paginated object may or may not contain 'empty' property. In either case, Pageable should return as true.
135
+ var paginatedObj = omit(obj, 'empty');
136
+ return (isEqual(keys(pageable), keys(paginatedObj).sort()));
137
+ };
138
+ var IDGenerator = /** @class */ (function () {
139
+ function IDGenerator(key) {
140
+ this.generator = idGenerator(key);
141
+ }
142
+ IDGenerator.prototype.nextUid = function () {
143
+ return this.generator.next().value;
144
+ };
145
+ return IDGenerator;
146
+ }());
147
+ export { IDGenerator };
148
+ // ToDo - variable seperation
149
+ export var hasCordova = function () {
150
+ return !!window['cordova'];
151
+ };
152
+ export var removeExtraSlashes = function (url) {
153
+ var base64regex = /^data:image\/([a-z]{2,});base64,/;
154
+ if (isString(url)) {
155
+ /*
156
+ * support for mobile apps having local file path url starting with file:/// and
157
+ * support for base64 format
158
+ * */
159
+ if (startsWith(url, 'file:///') || base64regex.test(url)) {
160
+ return url;
161
+ }
162
+ return url.replace(new RegExp('([^:]\/)(\/)+', 'g'), '$1');
163
+ }
164
+ };
165
+ export var isDefined = function (v) { return 'undefined' !== typeof v; };
166
+ export var isObject = function (v) { return null !== v && 'object' === typeof v; };
167
+ /* returns true if the provided data type matches number type */
168
+ export var isNumberType = function (type) {
169
+ return (NUMBER_TYPES.indexOf(extractType(type).toLowerCase()) !== -1);
170
+ };
171
+ /*
172
+ * extracts and returns the last bit from full typeRef of a field
173
+ * e.g. returns 'String' for typeRef = 'java.lang.String'
174
+ * @params: {typeRef} type reference
175
+ */
176
+ export var extractType = function (typeRef) {
177
+ var type;
178
+ if (!typeRef) {
179
+ return DataType.STRING;
180
+ }
181
+ type = typeRef && typeRef.substring(typeRef.lastIndexOf('.') + 1);
182
+ type = type && type.toLowerCase();
183
+ type = type === DataType.LOCALDATETIME ? DataType.DATETIME : type;
184
+ return type;
185
+ };
186
+ /*Function to check if date time type*/
187
+ export var isDateTimeType = function (type) {
188
+ if (includes(type, '.')) {
189
+ type = toLower(extractType(type));
190
+ }
191
+ return includes([DataType.DATE, DataType.TIME, DataType.TIMESTAMP, DataType.DATETIME, DataType.LOCALDATETIME], type);
192
+ };
193
+ export var getValidJSON = function (content) {
194
+ if (!content) {
195
+ return undefined;
196
+ }
197
+ try {
198
+ var parsedIntValue = parseInt(content, 10);
199
+ /*obtaining json from editor content string*/
200
+ return isObject(content) || !isNaN(parsedIntValue) ? content : JSON.parse(content);
201
+ }
202
+ catch (e) {
203
+ /*terminating execution if new variable object is not valid json.*/
204
+ return undefined;
205
+ }
206
+ };
207
+ export var xmlToJson = function (xmlString) {
208
+ var x2jsObj = new X2JS({ 'emptyNodeForm': 'content', 'attributePrefix': '', 'enableToStringFunc': false });
209
+ var json = x2jsObj.xml2js(xmlString);
210
+ if (json) {
211
+ // in x2js version 3.4.4, for simple string, {} is returned.
212
+ // in this case also, return null to denote conversion failure
213
+ if (Object.keys(json).length === 0) {
214
+ json = null;
215
+ }
216
+ else if (get(json, 'html.body.parsererror')) {
217
+ // for csv data, the response comes in an object
218
+ json = null;
219
+ }
220
+ else {
221
+ json = get(json, Object.keys(json)[0]);
222
+ }
223
+ }
224
+ return json;
225
+ };
226
+ /*
227
+ * Util method to replace patterns in string with object keys or array values
228
+ * Examples:
229
+ * Utils.replace('Hello, ${first} ${last} !', {first: 'wavemaker', last: 'ng'}) --> Hello, wavemaker ng
230
+ * Utils.replace('Hello, ${0} ${1} !', ['wavemaker','ng']) --> Hello, wavemaker ng
231
+ * Examples if parseError is true:
232
+ * Utils.replace('Hello, {0} {1} !', ['wavemaker','ng']) --> Hello, wavemaker ng
233
+ */
234
+ export var replace = function (template, map, parseError) {
235
+ var regEx = REGEX.REPLACE_PATTERN;
236
+ if (!template) {
237
+ return;
238
+ }
239
+ if (parseError) {
240
+ regEx = /\{([^\}]+)\}/g;
241
+ }
242
+ return template.replace(regEx, function (match, key) {
243
+ return get(map, key);
244
+ });
245
+ };
246
+ /**
247
+ * prepare a blob object based on the content and content type provided
248
+ * if content is blob itself, simply returns it back
249
+ * @param val
250
+ * @param valContentType
251
+ * @returns {*}
252
+ */
253
+ export var getBlob = function (val, valContentType) {
254
+ if (val instanceof Blob) {
255
+ return val;
256
+ }
257
+ var jsonVal = getValidJSON(val);
258
+ if (jsonVal && jsonVal instanceof Object) {
259
+ val = new Blob([JSON.stringify(jsonVal)], { type: valContentType || 'application/json' });
260
+ }
261
+ else {
262
+ val = new Blob([val], { type: valContentType || 'text/plain' });
263
+ }
264
+ return val;
265
+ };
266
+ /**
267
+ * Returns a deep cloned replica of the passed object/array
268
+ * @param object object/array to clone
269
+ * @returns a clone of the passed object
270
+ */
271
+ export var getClonedObject = function (object) {
272
+ return cloneDeep(object);
273
+ };
274
+ /**
275
+ * this method checks if a given string starts with the given string
276
+ */
277
+ export var stringStartsWith = function (str, startsWith, ignoreCase) {
278
+ if (!str) {
279
+ return false;
280
+ }
281
+ var regEx = new RegExp('^' + startsWith, ignoreCase ? 'i' : '');
282
+ return regEx.test(str);
283
+ };
284
+ /*function to check if fn is a function and then execute*/
285
+ export function triggerFn(fn) {
286
+ /* Use of slice on arguments will make this function not optimizable
287
+ * https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments
288
+ * */
289
+ var argmnts = [];
290
+ for (var _i = 1; _i < arguments.length; _i++) {
291
+ argmnts[_i - 1] = arguments[_i];
292
+ }
293
+ var start = 1;
294
+ var len = arguments.length, args = new Array(len - start);
295
+ for (start; start < len; start++) {
296
+ args[start - 1] = arguments[start];
297
+ }
298
+ if (isFunction(fn)) {
299
+ return fn.apply(null, args);
300
+ }
301
+ }
302
+ /*
303
+ * Util method to find the value of a key in the object
304
+ * if key not found and create is true, an object is created against that node
305
+ * Examples:
306
+ * var a = {
307
+ * b: {
308
+ * c : {
309
+ * d: 'test'
310
+ * }
311
+ * }
312
+ * }
313
+ * Utils.findValue(a, 'b.c.d') --> 'test'
314
+ * Utils.findValue(a, 'b.c') --> {d: 'test'}
315
+ * Utils.findValue(a, 'e') --> undefined
316
+ * Utils.findValue(a, 'e', true) --> {} and a will become:
317
+ * {
318
+ * b: {
319
+ * c : {
320
+ * d: 'test'
321
+ * }
322
+ * },
323
+ * e: {
324
+ * }
325
+ * }
326
+ */
327
+ export var findValueOf = function (obj, key, create) {
328
+ if (!obj || !key) {
329
+ return;
330
+ }
331
+ if (!create) {
332
+ return get(obj, key);
333
+ }
334
+ var parts = key.split('.'), keys = [];
335
+ var skipProcessing;
336
+ parts.forEach(function (part) {
337
+ if (!parts.length) { // if the part of a key is not valid, skip the processing.
338
+ skipProcessing = true;
339
+ return false;
340
+ }
341
+ var subParts = part.match(/\w+/g);
342
+ var subPart;
343
+ while (subParts.length) {
344
+ subPart = subParts.shift();
345
+ keys.push({ 'key': subPart, 'value': subParts.length ? [] : {} }); // determine whether to create an array or an object
346
+ }
347
+ });
348
+ if (skipProcessing) {
349
+ return undefined;
350
+ }
351
+ keys.forEach(function (_key) {
352
+ var tempObj = obj[_key.key];
353
+ if (!isObject(tempObj)) {
354
+ tempObj = getValidJSON(tempObj);
355
+ if (!tempObj) {
356
+ tempObj = _key.value;
357
+ }
358
+ }
359
+ obj[_key.key] = tempObj;
360
+ obj = tempObj;
361
+ });
362
+ return obj;
363
+ };
364
+ //# sourceMappingURL=utils.js.map