@balmli/homey-utility-prices 2.0.2 → 2.1.0

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/.mocharc.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "node-option": [
3
+ "import=tsx"
4
+ ],
5
+ "spec": [
6
+ "tests/**/*.*"
7
+ ],
8
+ "timeout": 10000
9
+ }
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- v18.20.4
1
+ 24
package/AGENT.md CHANGED
@@ -4,7 +4,7 @@ Welcome! This document captures the minimum context an AI coding agent needs bef
4
4
 
5
5
  ## Project Snapshot
6
6
  - TypeScript sources live under `lib/`; compiled CJS + typings are emitted to `dist/`.
7
- - Tests run with `mocha` + `ts-node`. Primary entry points are `lib/NordpoolApi.ts`, `lib/PriceApi.ts`, and `lib/PriceComparer.ts`.
7
+ - Tests run with `mocha` + `tsx` (config in `.mocharc.json`). Primary entry points are `lib/NordpoolApi.ts`, `lib/PriceApi.ts`, and `lib/PriceComparer.ts`.
8
8
  - The package fetches day-ahead electricity prices from Nord Pool’s Data Portal, caches data in Homey device storage, and exposes helpers for price analytics and heating automation.
9
9
 
10
10
  ## Task Workflow
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import EventEmitter from "events";
3
2
  import { Device } from "homey";
4
3
  import { UtilityBillApi } from "@balmli/homey-utility-prices-client";
@@ -24,8 +24,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
24
24
  });
25
25
  };
26
26
  var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
28
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
29
  function verb(n) { return function (v) { return step([n, v]); }; }
30
30
  function step(op) {
31
31
  if (f) throw new TypeError("Generator is already executing.");
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
package/dist/index.js CHANGED
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
18
18
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
19
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
20
  };
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
28
38
  Object.defineProperty(exports, "__esModule", { value: true });
29
39
  exports.heating = exports.PriceComparer = exports.PriceFetcher = exports.PricesFetchClient = exports.NordpoolApi = exports.PriceApi = void 0;
30
40
  __exportStar(require("./types"), exports);
package/dist/types.js CHANGED
@@ -7,7 +7,7 @@ var Currency;
7
7
  Currency["SEK"] = "SEK";
8
8
  Currency["DKK"] = "DKK";
9
9
  Currency["EUR"] = "EUR";
10
- })(Currency = exports.Currency || (exports.Currency = {}));
10
+ })(Currency || (exports.Currency = Currency = {}));
11
11
  exports.PriceAreas = [
12
12
  {
13
13
  id: "AT",
@@ -149,13 +149,13 @@ var HolidayToday;
149
149
  HolidayToday["holiday"] = "holiday";
150
150
  HolidayToday["not_holiday"] = "not_holiday";
151
151
  HolidayToday["automatic"] = "automatic";
152
- })(HolidayToday = exports.HolidayToday || (exports.HolidayToday = {}));
152
+ })(HolidayToday || (exports.HolidayToday = HolidayToday = {}));
153
153
  var PriceFetcherMethod;
154
154
  (function (PriceFetcherMethod) {
155
155
  PriceFetcherMethod["nordpool"] = "nordpool";
156
156
  PriceFetcherMethod["utilityPriceClient"] = "utilityPriceClient";
157
157
  PriceFetcherMethod["disabled"] = "disabled";
158
- })(PriceFetcherMethod = exports.PriceFetcherMethod || (exports.PriceFetcherMethod = {}));
158
+ })(PriceFetcherMethod || (exports.PriceFetcherMethod = PriceFetcherMethod = {}));
159
159
  var PriceFetcherOptions = /** @class */ (function () {
160
160
  function PriceFetcherOptions(_a) {
161
161
  var prevDays = _a.prevDays, nextDays = _a.nextDays, nordpoolOptions = _a.nordpoolOptions, fetchMethod = _a.fetchMethod, fetchMonthlyAverage = _a.fetchMonthlyAverage, fetchTime = _a.fetchTime;
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "@balmli/homey-utility-prices",
3
- "version": "2.0.2",
3
+ "version": "2.1.0",
4
4
  "description": "Price utility for Homey apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "type": "commonjs",
8
8
  "engines": {
9
- "node": ">=16.0.0"
9
+ "node": ">=24"
10
10
  },
11
11
  "scripts": {
12
12
  "prebuild": "del dist/",
13
13
  "build": "tsc",
14
14
  "watch": "tsc -w",
15
15
  "pretest": "npm run build",
16
- "test": "env NODE_OPTIONS=--no-experimental-strip-types TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha -r ts-node/register --timeout 10000 'tests/**/*.*'",
17
- "test0": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha -r ts-node/register --timeout 10000 'tests/**/currentPriceAmongNextHoursComparer_*.*'",
18
- "test2": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha -r ts-node/register --timeout 10000 'tests2/**/*.*'",
19
- "test3": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha -r ts-node/register --timeout 10000 'tests2/**/fetch_monthly_average_*.*'",
16
+ "test": "mocha",
17
+ "test0": "mocha 'tests/**/currentPriceAmongNextHoursComparer_*.*'",
18
+ "test2": "mocha 'tests2/**/*.*'",
19
+ "test3": "mocha 'tests2/**/fetch_monthly_average_*.*'",
20
20
  "prepublishOnly": "npm run test"
21
21
  },
22
22
  "keywords": [
@@ -45,14 +45,13 @@
45
45
  "@types/chai": "^4.3.0",
46
46
  "@types/homey": "npm:homey-apps-sdk-v3-types@^0.3.3",
47
47
  "@types/mocha": "^9.1.1",
48
- "@types/node": "^16.11.12",
48
+ "@types/node": "^24.19.4",
49
49
  "chai": "^4.3.6",
50
50
  "cpy-cli": "^4.2.0",
51
51
  "del-cli": "^3.0.0",
52
52
  "mocha": "^10.0.0",
53
- "ts-mocha": "^10.0.0",
54
- "ts-node": "^10.7.0",
55
- "typescript": "^4.6.4"
53
+ "tsx": "^4.23.15",
54
+ "typescript": "^5.9.3"
56
55
  },
57
56
  "publishConfig": {
58
57
  "access": "public",