@digipair/skill-basic 0.39.0

Sign up to get free protection for your applications and to get access to all the features.
package/index.cjs.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./src/index";
package/index.cjs.js ADDED
@@ -0,0 +1,59 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var engine = require('@digipair/engine');
6
+
7
+ let BasicService = class BasicService {
8
+ async transform(params, _pinsSettingsList, context) {
9
+ const { value, execute } = params;
10
+ if (!execute || execute.length <= 0) {
11
+ return value;
12
+ }
13
+ const result = await engine.executePinsList(execute, context);
14
+ return result;
15
+ }
16
+ async setVariable(params, _pinsSettingsList, context) {
17
+ const { name, value, execute } = params;
18
+ if (!execute || execute.length <= 0) {
19
+ context.variables[name] = value;
20
+ return value;
21
+ }
22
+ const result = await engine.executePinsList(execute, context);
23
+ context.variables[name] = result;
24
+ return result;
25
+ }
26
+ async interval(params, _pinsSettingsList, context) {
27
+ const { time, execute } = params;
28
+ return setInterval(()=>{
29
+ engine.executePinsList(execute, context);
30
+ }, time);
31
+ }
32
+ async defer(params, _pinsSettingsList, context) {
33
+ const { time, execute } = params;
34
+ return setTimeout(()=>{
35
+ engine.executePinsList(execute, context);
36
+ }, time);
37
+ }
38
+ async stopInterval(params, _pinsSettingsList, context) {
39
+ const { id } = params;
40
+ return clearInterval(id);
41
+ }
42
+ async stopDefer(params, _pinsSettingsList, context) {
43
+ const { id } = params;
44
+ return clearTimeout(id);
45
+ }
46
+ };
47
+ const transform = (params, pinsSettingsList, context)=>new BasicService().transform(params, pinsSettingsList, context);
48
+ const setVariable = (params, pinsSettingsList, context)=>new BasicService().setVariable(params, pinsSettingsList, context);
49
+ const interval = (params, pinsSettingsList, context)=>new BasicService().interval(params, pinsSettingsList, context);
50
+ const defer = (params, pinsSettingsList, context)=>new BasicService().defer(params, pinsSettingsList, context);
51
+ const stopInterval = (params, pinsSettingsList, context)=>new BasicService().stopInterval(params, pinsSettingsList, context);
52
+ const stopDefer = (params, pinsSettingsList, context)=>new BasicService().stopDefer(params, pinsSettingsList, context);
53
+
54
+ exports.defer = defer;
55
+ exports.interval = interval;
56
+ exports.setVariable = setVariable;
57
+ exports.stopDefer = stopDefer;
58
+ exports.stopInterval = stopInterval;
59
+ exports.transform = transform;
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from 'libs/skill-basic/src/index';