myenergi-api 2.1.1 → 2.1.3
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/debug/debug.d.ts +1 -0
- package/dist/debug/debug.js +60 -0
- package/dist/{AuthDigest.d.ts → src/AuthDigest.d.ts} +0 -0
- package/dist/{AuthDigest.js → src/AuthDigest.js} +2 -2
- package/dist/{Digest.d.ts → src/Digest.d.ts} +0 -0
- package/dist/{Digest.js → src/Digest.js} +0 -0
- package/dist/{MyEnergi.d.ts → src/MyEnergi.d.ts} +0 -0
- package/dist/{MyEnergi.js → src/MyEnergi.js} +0 -0
- package/dist/{index.d.ts → src/index.d.ts} +0 -0
- package/dist/{index.js → src/index.js} +0 -0
- package/dist/{models → src/models}/Eddi.d.ts +0 -0
- package/dist/{models → src/models}/Eddi.js +0 -0
- package/dist/{models → src/models}/Harvi.d.ts +0 -0
- package/dist/{models → src/models}/Harvi.js +0 -0
- package/dist/{models → src/models}/Types.d.ts +0 -0
- package/dist/{models → src/models}/Types.js +0 -0
- package/dist/{models → src/models}/Zappi.d.ts +0 -0
- package/dist/{models → src/models}/Zappi.js +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
const process_1 = require("process");
|
|
36
|
+
const src_1 = require("../src");
|
|
37
|
+
const dotenv = __importStar(require("dotenv"));
|
|
38
|
+
dotenv.config();
|
|
39
|
+
function timeout(ms) {
|
|
40
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
41
|
+
}
|
|
42
|
+
const runner = (iterations) => new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
const myenergi = new src_1.MyEnergi(process.env.USERNAME, process.env.PASSWORD, 'https://s18.myenergi.net');
|
|
44
|
+
for (let index = 0; index < iterations; index++) {
|
|
45
|
+
try {
|
|
46
|
+
console.log(`Iteration: ${index + 1}`);
|
|
47
|
+
const statusAll = yield myenergi.getStatusAll();
|
|
48
|
+
console.log(statusAll);
|
|
49
|
+
yield timeout(15000);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
reject(error);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
resolve("OK");
|
|
56
|
+
}));
|
|
57
|
+
runner(10000).then((x) => {
|
|
58
|
+
console.log(x);
|
|
59
|
+
(0, process_1.exit)();
|
|
60
|
+
}).catch(console.error);
|
|
File without changes
|
|
@@ -77,7 +77,7 @@ class AuthDigest {
|
|
|
77
77
|
init(wwwAuthHeader) {
|
|
78
78
|
if (!wwwAuthHeader)
|
|
79
79
|
return;
|
|
80
|
-
const authSplit = wwwAuthHeader
|
|
80
|
+
const authSplit = wwwAuthHeader.split(",");
|
|
81
81
|
for (const item of authSplit) {
|
|
82
82
|
if (item && item.indexOf("realm=") >= 0) {
|
|
83
83
|
const realmSplit = item.split('="');
|
|
@@ -104,7 +104,7 @@ class AuthDigest {
|
|
|
104
104
|
this._algorithm = algorithmSplit[algorithmSplit.length - 1];
|
|
105
105
|
this._algorithm = this._algorithm.substring(0, this._algorithm.length);
|
|
106
106
|
if (this._onError && this.algorithm !== "MD5") {
|
|
107
|
-
this._onError(`Algorithm ${this.algorithm} is
|
|
107
|
+
this._onError(`Algorithm ${this.algorithm} is not supported. Only MD5 is supportet`);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED