iobroker.panasonic-comfort-cloud 2.0.4 → 2.0.6
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/README.md +7 -1
- package/build/lib/tools.js +54 -52
- package/build/lib/tools.js.map +7 -0
- package/build/main.js +474 -381
- package/build/main.js.map +7 -0
- package/io-package.json +76 -77
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -21,6 +21,12 @@ It is recommended that a second account, for which the devices have been shared,
|
|
|
21
21
|
|
|
22
22
|
## Changelog
|
|
23
23
|
|
|
24
|
+
### 2.0.6
|
|
25
|
+
* panasonic-comfort-cloud-client updated to new version. (appVersion changed again)
|
|
26
|
+
|
|
27
|
+
### 2.0.5
|
|
28
|
+
* Translation for news added.
|
|
29
|
+
|
|
24
30
|
### 2.0.4
|
|
25
31
|
* New version of dependencies installed.
|
|
26
32
|
|
|
@@ -73,7 +79,7 @@ It is recommended that a second account, for which the devices have been shared,
|
|
|
73
79
|
## License
|
|
74
80
|
MIT License
|
|
75
81
|
|
|
76
|
-
Copyright (c)
|
|
82
|
+
Copyright (c) 2022 marc <marc@lammers.dev>
|
|
77
83
|
|
|
78
84
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
79
85
|
of this software and associated documentation files (the "Software"), to deal
|
package/build/lib/tools.js
CHANGED
|
@@ -1,59 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
11
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var tools_exports = {};
|
|
26
|
+
__export(tools_exports, {
|
|
27
|
+
isArray: () => isArray,
|
|
28
|
+
isObject: () => isObject,
|
|
29
|
+
translateText: () => translateText
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(tools_exports);
|
|
32
|
+
var import_axios = __toESM(require("axios"));
|
|
18
33
|
function isObject(it) {
|
|
19
|
-
|
|
20
|
-
// typeof null === 'object'
|
|
21
|
-
// typeof [] === 'object'
|
|
22
|
-
// [] instanceof Object === true
|
|
23
|
-
return Object.prototype.toString.call(it) === '[object Object]';
|
|
34
|
+
return Object.prototype.toString.call(it) === "[object Object]";
|
|
24
35
|
}
|
|
25
|
-
exports.isObject = isObject;
|
|
26
|
-
/**
|
|
27
|
-
* Tests whether the given variable is really an Array
|
|
28
|
-
* @param it The variable to test
|
|
29
|
-
*/
|
|
30
36
|
function isArray(it) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
if (Array.isArray != null)
|
|
38
|
+
return Array.isArray(it);
|
|
39
|
+
return Object.prototype.toString.call(it) === "[object Array]";
|
|
34
40
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (isArray(response.data)) {
|
|
49
|
-
// we got a valid response
|
|
50
|
-
return response.data[0][0][0];
|
|
51
|
-
}
|
|
52
|
-
throw new Error('Invalid response for translate request');
|
|
53
|
-
}
|
|
54
|
-
catch (e) {
|
|
55
|
-
throw new Error(`Could not translate to "${targetLang}": ${e}`);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
41
|
+
async function translateText(text, targetLang) {
|
|
42
|
+
if (targetLang === "en")
|
|
43
|
+
return text;
|
|
44
|
+
try {
|
|
45
|
+
const url = `http://translate.googleapis.com/translate_a/single?client=gtx&sl=en&tl=${targetLang}&dt=t&q=${encodeURIComponent(text)}&ie=UTF-8&oe=UTF-8`;
|
|
46
|
+
const response = await (0, import_axios.default)({ url, timeout: 5e3 });
|
|
47
|
+
if (isArray(response.data)) {
|
|
48
|
+
return response.data[0][0][0];
|
|
49
|
+
}
|
|
50
|
+
throw new Error("Invalid response for translate request");
|
|
51
|
+
} catch (e) {
|
|
52
|
+
throw new Error(`Could not translate to "${targetLang}": ${e}`);
|
|
53
|
+
}
|
|
58
54
|
}
|
|
59
|
-
|
|
55
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
+
0 && (module.exports = {
|
|
57
|
+
isArray,
|
|
58
|
+
isObject,
|
|
59
|
+
translateText
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/lib/tools.ts"],
|
|
4
|
+
"sourcesContent": ["import axios from 'axios';\n\n/**\n * Tests whether the given variable is a real object and not an Array\n * @param it The variable to test\n */\nexport function isObject(it: any): it is object {\n // This is necessary because:\n // typeof null === 'object'\n // typeof [] === 'object'\n // [] instanceof Object === true\n return Object.prototype.toString.call(it) === '[object Object]';\n}\n\n/**\n * Tests whether the given variable is really an Array\n * @param it The variable to test\n */\nexport function isArray(it: any): it is any[] {\n if (Array.isArray != null) return Array.isArray(it);\n return Object.prototype.toString.call(it) === '[object Array]';\n}\n\n/**\n * Translates text using the Google Translate API\n * @param text The text to translate\n * @param targetLang The target languate\n */\nexport async function translateText(text: string, targetLang: string): Promise<string> {\n if (targetLang === 'en') return text;\n try {\n const url = `http://translate.googleapis.com/translate_a/single?client=gtx&sl=en&tl=${targetLang}&dt=t&q=${encodeURIComponent(text)}&ie=UTF-8&oe=UTF-8`;\n const response = await axios({url, timeout: 5000});\n if (isArray(response.data)) {\n // we got a valid response\n return response.data[0][0][0];\n }\n throw new Error('Invalid response for translate request');\n } catch (e) {\n throw new Error(`Could not translate to \"${targetLang}\": ${e}`);\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAMX,SAAS,SAAS,IAAuB;AAK5C,SAAO,OAAO,UAAU,SAAS,KAAK,EAAE,MAAM;AAClD;AAMO,SAAS,QAAQ,IAAsB;AAC1C,MAAI,MAAM,WAAW;AAAM,WAAO,MAAM,QAAQ,EAAE;AAClD,SAAO,OAAO,UAAU,SAAS,KAAK,EAAE,MAAM;AAClD;AAOA,eAAsB,cAAc,MAAc,YAAqC;AACnF,MAAI,eAAe;AAAM,WAAO;AAChC,MAAI;AACA,UAAM,MAAM,0EAA0E,qBAAqB,mBAAmB,IAAI;AAClI,UAAM,WAAW,UAAM,aAAAA,SAAM,EAAC,KAAK,SAAS,IAAI,CAAC;AACjD,QAAI,QAAQ,SAAS,IAAI,GAAG;AAExB,aAAO,SAAS,KAAK,GAAG,GAAG;AAAA,IAC/B;AACA,UAAM,IAAI,MAAM,wCAAwC;AAAA,EAC5D,SAAS,GAAP;AACE,UAAM,IAAI,MAAM,2BAA2B,gBAAgB,GAAG;AAAA,EAClE;AACJ;",
|
|
6
|
+
"names": ["axios"]
|
|
7
|
+
}
|