@builderbot/bot 1.1.7-alpha.0 → 1.1.7-alpha.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalstateClass.d.ts","sourceRoot":"","sources":["../../src/context/globalstateClass.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAE1C,cAAM,WAAW;IACN,GAAG,EAAE,eAAe,CAAA;IAC3B,OAAO,CAAC,KAAK,CAA8B;;IAQ3C;;;;OAIG;IACH,WAAW,QAAO,CAAC,CAAC,QAAQ,EAAE,eAAe,KAAK,QAAQ,IAAI,CAAC,CAAC,CAQ/D;IAED;;;OAGG;IACH,UAAU,QAAO,CAAC,MAAM,eAAe,CAAC,CAEvC;IAED;;;OAGG;IACH,GAAG,QAAO,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"globalstateClass.d.ts","sourceRoot":"","sources":["../../src/context/globalstateClass.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAE1C,cAAM,WAAW;IACN,GAAG,EAAE,eAAe,CAAA;IAC3B,OAAO,CAAC,KAAK,CAA8B;;IAQ3C;;;;OAIG;IACH,WAAW,QAAO,CAAC,CAAC,QAAQ,EAAE,eAAe,KAAK,QAAQ,IAAI,CAAC,CAAC,CAQ/D;IAED;;;OAGG;IACH,UAAU,QAAO,CAAC,MAAM,eAAe,CAAC,CAEvC;IAED;;;OAGG;IACH,GAAG,QAAO,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC,CAehC;IAED;;;OAGG;IACH,WAAW,QAAO,iBAAiB,eAAe,CAAC,CAAuB;IAE1E;;;OAGG;IACH,KAAK,QAAO,CAAC,MAAM,IAAI,CAAC,CAEvB;CACJ;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stateClass.d.ts","sourceRoot":"","sources":["../../src/context/stateClass.ts"],"names":[],"mappings":"AAAA,KAAK,OAAO,GAAG;IACX,IAAI,EAAE,MAAM,CAAA;CACf,CAAA;AAED,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAErC,cAAM,WAAW;IACb,OAAO,CAAC,KAAK,CAAqC;;IAIlD;;;;OAIG;IACH,WAAW,SAAS,OAAO,KAAkB,CAAC,CAAC,QAAQ,EAAE,UAAU,KAAK,QAAQ,IAAI,CAAC,CAAC,CASrF;IAED;;;;OAIG;IACH,UAAU,SAAU,MAAM,KAAG,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC,CAE1D;IAED;;;;OAIG;IACH,GAAG,SAAU,MAAM,KAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"stateClass.d.ts","sourceRoot":"","sources":["../../src/context/stateClass.ts"],"names":[],"mappings":"AAAA,KAAK,OAAO,GAAG;IACX,IAAI,EAAE,MAAM,CAAA;CACf,CAAA;AAED,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAErC,cAAM,WAAW;IACb,OAAO,CAAC,KAAK,CAAqC;;IAIlD;;;;OAIG;IACH,WAAW,SAAS,OAAO,KAAkB,CAAC,CAAC,QAAQ,EAAE,UAAU,KAAK,QAAQ,IAAI,CAAC,CAAC,CASrF;IAED;;;;OAIG;IACH,UAAU,SAAU,MAAM,KAAG,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC,CAE1D;IAED;;;;OAIG;IACH,GAAG,SAAU,MAAM,KAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC,CAe5C;IAED;;;OAGG;IACH,WAAW,QAAO,iBAAiB,UAAU,CAAC,CAAuB;IAErE;;;;OAIG;IACH,KAAK,SAAU,MAAM,KAAG,CAAC,MAAM,OAAO,CAAC,CAEtC;IAED;;;OAGG;IACH,QAAQ,QAAO,IAAI,CAAsB;CAC5C;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -64,7 +64,19 @@ class GlobalState {
|
|
|
64
64
|
* @returns A function that returns the value of the specified property when called.
|
|
65
65
|
*/
|
|
66
66
|
this.get = () => {
|
|
67
|
-
return (prop) =>
|
|
67
|
+
return (prop) => {
|
|
68
|
+
const globalState = this.STATE.get('__global__');
|
|
69
|
+
if (!globalState)
|
|
70
|
+
return undefined;
|
|
71
|
+
const properties = prop.split('.');
|
|
72
|
+
let result = globalState;
|
|
73
|
+
for (const property of properties) {
|
|
74
|
+
result = result[property];
|
|
75
|
+
if (result === undefined)
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
return result;
|
|
79
|
+
};
|
|
68
80
|
};
|
|
69
81
|
/**
|
|
70
82
|
* Retrieves all state values.
|
|
@@ -116,7 +128,19 @@ class SingleState {
|
|
|
116
128
|
* @returns A function that takes a property name and returns its value.
|
|
117
129
|
*/
|
|
118
130
|
this.get = (from) => {
|
|
119
|
-
return (prop) =>
|
|
131
|
+
return (prop) => {
|
|
132
|
+
const state = this.STATE.get(from);
|
|
133
|
+
if (!state)
|
|
134
|
+
return undefined;
|
|
135
|
+
const properties = prop.split('.');
|
|
136
|
+
let result = state;
|
|
137
|
+
for (const property of properties) {
|
|
138
|
+
result = result[property];
|
|
139
|
+
if (result === undefined)
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
return result;
|
|
143
|
+
};
|
|
120
144
|
};
|
|
121
145
|
/**
|
|
122
146
|
* Retrieves all states.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builderbot/bot",
|
|
3
|
-
"version": "1.1.7-alpha.
|
|
3
|
+
"version": "1.1.7-alpha.1",
|
|
4
4
|
"description": "core typescript",
|
|
5
5
|
"author": "Leifer Mendez <leifer33@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/codigoencasa/bot-whatsapp#readme",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"optionalDependencies": {
|
|
63
63
|
"sharp": "0.33.3"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "8b46e9df59a6c93e9b57b644f92aff4651cfd60f"
|
|
66
66
|
}
|