@cpzxrobot/sdk 1.2.59 → 1.2.61
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/dist/energy_gateway.js +1 -1
- package/dist/index.js +7 -3
- package/energy_gateway.ts +1 -1
- package/index.ts +5 -1
- package/package.json +1 -1
package/dist/energy_gateway.js
CHANGED
|
@@ -38,7 +38,7 @@ class EnergyGateway extends Object {
|
|
|
38
38
|
request.factory_id = factory.id;
|
|
39
39
|
}
|
|
40
40
|
const axios = await this.context.ready;
|
|
41
|
-
return axios.post('/api/v3/energy/
|
|
41
|
+
return axios.post('/api/v3/energy/createstat', {
|
|
42
42
|
factory_id: request.factory_id,
|
|
43
43
|
time: request.time.toISOString(),
|
|
44
44
|
period: request.period,
|
package/dist/index.js
CHANGED
|
@@ -106,6 +106,10 @@ class Cpzxrobot {
|
|
|
106
106
|
};
|
|
107
107
|
const instance = {
|
|
108
108
|
get: async (url, config) => {
|
|
109
|
+
if (config.params) {
|
|
110
|
+
url += "?" + new URLSearchParams(config.params).toString();
|
|
111
|
+
delete config.params;
|
|
112
|
+
}
|
|
109
113
|
const response = await fetchWithAuth(url, {
|
|
110
114
|
method: 'GET',
|
|
111
115
|
headers: config === null || config === void 0 ? void 0 : config.headers
|
|
@@ -577,7 +581,7 @@ function default_1(args = {
|
|
|
577
581
|
},
|
|
578
582
|
verbose: false,
|
|
579
583
|
}) {
|
|
580
|
-
var _a;
|
|
584
|
+
var _a, _b;
|
|
581
585
|
// @ts-ignore
|
|
582
586
|
var instance = window.single_cpzxrobot_instance;
|
|
583
587
|
if (!instance) {
|
|
@@ -585,9 +589,9 @@ function default_1(args = {
|
|
|
585
589
|
// @ts-ignore
|
|
586
590
|
window.single_cpzxrobot_instance = instance;
|
|
587
591
|
instance.setAuth(args.devAuth, {
|
|
588
|
-
baseURL: args.baseURL,
|
|
592
|
+
baseURL: (_a = args.baseURL) !== null && _a !== void 0 ? _a : "",
|
|
589
593
|
verbose: args.verbose,
|
|
590
|
-
disableFactorySelector: (
|
|
594
|
+
disableFactorySelector: (_b = args.disableFactorySelector) !== null && _b !== void 0 ? _b : false,
|
|
591
595
|
});
|
|
592
596
|
if (args.selectedFarm) {
|
|
593
597
|
instance.user.selectedFarm = args.selectedFarm;
|
package/energy_gateway.ts
CHANGED
|
@@ -48,7 +48,7 @@ export class EnergyGateway extends Object {
|
|
|
48
48
|
request.factory_id = factory.id;
|
|
49
49
|
}
|
|
50
50
|
const axios = await this.context.ready;
|
|
51
|
-
return axios.post('/api/v3/energy/
|
|
51
|
+
return axios.post('/api/v3/energy/createstat', {
|
|
52
52
|
factory_id: request.factory_id,
|
|
53
53
|
time: request.time.toISOString(),
|
|
54
54
|
period: request.period,
|
package/index.ts
CHANGED
|
@@ -125,6 +125,10 @@ export class Cpzxrobot {
|
|
|
125
125
|
|
|
126
126
|
const instance = {
|
|
127
127
|
get: async (url: string, config?: any) => {
|
|
128
|
+
if (config.params) {
|
|
129
|
+
url += "?" + new URLSearchParams(config.params).toString();
|
|
130
|
+
delete config.params;
|
|
131
|
+
}
|
|
128
132
|
const response = await fetchWithAuth(url, {
|
|
129
133
|
method: 'GET',
|
|
130
134
|
headers: config?.headers
|
|
@@ -625,7 +629,7 @@ export default function (
|
|
|
625
629
|
// @ts-ignore
|
|
626
630
|
window.single_cpzxrobot_instance = instance;
|
|
627
631
|
instance.setAuth(args.devAuth, {
|
|
628
|
-
baseURL: args.baseURL,
|
|
632
|
+
baseURL: args.baseURL ?? "",
|
|
629
633
|
verbose: args.verbose,
|
|
630
634
|
disableFactorySelector: args.disableFactorySelector ?? false,
|
|
631
635
|
});
|