zet-lib 1.3.39 → 1.3.40

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/lib/zFn.js CHANGED
@@ -1,58 +1,58 @@
1
- const moment = require('moment')
2
- const zRoute = require('./zRoute')
3
- const io = require('./io')
4
- const qs = require('qs')
5
- const axios = require('axios')
6
- const myCache = require('./cache')
7
- const connection = require('./connection')
8
- const Util = require('./Util')
9
- const moduleLib = require('./moduleLib')
10
- const zCache = require('./zCache')
11
-
12
- const running = (scripts = '', params = {}, obj = {}) => {
13
- const MYMODELS = zRoute.MYMODELS()
14
- let stringParams = ''
15
- const defaultCall = {
16
- Util: Util,
17
- connection: connection,
18
- io: io,
19
- qs: qs,
20
- moment: moment,
21
- axios: axios,
22
- myCache: myCache,
23
- zCache: zCache,
24
- params: params,
25
- MYMODELS: MYMODELS,
26
- moduleLib: moduleLib,
27
- }
28
-
29
- const CALL = Object.assign(defaultCall, obj)
30
-
31
- stringParams = ''
32
- for (const keys in CALL) {
33
- stringParams += `var ${keys} = this.${keys};`
34
- }
35
-
36
- const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor
37
-
38
- try {
39
- return AsyncFunction(`
40
- try {
41
- ${stringParams};
42
- ${scripts};
43
- } catch(error) {
44
- console.log('error in zfn', error.toString());
45
- return {
46
- error:true,
47
- status : 0,
48
- message:error.toString()
49
- };
50
- }
51
- `).call(CALL)
52
- } catch (e) {
53
- throw new Error(e)
54
- return
55
- }
56
- }
57
-
58
- module.exports = running
1
+ const moment = require('moment')
2
+ const zRoute = require('./zRoute')
3
+ const io = require('./io')
4
+ const qs = require('qs')
5
+ const axios = require('axios')
6
+ const myCache = require('./cache')
7
+ const connection = require('./connection')
8
+ const Util = require('./Util')
9
+ const moduleLib = require('./moduleLib')
10
+ const zCache = require('./zCache')
11
+
12
+ const running = (scripts = '', params = {}, obj = {}) => {
13
+ const MYMODELS = zRoute.MYMODELS()
14
+ let stringParams = ''
15
+ const defaultCall = {
16
+ Util: Util,
17
+ connection: connection,
18
+ io: io,
19
+ qs: qs,
20
+ moment: moment,
21
+ axios: axios,
22
+ myCache: myCache,
23
+ zCache: zCache,
24
+ params: params,
25
+ MYMODELS: MYMODELS,
26
+ moduleLib: moduleLib,
27
+ }
28
+
29
+ const CALL = Object.assign(defaultCall, obj)
30
+
31
+ stringParams = ''
32
+ for (const keys in CALL) {
33
+ stringParams += `var ${keys} = this.${keys};`
34
+ }
35
+
36
+ const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor
37
+
38
+ try {
39
+ return AsyncFunction(`
40
+ try {
41
+ ${stringParams};
42
+ ${scripts};
43
+ } catch(error) {
44
+ console.log('error in zfn', error.toString());
45
+ return {
46
+ error:true,
47
+ status : 0,
48
+ message:error.toString()
49
+ };
50
+ }
51
+ `).call(CALL)
52
+ } catch (e) {
53
+ throw new Error(e)
54
+ return
55
+ }
56
+ }
57
+
58
+ module.exports = running
package/lib/zFunction.js CHANGED
@@ -1,20 +1,20 @@
1
- const zFn = require('./zFn');
2
- const myCache = require("./cache");
3
-
4
- module.exports = (...args) => {
5
- let title = "", params = [];
6
- for (let i = 0; i < args.length; i++) {
7
- if(i == 0) {
8
- title = args[i];
9
- } else {
10
- params.push(args[i])
11
- }
12
- }
13
- let results = myCache.get('ZFUNCTIONS');
14
- let result = results[title];
15
- if(result.id) {
16
- return zFn(result.code, params);
17
- } else {
18
- return;
19
- }
20
- };
1
+ const zFn = require('./zFn');
2
+ const myCache = require("./cache");
3
+
4
+ module.exports = (...args) => {
5
+ let title = "", params = [];
6
+ for (let i = 0; i < args.length; i++) {
7
+ if(i == 0) {
8
+ title = args[i];
9
+ } else {
10
+ params.push(args[i])
11
+ }
12
+ }
13
+ let results = myCache.get('ZFUNCTIONS');
14
+ let result = results[title];
15
+ if(result.id) {
16
+ return zFn(result.code, params);
17
+ } else {
18
+ return;
19
+ }
20
+ };